I am trying to construct the below query using the Jena query builder in JAVA. I have tried multiple different ways to build it, but nothing seems to work. Adding values block inside Graph seems to be not possible. Can anyone suggest how this can be done?
We are currently using jena query builder 3.5. Which does not have WhereBuilder
SELECT ?subject ?predicate ?object ?graph
WHERE {
{
GRAPH <G1> {
?subject ?predicate ?object
VALUES (?subject ?predicate ?object) {
(<S1> <P1> <O1>)
(<S2> <P2> <O2>)
(<S3> <P3> <O3>)
}
BIND(<G1> AS ?graph)
}
}
UNION
{
GRAPH <G2 > {
?subject ?predicate ?object
VALUES (?subject ?predicate ?object) {
(<S4> <P4> <O4>)
(<S5> <P4> <O5>)
(<S6> <P4> <O6>)
}
BIND(<G2> AS ?graph)
}
}
Try something like below :