Reputation: 5696
Related to another question (see: SPARQL functions in CONSTRUCT/WHERE) where the answer leads to having a SPARQL CONSTRUCT query with a aggregate SELECT inside, I now would like to know how to use BIND in this construct.
My current query looks like this (simplified):
PREFIXES
CONSTRUCT { ?s rdfs:label ?var . }
WHERE {
SELECT ?s (AVG(?single) as ?agg) ...
WHERE {
...
}
GROUP BY ?s ...
}
The question is: Where to place a BIND statement which is used to bind values to variables, which are then used in the CONSTRUCT statement (e.g. ?var
)?
I tried to do it similar as is shown in this message: http://mail-archives.apache.org/mod_mbox/jena-users/201111.mbox/%[email protected]%3E. But the difference is, that there is no nested SELECT in this example.
Upvotes: 0
Views: 1661
Reputation: 5696
This query composition seems to work for me:
PREFIX
CONSTRUCT { ... }
WHERE {
BIND () {
SELECT ...
WHERE {
...
}
GROUP BY ...
}
}
Upvotes: 2