public Set<OWLAxiom> write(OWLDataProperty property) {
   Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();
   axioms.addAll(writeEntityStart(DATA_PROPERTY, property));
   if (!isFiltered(AxiomType.FUNCTIONAL_DATA_PROPERTY)) {
     for (OWLOntology ontology : getOntologies()) {
       SectionMap characteristics = new SectionMap();
       for (OWLAxiom ax : ontology.getFunctionalDataPropertyAxioms(property)) {
         if (isDisplayed(ax)) {
           characteristics.add(FUNCTIONAL.toString(), ax);
           axioms.add(ax);
         }
       }
       writeSection(CHARACTERISTICS, characteristics, ",", true, ontology);
     }
   }
   if (!isFiltered(AxiomType.DATA_PROPERTY_DOMAIN)) {
     for (OWLOntology ontology : getOntologies()) {
       SectionMap domains = new SectionMap();
       for (OWLDataPropertyDomainAxiom ax : ontology.getDataPropertyDomainAxioms(property)) {
         if (isDisplayed(ax)) {
           domains.add(ax.getDomain(), ax);
           axioms.add(ax);
         }
       }
       writeSection(DOMAIN, domains, ",", true, ontology);
     }
   }
   if (!isFiltered(AxiomType.DATA_PROPERTY_RANGE)) {
     for (OWLOntology ontology : getOntologies()) {
       SectionMap ranges = new SectionMap();
       for (OWLDataPropertyRangeAxiom ax : ontology.getDataPropertyRangeAxioms(property)) {
         if (isDisplayed(ax)) {
           ranges.add(ax.getRange(), ax);
           axioms.add(ax);
         }
       }
       writeSection(RANGE, ranges, ",", true, ontology);
     }
   }
   if (!isFiltered(AxiomType.SUB_DATA_PROPERTY)) {
     for (OWLOntology ontology : getOntologies()) {
       SectionMap supers = new SectionMap();
       for (OWLSubDataPropertyOfAxiom ax :
           ontology.getDataSubPropertyAxiomsForSubProperty(property)) {
         if (isDisplayed(ax)) {
           supers.add(ax.getSuperProperty(), ax);
           axioms.add(ax);
         }
       }
       writeSection(SUB_PROPERTY_OF, supers, ",", true, ontology);
     }
   }
   if (!isFiltered(AxiomType.EQUIVALENT_DATA_PROPERTIES)) {
     for (OWLOntology ontology : getOntologies()) {
       SectionMap props = new SectionMap();
       for (OWLEquivalentDataPropertiesAxiom ax :
           ontology.getEquivalentDataPropertiesAxioms(property)) {
         if (isDisplayed(ax) && ax.getProperties().size() == 2) {
           props.add(ax.getPropertiesMinus(property).iterator().next(), ax);
           axioms.add(ax);
         }
       }
       writeSection(EQUIVALENT_TO, props, ",", true, ontology);
     }
   }
   if (!isFiltered(AxiomType.DISJOINT_DATA_PROPERTIES)) {
     for (OWLOntology ontology : getOntologies()) {
       SectionMap props = new SectionMap();
       for (OWLDisjointDataPropertiesAxiom ax :
           ontology.getDisjointDataPropertiesAxioms(property)) {
         if (ax.getProperties().size() == 2 && isDisplayed(ax)) {
           props.add(ax.getPropertiesMinus(property).iterator().next(), ax);
           axioms.add(ax);
         }
       }
       props.remove(property);
       writeSection(DISJOINT_WITH, props, ",", 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)) {
               writeSection(RULE, rules, "", true, ontology);
               break;
             }
           }
         }
       }
     }
   }
   writeEntitySectionEnd(DATA_PROPERTY.toString());
   return axioms;
 }
Exemplo n.º 2
0
 @Override
 protected Set<? extends OWLSubPropertyAxiom<OWLDataPropertyExpression>> getSubPropertyAxioms(
     OWLOntology ontology) {
   return ontology.getDataSubPropertyAxiomsForSubProperty(this);
 }