@Test public void ontologyStructure_isAdded() throws OWLOntologyCreationException { OWLOntology ontology = manager.loadOntology(IRI.create("http: producer.addOntologyStructure(manager, ontology); Optional<Long> main = graph.getNode("http: Optional<Long> child1 = graph.getNode("http: Optional<Long> child2 = graph.getNode("http: Optional<Long> grandchild = graph.getNode("http: assertThat(main.isPresent(), is(true)); assertThat(child1.isPresent(), is(true)); assertThat(child2.isPresent(), is(true)); assertThat(grandchild.isPresent(), is(true)); assertThat(graph.getRelationship(child1.get(), main.get(), OwlRelationships.RDFS_IS_DEFINED_BY).isPresent(), is(true)); }
void addOntologyStructure(OWLOntologyManager manager, OWLOntology ontology) { long parent = graph.createNode(OwlApiUtils.getIri(ontology)); graph.addLabel(parent, OwlLabels.OWL_ONTOLOGY); for (OWLImportsDeclaration importDeclaration : ontology.getImportsDeclarations()) { OWLOntology childOnt = manager.getImportedOntology(importDeclaration); if (null == childOnt) { continue; } long child = graph.createNode(OwlApiUtils.getIri(childOnt)); graph.addLabel(parent, OwlLabels.OWL_ONTOLOGY); if (graph.getRelationship(child, parent, OwlRelationships.RDFS_IS_DEFINED_BY).isPresent()) { continue; } graph.createRelationship(child, parent, OwlRelationships.RDFS_IS_DEFINED_BY); addOntologyStructure(manager, childOnt); } }
OwlOntologyProducer implements Callable<Long> { void addOntologyStructure(OWLOntologyManager manager, OWLOntology ontology) { long parent = graph.createNode(OwlApiUtils.getIri(ontology)); graph.addLabel(parent, OwlLabels.OWL_ONTOLOGY); for (OWLImportsDeclaration importDeclaration : ontology.getImportsDeclarations()) { OWLOntology childOnt = manager.getImportedOntology(importDeclaration); if (null == childOnt) { continue; } long child = graph.createNode(OwlApiUtils.getIri(childOnt)); graph.addLabel(parent, OwlLabels.OWL_ONTOLOGY); if (graph.getRelationship(child, parent, OwlRelationships.RDFS_IS_DEFINED_BY).isPresent()) { continue; } graph.createRelationship(child, parent, OwlRelationships.RDFS_IS_DEFINED_BY); addOntologyStructure(manager, childOnt); } } }
OwlOntologyProducer implements Callable<Long> { void addOntologyStructure(OWLOntologyManager manager, OWLOntology ontology) { long parent = graph.createNode(OwlApiUtils.getIri(ontology)); graph.addLabel(parent, OwlLabels.OWL_ONTOLOGY); for (OWLImportsDeclaration importDeclaration : ontology.getImportsDeclarations()) { OWLOntology childOnt = manager.getImportedOntology(importDeclaration); if (null == childOnt) { continue; } long child = graph.createNode(OwlApiUtils.getIri(childOnt)); graph.addLabel(parent, OwlLabels.OWL_ONTOLOGY); if (graph.getRelationship(child, parent, OwlRelationships.RDFS_IS_DEFINED_BY).isPresent()) { continue; } graph.createRelationship(child, parent, OwlRelationships.RDFS_IS_DEFINED_BY); addOntologyStructure(manager, childOnt); } } @Inject  OwlOntologyProducer(BlockingQueue<OWLCompositeObject> queue,
      BlockingQueue<OntologySetup> ontologyQueue,
      @IndicatesNumberOfShutdownProducers AtomicInteger numProducersShutdown, Graph graph); }
OwlOntologyProducer implements Callable<Long> { void addOntologyStructure(OWLOntologyManager manager, OWLOntology ontology) { long parent = graph.createNode(OwlApiUtils.getIri(ontology)); graph.addLabel(parent, OwlLabels.OWL_ONTOLOGY); for (OWLImportsDeclaration importDeclaration : ontology.getImportsDeclarations()) { OWLOntology childOnt = manager.getImportedOntology(importDeclaration); if (null == childOnt) { continue; } long child = graph.createNode(OwlApiUtils.getIri(childOnt)); graph.addLabel(parent, OwlLabels.OWL_ONTOLOGY); if (graph.getRelationship(child, parent, OwlRelationships.RDFS_IS_DEFINED_BY).isPresent()) { continue; } graph.createRelationship(child, parent, OwlRelationships.RDFS_IS_DEFINED_BY); addOntologyStructure(manager, childOnt); } } @Inject  OwlOntologyProducer(BlockingQueue<OWLCompositeObject> queue,
      BlockingQueue<OntologySetup> ontologyQueue,
      @IndicatesNumberOfShutdownProducers AtomicInteger numProducersShutdown, Graph graph); void reason(OWLOntologyManager manager, OWLOntology ont, OntologySetup config); void queueObjects(OWLOntologyManager manager, OntologySetup ontologyConfig); @Override Long call(); }
OwlOntologyProducer implements Callable<Long> { void addOntologyStructure(OWLOntologyManager manager, OWLOntology ontology) { long parent = graph.createNode(OwlApiUtils.getIri(ontology)); graph.addLabel(parent, OwlLabels.OWL_ONTOLOGY); for (OWLImportsDeclaration importDeclaration : ontology.getImportsDeclarations()) { OWLOntology childOnt = manager.getImportedOntology(importDeclaration); if (null == childOnt) { continue; } long child = graph.createNode(OwlApiUtils.getIri(childOnt)); graph.addLabel(parent, OwlLabels.OWL_ONTOLOGY); if (graph.getRelationship(child, parent, OwlRelationships.RDFS_IS_DEFINED_BY).isPresent()) { continue; } graph.createRelationship(child, parent, OwlRelationships.RDFS_IS_DEFINED_BY); addOntologyStructure(manager, childOnt); } } @Inject  OwlOntologyProducer(BlockingQueue<OWLCompositeObject> queue,
      BlockingQueue<OntologySetup> ontologyQueue,
      @IndicatesNumberOfShutdownProducers AtomicInteger numProducersShutdown, Graph graph); void reason(OWLOntologyManager manager, OWLOntology ont, OntologySetup config); void queueObjects(OWLOntologyManager manager, OntologySetup ontologyConfig); @Override Long call();  }