query-a8951641f049e028ec04a221b91285c8
06:46, 23 August 2024 (UTC)) talk (VicarageBut the concatenation of 2 variables does not work. This smells like a bug to me. 09:24, 23 August 2024 (UTC)) talk (VIGNERON: what doesn't work exactly? or what did you expect? I do see the query doing what is asked and "16 Draco" correctly concatenated in the last column. Also, these items have a "en" label but no "mul" labels ; for checking, I tried with different items with "mul" labels and it also worked. Cheers, Vicarage@Oops, its using qname that fails, not qcount. The mul bit works fine, I tested it on en,de for other stuff
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?qcount ?qlabel ?quantity WHERE{
VALUES ?item {wd:Q17122887}
{ ?item p:P516 [ps:P516 ?qname; pq:P1114 ?qcount].
SERVICE wikibase:label {bd:serviceParam wikibase:language "en,mul".
?qname rdfs:label ?qlabel.
}
# works
#BIND(CONCAT(" ",?qlabel) AS ?quantity)
# works
# BIND(CONCAT(STR(?qcount)," ",?qlabel) AS ?quantity)
# does not work
BIND(CONCAT(STR(?qname)," ",?qlabel) AS ?quantity)
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
v3("?qcount"):::projected
v4("?qlabel"):::projected
v2("?qname")
v5("?quantity"):::projected
a1((" "))
c5(["bd:serviceParam"]):::iri
c7(["en,mul"]):::literal
bind0[/VALUES ?item/]
bind0-->v1
bind00(["wd:Q17122887"])
bind00 --> bind0
a1 --"p:statement/P516"--> v2
a1 --"p:qualifier/P1114"--> v3
v1 --"p:P516"--> a1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
v2 --"rdfs:label"--> v4
end
bind1[/"concat(str(?qname),' ',?qlabel)"/]
v2 --o bind1
v4 --o bind1
bind1 --as--o v5