On 26/11/2024 08:56, Martynas Jusevičius wrote:
Hi,
I have two Fuseki 4.6.1 instances in a Docker network (fuseki-admin
and fuseki-end-user) that federate SPARQL queries between each other.
If you want to provide detailed control of SERVICE, then there is
https://jena.apache.org/documentation/query/service_enhancer.html
When I execute this query on fuseki-admin:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX acl: <http://www.w3.org/ns/auth/acl#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
SELECT *
FROM <urn:x-arq:UnionGraph>
WHERE
{ VALUES ( ?this ?Container ) {
( <https://localhost:4443/whateverest/> <https://localhost:4443/> )
}
SERVICE <http://fuseki-end-user:3030/ds/>
{ GRAPH ?Container
{ ?Container a ?Type }
}
}
then I can see the ?Container binding was injected into the query
string executed on fuseki-end-user:
Query = SELECT * WHERE { GRAPH <https://localhost:4443/> {
<https://localhost:4443/> a ?Type } }
However when I add FILTER NOT EXISTS to the federated part
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX acl: <http://www.w3.org/ns/auth/acl#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
SELECT *
FROM <urn:x-arq:UnionGraph>
WHERE
{ VALUES (?this ?Container) { (<https://localhost:4443/whateverest/>
<https://localhost:4443/>) }
SERVICE <http://fuseki-end-user:3030/ds/>
{ GRAPH ?Container
{
?Container a ?Type
}
FILTER NOT EXISTS { GRAPH ?this
{ ?this
sioc:has_parent|sioc:has_container ?Container }
}
}
}
Without the service enhancer, there is no rewrite and it is a has join:
(join
VALUES
SERVICE
)
otherwise it can become a denial of service vector!
With control such as correlated joins:
https://jena.apache.org/documentation/query/service_enhancer.html#correlated-joins
you may be able to get the effect you want.
The ?this case is changing the meaning of the query -- ?this is not
in-scope in the NOT EXISTS so it is undefined.
Andy
I see a single request in fuseki-end-user but none of the variables
are bound to anything:
Query = Query = SELECT * WHERE { GRAPH ?Container {
?Container a ?Type } FILTER NOT EXISTS { GRAPH ?this
{ ?this
<http://rdfs.org/sioc/ns#has_parent>|<http://rdfs.org/sioc/ns#has_container>
?Container }
This looks plain wrong because without bindings it eliminates too many
(positive) results, and the final result on fuseki-end-user comes out
empty.
Is this a bug or am I misunderstanding something about VALUES and/or SERVICE?
Martynas