/** * Gets the ontologies. * * @return ontologies as a set */ public Stream<OWLOntology> getOntologies() { if (importsClosureUsed) { return ontology.importsClosure(); } else { return Stream.of(ontology); } }
/** * Gets the ontologies. * * @return ontologies as a set */ public Stream<OWLOntology> getOntologies() { if (importsClosureUsed) { return ontology.importsClosure(); } else { return Stream.of(ontology); } }
@Override public List<OWLOntology> getSortedImportsClosure(OWLOntology ontology) { readLock.lock(); try { return asList(ontology.importsClosure().sorted()); } finally { readLock.unlock(); } }
/** * @return sets of equivalent properties */ public Collection<Set<OWLObjectPropertyExpression>> getEquivalentObjectProperties() { return getEquivalentObjectProperties(ontology.importsClosure()); } }
@Override public List<OWLOntology> getSortedImportsClosure(OWLOntology ontology) { readLock.lock(); try { return asList(ontology.importsClosure().sorted()); } finally { readLock.unlock(); } }
@Override public List<OWLOntology> getSortedImportsClosure(OWLOntology ontology) { readLock.lock(); try { return asList(ontology.importsClosure().sorted()); } finally { readLock.unlock(); } }
/** * Instantiates a new definition tracker. * * @param ontology ontology to track */ public DefinitionTracker(OWLOntology ontology) { this.ontology = checkNotNull(ontology, "ontology cannot be null"); ontology.importsClosure().flatMap(OWLOntology::axioms).forEach(this::addAxiom); ontology.getOWLOntologyManager().addOntologyChangeListener(this); }
/** * Instantiates a new definition tracker. * * @param ontology ontology to track */ public DefinitionTracker(OWLOntology ontology) { this.ontology = checkNotNull(ontology, "ontology cannot be null"); ontology.importsClosure().flatMap(OWLOntology::axioms).forEach(this::addAxiom); ontology.getOWLOntologyManager().addOntologyChangeListener(this); }
private void backtrack(Set<OWLAxiom> currentPathContents, OWLAxiom axiom, List<OWLDeclarationAxiom> temporaryDeclarations, Set<OWLOntology> ontologies) { // Back track - go one level up the tree and run for the next axiom currentPathContents.remove(axiom); LOGGER.info("Restoring axiom: {}", axiom); // Remove any temporary declarations for (OWLDeclarationAxiom decl : temporaryDeclarations) { OntologyUtils.removeAxiom(decl, getReasoner().getRootOntology().importsClosure()); } // Done with the axiom that was removed. Add it back in OntologyUtils.addAxiom(axiom, ontologies.stream()); }
protected void expandAssertions(OWLOntology o, OWLAnnotationProperty p) { OWLAnnotationProperty ap425 = df.getOWLAnnotationProperty(IRI_IAO_0000425.getIRI()); getAnnotationObjects(p, o.importsClosure(), ap425).map(a -> a.getValue().asLiteral()) .filter(v -> v.isPresent()) .forEach(v -> { String str = v.get().getLiteral(); LOG.info("assertion mapping {} to {}", p, str); expandAssertionToMap.put(p.getIRI(), str); }); }
protected void expandAssertions(OWLOntology o, OWLAnnotationProperty p) { OWLAnnotationProperty ap425 = df.getOWLAnnotationProperty(IRI_IAO_0000425.getIRI()); getAnnotationObjects(p, o.importsClosure(), ap425).map(a -> a.getValue().asLiteral()) .filter(v -> v.isPresent()) .forEach(v -> { String str = v.get().getLiteral(); LOG.info("assertion mapping {} to {}", p, str); expandAssertionToMap.put(p.getIRI(), str); }); }
private void mergeImportsClosure() { OWLOntology o = ontology; try { ontology = man .createOntology(IRI.getNextDocumentIRI("http://debugger.semanticweb.org/ontolog"), o.importsClosure(), true); } catch (OWLOntologyCreationException e) { throw new OWLRuntimeException(e); } }
private void mergeImportsClosure() { OWLOntology o = ontology; try { ontology = man .createOntology(IRI.getNextDocumentIRI("http://debugger.semanticweb.org/ontolog"), o.importsClosure(), true); } catch (OWLOntologyCreationException e) { throw new OWLRuntimeException(e); } }
private void mergeImportsClosure() { OWLOntology o = ontology; try { ontology = man .createOntology(IRI.getNextDocumentIRI("http://debugger.semanticweb.org/ontolog"), o.importsClosure(), true); } catch (OWLOntologyCreationException e) { throw new OWLRuntimeException(e); } }
private void mergeImportsClosure() { OWLOntology o = ontology; try { ontology = man .createOntology(IRI.getNextDocumentIRI("http://debugger.semanticweb.org/ontolog"), o.importsClosure(), true); } catch (OWLOntologyCreationException e) { throw new OWLRuntimeException(e); } }
@Override public NodeSet<OWLClass> getDataPropertyDomains(OWLDataProperty pe, boolean direct) { ensurePrepared(); DefaultNodeSet<OWLClass> result = new OWLClassNodeSet(); getRootOntology().importsClosure().flatMap(o -> o.dataPropertyDomainAxioms(pe)) .forEach(ax -> addClasses(direct, result, ax.getDomain())); return result; }
@Override public NodeSet<OWLClass> getDataPropertyDomains(OWLDataProperty pe, boolean direct) { ensurePrepared(); DefaultNodeSet<OWLClass> result = new OWLClassNodeSet(); getRootOntology().importsClosure().flatMap(o -> o.dataPropertyDomainAxioms(pe)) .forEach(ax -> addClasses(direct, result, ax.getDomain())); return result; }
@Override public NodeSet<OWLClass> getTypes(OWLNamedIndividual ind, boolean direct) { ensurePrepared(); DefaultNodeSet<OWLClass> result = new OWLClassNodeSet(); getRootOntology().importsClosure().flatMap(o -> o.classAssertionAxioms(ind)) .forEach(ax -> addClasses(direct, result, ax.getClassExpression())); return result; }
public void computeHierarchy() { pm.reasonerTaskStarted("Computing " + name + " hierarchy"); pm.reasonerTaskBusy(); nodeCache.clear(); Map<T, Collection<T>> cache = new HashMap<>(); Set<T> entities = asUnorderedSet( getRootOntology().importsClosure().flatMap(this::getEntities)); classificationSize = entities.size(); pm.reasonerTaskProgressChanged(0, classificationSize); updateForSignature(entities, cache); pm.reasonerTaskStopped(); }
public void computeHierarchy() { pm.reasonerTaskStarted("Computing " + name + " hierarchy"); pm.reasonerTaskBusy(); nodeCache.clear(); Map<T, Collection<T>> cache = new HashMap<>(); Set<T> entities = asUnorderedSet( getRootOntology().importsClosure().flatMap(this::getEntities)); classificationSize = entities.size(); pm.reasonerTaskProgressChanged(0, classificationSize); updateForSignature(entities, cache); pm.reasonerTaskStopped(); }