@Override public OWLAxiom visit(OWLDataPropertyRangeAxiom axiom) { return df.getOWLDataPropertyRangeAxiom(axiom.getProperty(), axiom.getRange().accept(dataVisitor)); }
/** * Builder initialized from an existing object. * * @param expected the existing object * @param df data factory */ public BuilderDataPropertyRange(OWLDataPropertyRangeAxiom expected, OWLDataFactory df) { this(df); withProperty(expected.getProperty()).withRange(expected.getRange()) .withAnnotations(expected.annotations()); }
@Override public OWLClassExpression visit(OWLDataPropertyRangeAxiom axiom) { return factory.getOWLDataSomeValuesFrom(axiom.getProperty(), factory.getOWLDataComplementOf(axiom.getRange())); }
public void visit(OWLDataPropertyRangeAxiom axiom) { switch (localityCls) { case BOTTOM_BOTTOM: case TOP_BOTTOM: isLocal = !signature.contains(axiom.getProperty().asOWLDataProperty()) || axiom.getRange().isTopDatatype(); break; case TOP_TOP: isLocal = axiom.getRange().isTopDatatype(); break; } }
private void intializeDataRangeMap() { dataRangeMap = new HashMap<OWLDataProperty, OWLDatatype>(); for (OWLDataPropertyRangeAxiom axiom : ontology.getAxioms(AxiomType.DATA_PROPERTY_RANGE)) { if (!axiom.getProperty().isAnonymous()) { OWLDataProperty property = axiom.getProperty().asOWLDataProperty(); OWLDatatype dt = getContainingDatatype(axiom.getRange()); if (dataRangeMap.get(property) == null && dt != null) { dataRangeMap.put(property, dt); } } } }
@Override public Collection<OWLAxiom> visit(OWLDataPropertyRangeAxiom axiom) { return doDefault(df.getOWLSubClassOfAxiom(df.getOWLThing(), df.getOWLDataAllValuesFrom(axiom.getProperty(), axiom.getRange()))); }
@Override public OWLClassExpression visit(OWLDataPropertyRangeAxiom ax) { OWLClassExpression forall = df.getOWLDataAllValuesFrom(ax.getProperty(), ax.getRange()); return df.getOWLObjectIntersectionOf(df.getOWLThing(), df.getOWLObjectComplementOf(forall)); }
public void visit(OWLDataPropertyRangeAxiom axiom) { OWLDataPropertyExpression dataProperty=axiom.getProperty(); checkTopDataPropertyUse(dataProperty,axiom); OWLDataAllValuesFrom allPropertyRange=m_factory.getOWLDataAllValuesFrom(dataProperty,positive(axiom.getRange())); m_classExpressionInclusionsAsDisjunctions.add(new OWLClassExpression[] { allPropertyRange }); } public void visit(OWLFunctionalDataPropertyAxiom axiom) {
for (OWLOntology ontology : getOntologies()) { Map<String, Set<OWLAnnotation>> characteristics = new HashMap<String, Set<OWLAnnotation>>(); for (OWLAxiom ax : ontology.getFunctionalDataPropertyAxioms(property)) { if (isDisplayed(ax)) { characteristics.put(FUNCTIONAL.toString(), ax.getAnnotations()); for (OWLOntology ontology : getOntologies()) { Map<OWLClassExpression, Set<OWLAnnotation>> domains = new TreeMap<OWLClassExpression, Set<OWLAnnotation>>(); for (OWLDataPropertyDomainAxiom ax : ontology.getDataPropertyDomainAxioms(property)) { if (isDisplayed(ax)) { domains.put(ax.getDomain(), ax.getAnnotations()); for (OWLOntology ontology : getOntologies()) { Map<OWLDataRange, Set<OWLAnnotation>> ranges = new TreeMap<OWLDataRange, Set<OWLAnnotation>>(); for (OWLDataPropertyRangeAxiom ax : ontology.getDataPropertyRangeAxioms(property)) { if (isDisplayed(ax)) { ranges.put(ax.getRange(), ax.getAnnotations()); axioms.add(ax);
@Override public void visit(OWLDataPropertyRangeAxiom axiom) { OWLDataPropertyExpression property = axiom.getProperty(); property = expressionRenamer.rename(property); OWLDataRange range = axiom.getRange(); range = expressionRenamer.rename(range); renamedAxiom = df.getOWLDataPropertyRangeAxiom(property, range); }
public CoerceConstantsIntoDataPropertyRange(OWLDataFactory dataFactory, Set<OWLOntology> ontologies) { super(dataFactory); map = new HashMap<OWLDataPropertyExpression, OWLDatatype>(); for (OWLOntology ont : ontologies) { for (OWLDataPropertyRangeAxiom ax : ont.getAxioms(AxiomType.DATA_PROPERTY_RANGE)) { if (ax.getRange().isDatatype()) { map.put(ax.getProperty(), (OWLDatatype) ax.getRange()); } } } OWLConstantReplacer replacer = new OWLConstantReplacer(getDataFactory()); for (OWLOntology ont : ontologies) { for (OWLAxiom ax : ont.getLogicalAxioms()) { OWLAxiom dupAx = replacer.duplicateObject(ax); if (!ax.equals(dupAx)) { changes.add(new RemoveAxiom(ont, ax)); changes.add(new AddAxiom(ont, dupAx)); } } } }
/** * Instantiates a new coerce constants into data property range. * * @param m The manager providing data factory and config to be used for the duplication. * @param ontologies the ontologies to use */ public CoerceConstantsIntoDataPropertyRange(OWLOntologyManager m, Collection<OWLOntology> ontologies) { super(m.getOWLDataFactory()); checkNotNull(ontologies, "ontologies cannot be null"); Map<OWLDataPropertyExpression, OWLDatatype> map = asMap(datatypes(ontologies), ax -> ax.getProperty(), ax -> ax .getRange().asOWLDatatype()); OWLConstantReplacer replacer = new OWLConstantReplacer(m, map); ontologies.forEach(o -> o.logicalAxioms().forEach(ax -> duplicate(replacer, o, ax))); }
for (OWLDisjointClassesAxiom ax : o.getAxioms(AxiomType.DISJOINT_CLASSES)) for (OWLDisjointUnionAxiom ax : o.getAxioms(AxiomType.DISJOINT_UNION)) for (OWLSubClassOfAxiom ax : o.getAxioms(AxiomType.SUBCLASS_OF)) for (OWLDataPropertyRangeAxiom ax : o.getAxioms(AxiomType.DATA_PROPERTY_RANGE)) OWLDataPropertyExpression p = ax.getProperty(); OWLDataRange range = ax.getRange(); writeDataPropertyRangeAxiom(p, range);
@Override public Object visit(OWLDataPropertyRangeAxiom axiom) { return visitAxiom(axiom, () -> df.getOWLDataPropertyRangeAxiom(t(axiom.getProperty()), t(axiom.getRange()), t(axiom.annotations()))); }
OWLOntology schemaOntology = man.loadOntology(IRI.create(ontologyURL)); Set<OWLDataPropertyRangeAxiom> rangeAxioms = schemaOntology.getAxioms(AxiomType.DATA_PROPERTY_RANGE); Set<OWLAxiom> toRemove = new HashSet<>(); Set<OWLAxiom> toAdd = new HashSet<>(); for (OWLDataPropertyRangeAxiom ax : rangeAxioms) { OWLDatatype datatype = ax.getRange().asOWLDatatype(); if(datatype.equals(df.getOWLDatatype(IRI.create("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString")))) { toRemove.add(ax); man.addAxioms(schemaOntology, toAdd); man.removeAxioms(schemaOntology, schemaOntology.getAxioms(AxiomType.FUNCTIONAL_DATA_PROPERTY)); man.removeAxioms(schemaOntology, schemaOntology.getAxioms(AxiomType.DISJOINT_CLASSES));
if (!isFiltered(AxiomType.FUNCTIONAL_DATA_PROPERTY)) { SectionMap<Object, OWLAxiom> characteristics = new SectionMap<>(); filtersort(o.functionalDataPropertyAxioms(property)).forEach(ax -> { characteristics.put(FUNCTIONAL.toString(), ax); axioms.add(ax); filtersort(o.dataPropertyDomainAxioms(property)).forEach(ax -> { domains.put(ax.getDomain(), ax); axioms.add(ax); filtersort(o.dataPropertyRangeAxioms(property)).forEach(ax -> { ranges.put(ax.getRange(), ax); axioms.add(ax); });
ImmutableSet.Builder<OWLDatatypeData> ranges = ImmutableSet.builder(); boolean functional = false; for(OWLOntology ontology : rootOntology.getImportsClosure()) { propertyValueAxioms.addAll(ontology.getAnnotationAssertionAxioms(subject.getEntity().getIRI())); for(OWLDataPropertyDomainAxiom ax : ontology.getDataPropertyDomainAxioms(subject.getEntity())) { if(!ax.getDomain().isAnonymous()) { domains.add(ren.getClassData(ax.getDomain().asOWLClass())); for(OWLDataPropertyRangeAxiom ax : ontology.getDataPropertyRangeAxioms(subject.getEntity())) { if(ax.getRange().isDatatype()) { ranges.add(ren.getDatatypeData(ax.getRange().asOWLDatatype()));
/** * @param ontologies ontologies to inspect * @return datatypes declared in the ontologies (not including OWL 2 standard datatypes) */ public Stream<OWLDataPropertyRangeAxiom> datatypes(Collection<OWLOntology> ontologies) { return ontologies.stream().flatMap(ont -> ont.axioms(AxiomType.DATA_PROPERTY_RANGE)) .filter(ax -> ax.getRange() .isOWLDatatype()); }
@Override public OWLDataRange getRangeImpl(OWLDataProperty datatypeProperty) { Set<OWLDataPropertyRangeAxiom> axioms = ontology.getDataPropertyRangeAxioms(datatypeProperty); if(!axioms.isEmpty()){ OWLDataPropertyRangeAxiom axiom = axioms.iterator().next(); return axiom.getRange(); } else { return df.getOWLDatatype(OWL2Datatype.RDFS_LITERAL.getIRI()); } }
protected void refill(OWLOntology ontology) { for (OWLDataPropertyRangeAxiom ax : ontology.getDataPropertyRangeAxioms(getRootObject())) { addRow(new OWLDataPropertyRangeFrameSectionRow(getOWLEditorKit(), this, ontology, getRootObject(), ax)); addedRanges.add(ax.getRange()); } }