예제 #1
0
 @Override
 public void visit(OWLDisjointObjectPropertiesAxiom axiom) {
   constructs.add(R);
   for (OWLObjectPropertyExpression prop : axiom.getProperties()) {
     prop.accept(this);
   }
 }
 public void visit(OWLSubPropertyChainOfAxiom axiom) {
   for (OWLObjectPropertyExpression prop : axiom.getPropertyChain()) {
     prop.accept(this);
   }
   axiom.getSuperProperty().accept(this);
   processAxiomAnnotations(axiom);
 }
 @Override
 public void visit(OWLSubPropertyChainOfAxiom axiom) {
   handleObject(axiom);
   for (OWLObjectPropertyExpression prop : axiom.getPropertyChain()) {
     prop.accept(this);
   }
   axiom.getSuperProperty().accept(this);
 }
 public void visit(OWLEquivalentObjectPropertiesAxiom axiom) {
   for (OWLObjectPropertyExpression propA : axiom.getProperties()) {
     for (OWLObjectPropertyExpression propB : axiom.getProperties()) {
       if (!propA.equals(propB)) {
         addChildParent(propA, propB, axiom);
       }
     }
   }
 }
예제 #5
0
 @Override
 public void visit(OWLDisjointObjectPropertiesAxiom axiom) {
   write("DisjointObjectProperties");
   writeSpace();
   for (OWLObjectPropertyExpression p : axiom.getProperties()) {
     p.accept(this);
     writeSpace();
   }
 }
 private void addPropertyAssertion(
     OWLObjectPropertyExpression property, OWLIndividual subject, OWLIndividual object) {
   if (!property.isAnonymous()) {
     this.ontologyManager.addAxiom(
         this.ontology, this.factory.getOWLDeclarationAxiom(property.asOWLObjectProperty()));
   }
   this.ontologyManager.addAxiom(
       this.ontology, this.factory.getOWLObjectPropertyAssertionAxiom(property, subject, object));
 }
예제 #7
0
 public Set<OWLObjectProperty> getObjectPropertyEquivalents(OWLObjectProperty prop) {
   Set<OWLObjectProperty> propSet = new HashSet<OWLObjectProperty>();
   for (OWLEquivalentObjectPropertiesAxiom eopa :
       _ontology.getEquivalentObjectPropertiesAxioms(prop)) {
     for (OWLObjectPropertyExpression ope : eopa.getObjectPropertiesInSignature()) {
       if (!ope.equals(prop)) propSet.add(ope.asOWLObjectProperty());
     }
   }
   return propSet;
 }
예제 #8
0
 @Override
 public void visit(OWLSubPropertyChainOfAxiom axiom) {
   axiom.getSuperProperty().accept(this);
   OWLObjectPropertyExpression prop = (OWLObjectPropertyExpression) obj;
   List<OWLObjectPropertyExpression> chain = new ArrayList<OWLObjectPropertyExpression>();
   for (OWLObjectPropertyExpression p : axiom.getPropertyChain()) {
     p.accept(this);
     chain.add((OWLObjectPropertyExpression) obj);
   }
   obj = dataFactory.getOWLSubPropertyChainOfAxiom(chain, prop, duplicateAxiomAnnotations(axiom));
 }
 @Override
 public void visit(OWLHasKeyAxiom axiom) {
   handleObject(axiom);
   axiom.getClassExpression().accept(this);
   for (OWLObjectPropertyExpression prop : axiom.getObjectPropertyExpressions()) {
     prop.accept(this);
   }
   for (OWLDataPropertyExpression prop : axiom.getDataPropertyExpressions()) {
     prop.accept(this);
   }
 }
예제 #10
0
 // 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;
 }
 public LintReport<OWLObjectProperty> detected(Collection<? extends OWLOntology> targets)
     throws LintException {
   SimpleMatchBasedLintReport<OWLObjectProperty> report =
       new SimpleMatchBasedLintReport<OWLObjectProperty>(this);
   for (OWLOntology ontology : targets) {
     for (OWLObjectProperty objectProperty : ontology.getObjectPropertiesInSignature()) {
       if (objectProperty.isTransitive(ontology)) {
         Set<OWLObjectPropertyExpression> superProperties =
             objectProperty.getSuperProperties(ontology);
         for (OWLObjectPropertyExpression objectPropertyExpression : superProperties) {
           if (objectPropertyExpression.isTransitive(ontology)) {
             report.add(
                 objectProperty,
                 ontology,
                 "The property "
                     + objectProperty.toString()
                     + " is transitive and has a transitive super property");
           }
         }
       }
     }
   }
   return report;
 }
 @Test
 public void testBottomObjectPropertyNegative() {
   OWLObjectPropertyExpression prop = ObjectProperty(getIRI("prop"));
   assertFalse(prop.isOWLBottomObjectProperty());
 }
 @Test
 public void testBottomObjectPropertyPositive() {
   OWLObjectPropertyExpression prop = Factory.getFactory().getOWLBottomObjectProperty();
   assertTrue(prop.isOWLBottomObjectProperty());
 }
 public void visit(OWLEquivalentObjectPropertiesAxiom axiom) {
   for (OWLObjectPropertyExpression prop : axiom.getProperties()) {
     prop.accept(this);
   }
   processAxiomAnnotations(axiom);
 }