@Override public Iterator<Token> getTokens(final WME wme) { return IteratorUtils.iterator(size, index); }
public Iterator<Unfolding> unfold(final ATermAppl concept) { final Unfolding unfolding = _definitions.get(concept); return unfolding == null ? IteratorUtils.<Unfolding> emptyIterator() : IteratorUtils.singletonIterator(unfolding); }
@Override public Iterator<ATermAppl> getObjects(final KnowledgeBase kb, final ATermAppl subj) { return IteratorUtils.flatten(kb.getTypes(subj, true).iterator()); }
protected Iterator<CachedNode> getCachedNodes(final ABox abox, final ATermAppl c) { CachedNode node = abox.getCached(c); if (node != null) return IteratorUtils.singletonIterator(node); if (ATermUtils.isAnd(c)) { ATermList list = (ATermList) c.getArgument(0); final CachedNode[] nodes = new CachedNode[list.getLength()]; for (int i = 0; !list.isEmpty(); list = list.getNext()) { final ATermAppl d = (ATermAppl) list.getFirst(); node = abox.getCached(d); if (node == null) return IteratorUtils.emptyIterator(); else if (node.isBottom()) return IteratorUtils.singletonIterator(node); nodes[i++] = node; } return IteratorUtils.iterator(nodes); } return IteratorUtils.emptyIterator(); }
public Iterator<Unfolding> unfold(final ATermAppl concept) { final List<Unfolding> unfoldingList = _conditionalUnfoldings.get(concept); return unfoldingList == null ? IteratorUtils.<Unfolding> emptyIterator() : unfoldingList.iterator(); }
private void prepareDomainsRanges(final RBox rbox) { for (final Role role : rbox.getRoles().values()) { final Iterator<ATermAppl> assertedDomains = rbox.getAssertedDomains(role); if (assertedDomains.hasNext()) addTo(_domains, role.getName(), IteratorUtils.toSet(assertedDomains)); final Iterator<ATermAppl> assertedRanges = rbox.getAssertedRanges(role); if (assertedRanges.hasNext()) addTo(_ranges, role.getName(), IteratorUtils.toSet(assertedRanges)); } }
protected Iterator<WME> getMatches(final Individual s, @SuppressWarnings("unused") final Role r, final Node o) { Iterator<WME> i1 = IteratorUtils.emptyIterator(); Iterator<WME> i2 = IteratorUtils.emptyIterator(); final Role invRole = _role.getInverse(); if (s != null) { i1 = toWMEs(getEdges(s.getOutEdges(), _role, o), EdgeDirection.FORWARD); if (invRole != null) i2 = toWMEs(getEdges(s.getInEdges(), invRole, o), EdgeDirection.BACKWARD); } else { assert s == null; i1 = toWMEs(getEdges(o.getInEdges(), _role, null), EdgeDirection.FORWARD); if (invRole != null) i2 = toWMEs(getEdges(((Individual) o).getOutEdges(), invRole, null), EdgeDirection.BACKWARD); } return !i1.hasNext() ? i2 : !i2.hasNext() ? i1 : IteratorUtils.concat(i1, i2); }
@Override public Iterator<WME> getMatches() { final Iterator<Individual> inds = (_name == null) ? _abox.getIndIterator() : IteratorUtils.singletonIterator(initNode()); return new NestedIterator<Individual, WME>(inds) { @Override public Iterator<WME> getInnerIterator(final Individual ind) { final DependencySet depends = ind.getDepends(_predicate); return (depends == null) ? IteratorUtils.<WME> emptyIterator() : IteratorUtils.<WME> singletonIterator(WME.createType(ind, _predicate, depends)); } }; }
@SuppressWarnings("unchecked") public static <T> void assertIteratorValues(final Iterator<? extends T> it, final Iterator<? extends T> expected) { assertIteratorValues(it, (T[]) IteratorUtils.toList(expected).toArray()); }
protected Iterator<CachedNode> getCachedNodes(final ABox abox, final ATermAppl c) { CachedNode node = abox.getCached(c); if (node != null) return IteratorUtils.singletonIterator(node); if (ATermUtils.isAnd(c)) { ATermList list = (ATermList) c.getArgument(0); final CachedNode[] nodes = new CachedNode[list.getLength()]; for (int i = 0; !list.isEmpty(); list = list.getNext()) { final ATermAppl d = (ATermAppl) list.getFirst(); node = abox.getCached(d); if (node == null) return IteratorUtils.emptyIterator(); else if (node.isBottom()) return IteratorUtils.singletonIterator(node); nodes[i++] = node; } return IteratorUtils.iterator(nodes); } return IteratorUtils.emptyIterator(); }
public Iterator<Unfolding> unfold(final ATermAppl concept) { final List<Unfolding> unfoldingList = _unfoldings.get(concept); return unfoldingList == null ? IteratorUtils.<Unfolding> emptyIterator() : unfoldingList.iterator(); }
private void prepareDomainsRanges(final RBox rbox) { for (final Role role : rbox.getRoles().values()) { final Iterator<ATermAppl> assertedDomains = rbox.getAssertedDomains(role); if (assertedDomains.hasNext()) addTo(_domains, role.getName(), IteratorUtils.toSet(assertedDomains)); final Iterator<ATermAppl> assertedRanges = rbox.getAssertedRanges(role); if (assertedRanges.hasNext()) addTo(_ranges, role.getName(), IteratorUtils.toSet(assertedRanges)); } }
protected Iterator<WME> getMatches(final Individual s, @SuppressWarnings("unused") final Role r, final Node o) { Iterator<WME> i1 = IteratorUtils.emptyIterator(); Iterator<WME> i2 = IteratorUtils.emptyIterator(); final Role invRole = _role.getInverse(); if (s != null) { i1 = toWMEs(getEdges(s.getOutEdges(), _role, o), EdgeDirection.FORWARD); if (invRole != null) i2 = toWMEs(getEdges(s.getInEdges(), invRole, o), EdgeDirection.BACKWARD); } else { assert s == null; i1 = toWMEs(getEdges(o.getInEdges(), _role, null), EdgeDirection.FORWARD); if (invRole != null) i2 = toWMEs(getEdges(((Individual) o).getOutEdges(), invRole, null), EdgeDirection.BACKWARD); } return !i1.hasNext() ? i2 : !i2.hasNext() ? i1 : IteratorUtils.concat(i1, i2); }
@Override public Iterator<WME> getMatches() { final Iterator<Individual> inds = (_name == null) ? _abox.getIndIterator() : IteratorUtils.singletonIterator(initNode()); return new NestedIterator<Individual, WME>(inds) { @Override public Iterator<WME> getInnerIterator(final Individual ind) { final DependencySet depends = ind.getDepends(_predicate); return (depends == null) ? IteratorUtils.<WME> emptyIterator() : IteratorUtils.<WME> singletonIterator(WME.createType(ind, _predicate, depends)); } }; }
@SuppressWarnings("unchecked") public static <T> void assertIteratorValues(final Iterator<? extends T> it, final Iterator<? extends T> expected) { assertIteratorValues(it, (T[]) IteratorUtils.toList(expected).toArray()); }
public Iterator<Unfolding> unfold(final ATermAppl concept) { final Unfolding unfolding = _definitions.get(concept); return unfolding == null ? IteratorUtils.<Unfolding> emptyIterator() : IteratorUtils.singletonIterator(unfolding); }
@Override public Iterator<Token> getTokens(final WME wme) { return IteratorUtils.iterator(size, index); }
protected ExtendedIterator<Triple> subjectSetFiller(final Set<Set<ATermAppl>> subjectSets, final Node p, final Node o) { return subjectFiller(flatten(subjectSets.iterator()), p, o); } }
public Iterator<Unfolding> unfold(final ATermAppl concept) { final List<Unfolding> unfoldingList = _conditionalUnfoldings.get(concept); return unfoldingList == null ? IteratorUtils.<Unfolding> emptyIterator() : unfoldingList.iterator(); }