private static boolean isCons (GNode gnode) { return gnode.findable.contains(gnode.node, CDR, null) ; }
/** Return the number of triples matching the (s,p,o) pattern. */ public default int count(Node s, Node p, Node o) { return (int)Iter.count(find(s,p,o)); } }
private static Triple getTripleReverse(GNode gnode, Node arc) { Iterator<Triple> iter = gnode.findable.find(Node.ANY, arc, gnode.node) ; if ( ! iter.hasNext() ) return null ; Triple t = iter.next() ; if ( iter.hasNext() ) Log.warn(GraphList.class, "Unusual list: two arcs with same property ("+arc+")") ; NiceIterator.close(iter) ; return t ; }
private static Set<GNode> findCellsWithMember(GNode gnode) { Set<GNode> x = new HashSet<>() ; Iterator<Triple> iter = gnode.findable.find(Node.ANY, CAR, gnode.node) ; for ( ; iter.hasNext() ; ) { Triple t = iter.next() ; x.add(new GNode(gnode, t.getSubject())) ; } NiceIterator.close(iter) ; return x ; }
private static Triple getTriple(GNode gnode, Node arc) { if ( listEnd(gnode) ) return null ; Iterator<Triple> iter = gnode.findable.find(gnode.node, arc, Node.ANY) ; if ( ! iter.hasNext() ) return null ; Triple t = iter.next() ; if ( iter.hasNext() ) Log.warn(GraphList.class, "Unusual list: two arcs with same property ("+arc+")") ; NiceIterator.close(iter) ; return t ; } }