@Override public boolean isBottom() { return property.isBottom(); }
@Override public boolean isTop() { return property.isTop(); } }
@Override public boolean isTop() { return property.isTop(); } }
@Override public void merge(ImmutableOntologyVocabulary v) { if (v instanceof OntologyVocabularyImpl) { OntologyVocabularyImpl vi = (OntologyVocabularyImpl)v; concepts.putAll(vi.concepts); objectProperties.putAll(vi.objectProperties); dataProperties.putAll(vi.dataProperties); annotationProperties.putAll(vi.annotationProperties); } else { for (OClass oc : v.getClasses()) if (!oc.isTop() && !oc.isBottom()) concepts.put(oc.getName(), oc); for (ObjectPropertyExpression ope : v.getObjectProperties()) if (!ope.isTop() && !ope.isBottom()) objectProperties.put(ope.getName(), ope); for (DataPropertyExpression dpe : v.getDataProperties()) if (!dpe.isTop() && !dpe.isBottom()) dataProperties.put(dpe.getName(), dpe); for (AnnotationProperty ap : v.getAnnotationProperties()) annotationProperties.put(ap.getName(), ap); } }
/** * Creates an object property assertion * <p> * ObjectPropertyAssertion := 'ObjectPropertyAssertion' '(' axiomAnnotations * ObjectPropertyExpression sourceIndividual targetIndividual ')' * <p> * Implements rule [O4]: * - ignore (return null) if the property is top * - inconsistency if the property is bot * - swap the arguments to eliminate inverses */ public ObjectPropertyAssertion createObjectPropertyAssertion(ObjectPropertyExpression ope, ObjectConstant o1, ObjectConstant o2) throws InconsistentOntologyException { if (ope.isTop()) return null; if (ope.isBottom()) throw new InconsistentOntologyException(); if (ope.isInverse()) return new ObjectPropertyAssertionImpl(ope.getInverse(), o2, o1); else return new ObjectPropertyAssertionImpl(ope, o1, o2); }
public Iterator<Predicate> iEmptyRoles() { return new EmptyEntitiesIterator(onto.getVocabulary().getObjectProperties().iterator(), onto.getVocabulary().getDataProperties().iterator(), conn); }
/** * Creates a class assertion * <p> * ClassAssertion := 'ClassAssertion' '(' axiomAnnotations Class Individual ')' * <p> * Implements rule [C4]: * - ignore (return null) if the class is top * - inconsistency if the class is bot */ @Override public ClassAssertion createClassAssertion(OClass ce, ObjectConstant object) throws InconsistentOntologyException { if (ce.isTop()) return null; if (ce.isBottom()) throw new InconsistentOntologyException(); return new ClassAssertionImpl(ce, object); }
/** * Creates a data property assertion * <p> * DataPropertyAssertion := 'DataPropertyAssertion' '(' axiomAnnotations * DataPropertyExpression sourceIndividual targetValue ')' * <p> * Implements rule [D4]: * - ignore (return null) if the property is top * - inconsistency if the property is bot */ @Override public DataPropertyAssertion createDataPropertyAssertion(DataPropertyExpression dpe, ObjectConstant o1, ValueConstant o2) throws InconsistentOntologyException { if (dpe.isTop()) return null; if (dpe.isBottom()) throw new InconsistentOntologyException(); return new DataPropertyAssertionImpl(dpe, o1, o2); }
public Iterator<Predicate> iEmptyConcepts() { return new EmptyEntitiesIterator( onto.getVocabulary().getClasses().iterator(), conn); }
private void checkSignature(ClassExpression desc) { if (desc instanceof OClass) { OClass cl = (OClass) desc; if (!vocabulary.concepts.containsKey(cl.getName())) throw new IllegalArgumentException(CLASS_NOT_FOUND + desc); } else if (desc instanceof ObjectSomeValuesFrom) { checkSignature(((ObjectSomeValuesFrom) desc).getProperty()); } else { assert (desc instanceof DataSomeValuesFrom); checkSignature(((DataSomeValuesFrom) desc).getProperty()); } }
@Override public boolean isBottom() { return property.isBottom(); }
/** * 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); }
/** * 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 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); }
private void checkSignature(DataPropertyRangeExpression desc) { checkSignature(desc.getProperty()); }
@Override public void addObjectPropertyAssertion(ObjectPropertyAssertion assertion) { checkSignature(assertion.getProperty()); objectPropertyAssertions.add(assertion); }
public QuestDBClassicStore(String name, String tboxFile, QuestPreferences config) throws Exception { super(name); Ontology tbox = null; if (tboxFile == null) { OntologyVocabulary voc = ofac.createVocabulary(); tbox = ofac.createOntology(voc); } else { tbox = readOntology(tboxFile); } setup(tbox, config); }
public Ontology getOntology() { return ofac.createOntology(vb); }
/** * Normalizes and adds a reflexive object property axiom * <p> * ReflexiveObjectProperty := 'ReflexiveObjectProperty' '(' axiomAnnotations ObjectPropertyExpression ')' * <p> * Implements rule [O3]:<br> * - ignores if top (which is reflexive by definition)<br> * - inconsistency if bot (which is not reflexive)<br> * - otherwise, removes the inverse if required * * @throws InconsistentOntologyException */ @Override public void addReflexiveObjectPropertyAxiom(ObjectPropertyExpression ope) throws InconsistentOntologyException { if (ope.isTop()) return; if (ope.isBottom()) throw new InconsistentOntologyException(); if (ope.isInverse()) reflexiveObjectPropertyAxioms.add(ope.getInverse()); else reflexiveObjectPropertyAxioms.add(ope); }