public static ABoxAssertionSupplier assertionSupplier() { return new ABoxAssertionSupplier() { @Override public ClassAssertion createClassAssertion(String c, ObjectConstant o) throws InconsistentOntologyException { return OntologyBuilderImpl.createClassAssertion(new ClassImpl(c), o); } @Override public ObjectPropertyAssertion createObjectPropertyAssertion(String op, ObjectConstant o1, ObjectConstant o2) throws InconsistentOntologyException { return OntologyBuilderImpl.createObjectPropertyAssertion(new ObjectPropertyExpressionImpl(op), o1, o2); } @Override public DataPropertyAssertion createDataPropertyAssertion(String dp, ObjectConstant o, ValueConstant v) throws InconsistentOntologyException { return OntologyBuilderImpl.createDataPropertyAssertion(new DataPropertyExpressionImpl(dp), o, v); } }; }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj instanceof DataPropertyExpressionImpl) { DataPropertyExpressionImpl other = (DataPropertyExpressionImpl) obj; return name.equals(other.name); } // object and data properties share the same name space if (obj instanceof ObjectPropertyExpressionImpl) { ObjectPropertyExpressionImpl other = (ObjectPropertyExpressionImpl) obj; return (false == other.isInverse()) && name.equals(other.getName()); } return false; }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj instanceof ObjectPropertyExpressionImpl) { ObjectPropertyExpressionImpl other = (ObjectPropertyExpressionImpl) obj; return string.equals(other.string) && (isInverse == other.isInverse); } // the two types of properties share the same name space if (obj instanceof DataPropertyExpressionImpl) { DataPropertyExpressionImpl other = (DataPropertyExpressionImpl) obj; return (isInverse == false) && getName().equals(other.getName()); } return false; }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj instanceof ObjectPropertyExpressionImpl) { ObjectPropertyExpressionImpl other = (ObjectPropertyExpressionImpl) obj; return string.equals(other.string) && (isInverse == other.isInverse); } // the two types of properties share the same name space if (obj instanceof DataPropertyExpressionImpl) { DataPropertyExpressionImpl other = (DataPropertyExpressionImpl) obj; return (isInverse == false) && getName().equals(other.getName()); } return false; }
@Override public ObjectPropertyExpression createAuxiliaryObjectProperty() { ObjectPropertyExpression ope = new ObjectPropertyExpressionImpl(AUXROLEURI + auxCounter); auxCounter++ ; auxObjectProperties.add(ope); return ope; }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj instanceof DataPropertyExpressionImpl) { DataPropertyExpressionImpl other = (DataPropertyExpressionImpl) obj; return name.equals(other.name); } // object and data properties share the same name space if (obj instanceof ObjectPropertyExpressionImpl) { ObjectPropertyExpressionImpl other = (ObjectPropertyExpressionImpl) obj; return (false == other.isInverse()) && name.equals(other.getName()); } return false; }
@Override public ObjectPropertyExpression createAuxiliaryObjectProperty() { ObjectPropertyExpression ope = new ObjectPropertyExpressionImpl(rdfFactory.createIRI(AUXROLEURI + auxCounter)); auxCounter++ ; auxObjectProperties.add(ope); return ope; }
@Override public ObjectPropertyAssertion createObjectPropertyAssertion(String op, ObjectConstant o1, ObjectConstant o2) throws InconsistentOntologyException { return OntologyBuilderImpl.createObjectPropertyAssertion(new ObjectPropertyExpressionImpl(op), o1, o2); }
/** * general constructor * * @param name */ ObjectPropertyExpressionImpl(String name) { this.predicate = TERM_FACTORY.getObjectPropertyPredicate(name); this.isInverse = false; this.string = name; this.isTop = name.equals(owlTopObjectPropertyIRI); this.isBottom = name.equals(owlBottomObjectPropertyIRI); if (isTop || isBottom) this.inverseProperty = this; // rule [R6] else this.inverseProperty = new ObjectPropertyExpressionImpl(predicate, this); this.domain = new ObjectSomeValuesFromImpl(this); }
@Override public ObjectPropertyAssertion createObjectPropertyAssertion(String op, ObjectConstant o1, ObjectConstant o2) throws InconsistentOntologyException { return OntologyBuilderImpl.createObjectPropertyAssertion(new ObjectPropertyExpressionImpl(rdfFactory.createIRI(op)), o1, o2); }
ObjectPropertyExpressionImpl(IRI iri) { this.iri = iri; this.isInverse = false; this.string = iri.getIRIString(); this.isTop = iri.equals(OWL.TOP_OBJECT_PROPERTY); this.isBottom = iri.equals(OWL.BOTTOM_OBJECT_PROPERTY); if (isTop || isBottom) this.inverseProperty = this; // rule [R6] else this.inverseProperty = new ObjectPropertyExpressionImpl(iri, this); this.domain = new ObjectSomeValuesFromImpl(this); }
private OntologyBuilderImpl(RDF rdfFactory) { classes = new OntologyCategoryImpl<>(s -> new ClassImpl(rdfFactory.createIRI(s)), CLASS_NOT_FOUND,""); objectProperties = new OntologyCategoryImpl<>(s -> new ObjectPropertyExpressionImpl(rdfFactory.createIRI(s)), OBJECT_PROPERTY_NOT_FOUND,""); dataProperties = new OntologyCategoryImpl<>(s -> new DataPropertyExpressionImpl(rdfFactory.createIRI(s)), DATA_PROPERTY_NOT_FOUND,""); annotationProperties = new OntologyCategoryImpl<>(s -> new AnnotationPropertyImpl(rdfFactory.createIRI(s)), ANNOTATION_PROPERTY_NOT_FOUND,""); classes.map.put(OWL.THING.getIRIString(), ClassImpl.owlThing); classes.map.put(OWL.NOTHING.getIRIString(), ClassImpl.owlNothing); objectProperties.map.put(OWL.TOP_OBJECT_PROPERTY.getIRIString(), ObjectPropertyExpressionImpl.owlTopObjectProperty); objectProperties.map.put(OWL.BOTTOM_OBJECT_PROPERTY.getIRIString(), ObjectPropertyExpressionImpl.owlBottomObjectProperty); dataProperties.map.put(OWL.TOP_DATA_PROPERTY.getIRIString(), DataPropertyExpressionImpl.owlTopDataProperty); dataProperties.map.put(OWL.BOTTOM_DATA_PROPERTY.getIRIString(), DataPropertyExpressionImpl.owlBottomDataProperty); this.rdfFactory = rdfFactory; }