@Override public void visit(OWLObjectPropertyAssertionAxiom axiom) { axiom.getSubject().accept(this); axiom.getObject().accept(this); axiom.annotations().forEach(a1 -> a1.accept(this)); }
/** * @param i individual * @param ontology ontology to search * @return property values */ public static Multimap<OWLObjectPropertyExpression, OWLIndividual> getObjectPropertyValues( OWLIndividual i, OWLOntology ontology) { Multimap<OWLObjectPropertyExpression, OWLIndividual> map = LinkedListMultimap.create(); ontology.objectPropertyAssertionAxioms(i) .forEach(ax -> map.put(ax.getProperty(), ax.getObject())); return map; }
@Override public void visit(OWLObjectPropertyAssertionAxiom axiom) { OWLObjectPropertyAssertionAxiom simplified = axiom.getSimplified(); addSingleTripleAxiom(simplified, simplified.getSubject(), simplified.getProperty(), simplified.getObject()); processIfAnonymous(simplified.getObject(), axiom); processIfAnonymous(simplified.getSubject(), axiom); }
@Override public OWLClassExpression visit(OWLObjectPropertyAssertionAxiom ax) { return df.getOWLObjectHasValue(ax.getProperty(), ax.getObject()); }
@Override public OWLClassExpression visit(OWLObjectPropertyAssertionAxiom ax) { OWLClassExpression nom = df.getOWLObjectOneOf(ax.getSubject()); OWLClassExpression hasVal = df.getOWLObjectHasValue(ax.getProperty(), ax.getObject()); return df.getOWLObjectIntersectionOf(nom, df.getOWLObjectComplementOf(hasVal)); }
@Override public void visit(OWLObjectPropertyAssertionAxiom axiom) { addFact(m_factory.getOWLObjectPropertyAssertionAxiom(axiom.getProperty(),axiom.getSubject(),axiom.getObject())); m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(axiom.getProperty().getNamedProperty()); } @Override
@Override protected Set<OWLEntity> getEntitiesThatRequireNamespaces() { return asUnorderedSet( Stream.of( getOntology().axioms(AxiomType.OBJECT_PROPERTY_ASSERTION).flatMap( ax -> ax.getProperty().objectPropertiesInSignature()), getOntology().axioms(AxiomType.DATA_PROPERTY_ASSERTION) .map(ax -> ax.getProperty().asOWLDataProperty()), getOntology().annotationPropertiesInSignature(Imports.INCLUDED)).flatMap(x -> x)); }
private void createEdgesForClassAssertions(Set<Edge> edges, Set<OWLEntity> processed, OWLNamedIndividual individual, OWLNamedIndividualData individualData) { getOntologies() .flatMap(o -> o.getObjectPropertyAssertionAxioms(individual).stream()) .filter(ax -> isNamedIndividual(ax.getObject())) .filter(ax -> isNamedProperty(ax.getProperty())) .forEach(ax -> { var object = ax.getObject().asOWLNamedIndividual(); var objectData = renderer.getIndividualData(object); var propertyData = renderer.getObjectPropertyData(ax.getProperty().asOWLObjectProperty()); edges.add(RelationshipEdge.get(individualData, objectData, propertyData)); createEdgesForIndividual(edges, processed, object); }); }
OWLNamedIndividualNodeSet result = new OWLNamedIndividualNodeSet(); Node<OWLObjectPropertyExpression> inverses = getInverseObjectProperties(pe); getRootOntology().importsClosure().flatMap(o -> o.objectPropertyAssertionAxioms(ind)) .forEach(axiom -> { if (!axiom.getObject().isAnonymous() && axiom.getProperty().getSimplified() .equals(pe.getSimplified())) { if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) { result .addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual())); } else { result.addNode( new OWLNamedIndividualNode(axiom.getObject().asOWLNamedIndividual())); if (axiom.getObject().equals(ind) && !axiom.getSubject().isAnonymous()) { OWLObjectPropertyExpression invPe = axiom.getProperty().getInverseProperty() .getSimplified(); if (!invPe.isAnonymous() && inverses.contains(invPe.asOWLObjectProperty())) { .equals(IndividualNodeSetPolicy.BY_SAME_AS)) { result.addNode( getSameIndividuals(axiom.getObject().asOWLNamedIndividual())); } else { result.addNode(new OWLNamedIndividualNode( axiom.getObject().asOWLNamedIndividual()));
@Override public boolean isEntailed(@Nonnull OWLAxiom axiom) throws ReasonerInterruptedException, UnsupportedEntailmentTypeException, TimeOutException, AxiomNotInProfileException, FreshEntitiesException, InconsistentOntologyException { boolean containsAxiom = getRootOntology().containsAxiom(axiom, INCLUDED, AxiomAnnotations.IGNORE_AXIOM_ANNOTATIONS); } else if (!ce.isAnonymous()) { return getSubClasses(ce.asOWLClass(), false).getFlattened().stream() .anyMatch(sub -> getRootOntology().containsAxiom(df.getOWLClassAssertionAxiom(sub, individual), INCLUDED, AxiomAnnotations.IGNORE_AXIOM_ANNOTATIONS)); } else { if (ce instanceof OWLObjectIntersectionOf) { return ((OWLObjectIntersectionOf) ce).getOperands().stream() .allMatch(op -> isEntailed(df.getOWLClassAssertionAxiom(op, individual))); } else if (ce instanceof OWLObjectUnionOf) { return ((OWLObjectUnionOf) ce).getOperands().stream() .anyMatch(op -> isEntailed(df.getOWLClassAssertionAxiom(op, individual))); } else if (ce instanceof OWLObjectSomeValuesFrom) { OWLObjectPropertyExpression ope = ((OWLObjectSomeValuesFrom) ce).getProperty(); Set<OWLIndividualAxiom> axioms = getRootOntology().getAxioms(individual, INCLUDED); ope.equals(((OWLObjectPropertyAssertionAxiom) curAx).getProperty())) { OWLIndividual object = ((OWLObjectPropertyAssertionAxiom) curAx).getObject(); return isEntailed(df.getOWLClassAssertionAxiom(filler, object));
@Override public void visit(OWLObjectPropertyAssertionAxiom axiom) { process(axiom); axiom.getSubject().accept(this); axiom.getProperty().accept(this); axiom.getObject().accept(this); }
public NodeSet<OWLNamedIndividual> getObjectPropertyValues(OWLNamedIndividual ind, OWLObjectPropertyExpression pe) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { OWLNamedIndividualNodeSet result = new OWLNamedIndividualNodeSet(); Node<OWLObjectProperty> inverses = getInverseObjectProperties(pe); for (OWLOntology ontology : getRootOntology().getImportsClosure()) { for (OWLObjectPropertyAssertionAxiom axiom : ontology.getObjectPropertyAssertionAxioms(ind)) { if (!axiom.getObject().isAnonymous()) { if (axiom.getProperty().getSimplified().equals(pe.getSimplified())) { if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) { result.addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual())); result.addNode(new OWLNamedIndividualNode(axiom.getObject().asOWLNamedIndividual())); if (axiom.getObject().equals(ind) && !axiom.getSubject().isAnonymous()) { OWLObjectPropertyExpression invPe = axiom.getProperty().getInverseProperty().getSimplified(); if (!invPe.isAnonymous() && inverses.contains(invPe.asOWLObjectProperty())) { if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) { result.addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual())); result.addNode(new OWLNamedIndividualNode(axiom.getObject().asOWLNamedIndividual()));
@Override public OWLClassExpression visit(OWLObjectPropertyAssertionAxiom axiom) { OWLClassExpression sub = oneOf(axiom.getSubject()); OWLClassExpression sup = factory .getOWLObjectHasValue(axiom.getProperty(), axiom.getObject()); OWLSubClassOfAxiom ax = factory.getOWLSubClassOfAxiom(sub, sup); return ax.accept(this); }
@Override public Set<? extends OWLAxiom> visit(OWLObjectPropertyAssertionAxiom axiom) { // Here, we can weaken the checker by "striking out the object" - to do this, we // must use nominals and change the syntax to a subclass checker OR a class assertion! Set<OWLAxiom> result = new HashSet<>(2); result.add(axiom); OWLClassExpression type = dataFactory.getOWLObjectSomeValuesFrom(axiom.getProperty(), dataFactory.getOWLThing()); result.add(dataFactory.getOWLClassAssertionAxiom(type, axiom.getSubject())); return log(result); }
clses.addAll(getSubClasses(cls, false).getFlattened()); for (OWLOntology ontology : getRootOntology().getImportsClosure()) { for (OWLClass curCls : clses) { for (OWLClassAssertionAxiom axiom : ontology.getClassAssertionAxioms(curCls)) { OWLIndividual individual = axiom.getIndividual(); if (!individual.isAnonymous()) { if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) { result.addNode(getSameIndividuals(individual.asOWLNamedIndividual())); result.addNode(new OWLNamedIndividualNode(individual.asOWLNamedIndividual())); OWLClassExpression filler = ((OWLObjectSomeValuesFrom) ce).getFiller(); Set<OWLObjectPropertyExpression> properties = new HashSet<>(); properties.add(ope.asOWLObjectProperty()); if (!direct) { properties.addAll(getSubObjectProperties(ope, false).getFlattened()); for (OWLOntology ontology : getRootOntology().getImportsClosure()) { for (OWLObjectPropertyExpression curProp : properties) { Set<OWLAxiom> referencingAxioms = ontology.getReferencingAxioms(curProp.asOWLObjectProperty()); OWLIndividual object = ((OWLObjectPropertyAssertionAxiom) axiom).getObject(); if(!object.isAnonymous()){ if(filler.isOWLThing() || getInstances(filler, false).containsEntity(object.asOWLNamedIndividual())){ OWLIndividual subject = ((OWLObjectPropertyAssertionAxiom) axiom).getSubject(); if (!subject.isAnonymous()) { if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
.getAxioms(AxiomType.OBJECT_PROPERTY_ASSERTION, Imports.INCLUDED); OWLNamedIndividual candidateValue1 = axiom.getSubject().asOWLNamedIndividual(); OWLObjectPropertyExpression candidateValue2 = axiom.getProperty(); OWLNamedIndividual candidateValue3 = axiom.getObject().asOWLNamedIndividual();
for (OWLDisjointClassesAxiom ax : o.getAxioms(AxiomType.DISJOINT_CLASSES)) for (OWLDisjointUnionAxiom ax : o.getAxioms(AxiomType.DISJOINT_UNION)) for (OWLSubClassOfAxiom ax : o.getAxioms(AxiomType.SUBCLASS_OF)) for (OWLObjectPropertyAssertionAxiom ax : o.getAxioms(AxiomType.OBJECT_PROPERTY_ASSERTION)) OWLObjectPropertyExpression p = ax.getProperty(); OWLIndividual i1 = ax.getSubject(); OWLIndividual i2 = ax.getObject(); double d = getDegree(ax); writeObjectPropertyAssertionAxiom(i1, i2, p, d);
for (OWLOntology ontology : getOntologies()) { Map<OWLClassExpression, Set<OWLAnnotation>> expressions = new TreeMap<OWLClassExpression, Set<OWLAnnotation>>(); for (OWLClassAssertionAxiom ax : ontology.getClassAssertionAxioms(individual)) { if (isDisplayed(ax)) { expressions.put(ax.getClassExpression(), ax.getAnnotations()); for (OWLObjectPropertyAssertionAxiom ax : ontology.getObjectPropertyAssertionAxioms(individual)) { if (isDisplayed(ax)) { axioms.add((ax)); Map<OWLIndividual, Set<OWLAnnotation>> inds = objectMap.get(ax.getProperty()); if (inds == null) { inds = new TreeMap<OWLIndividual, Set<OWLAnnotation>>(); objectMap.put(ax.getProperty(), inds); inds.put(ax.getObject(), ax.getAnnotations()); for (OWLDataPropertyAssertionAxiom ax : ontology.getDataPropertyAssertionAxioms(individual)) { if (isDisplayed(ax)) { axioms.add((ax));
for (OWLOntology ontology : asList(ontologySetProvider.ontologies())) { for (OWLObjectPropertyAssertionAxiom ax : asList( ontology.objectPropertyAssertionAxioms(individual))) { int index = properties.indexOf(ax.getProperty()); if (index == -1) { continue; candidateValue = ax.getObject(); ontology.dataPropertyAssertionAxioms(individual))) { int index = properties.indexOf(ax.getProperty()); if (index == -1) {
@Override protected Set<OWLEntity> getEntitiesThatRequireNamespaces() { Set<OWLEntity> entities = new HashSet<OWLEntity>(); for(OWLObjectPropertyAssertionAxiom ax : getOntology().getAxioms(AxiomType.OBJECT_PROPERTY_ASSERTION)) { entities.addAll(ax.getProperty().getSignature()); } for(OWLDataPropertyAssertionAxiom ax : getOntology().getAxioms(AxiomType.DATA_PROPERTY_ASSERTION)) { entities.add(ax.getProperty().asOWLDataProperty()); } entities.addAll(getOntology().getAnnotationPropertiesInSignature()); return entities; }