// A list head is a node with a rdf:rest from it, not but rdf:rest to it.
Iterator<Triple> iter = graph.find(Node.ANY, CDR, Node.ANY) ;
try {
for ( ; iter.hasNext() ; )
{
Triple t = iter.next();
Node node = t.getSubject() ;
if ( ! graph.contains(Node.ANY, CDR, node) )
acc.add(node) ;
}
} finally { NiceIterator.close(iter) ; }
// Find any rdf:nil lists (which are not pure tails)
iter = graph.find(Node.ANY, Node.ANY, NIL) ;
try {
for ( ; iter.hasNext() ; )
{
Triple t = iter.next();
if ( ! t.getPredicate().equals(CDR) )
{
acc.add(NIL) ;
break ;
}
}