public void retrieveSubObjectPropertyAxioms() { // this method is to perform a dual operation; it shall retrieve all the declarative object // properties categories' annotations, // thus filling the objPropCategories Set, while parallelly will, for each category entry // retrieve the object properties themselves // and adding their entries in the objPropEntries Set. Set<OWLSubObjectPropertyOfAxiom> tmpSet; OWLObjectPropertyExpression tempDeclarativePropertyClass = OWLFactory.getOWLObjectProperty(":DeclarativeProperty", topIxPrefixManager); tmpSet = topIxOnt.getObjectSubPropertyAxiomsForSuperProperty( tempDeclarativePropertyClass); // OWLFactory.getOWLObjectProperty(IRI.create("http://www.semanticweb.org/ontologies/ptyxiaki_v0.6/2011/5/Ontology1308067064597.owl#DeclarativeProperty"))); Set<OWLSubObjectPropertyOfAxiom> tmpSet2; Set<OWLAnnotationAssertionAxiom> tmpAnnSet1; Set<OWLAnnotationAssertionAxiom> tmpAnnSet2; // to become class variables. for (OWLSubObjectPropertyOfAxiom sopAx : tmpSet) { String tmpS = sopAx.getSubProperty().toString(); // categories... tmpAnnSet1 = topIxOnt.getAnnotationAssertionAxioms( IRI.create( tmpS.substring( 1, tmpS.indexOf('>')))); // this set only contains one annotation per entry for (OWLAnnotationAssertionAxiom aaAx : tmpAnnSet1) { String currentObjPropCatName = aaAx.getValue().toString().substring(1, aaAx.getValue().toString().indexOf('^') - 1); tmpSet2 = topIxOnt.getObjectSubPropertyAxiomsForSuperProperty( OWLFactory.getOWLObjectProperty(IRI.create(tmpS.substring(1, tmpS.length() - 1)))); for (OWLSubObjectPropertyOfAxiom sopAx2 : tmpSet2) { String tmpS2 = sopAx2.getSubProperty().toString(); tmpAnnSet2 = topIxOnt.getAnnotationAssertionAxioms( IRI.create(tmpS2.substring(1, tmpS2.length() - 1))); for (OWLAnnotationAssertionAxiom aaAx2 : tmpAnnSet2) { String currentObjPropEntryName = aaAx2 .getValue() .toString() .substring(1, aaAx2.getValue().toString().indexOf('^') - 1); propEntryNameToPropCatName.put(currentObjPropEntryName, currentObjPropCatName); propEntryNametoPropEntryIRI.put( currentObjPropEntryName, tmpS2.substring(1, tmpS2.length() - 1)); } } } } }
@Override public void visit(OWLSubObjectPropertyOfAxiom axiom) { axiom.getSubProperty(); writeSpace(); write(SUBCLASS); writeSpace(); axiom.getSuperProperty().accept(this); }
// TODO optimize translatin: (e) can be discarded for roles for which there // aren't assertions private Set<Rule> translation(QLAxiomsTranslator axiomsTranslator) { final Set<Rule> result = new HashSet<Rule>(); for (final OWLClassAssertionAxiom assertion : ontologyNormalization.conceptAssertions()) result.addAll(axiomsTranslator.assertionTranslation(assertion)); for (final OWLObjectPropertyAssertionAxiom assertion : ontologyNormalization.roleAssertions()) result.addAll(axiomsTranslator.assertionTranslation(assertion)); for (final OWLDataPropertyAssertionAxiom assertion : ontologyNormalization.dataAssertions()) result.addAll(axiomsTranslator.assertionTranslation(assertion)); for (final OWLSubClassOfAxiom subsumption : ontologyNormalization.conceptSubsumptions()) result.addAll( axiomsTranslator.subsumptionTranslation( subsumption.getSubClass(), subsumption.getSuperClass())); for (final OWLSubPropertyAxiom<?> subsumption : ontologyNormalization.roleSubsumptions()) if (subsumption instanceof OWLSubObjectPropertyOfAxiom) { result.addAll( axiomsTranslator.subsumptionTranslation( subsumption.getSubProperty(), subsumption.getSuperProperty())); final OWLSubObjectPropertyOfAxiom axiom = (OWLSubObjectPropertyOfAxiom) subsumption; final OWLObjectPropertyExpression ope1 = axiom.getSubProperty(); final OWLObjectPropertyExpression ope2 = axiom.getSuperProperty(); final OWLObjectPropertyExpression invOpe1 = ope1.getInverseProperty().getSimplified(); final OWLObjectPropertyExpression invOpe2 = ope2.getInverseProperty().getSimplified(); if ((ontologyNormalization.isSuper(some(ope1)) || ontologyNormalization.isSuper(ope1)) && (ontologyNormalization.isSub(some(ope2)) || ontologyNormalization.isSub(ope2))) result.add( axiomsTranslator.domainSubsumptionTranslation( axiom.getSubProperty(), axiom.getSuperProperty())); if ((ontologyNormalization.isSuper(some(invOpe1)) || ontologyNormalization.isSuper(invOpe1)) && (ontologyNormalization.isSub(some(invOpe2)) || ontologyNormalization.isSub(invOpe2))) result.add(axiomsTranslator.rangeSubsumptionTranslation(invOpe1, invOpe2)); } else if (subsumption instanceof OWLSubDataPropertyOfAxiom) result.addAll( axiomsTranslator.subsumptionTranslation( subsumption.getSubProperty(), subsumption.getSuperProperty())); for (final OWLPropertyExpression ope : ontologyNormalization.getRoles()) if (ope instanceof OWLObjectPropertyExpression) { final OWLObjectProperty p = ((OWLObjectPropertyExpression) ope).getNamedProperty(); final OWLObjectPropertyExpression invP = p.getInverseProperty(); if (ontologyNormalization.isSub(some(p)) || ontologyNormalization.isSub(p)) result.add(axiomsTranslator.domainTranslation(p)); if (ontologyNormalization.isSub(some(invP)) || ontologyNormalization.isSub(invP)) result.add(axiomsTranslator.rangeTranslation(p)); } return result; }
@Override public void visit(OWLSubObjectPropertyOfAxiom axiom) { axiom.getSubProperty().accept(this); OWLObjectPropertyExpression subProp = (OWLObjectPropertyExpression) obj; axiom.getSuperProperty().accept(this); OWLObjectPropertyExpression supProp = (OWLObjectPropertyExpression) obj; obj = dataFactory.getOWLSubObjectPropertyOfAxiom( subProp, supProp, duplicateAxiomAnnotations(axiom)); }
public Set<OWLAxiom> write(OWLObjectPropertyExpression property) { Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(); axioms.addAll(writeEntityStart(OBJECT_PROPERTY, property)); if (!isFiltered(AxiomType.SUB_OBJECT_PROPERTY)) { for (OWLOntology ontology : getOntologies()) { SectionMap properties = new SectionMap(); for (OWLSubObjectPropertyOfAxiom ax : ontology.getObjectSubPropertyAxiomsForSubProperty(property)) { if (isDisplayed(ax)) { properties.add(ax.getSuperProperty(), ax); axioms.add(ax); } } writeSection(SUB_PROPERTY_OF, properties, ",", true, ontology); } if (renderExtensions) { for (OWLOntology ontology : getOntologies()) { SectionMap properties = new SectionMap(); for (OWLSubObjectPropertyOfAxiom ax : ontology.getObjectSubPropertyAxiomsForSuperProperty(property)) { if (isDisplayed(ax)) { properties.add(ax.getSubProperty(), ax); axioms.add(ax); } } writeSection(SUPER_PROPERTY_OF, properties, ",", true, ontology); } } } if (!isFiltered(AxiomType.EQUIVALENT_OBJECT_PROPERTIES)) { for (OWLOntology ontology : getOntologies()) { SectionMap properties = new SectionMap(); for (OWLEquivalentObjectPropertiesAxiom ax : ontology.getEquivalentObjectPropertiesAxioms(property)) { if (isDisplayed(ax) && ax.getProperties().size() == 2) { Set<OWLObjectPropertyExpression> props = ax.getPropertiesMinus(property); properties.add(props.iterator().next(), ax); axioms.add(ax); } } writeSection(EQUIVALENT_TO, properties, ",", true, ontology); } } if (!isFiltered(AxiomType.DISJOINT_OBJECT_PROPERTIES)) { for (OWLOntology ontology : getOntologies()) { SectionMap properties = new SectionMap(); for (OWLDisjointObjectPropertiesAxiom ax : ontology.getDisjointObjectPropertiesAxioms(property)) { if (ax.getProperties().size() == 2 && isDisplayed(ax)) { Set<OWLObjectPropertyExpression> props = ax.getPropertiesMinus(property); properties.add(props.iterator().next(), ax); axioms.add(ax); } } writeSection(DISJOINT_WITH, properties, ",", true, ontology); } } if (!isFiltered(AxiomType.SUB_PROPERTY_CHAIN_OF)) { for (OWLOntology ontology : getOntologies()) { for (OWLSubPropertyChainOfAxiom ax : ontology.getAxioms(AxiomType.SUB_PROPERTY_CHAIN_OF)) { if (ax.getSuperProperty().equals(property)) { if (isDisplayed(ax)) { SectionMap map = new SectionMap(); map.add(ax.getPropertyChain(), ax); writeSection(SUB_PROPERTY_CHAIN, map, " o ", false, ontology); axioms.add(ax); } } } } } for (OWLOntology ontology : getOntologies()) { SectionMap characteristics = new SectionMap(); if (!isFiltered(AxiomType.FUNCTIONAL_OBJECT_PROPERTY)) { for (OWLFunctionalObjectPropertyAxiom ax : ontology.getFunctionalObjectPropertyAxioms(property)) { if (isDisplayed(ax)) { characteristics.add(FUNCTIONAL.toString(), ax); axioms.add(ax); } } } if (!isFiltered(AxiomType.INVERSE_FUNCTIONAL_OBJECT_PROPERTY)) { for (OWLAxiom ax : ontology.getInverseFunctionalObjectPropertyAxioms(property)) { if (isDisplayed(ax)) { characteristics.add(INVERSE_FUNCTIONAL.toString(), ax); axioms.add(ax); } } } if (!isFiltered(AxiomType.SYMMETRIC_OBJECT_PROPERTY)) { for (OWLAxiom ax : ontology.getSymmetricObjectPropertyAxioms(property)) { if (isDisplayed(ax)) { characteristics.add(SYMMETRIC.toString(), ax); axioms.add(ax); } } } if (!isFiltered(AxiomType.TRANSITIVE_OBJECT_PROPERTY)) { for (OWLAxiom ax : ontology.getTransitiveObjectPropertyAxioms(property)) { if (isDisplayed(ax)) { characteristics.add(TRANSITIVE.toString(), ax); axioms.add(ax); } } } if (!isFiltered(AxiomType.REFLEXIVE_OBJECT_PROPERTY)) { for (OWLAxiom ax : ontology.getReflexiveObjectPropertyAxioms(property)) { if (isDisplayed(ax)) { characteristics.add(REFLEXIVE.toString(), ax); axioms.add(ax); } } } if (!isFiltered(AxiomType.IRREFLEXIVE_OBJECT_PROPERTY)) { for (OWLAxiom ax : ontology.getIrreflexiveObjectPropertyAxioms(property)) { if (isDisplayed(ax)) { characteristics.add(IRREFLEXIVE.toString(), ax); axioms.add(ax); } } } if (!isFiltered(AxiomType.ASYMMETRIC_OBJECT_PROPERTY)) { for (OWLAxiom ax : ontology.getAsymmetricObjectPropertyAxioms(property)) { if (isDisplayed(ax)) { characteristics.add(ASYMMETRIC.toString(), ax); axioms.add(ax); } } } writeSection(CHARACTERISTICS, characteristics, ",", true, ontology); } if (!isFiltered(AxiomType.OBJECT_PROPERTY_DOMAIN)) { for (OWLOntology ontology : getOntologies()) { SectionMap expressions = new SectionMap(); for (OWLObjectPropertyDomainAxiom ax : ontology.getObjectPropertyDomainAxioms(property)) { if (isDisplayed(ax)) { expressions.add(ax.getDomain(), ax); axioms.add(ax); } } writeSection(DOMAIN, expressions, ",", true, ontology); } } if (!isFiltered(AxiomType.OBJECT_PROPERTY_RANGE)) { for (OWLOntology ontology : getOntologies()) { SectionMap expressions = new SectionMap(); for (OWLObjectPropertyRangeAxiom ax : ontology.getObjectPropertyRangeAxioms(property)) { if (isDisplayed(ax)) { expressions.add(ax.getRange(), ax); axioms.add(ax); } } writeSection(RANGE, expressions, ",", true, ontology); } } if (!isFiltered(AxiomType.INVERSE_OBJECT_PROPERTIES)) { for (OWLOntology ontology : getOntologies()) { Set<OWLObjectPropertyExpression> properties = new TreeSet<OWLObjectPropertyExpression>(); for (OWLInverseObjectPropertiesAxiom ax : ontology.getInverseObjectPropertyAxioms(property)) { if (isDisplayed(ax)) { if (ax.getFirstProperty().equals(property)) { properties.add(ax.getSecondProperty()); } else { properties.add(ax.getFirstProperty()); } axioms.add(ax); } } writeSection(INVERSE_OF, properties, ",", true, ontology); } } if (!isFiltered(AxiomType.SWRL_RULE)) { for (OWLOntology ontology : getOntologies()) { Set<OWLAxiom> rules = new HashSet<OWLAxiom>(); for (SWRLRule rule : ontology.getAxioms(AxiomType.SWRL_RULE)) { if (isDisplayed(rule)) { for (SWRLAtom atom : rule.getHead()) { if (atom.getPredicate().equals(property)) { rules.add(rule); // XXX attempted patching writeSection(RULE, rules, ",", true, ontology); break; } } } } } } writeEntitySectionEnd(OBJECT_PROPERTY.toString()); return axioms; }
@Override public void visit(OWLSubObjectPropertyOfAxiom axiom) { handleObject(axiom); axiom.getSubProperty().accept(this); axiom.getSuperProperty().accept(this); }
@Override public void visit(OWLSubObjectPropertyOfAxiom axiom) { constructs.add(H); axiom.getSubProperty().accept(this); axiom.getSuperProperty().accept(this); }
public void visit(OWLSubObjectPropertyOfAxiom axiom) { axiom.getSubProperty().accept(this); axiom.getSuperProperty().accept(this); processAxiomAnnotations(axiom); }
public void visit(OWLSubObjectPropertyOfAxiom axiom) { addChildParent(axiom.getSubProperty(), axiom.getSuperProperty(), axiom); }