--- a/src/main/scala/SPARQL.scala Sun Feb 28 11:40:20 2010 -0500
+++ b/src/main/scala/SPARQL.scala Sun Feb 28 15:04:42 2010 -0500
@@ -58,7 +58,15 @@
r.neededFor(terms, t.o, Set(t.s))) s + t
else s
})
- TriplesBlock(useful.toList)
+ val useful2 =
+ if (useful.size == 0)
+ triplepatterns.foldLeft(Set[TriplePattern]())((s, t) => {
+ if (r.neededFor(terms, t.s, Set(t.o)) ||
+ r.neededFor(terms, t.o, Set(t.s))) s + t
+ else s
+ })
+ else useful
+ TriplesBlock(useful2.toList)
}
case TableConjunction(list) =>