BIND in CONSTRUCT query with sub-SELECT (SPARQL)

2015-11-24 Thread Wetz Peter
Related to the answer of a previous question of mine (see [1]) I have a new question: I currently have a CONSTRUCT query with a nested SELECT which makes use of aggregates. What I now want to do is to construct new URIs in the CONSTRUCT statement. What I want to do is basically similar as can b

AW: BIND in CONSTRUCT query with sub-SELECT (SPARQL)

2015-11-24 Thread Wetz Peter
To answer my own question, I think this is the correct solution: PREFIX CONSTRUCT { ... } WHERE { BIND () { SELECT ... WHERE { ... } GROUP BY ... } } Best, Peter > -Ursprüngliche Nachrich

Re: BIND in CONSTRUCT query with sub-SELECT (SPARQL)

2015-11-24 Thread Martynas Jusevičius
The BIND could also be within the sub-SELECT, depends on the use case. On Tue, Nov 24, 2015 at 11:35 AM, Wetz Peter wrote: > To answer my own question, I think this is the correct solution: > > PREFIX > CONSTRUCT { ... } > WHERE { > BIND () { > SELECT ... >

AW: BIND in CONSTRUCT query with sub-SELECT (SPARQL)

2015-11-24 Thread Wetz Peter
Maybe a valid answer, however in my use case that wouldnt work, because I want to bind a variable which is then used in the CONSTRUCT, but it's a new (!) variable and not a variable which comes from the nested SELECT. Best > -Ursprüngliche Nachricht- > Von: Martynas Jusevičius [mailto:m

Re: BIND in CONSTRUCT query with sub-SELECT (SPARQL)

2015-11-24 Thread Martynas Jusevičius
In your example, the only variable from WHERE which is used in CONSTRUCT template is ?s, and you don't show how ?s is obtained. You aggregate ?agg but you don't use it in the template. A better example would yield a more definite answer. On Tue, Nov 24, 2015 at 11:44 AM, Wetz Peter wrote: > Mayb

Re: BIND in CONSTRUCT query with sub-SELECT (SPARQL)

2015-11-24 Thread Rob Vesse
Instead of BIND you can simply use a project expression, this is essentially the same as you would do for a BIND but placed on the SELECT line with variables and aggregates e.g. PREFIXES CONSTRUCT { ?s rdfs:label ?var . } WHERE { SELECT ?s (AVG(?single) as ?agg) (IRI(expr) AS ?va

AW: BIND in CONSTRUCT query with sub-SELECT (SPARQL)

2015-11-24 Thread Wetz Peter
Thanks Rob, this also does the job. What are advantages of this approach compared to using BIND() ? Performance? Thanks again and best, Peter > -Ursprüngliche Nachricht- > Von: Rob Vesse [mailto:rve...@dotnetrdf.org] > Gesendet: Dienstag, 24. November 2015 12:02 > An: users@jena.apache.or

Re: AW: BIND in CONSTRUCT query with sub-SELECT (SPARQL)

2015-11-24 Thread Andy Seaborne
On 24/11/15 13:14, Wetz Peter wrote: Thanks Rob, this also does the job. What are advantages of this approach compared to using BIND() ? Performance? Thanks again and best, Peter Not much difference. They are the same operation with same rules as to what you can and can't do. They happen at