@Override
 public void visit(OWLObjectPropertyRangeAxiom axiom) {
   write(TOP);
   writeSpace();
   write(SUBCLASS);
   writeSpace();
   df.getOWLObjectAllValuesFrom(axiom.getProperty(), axiom.getRange()).accept(this);
 }
 @Override
 public void visit(OWLObjectPropertyRangeAxiom axiom) {
   axiom.getProperty().accept(this);
   OWLObjectPropertyExpression prop = (OWLObjectPropertyExpression) obj;
   axiom.getRange().accept(this);
   OWLClassExpression range = (OWLClassExpression) obj;
   obj = dataFactory.getOWLObjectPropertyRangeAxiom(prop, range, duplicateAxiomAnnotations(axiom));
 }
示例#3
0
    public Object visit(OWLSubPropertyChainOfAxiom axiom) {
      Set<OWLObjectPropertyRangeAxiom> rangeAxioms =
          getCurrentOntology().getAxioms(AxiomType.OBJECT_PROPERTY_RANGE, true);
      if (rangeAxioms.isEmpty()) {
        return false;
      }

      // Do we have a range restriction imposed on our super property?
      for (OWLObjectPropertyRangeAxiom rngAx : rangeAxioms) {
        if (getPropertyManager().isSubPropertyOf(axiom.getSuperProperty(), rngAx.getProperty())) {
          // Imposed range restriction!
          OWLClassExpression imposedRange = rngAx.getRange();
          // There must be an axiom that imposes a range on the last prop in the chain
          List<OWLObjectPropertyExpression> chain = axiom.getPropertyChain();
          if (!chain.isEmpty()) {
            OWLObjectPropertyExpression lastProperty = chain.get(chain.size() - 1);
            boolean rngPresent = false;
            for (OWLOntology ont : getCurrentOntology().getImportsClosure()) {
              for (OWLObjectPropertyRangeAxiom lastPropRngAx :
                  ont.getObjectPropertyRangeAxioms(lastProperty)) {
                if (lastPropRngAx.getRange().equals(imposedRange)) {
                  // We're o.k.
                  rngPresent = true;
                  break;
                }
              }
            }
            if (!rngPresent) {
              profileViolations.add(
                  new LastPropertyInChainNotInImposedRange(getCurrentOntology(), axiom, rngAx));
            }
          }
        }
      }

      return null;
    }
  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(OWLObjectPropertyRangeAxiom axiom) {
   result = factory.getOWLObjectSomeValuesFrom(axiom.getProperty(), not(axiom.getRange()));
 }
 @Override
 public void visit(OWLObjectPropertyRangeAxiom axiom) {
   handleObject(axiom);
   axiom.getRange().accept(this);
   axiom.getProperty().accept(this);
 }
 @Override
 public void visit(OWLObjectPropertyRangeAxiom axiom) {
   constructs.add(AL);
   axiom.getRange().accept(this);
   axiom.getProperty().accept(this);
 }
 public void visit(OWLObjectPropertyRangeAxiom axiom) {
   type = AXIOM_TYPE_INDEX_BASE + axiom.getAxiomType().getIndex();
 }
 public void visit(OWLObjectPropertyRangeAxiom axiom) {
   axiom.getRange().accept(this);
   axiom.getProperty().accept(this);
   processAxiomAnnotations(axiom);
 }