org.apache.jena.shared.Lock Java Examples

The following examples show how to use org.apache.jena.shared.Lock. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DatasetWrappingDatasetGraph.java    From shacl with Apache License 2.0 4 votes vote down vote up
@Override
public Lock getLock() {
	return dataset.getLock();
}
 
Example #2
Source File: DelegatingDataset.java    From shacl with Apache License 2.0 4 votes vote down vote up
@Override
public Lock getLock() {
	return delegate.getLock();
}
 
Example #3
Source File: OntologyProvider.java    From Processor with Apache License 2.0 4 votes vote down vote up
/**
 * Loads ontology by URI.
 * 
 * @param manager
 * @param ontologyURI ontology location
 * @param ontModelSpec ontology model specification
 * @return ontology model
 */
public static OntModel getOntModel(OntDocumentManager manager, String ontologyURI, OntModelSpec ontModelSpec)
{
    if (manager == null) throw new IllegalArgumentException("OntDocumentManager cannot be null");
    if (ontologyURI == null) throw new IllegalArgumentException("URI cannot be null");
    if (ontModelSpec == null) throw new IllegalArgumentException("OntModelSpec cannot be null");
    if (log.isDebugEnabled()) log.debug("Loading sitemap ontology from URI: {}", ontologyURI);

    try
    {
        OntModel ontModel = manager.getOntology(ontologyURI, ontModelSpec);

        // explicitly loading owl:imports -- workaround for Jena bug: https://issues.apache.org/jira/browse/JENA-1210
        ontModel.enterCriticalSection(Lock.WRITE);
        try
        {
            ontModel.loadImports();
        }
        finally
        {
            ontModel.leaveCriticalSection();
        }

        // lock and clone the model to avoid ConcurrentModificationExceptions
        ontModel.enterCriticalSection(Lock.READ);
        try
        {
            return ModelFactory.createOntologyModel(ontModelSpec,
                    ModelFactory.createUnion(ModelFactory.createDefaultModel(), ontModel.getBaseModel()));
        }
        finally
        {
            ontModel.leaveCriticalSection();
        }
    }
    catch (ClientHandlerException ex) // thrown by DataManager
    {
        // remove ontology from cache, so next time it will be reloaded, possibly with fixed imports
        manager.getFileManager().removeCacheModel(ontologyURI);
        
        if (log.isErrorEnabled()) log.error("Could not load ontology '{}' or its imports", ontologyURI);
        throw new OntologyException("Could not load ontology '" + ontologyURI + "' or its imports", ex);
    }
}
 
Example #4
Source File: DB2Dataset.java    From quetzal with Eclipse Public License 2.0 4 votes vote down vote up
public Lock getLock()
{
return null;
}