@Override public void visit(OWLSubObjectPropertyOfAxiom axiom) { OWLObjectPropertyExpression subPropertyExpression = axiom.getSubProperty(); if(subPropertyExpression.isAnonymous()){ sparql += objectVar + "<" + subPropertyExpression.getInverseProperty().asOWLObjectProperty().toStringID() + "> " + subjectVar + " ."; } else { sparql += subjectVar + "<" + subPropertyExpression.asOWLObjectProperty().toStringID() + "> " + objectVar + " ."; } OWLObjectPropertyExpression superPropertyExpression = axiom.getSuperProperty(); if(superPropertyExpression.isAnonymous()){ sparql += objectVar + "<" + superPropertyExpression.getInverseProperty().asOWLObjectProperty().toStringID() + "> " + subjectVar + " ."; } else { sparql += subjectVar + "<" + superPropertyExpression.asOWLObjectProperty().toStringID() + "> " + objectVar + " ."; } }
private void addAxiom(List<Rule> list, OWLSubObjectPropertyOfAxiom a) { if (!(a.getSubProperty().isAnonymous() || a.getSuperProperty().isAnonymous())) { String op1 = getString(a.getSubProperty()); String op2 = getString(a.getSuperProperty()); list.add(new SubPropertyOf(op1, op2)); } }
/** * Find all asserted direct sub properties of the parent property. * * @param parent * @param g * @return set */ public static Set<OWLObjectProperty> getAssertedSubProperties(OWLObjectProperty parent, OWLGraphWrapper g) { Set<OWLObjectProperty> properties = new HashSet<OWLObjectProperty>(); for(OWLOntology ont : g.getAllOntologies()) { Set<OWLSubObjectPropertyOfAxiom> axioms = ont.getObjectSubPropertyAxiomsForSuperProperty(parent); for (OWLSubObjectPropertyOfAxiom axiom : axioms) { OWLObjectPropertyExpression subProperty = axiom.getSubProperty(); if (subProperty instanceof OWLObjectProperty) { properties.add(subProperty.asOWLObjectProperty()); } } } return properties; }
protected static boolean isUnsupportedExtensionAxiom(OWLAxiom axiom) { return axiom instanceof OWLSubObjectPropertyOfAxiom || axiom instanceof OWLTransitiveObjectPropertyAxiom || axiom instanceof OWLSubPropertyChainOfAxiom || axiom instanceof OWLFunctionalObjectPropertyAxiom || axiom instanceof OWLInverseFunctionalObjectPropertyAxiom || axiom instanceof SWRLRule; }
@Override public T visit(OWLSubObjectPropertyOfAxiom axiom) { throw new IllegalArgumentException( OWLSubObjectPropertyOfAxiom.class.getSimpleName() + " cannot be converted to " + getTargetClass().getSimpleName()); }
public static Set<OWLObjectPropertyExpression> getSuperProperties(OWLObjectPropertyExpression prop, OWLOntology ont) { Set<OWLObjectPropertyExpression> result = new HashSet<>(); Set<OWLSubObjectPropertyOfAxiom> axioms = ont.getObjectSubPropertyAxiomsForSubProperty(prop); for (OWLSubPropertyAxiom<OWLObjectPropertyExpression> axiom : axioms) { result.add(axiom.getSuperProperty()); } return result; }
public static Set<OWLObjectPropertyExpression> getSubProperties(OWLObjectPropertyExpression prop, OWLOntology ont) { Set<OWLObjectPropertyExpression> results = new HashSet<>(); Set<OWLSubObjectPropertyOfAxiom> axioms = ont.getObjectSubPropertyAxiomsForSuperProperty(prop); for (OWLSubObjectPropertyOfAxiom axiom : axioms) { results.add(axiom.getSubProperty()); } return results; }
/** * returns parent properties of p in all ontologies * @param p * @return set of properties */ public Set<OWLObjectPropertyExpression> getSuperPropertiesOf(OWLObjectPropertyExpression p) { Set<OWLObjectPropertyExpression> ps = new HashSet<OWLObjectPropertyExpression>(); for (OWLOntology ont : getAllOntologies()) { for (OWLSubObjectPropertyOfAxiom a : ont.getObjectSubPropertyAxiomsForSubProperty(p)) { ps.add(a.getSuperProperty()); } } return ps; }
/** * Returns the direct child properties of <code>prop</code> in all ontologies. * @param prop The <code>OWLObjectPropertyExpression</code> for which * we want the direct sub-properties. * @return A <code>Set</code> of <code>OWLObjectPropertyExpression</code>s * that are the direct sub-properties of <code>prop</code>. * * @see #getSubPropertyClosureOf(OWLObjectPropertyExpression) * @see #getSubPropertyReflexiveClosureOf(OWLObjectPropertyExpression) */ public Set<OWLObjectPropertyExpression> getSubPropertiesOf( OWLObjectPropertyExpression prop) { Set<OWLObjectPropertyExpression> subProps = new HashSet<OWLObjectPropertyExpression>(); for (OWLOntology ont : this.getAllOntologies()) { for (OWLSubObjectPropertyOfAxiom axiom : ont.getObjectSubPropertyAxiomsForSuperProperty(prop)) { subProps.add(axiom.getSubProperty()); } } return subProps; }
@Override public Set<ComplexIntegerAxiom> visit(OWLSubObjectPropertyOfAxiom axiom) throws TranslationException { Objects.requireNonNull(axiom); OWLObjectPropertyExpression leftPropExpr = axiom.getSubProperty(); OWLObjectPropertyExpression rightPropExpr = axiom.getSuperProperty(); ComplexIntegerAxiom ret = getAxiomFactory().createSubObjectPropertyOfAxiom( translateObjectPropertyExpression(leftPropExpr), translateObjectPropertyExpression(rightPropExpr), translateAnnotations(axiom.getAnnotations())); return Collections.singleton(ret); }
@Override public Void visit(OWLSubObjectPropertyOfAxiom axiom) { long subProperty = getOrCreateNode(getIri(axiom.getSubProperty())); long superProperty = getOrCreateNode(getIri(axiom.getSuperProperty())); getOrCreateRelationship(subProperty, superProperty, OwlRelationships.RDFS_SUB_PROPERTY_OF); return null; }
/** * A utility method to process OWL <code>SubObjectPropertyOf(OPE1 OPE2)</code> axiom and produce * inferred mapping assertions. */ @Override public void visit(OWLSubObjectPropertyOfAxiom axiom) { /* * Trace all the ancestors of the object property expression in the given OWL SubObjectPropertyOf axiom. */ Set<OWLSubPropertyAxiom<?>> ancestors = mOntology.traceAncestors(axiom.getSubProperty(), true); for (OWLSubPropertyAxiom<?> ax : ancestors) { /* * Get all (copy) known mappings for the visited sub object property expression. */ OWLObjectPropertyExpression subProperty = (OWLObjectPropertyExpression) ax.getSubProperty(); subProperty.accept(this); // this call will produce (sub property) mSignature Set<IMapping> subPropertyMappings = getMappingsForPropertyExpression(); if (subPropertyMappings.isEmpty()) { continue; } /* * Produce the "extra" mappings for the visited super object property expression as many as * the known mappings in the sub object property expression. */ OWLObjectPropertyExpression superProperty = (OWLObjectPropertyExpression) ax.getSuperProperty(); superProperty.accept(this); // this call will produce (super property) mSignature and mIsInverse URI superPropertySignature = mSignature; for (IMapping subPropertyMapping : subPropertyMappings) { IPropertyMapping pm = createPropertyMapping(superPropertySignature, subPropertyMapping, mIsInverse); addInferredMapping(pm); } } }
@Override public void visit(OWLSubObjectPropertyOfAxiom axiom) { hashCode = primes[27]; hashCode = hashCode * MULT + axiom.getSubProperty().hashCode(); hashCode = hashCode * MULT + axiom.getSuperProperty().hashCode(); hashCode = hashCode * MULT + axiom.getAnnotations().hashCode(); }
@Override public Set<OWLSubObjectPropertyOfAxiom> asSubObjectPropertyOfAxioms() { Set<OWLSubObjectPropertyOfAxiom> axs = new HashSet<>(); axs.add(new OWLSubObjectPropertyOfAxiomImpl(getFirstProperty(), getSecondProperty().getInverseProperty().getSimplified(), NO_ANNOTATIONS)); axs.add(new OWLSubObjectPropertyOfAxiomImpl(getSecondProperty(), getFirstProperty().getInverseProperty().getSimplified(), NO_ANNOTATIONS)); return axs; }
@Nonnull @Override public Set<OWLSubObjectPropertyOfAxiom> asSubPropertyAxioms() { Set<OWLSubObjectPropertyOfAxiom> result = new HashSet<>(5); result.add(new OWLSubObjectPropertyOfAxiomImpl(getProperty(), getProperty().getInverseProperty().getSimplified(), NO_ANNOTATIONS)); result.add(new OWLSubObjectPropertyOfAxiomImpl(getProperty() .getInverseProperty().getSimplified(), getProperty(), NO_ANNOTATIONS)); return result; }
@Override public OWLSubObjectPropertyOfAxiom getAxiomWithoutAnnotations() { if (!isAnnotated()) { return this; } return new OWLSubObjectPropertyOfAxiomImpl(getSubProperty(), getSuperProperty(), NO_ANNOTATIONS); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } return obj instanceof OWLSubObjectPropertyOfAxiom; }
private Axiom transformOWLSubObjectPropertyOfAxiom(OWLSubObjectPropertyOfAxiom a) { OWLObjectPropertyExpression sub = a.getSubProperty(); OWLObjectPropertyExpression sup = a.getSuperProperty(); Role lhs = new NamedRole(sub.asOWLObjectProperty().toStringID()); Role rhs = new NamedRole(sup.asOWLObjectProperty().toStringID()); return new RoleInclusion(new Role[]{lhs}, rhs); }
private List<Axiom> transformOWLEquivalentObjectPropertiesAxiom( OWLEquivalentObjectPropertiesAxiom a) { List<Axiom> axioms = new ArrayList<Axiom>(); for (OWLSubObjectPropertyOfAxiom ax : a.asSubObjectPropertyOfAxioms()) { OWLObjectPropertyExpression sub = ax.getSubProperty(); OWLObjectPropertyExpression sup = ax.getSuperProperty(); axioms.add( new RoleInclusion(new NamedRole(sub.asOWLObjectProperty().toStringID()), new NamedRole(sup.asOWLObjectProperty().toStringID())) ); } return axioms; }
public static String formatAxiom(OWLAxiom a, OWLOntology ont) { if (a instanceof OWLSubPropertyChainOfAxiom) { // TODO: implement return a.toString(); } else if (a instanceof OWLSubObjectPropertyOfAxiom) { // TODO: implement return a.toString(); } else if (a instanceof OWLSubClassOfAxiom) { OWLSubClassOfAxiom sc = (OWLSubClassOfAxiom) a; return formatClassExpression(sc.getSubClass(), ont) + " \u2286 " + formatClassExpression(sc.getSuperClass(), ont); } else if (a instanceof OWLEquivalentClassesAxiom) { OWLEquivalentClassesAxiom ec = (OWLEquivalentClassesAxiom) a; List<OWLClassExpression> ces = ec.getClassExpressionsAsList(); StringBuilder sb = new StringBuilder(); sb.append(formatClassExpression(ces.get(0), ont)); for (int i = 1; i < ces.size(); i++) { sb.append(" = "); sb.append(formatClassExpression(ces.get(i), ont)); } return sb.toString(); } else if (a instanceof OWLDeclarationAxiom) { OWLDeclarationAxiom da = (OWLDeclarationAxiom) a; OWLEntity ent = da.getEntity(); String name = (ent.isOWLClass()) ? getLabel(ent.asOWLClass(), ont) : ent.toString(); return "init(" + name + ")"; } else { return a.toString(); } }
private void addObjectAxioms(List<Rule> list, Set<OWLSubObjectPropertyOfAxiom> axs) { for (OWLSubObjectPropertyOfAxiom a : axs) { addAxiom(list, a); } }
public void visit(OWLSubObjectPropertyOfAxiom axiom) { notSupported(axiom); }
public void visit(OWLSubObjectPropertyOfAxiom axiom) { if (!axiom.getSubProperty().isOWLBottomObjectProperty() && !axiom.getSuperProperty().isOWLTopObjectProperty()) addInclusion(axiom.getSubProperty(),axiom.getSuperProperty()); m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(axiom.getSubProperty().getNamedProperty()); m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(axiom.getSuperProperty().getNamedProperty()); }
public Boolean visit(OWLSubObjectPropertyOfAxiom axiom) { return reasoner.isSubObjectPropertyExpressionOf(axiom.getSubProperty(),axiom.getSuperProperty()); }
public void visit(OWLSubObjectPropertyOfAxiom axiom) { }
@SuppressWarnings("static-method") public ElkSubObjectPropertyOfAxiom convert( OWLSubObjectPropertyOfAxiom owlSubObjectPropertyOfAxiom) { return new ElkSubObjectPropertyOfAxiomWrap<OWLSubObjectPropertyOfAxiom>( owlSubObjectPropertyOfAxiom); }
@Override public ElkAxiom visit( OWLSubObjectPropertyOfAxiom owlSubObjectPropertyOfAxiom) { return CONVERTER.convert(owlSubObjectPropertyOfAxiom); }
@Override public ElkObjectPropertyAxiom visit( OWLSubObjectPropertyOfAxiom owlSubObjectPropertyOfAxiom) { return CONVERTER.convert(owlSubObjectPropertyOfAxiom); }
@Override public void visit(OWLSubObjectPropertyOfAxiom axiom) { defaultVisit(axiom); }
@Override public OWLAxiom visit(OWLSubObjectPropertyOfAxiom axiom) { return factory.getOWLSubObjectPropertyOfAxiom(axiom.getSubProperty(), axiom.getSuperProperty(), annotations); }
@Override public void visit(OWLSubObjectPropertyOfAxiom axiom) { }
public void visit(OWLSubObjectPropertyOfAxiom arg0) { throw new NotImplementedException(); }