简体   繁体   中英

BIND in CONSTRUCT query with sub-SELECT (SPARQL)

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 (eg ?var )?

I tried to do it similar as is shown in this message: http://mail-archives.apache.org/mod_mbox/jena-users/201111.mbox/%3C4ED66723.7030506@googlemail.com%3E . But the difference is, that there is no nested SELECT in this example.

This query composition seems to work for me:

PREFIX
CONSTRUCT { ... }
WHERE {
    BIND () {
        SELECT ...
            WHERE {
            ...
            }
        GROUP BY ...
    } 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM