/** * @param arg items to add * @return builder */ @SuppressWarnings({"unchecked"}) public B withItems(Stream<? extends I> arg) { add(items, arg); return (B) this; }
/** * @param p all entities to add */ public void addAll(Stream<OWLEntity> p) { OWLAPIStreamUtils.add(set, p); }
/** * @param arg head atom * @return builder */ public BuilderSWRLRule withHead(Stream<SWRLAtom> arg) { add(head, arg); return this; }
/** * @param s stream to turn to set. The stream is consumed by this operation. * @param type force return type to be exactly T * @param <T> type of return collection * @return set including all elements in the stream */ public static <T> Set<T> asSet(Stream<?> s, Class<T> type) { Set<T> set = new LinkedHashSet<>(); add(set, s.map(type::cast)); return set; }
/** * @param entities the entities to add */ public DefaultNode(Stream<E> entities) { OWLAPIStreamUtils.add(this.entities, checkNotNull(entities, "entities cannot be null")); }
@Override public Collection<OWLEntity> visit(OWLOntology ontology) { add(objects, ontology.unsortedSignature()); return objects; }
protected Set<OWLEntity> getEntitiesThatRequireNamespaces() { Set<OWLEntity> result = new HashSet<>(); add(result, ontology.classesInSignature()); add(result, ontology.objectPropertiesInSignature()); add(result, ontology.dataPropertiesInSignature()); add(result, ontology.individualsInSignature()); add(result, ontology.annotationPropertiesInSignature()); return result; }
@Override public void visit(OWLDatatype datatype) { add(axioms, ontology.datatypeDefinitions(datatype)); graphCreation.accept(axioms.stream()); }
private void initSignature() { if (signature == null) { signature = new ArrayList<>(); axioms.forEach(ax -> add(verifyNotNull(signature), ax.signature())); } }
@Override public void visit(OWLObjectProperty property) { add(axioms, ontology.axioms(property).filter(this::threewayDisjointObject)); add(axioms, ontology.axioms(SUB_PROPERTY_CHAIN_OF) .filter(ax -> ax.getSuperProperty().equals(property))); OWLObjectInverseOf inverse = ontology.getOWLOntologyManager().getOWLDataFactory() .getOWLObjectInverseOf(property); add(axioms, ontology.axioms(inverse)); }
/** * Index axioms by rhs entities. * * @param rhs the rhs * @param axiom the axiom */ protected void indexAxiomsByRHSEntities(OWLObject rhs, OWLAxiom axiom) { add(getIndexedSet(axiom, entitiesByAxiomRHS, true), rhs.signature()); }
/** * Index axioms by rhs entities. * * @param rhs the rhs * @param axiom the axiom */ protected void indexAxiomsByRHSEntities(OWLObject rhs, OWLAxiom axiom) { add(getIndexedSet(axiom, entitiesByAxiomRHS, true), rhs.signature()); }
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()); } }