This question is related to the Blazegraph Java samples. I want to create a rule with a SPARQL NOT EXISTS
clause. This Blazegraph rule sample provides a constraint clause that checks for IsLiteral()
. I want to implement a rule that provides the following functionality:
?a rdf:type xyz:T .
filter(not exits(?a xyz:p ?o)) .
->
?a xyz:q xyz:T
I checked for suitable classes in: com.bigdata.rdf.internal.constraints
and can't find a BOp
class that supports EXIST
(and MINUS
). I found a NOT
operator NotBOp()
.
Here is the constraint that I want to create with a fictitious ExistsBOp
function:
new IConstraint[] { // constraints
// you can use SPARQL value expression bops in inference by wrapping them with an InferenceBVE
Constraint.wrap(new InferenceBVE(new NotBOp(new ExistsBOp(var("a"), vocab.getConstant(XYZ.q), vocab.getConstant(XYZ.T))))
}
Is there another way to achieve the constraint?