Yes, it's perfect.
Thank you very much,
Steven
Le ven., févr. 3 2023 at 09:12:53 +0000, Rob @ DNR
<rve...@dotnetrdf.org> a écrit :
The SERVICE clause can include any clauses you can use elsewhere in
the query. You can use a GRAPH clause inside your SERVICE clause i.e.
SERVICE
<<http://jena.int.microbiomestudio.fr:8080/jena-fuseki-war-4.7.0/demo>>
{
GRAPH ?g { ?protein biolink:provided_by ?soft . }
}
If the results might be in the default graph or a named graph you can
use UNION and GRAPH within your SERVICE clause i.e.
SERVICE
<<http://jena.int.microbiomestudio.fr:8080/jena-fuseki-war-4.7.0/demo>>
{
{ GRAPH ?g { ?protein biolink:provided_by ?soft . } } UNION {
?protein biolink:provided_by ?soft }
}
Hope this helps,
Rob
From: Steven Blanchard <steven.blanchard@microbiome.studio
<mailto:steven.blanchard@microbiome.studio>>
Date: Friday, 3 February 2023 at 08:32
To: users <users@jena.apache.org <mailto:users@jena.apache.org>>
Subject: from a named graph in a federated query
Dear Jena users,
I would like to do a federated query (with SERVICE) but on a named
graph and not on the default graph. How it is possible?
This query works if data are in the default graph :
query = """
PREFIX biolink: <<<https://w3id.org/biolink/vocab/>>>
PREFIX up: <<<http://purl.uniprot.org/uniprot/>>>
PREFIX reaction: <<<http://sparql.microbiome.studio/reaction/>>>
SELECT DISTINCT
?reaction
(COUNT(DISTINCT ?soft) AS ?NSOFT)
FROM <urn:x-arq:UnionGraph>
WHERE {
SERVICE
<<<http://jena.int.microbiomestudio.fr:8080/jena-fuseki-war-4.7.0/demo>>>
{
?protein biolink:provided_by ?soft .
}
?protein biolink:category biolink:Protein .
?reaction biolink:has_catalyst ?protein .
}
GROUP BY ?reaction
"""
But i have no results if data are in a named graph:
query = """
PREFIX biolink: <<<https://w3id.org/biolink/vocab/>>>
PREFIX up: <<<http://purl.uniprot.org/uniprot/>>>
PREFIX reaction: <<<http://sparql.microbiome.studio/reaction/>>>
SELECT DISTINCT
?reaction
(COUNT(DISTINCT ?soft) AS ?NSOFT)
FROM <urn:x-arq:UnionGraph>
WHERE {
SERVICE
<<<http://jena.int.microbiomestudio.fr:8080/jena-fuseki-war-4.7.0/demo2?graph=http://sparql.microbiome.studio/graph/SampleName>>>
{
?protein biolink:provided_by ?soft .
}
?protein biolink:category biolink:Protein .
?reaction biolink:has_catalyst ?protein .
}
GROUP BY ?reaction
"""
What is the synthax to query a named graph by SERVICE ?
Thanks in advance,
Steven