/** * Creates an annotation assertion * AnnotationAssertion := 'AnnotationAssertion' '(' axiomAnnotations AnnotationProperty AnnotationSubject AnnotationValue ')' * AnnotationSubject := IRI | AnonymousIndividual * */ @Override public AnnotationAssertion createAnnotationAssertion(AnnotationProperty ap, ObjectConstant o, Constant c) { return new AnnotationAssertionImpl(ap,o,c); }
@Override public OntologyVocabulary createVocabulary() { return new OntologyVocabularyImpl(); }
@Override public Ontology createOntology(ImmutableOntologyVocabulary vb) { return new OntologyImpl((OntologyVocabularyImpl)vb); }
/** * Normalizes and adds data property disjointness axiom * <p> * DisjointDataProperties := 'DisjointDataProperties' '(' axiomAnnotations * DataPropertyExpression DataPropertyExpression { DataPropertyExpression } ')'<br> * <p> * Implements rule [D2]:<br> * - eliminates all occurrences of bot and if the result contains<br> * - no top and at least two elements then disjointness<br> * - one top then emptiness of all other elements<br> * - two tops then inconsistency (this behavior is an extension of OWL 2, where duplicates are removed from the list) */ @Override public void addDisjointDataPropertiesAxiom(DataPropertyExpression... dpes) throws InconsistentOntologyException { for (DataPropertyExpression dpe : dpes) checkSignature(dpe); dataPropertyAxioms.addDisjointness(dpes); }
/** * Normalizes and adds an object subproperty axiom * <p> * SubObjectPropertyOf := 'SubObjectPropertyOf' '(' axiomAnnotations * ObjectPropertyExpression ObjectPropertyExpression ')' * <p> * Implements rule [O1]:<br> * - ignore the axiom if the first argument is owl:bottomObjectProperty * or the second argument is owl:topObjectProperty<br> * - replace by a disjointness axiom if the second argument is owl:bottomObjectProperty * but the first one is not owl:topObjectProperty<br> * - inconsistency if the first is owl:topObjectProperty but the second is owl:bottomObjectProperty * * @throws InconsistentOntologyException * */ @Override public void addSubPropertyOfAxiom(ObjectPropertyExpression ope1, ObjectPropertyExpression ope2) throws InconsistentOntologyException { checkSignature(ope1); checkSignature(ope2); objectPropertyAxioms.addInclusion(ope1, ope2); }
/** * Adds an annotation subproperty axiom * <p> * SubAnnotationPropertyOf := 'SubAnnotationPropertyOf' '(' axiomAnnotations subAnnotationProperty superAnnotationProperty ')'<br> * subAnnotationProperty := AnnotationProperty<br> * superAnnotationProperty := AnnotationProperty * <p> * * @throws InconsistentOntologyException */ @Override public void addSubPropertyOfAxiom(AnnotationProperty ap1, AnnotationProperty ap2) { checkSignature(ap1); checkSignature(ap2); BinaryAxiom<AnnotationProperty> ax = new BinaryAxiomImpl<>(ap1, ap2); annotationAxioms.add(ax); }
@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 void addFunctionalObjectPropertyAxiom(ObjectPropertyExpression prop) { checkSignature(prop); functionalObjectPropertyAxioms.add(prop); }
@Override public AnnotationProperty createAnnotationProperty(String uri) { AnnotationProperty ap = new AnnotationPropertyImpl(uri); annotationProperties.put(uri, ap); return ap; }
OntologyImpl(OntologyVocabularyImpl voc) { this.vocabulary = new ImmutableOntologyVocabularyImpl(voc); }
@Override public boolean equals(Object obj) { if (obj instanceof DatatypeImpl) { DatatypeImpl type2 = (DatatypeImpl) obj; return (predicate.equals(type2.getPredicate())); } return false; }
@Override public DataSomeValuesFrom getDomainRestriction(Datatype datatype) { DataSomeValuesFrom domain = domains.get(datatype); if (domain == null) { domain = new DataSomeValuesFromImpl(this, datatype); domains.put(datatype, domain); } return domain; }
/** * creates an object property assertion (without checking any vocabulary) * * @return null if it is top object property ([O4], @see OntologyFactoryImpl) * @throws InconsistentOntologyException if it is the bottom object property ([O4], @see OntologyFactoryImpl) */ @Override public ObjectPropertyAssertion createObjectPropertyAssertion(String propertyName, ObjectConstant o1, ObjectConstant o2) throws InconsistentOntologyException { ObjectPropertyExpression ope = new ObjectPropertyExpressionImpl(propertyName); return ofac.createObjectPropertyAssertion(ope, o1, o2); }
/** * creates a data property assertion (without checking any vocabulary) * * @return null if it is top data property ([D4], @see OntologyFactoryImpl) * @throws InconsistentOntologyException if it is the bottom data property ([D4], @see OntologyFactoryImpl) */ @Override public DataPropertyAssertion createDataPropertyAssertion(String propertyName, ObjectConstant o1, ValueConstant o2) throws InconsistentOntologyException { DataPropertyExpression dpe = new DataPropertyExpressionImpl(propertyName); return ofac.createDataPropertyAssertion(dpe, o1, o2); }
/** * creates a class assertion (without checking any vocabulary) * * @return null if it is top class ([C4], @see OntologyFactoryImpl) * @throws InconsistentOntologyException if it is the bottom class ([C4], @see OntologyFactoryImpl) */ @Override public ClassAssertion createClassAssertion(String className, ObjectConstant o) throws InconsistentOntologyException { OClass oc = new ClassImpl(className); return ofac.createClassAssertion(oc, o); }
/** * Normalizes and adds class disjointness axiom * <p> * DisjointClasses := 'DisjointClasses' '(' axiomAnnotations * subClassExpression subClassExpression { subClassExpression } ')'<br> * <p> * Implements rule [C2]:<br> * - eliminates all occurrences of bot and if the result contains<br> * - no top and at least two elements then disjointness<br> * - one top then emptiness of all other elements<br> * - two tops then inconsistency (this behavior is an extension of OWL 2, where duplicates are removed from the list) */ @Override public void addDisjointClassesAxiom(ClassExpression... ces) throws InconsistentOntologyException { for (ClassExpression c : ces) checkSignature(c); classAxioms.addDisjointness(ces); }
/** * Normalizes and adds a data subproperty axiom * <p> * SubDataPropertyOf := 'SubDataPropertyOf' '(' axiomAnnotations * subDataPropertyExpression superDataPropertyExpression ')'<br> * subDataPropertyExpression := DataPropertyExpression<br> * superDataPropertyExpression := DataPropertyExpression * <p> * implements rule [D1]:<br> * - ignore the axiom if the first argument is owl:bottomDataProperty * or the second argument is owl:topDataProperty<br> * - replace by a disjointness axiom if the second argument is owl:bottomDataProperty * but the first one is not owl:topDataProperty<br> * - inconsistency if the first is owl:topDataProperty but the second is owl:bottomDataProperty * * @throws InconsistentOntologyException */ @Override public void addSubPropertyOfAxiom(DataPropertyExpression dpe1, DataPropertyExpression dpe2) throws InconsistentOntologyException { checkSignature(dpe1); checkSignature(dpe2); dataPropertyAxioms.addInclusion(dpe1, dpe2); }
@Override public void addFunctionalDataPropertyAxiom(DataPropertyExpression prop) { checkSignature(prop); functionalDataPropertyAxioms.add(prop); }
/** * creates an annotation property assertion (without checking any vocabulary) * * */ @Override public AnnotationAssertion createAnnotationAssertion(String propertyName, ObjectConstant o, Constant v) { AnnotationProperty ap = new AnnotationPropertyImpl(propertyName); return ofac.createAnnotationAssertion(ap, o, v); }
/** * Normalizes and adds object property disjointness axiom * <p> * DisjointObjectProperties := 'DisjointObjectProperties' '(' axiomAnnotations * ObjectPropertyExpression ObjectPropertyExpression { ObjectPropertyExpression } ')'<br> * <p> * Implements rule [O2]:<br> * - eliminates all occurrences of bot and if the result contains<br> * - no top and at least two elements then disjointness<br> * - one top then emptiness of all other elements<br> * - two tops then inconsistency (this behavior is an extension of OWL 2, where duplicates are removed from the list) */ @Override public void addDisjointObjectPropertiesAxiom(ObjectPropertyExpression... opes) throws InconsistentOntologyException { for (ObjectPropertyExpression p : opes) checkSignature(p); objectPropertyAxioms.addDisjointness(opes); }