@Override public Stream<OWLNamedIndividual> filter(NodeSet<OWLNamedIndividual> nodes) { return nodes.entities(); } };
@Override public Stream<OWLNamedIndividual> filter(NodeSet<OWLNamedIndividual> nodes) { return nodes.entities(); } };
/** * @param ce The class expression whose strict (direct) super classes are to be retrieved. * @return a {@code NodeSet} such that for each class {@code C} in the {@code NodeSet} the set * of reasoner axioms entails {@code StrictSubClassOf(ce, C)}. <br> * If {@code ce} is equivalent to {@code owl:Thing} then the empty {@code NodeSet} will * be returned. * @see OWLReasoner#getSuperClasses(OWLClassExpression, boolean) Return all superclasses. */ default Stream<OWLClass> superClasses(OWLClassExpression ce) { return getSuperClasses(ce).entities(); }
/** * @param ce The class expression whose strict (direct) super classes are to be retrieved. * @return a {@code NodeSet} such that for each class {@code C} in the {@code NodeSet} the set * of reasoner axioms entails {@code StrictSubClassOf(ce, C)}. <br> * If {@code ce} is equivalent to {@code owl:Thing} then the empty {@code NodeSet} will * be returned. * @see OWLReasoner#getSuperClasses(OWLClassExpression, boolean) Return all superclasses. */ default Stream<OWLClass> superClasses(OWLClassExpression ce) { return getSuperClasses(ce).entities(); }
/** * @param elements elements */ public SetOfIndividualsImpl(NodeSet<OWLNamedIndividual> elements) { this(asUnorderedSet(elements.entities(), OWLIndividual.class)); }
/** * @param ce The class expression whose strict (direct) super classes are to be retrieved. * @return a {@code NodeSet} such that for each class {@code C} in the {@code NodeSet} the set * of reasoner axioms entails {@code StrictSubClassOf(ce, C)}. <br> * If {@code ce} is equivalent to {@code owl:Thing} then the empty {@code NodeSet} will * be returned. * @see OWLReasoner#getSuperClasses(OWLClassExpression, boolean) Return all superclasses. */ default Stream<OWLClass> superClasses(OWLClassExpression ce) { return getSuperClasses(ce).entities(); }
/** * @param ind The individual whose types are to be retrieved. * @return a {@code NodeSet} containing named classes such that for each named class {@code C} * in the node set, the set of reasoner axioms entails {@code ClassAssertion(C, ind)}. * <br> * @see OWLReasoner#getTypes(OWLNamedIndividual, boolean) Gets the named classes which are * (potentially direct) types of the specified named individual. The classes are returned * as a {@link org.semanticweb.owlapi.reasoner.NodeSet}. */ default Stream<OWLClass> types(OWLNamedIndividual ind) { return getTypes(ind, false).entities(); }
/** * A convenience method that gets all of the entities contained in the * {@code Nodes} in this {@code NodeSet}. * * @return The union of the entities contained in the {@code Nodes} in this {@code NodeSet}. * @deprecated use {@link #entities()} */ @Deprecated default Set<E> getFlattened() { return asSet(entities()); }
/** * @param ind The individual whose types are to be retrieved. * @return a {@code NodeSet} containing named classes such that for each named class {@code C} * in the node set, the set of reasoner axioms entails {@code ClassAssertion(C, ind)}. * <br> * @see OWLReasoner#getTypes(OWLNamedIndividual, boolean) Gets the named classes which are * (potentially direct) types of the specified named individual. The classes are returned * as a {@link org.semanticweb.owlapi.reasoner.NodeSet}. */ default Stream<OWLClass> types(OWLNamedIndividual ind) { return getTypes(ind, false).entities(); }
/** * Returns all subclasses. * * @param ce The class expression whose strict (direct) subclasses are to be retrieved. * @return a {@code NodeSet} such that for each class {@code C} in the {@code NodeSet} the set * of reasoner axioms entails {@code StrictSubClassOf(C, ce)}. <br> * If {@code ce} is equivalent to {@code owl:Nothing} then the empty {@code NodeSet} * will be returned. * @see OWLReasoner#getSubClasses(OWLClassExpression, boolean) */ default Stream<OWLClass> subClasses(OWLClassExpression ce) { return getSubClasses(ce).entities(); }
/** * A convenience method that gets all of the entities contained in the * {@code Nodes} in this {@code NodeSet}. * * @return The union of the entities contained in the {@code Nodes} in this {@code NodeSet}. * @deprecated use {@link #entities()} */ @Deprecated default Set<E> getFlattened() { return asSet(entities()); }
@Override protected void addAxioms(OWLNamedIndividual entity, OWLReasoner reasoner, OWLDataFactory dataFactory, Set<OWLClassAssertionAxiom> result) { reasoner.getTypes(entity, false).entities() .forEach(t -> result.add(dataFactory.getOWLClassAssertionAxiom(t, entity))); }
@Override protected void addAxioms(OWLNamedIndividual entity, OWLReasoner reasoner, OWLDataFactory dataFactory, Set<OWLClassAssertionAxiom> result) { reasoner.getTypes(entity, false).entities() .forEach(t -> result.add(dataFactory.getOWLClassAssertionAxiom(t, entity))); }
@Override protected void addAxioms(OWLNamedIndividual entity, OWLReasoner reasoner, OWLDataFactory dataFactory, Set<OWLClassAssertionAxiom> result) { reasoner.getTypes(entity, false).entities() .forEach(t -> result.add(dataFactory.getOWLClassAssertionAxiom(t, entity))); }
/** * @param subject subject * @param property property * @return all objects * @since 2.5.1 */ default Stream<OWLNamedIndividual> getObjects(final OWLNamedIndividual subject, final OWLObjectPropertyExpression property) { return getReasoner().getObjectPropertyValues(subject, property).entities(); }
protected static void negativeLevel(boolean superVsSub, OWLReasoner reasoner, Set<OWLClass> classesInSig, Set<OWLClass> superOrSubClasses) { for (OWLClassExpression ent : classesInSig) { NodeSet<OWLClass> nodes; if (superVsSub) { nodes = reasoner.getSuperClasses(ent, false); } else { nodes = reasoner.getSubClasses(ent, false); } add(superOrSubClasses, nodes.entities()); } }
protected static void negativeLevel(boolean superVsSub, OWLReasoner reasoner, Set<OWLClass> classesInSig, Set<OWLClass> superOrSubClasses) { for (OWLClassExpression ent : classesInSig) { NodeSet<OWLClass> nodes; if (superVsSub) { nodes = reasoner.getSuperClasses(ent, false); } else { nodes = reasoner.getSubClasses(ent, false); } add(superOrSubClasses, nodes.entities()); } }
protected static void negativeLevel(boolean superVsSub, OWLReasoner reasoner, Set<OWLClass> classesInSig, Set<OWLClass> superOrSubClasses) { for (OWLClassExpression ent : classesInSig) { NodeSet<OWLClass> nodes; if (superVsSub) { nodes = reasoner.getSuperClasses(ent, false); } else { nodes = reasoner.getSubClasses(ent, false); } add(superOrSubClasses, nodes.entities()); } }
@Override protected void addAxioms(OWLDataProperty entity, OWLReasoner reasoner, OWLDataFactory dataFactory, Set<OWLSubDataPropertyOfAxiom> result) { checkNotNull(dataFactory, "dataFactory cannot be null"); checkNotNull(reasoner, "reasoner cannot be null"); checkNotNull(result, "result cannot be null"); checkNotNull(entity, "entity cannot be null"); reasoner.getSuperDataProperties(entity, true).entities() .forEach(sup -> result.add(dataFactory.getOWLSubDataPropertyOfAxiom(entity, sup))); }
@Test public void testObjectRangeWithEquivalents() { createReasoner(OWL.equivalentClasses(_C, some(inverse(_p), OWL.Thing)), OWL.range(_p, _D), OWL.subClassOf(_C, _E)); _reasoner.getKB().printClassTree(); assertTrue(_reasoner.isEntailed(OWL.range(_p, _C))); assertStreamAsSetEquals(Stream.of(_C), _reasoner.getEquivalentClasses(some(inverse(_p), OWL.Thing)).entities()); assertStreamAsSetEquals(Stream.of(_C), _reasoner.getObjectPropertyRanges(_p, true).entities()); assertStreamAsSetEquals(Stream.of(_C, _D, _E, OWL.Thing), _reasoner.getObjectPropertyRanges(_p, false).entities()); }