org.apache.jena.ontology.OntModel Java Examples

The following examples show how to use org.apache.jena.ontology.OntModel. 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: TestRoEvoSerializer.java    From incubator-taverna-language with Apache License 2.0 6 votes vote down vote up
@Test
public void workflowUUIDs() throws Exception {
	ByteArrayOutputStream os = new ByteArrayOutputStream();
	roEvo.workflowHistory(helloWorld.getMainWorkflow(), os);
	System.out.write(os.toByteArray());
	assertTrue(500 < os.size());
	String ttl = os.toString("UTF-8");
	assertTrue(ttl.contains("01348671-5aaa-4cc2-84cc-477329b70b0d"));
	assertTrue(ttl.contains("VersionableResource"));
	assertTrue(ttl.contains("Entity"));
	
	OntModel m = ModelFactory.createOntologyModel();
	m.read(new ByteArrayInputStream(os.toByteArray()), "http://example.com/", "Turtle");
	Resource mainWf = m.getResource(helloWorld.getMainWorkflow().getIdentifier().toASCIIString());		
	Resource older = mainWf.getProperty(prov.wasRevisionOf).getResource();
	Resource oldest = older.getProperty(prov.wasRevisionOf).getResource();
	assertNull(oldest.getProperty(prov.wasRevisionOf));
	
}
 
Example #2
Source File: PizzaSparqlNoInf.java    From xcurator with Apache License 2.0 6 votes vote down vote up
public void run() {
    OntModel m = getModel();
    loadData( m );
    String prefix = "prefix pizza: <" + PIZZA_NS + ">\n" +
                    "prefix rdfs: <" + RDFS.getURI() + ">\n" +
                    "prefix owl: <" + OWL.getURI() + ">\n";


    showQuery( m,
               prefix +
               "select ?pizza where {?pizza a owl:Class ; " +
               "                            rdfs:subClassOf ?restriction.\n" +
               "                     ?restriction owl:onProperty pizza:hasTopping ;" +
               "                            owl:someValuesFrom pizza:PeperoniSausageTopping" +
               "}" );
}
 
Example #3
Source File: AbstractRdfEntityGraphConsumer.java    From baleen with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({"rawtypes", "unchecked"})
private Individual addIndividual(OntModel model, Vertex v, String className) {
  OntClass ontClass = model.getOntClass(namespace + className);
  if (ontClass != null) {
    Individual individual = ontClass.createIndividual(namespace + v.id());
    Map<String, List> propertyValueMap = ElementHelper.vertexPropertyValueMap(v);
    propertyValueMap
        .entrySet()
        .forEach(
            e -> {
              Property property = model.getProperty(namespace + e.getKey());
              if (property != null) {
                e.getValue().forEach(value -> individual.addProperty(property, value.toString()));
              }
            });
    return individual;
  } else {
    getMonitor().warn("Missing ontology class {}", className);
  }
  return null;
}
 
Example #4
Source File: OwlSchemaFactory.java    From baleen with Apache License 2.0 6 votes vote down vote up
/** Creates an entity ontology */
public OntModel createEntityOntology() {
  OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);

  OntClass entity = addType(ontModel, null, getType(ENTITY));
  OntClass event = addType(ontModel, null, getType(EVENT));

  addProperty(ontModel, entity, "value", "The value of the mention", XSD.xstring);
  addProperty(ontModel, entity, "longestValue", "The longest value of the mention", XSD.xstring);
  addProperty(
      ontModel, entity, "mostCommonValue", "The most common value of the mention", XSD.xstring);
  addProperty(ontModel, entity, "mentions", "The details of the mentions", XSD.xstring);
  addProperty(ontModel, "docId", "The docId the mention came from", XSD.xstring);

  addRelation(ontModel, entity, entity, RELATION, "A relationship between two entities");
  addRelation(ontModel, entity, event, PARTICIPANT_IN, "A participant in the event");

  return ontModel;
}
 
Example #5
Source File: AbstractRdfEntityGraphConsumer.java    From baleen with Apache License 2.0 6 votes vote down vote up
private ObjectProperty addRelationToModel(OntModel model, Edge e) {
  Individual source = model.getIndividual(namespace + e.outVertex().id());
  Individual target = model.getIndividual(namespace + e.inVertex().id());
  ObjectProperty property = model.getObjectProperty(namespace + e.label());

  if (source != null && target != null && property != null) {
    source.addProperty(property, target);
    return property;
  } else {
    getMonitor()
        .warn(
            "Missing individuals {} or {} or relation {}",
            e.outVertex(),
            e.inVertex(),
            e.label());
    return null;
  }
}
 
Example #6
Source File: AbstractRdfDocumentGraphConsumer.java    From baleen with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({"rawtypes", "unchecked"})
private Individual addIndividual(OntModel model, Vertex v, String className) {
  OntClass ontClass = model.getOntClass(namespace + className);
  if (ontClass != null) {
    Individual individual = ontClass.createIndividual(namespace + v.id());
    Map<String, List> propertyValueMap = ElementHelper.vertexPropertyValueMap(v);
    propertyValueMap
        .entrySet()
        .forEach(
            e -> {
              Property property = model.getProperty(namespace + e.getKey());
              if (property != null) {
                e.getValue().forEach(value -> individual.addProperty(property, value.toString()));
              }
            });
    return individual;
  } else {
    getMonitor().warn("Missing ontology class {}", className);
  }
  return null;
}
 
Example #7
Source File: Validator.java    From Processor with Apache License 2.0 6 votes vote down vote up
public OntModel fixOntModel(OntModel ontModel)
    {
        if (ontModel == null) throw new IllegalArgumentException("Model cannot be null");
        
        OntModel fixedModel = ModelFactory.createOntologyModel(ontModel.getSpecification());
        Query fix = QueryFactory.create("CONSTRUCT\n" +
"{\n" +
"  ?s ?p ?o\n" +
"}\n" +
"WHERE\n" +
"{\n" +
"  ?s ?p ?o\n" +
"  FILTER (!(?p = <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> && ?o = <https://www.w3.org/ns/ldt#Constraint>))\n" +
"}");
        
        try (QueryExecution qex = QueryExecutionFactory.create(fix, ontModel))
        {
            fixedModel.add(qex.execConstruct());
        }
        
        return fixedModel;
    }
 
Example #8
Source File: AbstractRdfDocumentGraphConsumer.java    From baleen with Apache License 2.0 6 votes vote down vote up
private Object addNodeToModel(OntModel model, Vertex v) {
  String label = v.label();
  if (DOCUMENT.equals(label)) {
    return addIndividual(model, v, DOCUMENT);
  }
  if (MENTION.equals(label)) {
    return addIndividual(model, v, v.property("type").orElse(ENTITY).toString());
  }
  if (EVENT.equals(label)) {
    return addIndividual(model, v, EVENT);
  }
  if (RELATION.equals(label)) {
    return addIndividual(model, v, RELATION);
  }
  if (REFERENCE_TARGET.equals(label)) {
    return addIndividual(model, v, REFERENCE_TARGET);
  }
  getMonitor().warn("Unrecognized Label {}", label);
  return null;
}
 
Example #9
Source File: ROEvoSerializer.java    From incubator-taverna-language with Apache License 2.0 6 votes vote down vote up
public void workflowHistory(Workflow mainWorkflow, OutputStream output) throws WriterException {	
		OntModel model = ModelFactory.createOntologyModel();
		Revision revision = mainWorkflow.getCurrentRevision();
		Revision previous = revision.getPreviousRevision();
		addRevision(model, revision);
		while (previous != null) {
			addRevision(model, previous);
			addPrevious(model, revision, previous);			
			revision = previous;
			previous = revision.getPreviousRevision();
		}
		
		java.net.URI baseURI = Workflow.WORKFLOW_ROOT;
		model.setNsPrefix("roevo", "http://purl.org/wf4ever/roevo#");
		model.setNsPrefix("prov", "http://www.w3.org/ns/prov#");
		model.setNsPrefix("rdfs",
				"http://www.w3.org/2000/01/rdf-schema#");
			
		model.write(output, "Turtle", baseURI.toASCIIString());

//			throw new WriterException("Can't write to output", e);
		
		
	}
 
Example #10
Source File: RdfEntityGraphConsumer.java    From baleen with Apache License 2.0 5 votes vote down vote up
@Override
protected void outputModel(String documentSourceName, OntModel model)
    throws AnalysisEngineProcessException {
  try (RDFConnection connect = createConnection()) {
    Txn.executeWrite(connect, () -> connect.load(model));
  } catch (Exception e) {
    throw new AnalysisEngineProcessException(e);
  }
}
 
Example #11
Source File: Rdf.java    From baleen with Apache License 2.0 5 votes vote down vote up
@Override
protected void outputModel(String documentSourceName, OntModel model)
    throws AnalysisEngineProcessException {
  try (OutputStream outputStream = createOutputStream(documentSourceName)) {
    model.write(outputStream, rdfFormat.getKey());
  } catch (IOException e) {
    throw new AnalysisEngineProcessException(e);
  }
}
 
Example #12
Source File: RdfEntityGraph.java    From baleen with Apache License 2.0 5 votes vote down vote up
@Override
protected void outputModel(String documentSourceName, OntModel model)
    throws AnalysisEngineProcessException {
  try (OutputStream outputStream = createOutputStream(documentSourceName)) {
    model.write(outputStream, rdfFormat.getKey());
  } catch (IOException e) {
    throw new AnalysisEngineProcessException(e);
  }
}
 
Example #13
Source File: OwlSchemaFactory.java    From baleen with Apache License 2.0 5 votes vote down vote up
/** Creates a document ontology */
public OntModel createDocumentOntology() {
  OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);

  OntClass document = addType(ontModel, null, getType(Document.class.getSimpleName()));
  OntClass mention = ontModel.createClass(namespace + MENTION);

  mention.addComment("Root mention type", EN);
  addProperty(ontModel, mention, "begin", "The start of the mention offset", XSD.xint);
  addProperty(ontModel, mention, "end", "The end of the mention offset", XSD.xint);
  addProperty(ontModel, mention, "value", "The value of the mention", XSD.xstring);
  addProperty(ontModel, mention, "docId", "The docId the mention came from", XSD.xstring);

  OntClass reference = addType(ontModel, null, getType(REFERENCE_TARGET));
  OntClass relation = addType(ontModel, mention, getType(RELATION));

  OntClass entity = addType(ontModel, mention, getType(ENTITY));
  OntClass event = addType(ontModel, mention, getType(EVENT));

  addRelation(ontModel, entity, entity, RELATION, "A relationship between two entities");
  addRelation(ontModel, entity, relation, SOURCE, "The source of the relationship");
  addRelation(ontModel, relation, entity, TARGET, "The target of the relationship");
  addRelation(ontModel, mention, document, MENTION_IN, "The document this is mentioned in");
  addRelation(ontModel, entity, reference, MENTION_OF, "The mention of the reference");
  addRelation(ontModel, entity, event, PARTICIPANT_IN, "A participant in the event");

  return ontModel;
}
 
Example #14
Source File: OwlSchemaFactory.java    From baleen with Apache License 2.0 5 votes vote down vote up
private void addRelation(
    OntModel ontModel, OntClass domain, OntClass range, String property, String comment) {
  ObjectProperty objectProperty = ontModel.createObjectProperty(namespace + property);
  objectProperty.addComment(comment, EN);
  objectProperty.setDomain(domain);
  objectProperty.setRange(range);
}
 
Example #15
Source File: OwlSchemaFactory.java    From baleen with Apache License 2.0 5 votes vote down vote up
private void addProperty(
    OntModel ontModel, OntClass domain, String name, String comment, Resource range) {
  DatatypeProperty begin = ontModel.createDatatypeProperty(namespace + name);
  begin.addComment(comment, EN);
  begin.addDomain(domain);
  begin.addRange(range);
}
 
Example #16
Source File: OwlSchemaFactory.java    From baleen with Apache License 2.0 5 votes vote down vote up
private void addFeature(OntModel ontModel, OntClass ontClass, FeatureDescription feature) {
  if (ontModel.getDatatypeProperty(namespace + feature.getName()) == null) {
    DatatypeProperty property = ontModel.createDatatypeProperty(namespace + feature.getName());
    String propertyComment = feature.getDescription();
    if (propertyComment != null) {
      property.addComment(propertyComment, EN);
    }

    property.addDomain(ontClass);
    property.addRange(getRange(feature));
  }
}
 
Example #17
Source File: AbstractRdfDocumentGraphConsumer.java    From baleen with Apache License 2.0 5 votes vote down vote up
@Override
protected void processGraph(String documentSourceName, Graph graph)
    throws AnalysisEngineProcessException {

  OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM, documentOntology);
  model.setNsPrefix("baleen", namespace);
  GraphTraversalSource traversal = graph.traversal();
  traversal.V().forEachRemaining(v -> addNodeToModel(model, v));
  traversal.E().forEachRemaining(e -> addRelationToModel(model, e));

  outputModel(documentSourceName, model);
}
 
Example #18
Source File: AbstractRdfDocumentGraphConsumer.java    From baleen with Apache License 2.0 5 votes vote down vote up
private ObjectProperty addRelationToModel(OntModel model, Edge e) {
  Individual source = model.getIndividual(namespace + e.outVertex().id());
  Individual target = model.getIndividual(namespace + e.inVertex().id());

  ObjectProperty property = model.getObjectProperty(namespace + e.label());
  source.addProperty(property, target);

  return property;
}
 
Example #19
Source File: AbstractRdfEntityGraphConsumer.java    From baleen with Apache License 2.0 5 votes vote down vote up
@Override
protected void processGraph(String documentSourceName, Graph graph)
    throws AnalysisEngineProcessException {

  OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM, documentOntology);
  model.setNsPrefix("baleen", namespace);
  GraphTraversalSource traversal = graph.traversal();
  traversal.V().forEachRemaining(v -> addNodeToModel(model, v));
  traversal.E().forEachRemaining(e -> addRelationToModel(model, e));

  outputModel(documentSourceName, model);
}
 
Example #20
Source File: AbstractRdfEntityGraphConsumer.java    From baleen with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private Object addNodeToModel(OntModel model, Vertex v) {
  try {
    String label = v.label();
    if (EVENT.equals(label)) {
      return addIndividual(model, v, EVENT);
    }
    if (ENTITY.equals(label)) {
      Iterator<VertexProperty<Object>> properties = v.properties("type");
      List<?> types =
          Lists.newArrayList(properties).stream()
              .filter(VertexProperty::isPresent)
              .map(VertexProperty::value)
              .collect(Collectors.toList());
      Optional<String> aggregate = mode.aggregate((List<String>) types);
      if (aggregate.isPresent()) {
        return addIndividual(model, v, aggregate.get());
      }

      getMonitor().warn("Not type information for {} using entity", v);
      return addIndividual(model, v, ENTITY);
    }
    getMonitor().warn("Unrecognized Label {}", label);
  } catch (BaleenException e) {
    getMonitor().warn("Error adding node {} - {} ", v, e.getMessage());
  }
  return null;
}
 
Example #21
Source File: DumpTestSource.java    From RDFUnit with Apache License 2.0 5 votes vote down vote up
@Override
protected QueryExecutionFactory initQueryFactory() {

    // When we load the referenced schemata we do rdfs reasoning to avoid false errors
    // Many ontologies skip some domain / range statements and this way we add them
    OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.RDFS_MEM_RDFS_INF, ModelFactory.createDefaultModel());
    try {

        // load the data only when the model is empty in case it is initialized with the "copy constructor"
        // This sppeds up the process on very big in-memory datasets
        if (dumpModel.isEmpty()) {
            // load the data only when the model is empty in case it is initialized with the "copy constructor"
            dumpReader.read(dumpModel);
        }

        //if (dumpModel.isEmpty()) {
        //    throw new IllegalArgumentException("Dump is empty");
        //}
        //Load all the related ontologies as well (for more consistent querying
        for (SchemaSource src : getReferencesSchemata()) {
            ontModel.add(src.getModel());
        }
        // Here we add the ontologies in the dump mode
        // Note that the ontologies have reasoning enabled but not the dump source
        dumpModel.add(ontModel);
    } catch (Exception e) {
        log.error("Cannot read dump URI: " + getUri() + " Reason: " + e.getMessage());
        throw new IllegalArgumentException("Cannot read dump URI: " + getUri() + " Reason: " + e.getMessage(), e);
    }
    return masqueradeQEF(new QueryExecutionFactoryModel(dumpModel), this);
}
 
Example #22
Source File: DatasetTestSource.java    From RDFUnit with Apache License 2.0 5 votes vote down vote up
@Override
protected QueryExecutionFactory initQueryFactory() {

    // When we load the referenced schemata we do rdfs reasoning to avoid false errors
    // Many ontologies skip some domain / range statements and this way we add them
    OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.RDFS_MEM_RDFS_INF, ModelFactory.createDefaultModel());
    try {

        // load the data only when the model is empty in case it is initialized with the "copy constructor"
        // This sppeds up the process on very big in-memory datasets
        if (dumpDataset.getDefaultModel().isEmpty() && !dumpDataset.listNames().hasNext() ) {
            // load the data only when the model is empty in case it is initialized with the "copy constructor"
            dumpReader.readDataset(dumpDataset);
        }

        //if (dumpModel.isEmpty()) {
        //    throw new IllegalArgumentException("Dump is empty");
        //}
        //Load all the related ontologies as well (for more consistent querying
        for (SchemaSource src : getReferencesSchemata()) {
            ontModel.add(src.getModel());
        }
        // Here we add the ontologies in the dump mode
        // Note that the ontologies have reasoning enabled but not the dump source
        dumpDataset.setDefaultModel(ontModel.union(dumpDataset.getDefaultModel()));
    } catch (Exception e) {
        log.error("Cannot read dump URI: " + getUri() + " Reason: " + e.getMessage());
        throw new IllegalArgumentException("Cannot read dump URI: " + getUri() + " Reason: " + e.getMessage(), e);
    }
    return masqueradeQEF(new QueryExecutionFactoryDataset(dumpDataset), this);
}
 
Example #23
Source File: SchemaSource.java    From RDFUnit with Apache License 2.0 5 votes vote down vote up
/**
 * lazy loaded via lombok
 */
private Model initModel() {
    OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM, ModelFactory.createDefaultModel());
    try {
        schemaReader.read(m);
    } catch (RdfReaderException e) {
        log.error("Cannot load ontology: {} ", getSchema(), e);
    }
    return m;
}
 
Example #24
Source File: GetAllVocabLinksFromLOV.java    From RDFUnit with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    RDFUnitUtils.fillSchemaServiceFromLOV();
    OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_RULE_INF, ModelFactory.createDefaultModel());
    for (SchemaSource schema : SchemaService.getSourceListAll(false,null)){
        QueryExecutionFactory qef = new QueryExecutionFactoryModel(schema.getModel());

        String queryString = PrefixNSService.getSparqlPrefixDecl() +
                " SELECT DISTINCT ?s ?p ?o WHERE { " +
                " ?s ?p ?o ." +
                " FILTER (?p IN (owl:sameAs, owl:equivalentProperty, owl:equivalentClass))" +
               // " FILTER (strStarts(?s, 'http://dbpedia.org') || strStarts(?o, 'http://dbpedia.org')))" +
                "}";

        try (QueryExecution qe = qef.createQueryExecution(queryString)) {
            qe.execSelect().forEachRemaining(qs -> {

                Resource s = qs.get("s").asResource();
                Resource p = qs.get("p").asResource();
                RDFNode o = qs.get("o");

                model.add(s, ResourceFactory.createProperty(p.getURI()), o);

                // save the data in a file to read later
            });
        }
    }

    try (OutputStream fos = new FileOutputStream("output.ttl")) {

        model.write(fos, "TURTLE");

    } catch (Exception e) {
        throw new UnsupportedOperationException("Error writing file: " + e.getMessage(), e);
    }

}
 
Example #25
Source File: Rdf.java    From baleen with Apache License 2.0 5 votes vote down vote up
@Override
protected void outputModel(String documentSourceName, OntModel model)
    throws AnalysisEngineProcessException {
  try (OutputStream outputStream = createOutputStream(documentSourceName)) {
    model.write(outputStream, rdfFormat.getKey());
  } catch (IOException e) {
    throw new AnalysisEngineProcessException(e);
  }
}
 
Example #26
Source File: RdfEntityGraph.java    From baleen with Apache License 2.0 5 votes vote down vote up
@Override
protected void outputModel(String documentSourceName, OntModel model)
    throws AnalysisEngineProcessException {
  try (OutputStream outputStream = createOutputStream(documentSourceName)) {
    model.write(outputStream, rdfFormat.getKey());
  } catch (IOException e) {
    throw new AnalysisEngineProcessException(e);
  }
}
 
Example #27
Source File: WfdescSerialiser.java    From incubator-taverna-language with Apache License 2.0 5 votes vote down vote up
public void save(WorkflowBundle wfBundle, OutputStream output) throws WriterException {
	OntModel model;

	final URI baseURI;
	if (wfBundle.getMainWorkflow() != null) {
		Workflow mainWorkflow = wfBundle.getMainWorkflow();
		baseURI = uriTools.uriForBean(mainWorkflow);
		model = save(wfBundle);
	} else {
		throw new WriterException("wfdesc format requires a main workflow");
	}

	model.setNsPrefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
	model.setNsPrefix("xsd", "http://www.w3.org/2001/XMLSchema#");
	model.setNsPrefix("owl", "http://www.w3.org/2002/07/owl#");
	model.setNsPrefix("prov", "http://www.w3.org/ns/prov#");
	model.setNsPrefix("wfdesc", "http://purl.org/wf4ever/wfdesc#");
	model.setNsPrefix("wf4ever", "http://purl.org/wf4ever/wf4ever#");
	model.setNsPrefix("roterms", "http://purl.org/wf4ever/roterms#");
	model.setNsPrefix("dc", "http://purl.org/dc/elements/1.1/");
	model.setNsPrefix("dcterms", "http://purl.org/dc/terms/");
	model.setNsPrefix("comp", "http://purl.org/DP/components#");
	model.setNsPrefix("dep", "http://scape.keep.pt/vocab/dependencies#");
	model.setNsPrefix("biocat", "http://biocatalogue.org/attribute/");

	model.setNsPrefix("", "#");

	try {
		model.write(output, Lang.TURTLE.getName(), baseURI.toString());
	} catch (RiotException e) {
		throw new WriterException("Can't write to output", e);
	}

}
 
Example #28
Source File: ROEvoSerializer.java    From incubator-taverna-language with Apache License 2.0 5 votes vote down vote up
private void addPrevious(OntModel model,
		Revision revision, Revision previous) {
	OntClass VersionableResource = model.createClass("http://purl.org/wf4ever/roevo#VersionableResource");
	VersionableResource.addSuperClass(prov.Entity);
	
	Individual revisionResource = model.createIndividual(revision.getIdentifier().toASCIIString(), 
			VersionableResource);
	Individual previousResource = model.createIndividual(previous.getIdentifier().toASCIIString(), 
			VersionableResource);
	revisionResource.addProperty(prov.wasRevisionOf, previousResource);
}
 
Example #29
Source File: ROEvoSerializer.java    From incubator-taverna-language with Apache License 2.0 5 votes vote down vote up
private void addRevision(OntModel model,
		Revision revision) {
	OntClass VersionableResource = model.createClass("http://purl.org/wf4ever/roevo#VersionableResource");
	VersionableResource.addSuperClass(prov.Entity);
	Individual revisionResource = model.createIndividual(revision.getIdentifier().toASCIIString(), 
			VersionableResource);
	revisionResource.addRDFType(prov.Entity);
}
 
Example #30
Source File: RDFToManifest.java    From incubator-taverna-language with Apache License 2.0 5 votes vote down vote up
protected OntModel getOntModel() {
	OntModel ontModel = createOntologyModel(OWL_DL_MEM_RULE_INF);
	ontModel.setNsPrefix("foaf", foaf.NS);
	ontModel.setNsPrefix("prov", prov.NS);
	ontModel.setNsPrefix("ore", ore.NS);
	ontModel.setNsPrefix("pav", pav.NS);
	ontModel.setNsPrefix("dct", DCTerms.NS);
	// ontModel.getDocumentManager().loadImports(foaf.getOntModel());
	return ontModel;
}