Reputation: 3272
I'm trying to extract information about 2 genes at the same time using this query:
BASE <http://www.southgreen.fr/agrold/>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX vocab:<vocabulary/>
SELECT DISTINCT ?gene ?gene_lbl ?pathway
WHERE{
VALUES ?gene {<http://identifiers.org/ensembl.plant/BGIOSGA000040>
<http://identifiers.org/ensembl.plant/Sb01g003700.1>}
{
GRAPH ?graph1{
OPTIONAL{?gene rdfs:label ?gene_lbl.}
}
}
UNION
{
GRAPH ?graph2{
OPTIONAL{?gene vocab:is_agent_in ?pathway.}
}
}
}
but it gives me the following error :
Virtuoso 37000 Error SP031: SPARQL compiler: Internal error: sparp_gp_attach_filter_cbk(): attempt to attach a filter with used variable
It work without problems when I run it using only one gene OR when I remove the OPTIONAL
keyword, can someone explain to me the reason behind this behaviour ?
EDIT :
Part of the complexity is due to the fact that this is just a sample of a bigger query.
@TallTed, thank you for you answer, when I apply your proposed method to extract more information I don't get the desired results. for instance in this example gene OB12G15100
encodes a protein, but it doesn't show up in the results unless if I comment the OPTIONAL of gene_lbl, as far as I know, since the gene_lbl
is optional it can be ignored, hence, showing results of the rest of the query but it doesn't do so and I don't know why.
Please forgive my lack of knowledge.
Upvotes: 2
Views: 62
Reputation: 9434
I believe your target endpoint, now running a 3 year old version, should be encouraged to upgrade to the current Virtuoso Open Source Edition, 07.20.3229
a/k/a 7.2.5.1
. Note that both your original query and my revision execute without error on the LOD Cloud Cache (which lacks some of the data in AgroLD, so these don't deliver the results you want).
That said, I think your original query is unnecessarily complex. Note that this revision gets results from AgroLD with no problem --
BASE <http://www.southgreen.fr/agrold/>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX vocab:<vocabulary/>
SELECT DISTINCT ?gene ?gene_lbl ?pathway
WHERE
{
VALUES ?gene { <http://identifiers.org/ensembl.plant/BGIOSGA000040>
<http://identifiers.org/ensembl.plant/Sb01g003700.1> }
OPTIONAL{ ?gene rdfs:label ?gene_lbl }
OPTIONAL{ ?gene vocab:is_agent_in ?pathway }
}
Upvotes: 3