private Ontology getTBox(Dataset dataset) throws Exception { // Merge default and named graphs to filter duplicates Set<URI> graphURIs = new HashSet<>(); graphURIs.addAll(dataset.getDefaultGraphs()); graphURIs.addAll(dataset.getNamedGraphs()); OntologyVocabulary vb = ofac.createVocabulary(); for (URI graphURI : graphURIs) { Ontology o = getOntology(graphURI, graphURI); vb.merge(o.getVocabulary()); // TODO: restore copying ontology axioms (it was copying from result into result, at least since July 2013) //for (SubPropertyOfAxiom ax : result.getSubPropertyAxioms()) // result.add(ax); //for (SubClassOfAxiom ax : result.getSubClassAxioms()) // result.add(ax); } Ontology result = ofac.createOntology(vb); return result; }
@Override public void handleStatement(Statement st) throws RDFHandlerException { URI pred = st.getPredicate(); Value obj = st.getObject(); if (obj instanceof Literal) { String dataProperty = pred.stringValue(); vb.createDataProperty(dataProperty); } else if (pred.stringValue().equals(OBDAVocabulary.RDF_TYPE)) { String className = obj.stringValue(); vb.createClass(className); } else { String objectProperty = pred.stringValue(); vb.createObjectProperty(objectProperty); } /* Roman 10/08/15: recover? Axiom axiom = getTBoxAxiom(st); ontology.addAssertionWithCheck(axiom); */ }
obdaModelForMaterialization.getOntologyVocabulary().merge(tbox.getVocabulary());
obdaModelForMaterialization.getOntologyVocabulary().merge(translatedOntologyMerge.getVocabulary());
obdaModel.getOntologyVocabulary().merge(ontology.getVocabulary());
obdaModel.addSource(getMemOBDADataSource("MemH2")); obdaModel.getOntologyVocabulary().merge(tbox.getVocabulary());