/** * Retrieve the set of loaded ontologies from the underlying reasoner * instance * * @return the set of loaded ontologies */ public synchronized Set<OWLOntology> forOntologies() { return Collections.singleton(reasoner.getRootOntology()); }
/** * Instantiates a new unsatisfiable class count metric. * * @param reasoner the reasoner */ public UnsatisfiableClassCountMetric(OWLReasoner reasoner) { super(checkNotNull(reasoner, "reasoner cannot be null").getRootOntology()); this.reasoner = reasoner; }
/** * Instantiates a new unsatisfiable class count metric. * * @param reasoner the reasoner */ public UnsatisfiableClassCountMetric(OWLReasoner reasoner) { super(checkNotNull(reasoner, "reasoner cannot be null").getRootOntology()); this.reasoner = reasoner; }
/** * Instantiates a new unsatisfiable class count metric. * * @param reasoner the reasoner */ public UnsatisfiableClassCountMetric(OWLReasoner reasoner) { super(checkNotNull(reasoner, "reasoner cannot be null").getRootOntology()); this.reasoner = reasoner; }
@Override public Set<A> createAxioms(OWLDataFactory df, OWLReasoner reasoner) { Set<A> result = new HashSet<>(); reasoner.getRootOntology().importsClosure().flatMap(this::getEntities).distinct() .forEach(e -> addAxioms(e, reasoner, df, result)); return result; }
@Override public Set<A> createAxioms(OWLDataFactory df, OWLReasoner reasoner) { Set<A> result = new HashSet<>(); reasoner.getRootOntology().importsClosure().flatMap(this::getEntities).distinct() .forEach(e -> addAxioms(e, reasoner, df, result)); return result; }
protected Set<E> getAllEntities(OWLReasoner reasoner) { Set<E> results = new HashSet<E>(); for(OWLOntology ont : reasoner.getRootOntology().getImportsClosure()) { results.addAll(getEntities(ont)); } return results; }
protected boolean simple(OWLObjectProperty entity, OWLReasoner reasoner) { OWLOntology current = reasoner.getRootOntology(); OWLObjectPropertyManager objectPropertyManager = new OWLObjectPropertyManager(current); return !objectPropertyManager.isNonSimple(entity); }
/** * init c'tor * * @param r reasoner */ public SemanticLocalityChecker(OWLReasoner r) { kernel = r; manager = r.getRootOntology().getOWLOntologyManager(); df = manager.getOWLDataFactory(); isLocal = true; }
protected boolean simple(OWLObjectProperty entity, OWLReasoner reasoner) { OWLOntology current = reasoner.getRootOntology(); OWLObjectPropertyManager objectPropertyManager = new OWLObjectPropertyManager(current); return !objectPropertyManager.isNonSimple(entity); }
/** * init c'tor * * @param r reasoner */ public SemanticLocalityChecker(OWLReasoner r) { kernel = r; manager = r.getRootOntology().getOWLOntologyManager(); df = manager.getOWLDataFactory(); isLocal = true; }
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()); }
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 addAxioms(OWLNamedIndividual entity, OWLReasoner reasoner, OWLDataFactory dataFactory, Set<OWLPropertyAssertionAxiom> result) { for (OWLObjectProperty prop : reasoner.getRootOntology().getObjectPropertiesInSignature(true)) { for (OWLNamedIndividual value : reasoner.getObjectPropertyValues(entity, prop).getFlattened()) { result.add(dataFactory.getOWLObjectPropertyAssertionAxiom(prop, entity, value)); } } for (OWLDataProperty prop : reasoner.getRootOntology().getDataPropertiesInSignature(true)) { for (OWLLiteral value : reasoner.getDataPropertyValues(entity, prop)) { result.add(dataFactory.getOWLDataPropertyAssertionAxiom(prop, entity, value)); } } }
private void collectTemporaryDeclarations(OWLAxiom axiom, List<OWLDeclarationAxiom> temporaryDeclarations) { for (OWLEntity e : getSignature(axiom)) { boolean referenced = getReasoner().getRootOntology().isDeclared(e, INCLUDED); if (!referenced) { temporaryDeclarations.add(getDeclaration(e)); } } }
private void collectTemporaryDeclarations(OWLAxiom axiom, List<OWLDeclarationAxiom> temporaryDeclarations) { for (OWLEntity e : getSignature(axiom)) { boolean referenced = getReasoner().getRootOntology().isDeclared(e, INCLUDED); if (!referenced) { temporaryDeclarations.add(getDeclaration(e)); } } }
private void collectTemporaryDeclarations(OWLAxiom axiom, List<OWLDeclarationAxiom> temporaryDeclarations) { for (OWLEntity e : getSignature(axiom)) { boolean referenced = getReasoner().getRootOntology().isDeclared(e, INCLUDED); if (!referenced) { temporaryDeclarations.add(getDeclaration(e)); } } }
private void addAnnotations(List<OWLOntologyChange> changes) { for (OWLOntology o : getOWLModelManager().getReasoner().getRootOntology().getImportsClosure()) { for (OWLAnnotation annot : o.getAnnotations()) { changes.add(new AddOntologyAnnotation(exportedOntology, annot)); } for (OWLAnnotationAssertionAxiom axiom : o.getAxioms(AxiomType.ANNOTATION_ASSERTION)) { changes.add(new AddAxiom(exportedOntology, axiom)); } } }
private void addAsserted(List<OWLOntologyChange> changes) { for (OWLOntology o : getOWLModelManager().getReasoner().getRootOntology().getImportsClosure()) { for (OWLLogicalAxiom ax : o.getLogicalAxioms()) { if (ax.isAnnotated() && exportedOntology.containsAxiom(ax.getAxiomWithoutAnnotations())) { changes.add(new RemoveAxiom(exportedOntology, ax.getAxiomWithoutAnnotations())); } changes.add(new AddAxiom(exportedOntology, ax)); } } }
private void addAsserted(List<OWLOntologyChange> changes) { for (OWLOntology o : getOWLModelManager().getReasoner().getRootOntology().getImportsClosure()) { for (OWLLogicalAxiom ax : o.getLogicalAxioms()) { if (ax.isAnnotated() && exportedOntology.containsAxiom(ax.getAxiomWithoutAnnotations())) { changes.add(new RemoveAxiom(exportedOntology, ax.getAxiomWithoutAnnotations())); } changes.add(new AddAxiom(exportedOntology, ax)); } } }