Checking if need fragments are empty before querying.
@@ -140,6 +140,10 @@ public class SparqlMatcherActor extends UntypedActor {
Model subModel = new ModelExtract(boundary).extract(parentStatement.getObject().asResource(), model);
BasicPattern pattern = createDetailsQuery(subModel);
+ if(pattern.isEmpty()) {
+ return null;
+ }
+
pattern.add(new Triple(resultName.asNode(), newPredicate, NodeFactory.createVariable(hashFunction(parentStatement.getObject()))));
return new OpBGP(pattern);
@@ -230,7 +234,7 @@ public class SparqlMatcherActor extends UntypedActor {
if (seeks != null) {
Op seeksQuery = createNeedQuery(model, seeks, NodeFactory.createURI("http://purl.org/webofneeds/model#is"));
-
+ if(seeksQuery != null)
queries.add(seeksQuery);
}
@@ -238,7 +242,7 @@ public class SparqlMatcherActor extends UntypedActor {
if (is != null) {
Op isQuery = createNeedQuery(model, is, NodeFactory.createURI("http://purl.org/webofneeds/model#seeks"));
-
+ if(isQuery != null)
queries.add(isQuery);
}
