/** * 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))); }
protected void duplicate(OWLConstantReplacer replacer, OWLOntology o, OWLLogicalAxiom ax) { OWLAxiom dupAx = replacer.duplicateObject(ax); if (!ax.equals(dupAx)) { addChange(new RemoveAxiom(o, ax)); addChange(new AddAxiom(o, dupAx)); } }
private OWLDataOneOf process(OWLDataPropertyExpression prop, OWLDataOneOf oneOf) { return df.getOWLDataOneOf(oneOf.values().map(c -> process(prop, c))); }
/** * 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))); }
private OWLDataOneOf process(OWLDataPropertyExpression prop, OWLDataOneOf oneOf) { return df.getOWLDataOneOf(oneOf.values().map(c -> process(prop, c))); }
/** * 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))); }
private OWLDataOneOf process(OWLDataPropertyExpression prop, OWLDataOneOf oneOf) { return df.getOWLDataOneOf(oneOf.values().map(c -> process(prop, c))); }
@Override public OWLDataHasValue visit(OWLDataHasValue ce) { return df .getOWLDataHasValue(ce.getProperty(), process(ce.getProperty(), ce.getFiller())); }
@Override public OWLNegativeDataPropertyAssertionAxiom visit( OWLNegativeDataPropertyAssertionAxiom axiom) { return df .getOWLNegativeDataPropertyAssertionAxiom(axiom.getProperty(), axiom.getSubject(), process(axiom .getProperty(), axiom.getObject())); } }
@Override public OWLDataMaxCardinality visit(OWLDataMaxCardinality ce) { if (ce.getFiller() instanceof OWLDataOneOf) { return df.getOWLDataMaxCardinality(ce.getCardinality(), ce.getProperty(), process(ce.getProperty(), (OWLDataOneOf) ce.getFiller())); } return super.visit(ce); }
@Override public OWLDataSomeValuesFrom visit(OWLDataSomeValuesFrom ce) { if (ce.getFiller() instanceof OWLDataOneOf) { return df.getOWLDataSomeValuesFrom(ce.getProperty(), process(ce.getProperty(), (OWLDataOneOf) ce .getFiller())); } return super.visit(ce); }
@Override public OWLNegativeDataPropertyAssertionAxiom visit( OWLNegativeDataPropertyAssertionAxiom axiom) { return df .getOWLNegativeDataPropertyAssertionAxiom(axiom.getProperty(), axiom.getSubject(), process(axiom .getProperty(), axiom.getObject())); } }
@Override public OWLDataPropertyAssertionAxiom visit(OWLDataPropertyAssertionAxiom axiom) { return df.getOWLDataPropertyAssertionAxiom(axiom.getProperty(), axiom.getSubject(), process(axiom .getProperty(), axiom.getObject())); }
@Override public OWLDataAllValuesFrom visit(OWLDataAllValuesFrom ce) { if (ce.getFiller() instanceof OWLDataOneOf) { return df.getOWLDataAllValuesFrom(ce.getProperty(), process(ce.getProperty(), (OWLDataOneOf) ce .getFiller())); } return super.visit(ce); }
@Override public OWLDataMinCardinality visit(OWLDataMinCardinality ce) { if (ce.getFiller() instanceof OWLDataOneOf) { return df.getOWLDataMinCardinality(ce.getCardinality(), ce.getProperty(), process(ce.getProperty(), (OWLDataOneOf) ce.getFiller())); } return super.visit(ce); }
@Override public OWLDataMinCardinality visit(OWLDataMinCardinality ce) { if (ce.getFiller() instanceof OWLDataOneOf) { return df.getOWLDataMinCardinality(ce.getCardinality(), ce.getProperty(), process(ce.getProperty(), (OWLDataOneOf) ce.getFiller())); } return super.visit(ce); }
@Override public OWLDataSomeValuesFrom visit(OWLDataSomeValuesFrom ce) { if (ce.getFiller() instanceof OWLDataOneOf) { return df.getOWLDataSomeValuesFrom(ce.getProperty(), process(ce.getProperty(), (OWLDataOneOf) ce .getFiller())); } return super.visit(ce); }
@Override public OWLDataHasValue visit(OWLDataHasValue ce) { return df .getOWLDataHasValue(ce.getProperty(), process(ce.getProperty(), ce.getFiller())); }
@Override public OWLNegativeDataPropertyAssertionAxiom visit( OWLNegativeDataPropertyAssertionAxiom axiom) { return df .getOWLNegativeDataPropertyAssertionAxiom(axiom.getProperty(), axiom.getSubject(), process(axiom .getProperty(), axiom.getObject())); } }
@Override public OWLDataPropertyAssertionAxiom visit(OWLDataPropertyAssertionAxiom axiom) { return df.getOWLDataPropertyAssertionAxiom(axiom.getProperty(), axiom.getSubject(), process(axiom .getProperty(), axiom.getObject())); }