query-5644900a63f6660fd1ad0b5c0801e3e2

rq turtle/ttl

: You'd need to pre-fetch the ?aita label before you concatenate it, and then ensure the SELECT in the subquery and the main query at the top have the variable name. I've left this feature in the subquery you chose, but it's probably more appropriate to put it in the %k subquery, which deals with the father?Theklan@

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT 
?veteran 
?veteranLabel 
?veteran_
?layer 
?aita
?aitaLabel 
?aita_
?jaiolekua_aita_
?ama
?amaLabel
?ama_ 
?jaiolekua_ama_
?aitona
?aitonaLabel 
?aitona_ 
?jaiolekua_aitona_ 
?gatazkaLabel
?coord
?rgb 
WHERE {
{ { select ?veteran ?veteran_ ?layer ?ama ?jaiolekua_ama_ ?coord ?rgb WHERE {
 { SELECT ?veteran ?jaiolekua ?heriotza ?ama ?aita ?aitona WHERE {
?veteran wdt:P241 wd:Q11218.
?veteran wdt:P172 wd:Q126756.
?veteran wdt:P19 ?jaiolekua.
?veteran wdt:P20 ?heriotza.
?veteran wdt:P25 ?ama.
?veteran wdt:P22 ?aita.
OPTIONAL{?aita wdt:P22 ?aitona.}  
} }?ama wdt:P19 ?jaiolekua_ama.
?jaiolekua_ama wdt:P625 ?coord.
?veteran rdfs:label ?veteranL . FILTER(LANG(?veteranL)="eu")
BIND(CONCAT("Beteranoa: ",?veteranL) as ?veteran_)
?jaiolekua_ama rdfs:label ?jaiolekua_amaL . FILTER(LANG(?jaiolekua_amaL)="eu")
BIND(CONCAT("Amaren jaiolekua: ",?jaiolekua_amaL) as ?jaiolekua_ama_)
BIND("3366CC" as ?rgb)
BIND("Ama" as ?layer)
} }}
UNION
{ { select ?veteran ?veteran_ ?layer ?jaiolekua_aita_ ?aita ?coord ?rgb WHERE {
 { SELECT ?veteran ?jaiolekua ?heriotza ?ama ?aita ?aitona WHERE {
?veteran wdt:P241 wd:Q11218.
?veteran wdt:P172 wd:Q126756.
?veteran wdt:P19 ?jaiolekua.
?veteran wdt:P20 ?heriotza.
?veteran wdt:P25 ?ama.
?veteran wdt:P22 ?aita.
OPTIONAL{?aita wdt:P22 ?aitona.}  
} }?aita wdt:P19 ?jaiolekua_aita.
?jaiolekua_aita wdt:P625 ?coord.
?veteran rdfs:label ?veteranL . FILTER(LANG(?veteranL)="eu")
BIND(CONCAT("Beteranoa: ",?veteranL) as ?veteran_)
?jaiolekua_aita rdfs:label ?jaiolekua_aitaL . FILTER(LANG(?jaiolekua_aitaL)="eu")
BIND(CONCAT("Aitaren jaiolekua: ",?jaiolekua_aitaL) as ?jaiolekua_aita_)
BIND("FFCC33" as ?rgb)
BIND("Aita" as ?layer)
} }}
UNION
{ { select ?veteran ?veteran_ ?heriotza ?ama_ ?aita_ ?coord ?layer ?rgb WHERE {
 { SELECT ?veteran ?jaiolekua ?heriotza ?ama ?aita ?aitona WHERE {
?veteran wdt:P241 wd:Q11218.
?veteran wdt:P172 wd:Q126756.
?veteran wdt:P19 ?jaiolekua.
?veteran wdt:P20 ?heriotza.
?veteran wdt:P25 ?ama.
?veteran wdt:P22 ?aita.
OPTIONAL{?aita wdt:P22 ?aitona.}  
} }?heriotza wdt:P625 ?coord.
?veteran rdfs:label ?veteranL . FILTER(LANG(?veteranL)="eu")
BIND(CONCAT("Beteranoa: ",?veteranL) as ?veteran_)
?aita rdfs:label ?aitaL . FILTER(LANG(?aitaL)="eu")
BIND(CONCAT("Aita: ",?aitaL) as ?aita_)
?ama rdfs:label ?amaL . FILTER(LANG(?amaL)="eu")
BIND(CONCAT("Ama: ",?amaL) as ?ama_)
BIND("b32425" as ?rgb)
BIND("Heriotza lekua" as ?layer)
} }}
UNION
{ { select ?veteran ?veteran_ ?jaiolekua ?heriotza ?ama_ ?aita_ ?coord ?layer ?rgb WHERE {  
 { SELECT ?veteran ?jaiolekua ?heriotza ?ama ?aita ?aitona WHERE {
?veteran wdt:P241 wd:Q11218.
?veteran wdt:P172 wd:Q126756.
?veteran wdt:P19 ?jaiolekua.
?veteran wdt:P20 ?heriotza.
?veteran wdt:P25 ?ama.
?veteran wdt:P22 ?aita.
OPTIONAL{?aita wdt:P22 ?aitona.}  
} }?jaiolekua wdt:P625 ?coord.
?veteran rdfs:label ?veteranL . FILTER(LANG(?veteranL)="eu")
BIND(CONCAT("Beteranoa: ",?veteranL) as ?veteran_)
?aita rdfs:label ?aitaL . FILTER(LANG(?aitaL)="eu")
BIND(CONCAT("Aita: ",?aitaL) as ?aita_)
?ama rdfs:label ?amaL . FILTER(LANG(?amaL)="eu")
BIND(CONCAT("Ama: ",?amaL) as ?ama_)
BIND("00af89" as ?rgb)  
BIND("Jaiolekua" as ?layer)
} }}
UNION
{ { select ?veteran ?gatazka ?coord ?layer ?rgb WHERE {  
 { SELECT ?veteran ?jaiolekua ?heriotza ?ama ?aita ?aitona WHERE {
?veteran wdt:P241 wd:Q11218.
?veteran wdt:P172 wd:Q126756.
?veteran wdt:P19 ?jaiolekua.
?veteran wdt:P20 ?heriotza.
?veteran wdt:P25 ?ama.
?veteran wdt:P22 ?aita.
OPTIONAL{?aita wdt:P22 ?aitona.}  
} }?veteran wdt:P607 ?gatazka.
?gatazka wdt:P625 ?coord.
BIND("72777d" as ?rgb)
BIND("Gudua" as ?layer)
} }}
UNION
{ { select ?veteran ?veteran_ ?layer ?jaiolekua_aitona_ ?aitona_ ?coord ?rgb WHERE {
 { SELECT ?veteran ?jaiolekua ?heriotza ?ama ?aita ?aitona WHERE {
?veteran wdt:P241 wd:Q11218.
?veteran wdt:P172 wd:Q126756.
?veteran wdt:P19 ?jaiolekua.
?veteran wdt:P20 ?heriotza.
?veteran wdt:P25 ?ama.
?veteran wdt:P22 ?aita.
OPTIONAL{?aita wdt:P22 ?aitona.}  
} }  
?aitona wdt:P19 ?jaiolekua_aitona.
?jaiolekua_aitona wdt:P625 ?coord.
?veteran rdfs:label ?veteranL . FILTER(LANG(?veteranL)="eu")
BIND(CONCAT("Beteranoa: ",?veteranL) as ?veteran_)
?jaiolekua_aitona rdfs:label ?jaiolekua_aitona . FILTER(LANG(?jaiolekua_aitonaL)="eu")
BIND(CONCAT("Aitonaren jaiolekua: ",?jaiolekua_aitonaL) as ?jaiolekua_aitona_)
BIND("FFCC00" as ?rgb)
BIND("Aitona" as ?layer)
} }}
SERVICE wikibase:label { bd:serviceParam wikibase:language "eu,en,es". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?aita"):::projected v19("?aitaL") v22("?aita_"):::projected v8("?aitona"):::projected v6("?ama"):::projected v18("?amaL") v22("?ama_"):::projected v10("?coord"):::projected v22("?gatazka") v5("?heriotza") v4("?jaiolekua") v16("?jaiolekua_aita") v15("?jaiolekua_aitaL") v17("?jaiolekua_aita_"):::projected v24("?jaiolekua_aitona") v23("?jaiolekua_aitonaL") v25("?jaiolekua_aitona_"):::projected v9("?jaiolekua_ama") v1("?jaiolekua_amaL") v12("?jaiolekua_ama_"):::projected v26("?layer"):::projected v26("?rgb"):::projected v3("?veteran"):::projected v2("?veteranL") v25("?veteran_"):::projected a1((" ")) c5(["wd:Q126756"]):::iri c14(["bd:serviceParam"]):::iri c16(["eu,en,es"]):::literal c3(["wd:Q11218"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; subgraph union3[" Union "] subgraph union3l[" "] style union3l fill:#abf,stroke-dasharray: 3 3; subgraph union4[" Union "] subgraph union4l[" "] style union4l fill:#abf,stroke-dasharray: 3 3; f0[["?jaiolekua_aitonaL = 'eu'"]] f0 --> v23 f1[["?veteranL = 'eu'"]] f1 --> v2 v3 --"wdt:P241"--> c3 v3 --"wdt:P172"--> c5 v3 --"wdt:P19"--> v4 v3 --"wdt:P20"--> v5 v3 --"wdt:P25"--> v6 v3 --"wdt:P22"--> v7 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v7 -."wdt:P22".-> v8 end v8 --"wdt:P19"--> v24 v24 --"wdt:P625"--> v10 v3 --"rdfs:label"--> v2 bind2[/"concat('Beteranoa: ',?veteranL)"/] v2 --o bind2 bind2 --as--o v25 f3[["sameterm(?jaiolekua_aitona,)"]] f3 --> v24 f3 --> a1 v24 --"rdfs:label"--> a1 bind4[/"concat('Aitonaren jaiolekua: ',?jaiolekua_aitonaL)"/] v23 --o bind4 bind4 --as--o v25 bind5[/"'FFCC00'"/] bind5 --as--o v26 bind6[/"'Aitona'"/] bind6 --as--o v26 end subgraph union4r[" "] style union4r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P241"--> c3 v3 --"wdt:P172"--> c5 v3 --"wdt:P19"--> v4 v3 --"wdt:P20"--> v5 v3 --"wdt:P25"--> v6 v3 --"wdt:P22"--> v7 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v7 -."wdt:P22".-> v8 end v3 --"wdt:P607"--> v22 v22 --"wdt:P625"--> v10 bind7[/"'72777d'"/] bind7 --as--o v26 bind8[/"'Gudua'"/] bind8 --as--o v26 end union4r <== or ==> union4l end end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; f9[["?amaL = 'eu'"]] f9 --> v18 f10[["?aitaL = 'eu'"]] f10 --> v19 f11[["?veteranL = 'eu'"]] f11 --> v2 v3 --"wdt:P241"--> c3 v3 --"wdt:P172"--> c5 v3 --"wdt:P19"--> v4 v3 --"wdt:P20"--> v5 v3 --"wdt:P25"--> v6 v3 --"wdt:P22"--> v7 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v7 -."wdt:P22".-> v8 end v4 --"wdt:P625"--> v10 v3 --"rdfs:label"--> v2 bind12[/"concat('Beteranoa: ',?veteranL)"/] v2 --o bind12 bind12 --as--o v25 v7 --"rdfs:label"--> v19 bind13[/"concat('Aita: ',?aitaL)"/] v19 --o bind13 bind13 --as--o v22 v6 --"rdfs:label"--> v18 bind14[/"concat('Ama: ',?amaL)"/] v18 --o bind14 bind14 --as--o v22 bind15[/"'00af89'"/] bind15 --as--o v26 bind16[/"'Jaiolekua'"/] bind16 --as--o v26 end union3r <== or ==> union3l end end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; f17[["?amaL = 'eu'"]] f17 --> v18 f18[["?aitaL = 'eu'"]] f18 --> v19 f19[["?veteranL = 'eu'"]] f19 --> v2 v3 --"wdt:P241"--> c3 v3 --"wdt:P172"--> c5 v3 --"wdt:P19"--> v4 v3 --"wdt:P20"--> v5 v3 --"wdt:P25"--> v6 v3 --"wdt:P22"--> v7 subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v7 -."wdt:P22".-> v8 end v5 --"wdt:P625"--> v10 v3 --"rdfs:label"--> v2 bind20[/"concat('Beteranoa: ',?veteranL)"/] v2 --o bind20 bind20 --as--o v25 v7 --"rdfs:label"--> v19 bind21[/"concat('Aita: ',?aitaL)"/] v19 --o bind21 bind21 --as--o v22 v6 --"rdfs:label"--> v18 bind22[/"concat('Ama: ',?amaL)"/] v18 --o bind22 bind22 --as--o v22 bind23[/"'b32425'"/] bind23 --as--o v26 bind24[/"'Heriotza lekua'"/] bind24 --as--o v26 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; f25[["?jaiolekua_aitaL = 'eu'"]] f25 --> v15 f26[["?veteranL = 'eu'"]] f26 --> v2 v3 --"wdt:P241"--> c3 v3 --"wdt:P172"--> c5 v3 --"wdt:P19"--> v4 v3 --"wdt:P20"--> v5 v3 --"wdt:P25"--> v6 v3 --"wdt:P22"--> v7 subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v7 -."wdt:P22".-> v8 end v7 --"wdt:P19"--> v16 v16 --"wdt:P625"--> v10 v3 --"rdfs:label"--> v2 bind27[/"concat('Beteranoa: ',?veteranL)"/] v2 --o bind27 bind27 --as--o v25 v16 --"rdfs:label"--> v15 bind28[/"concat('Aitaren jaiolekua: ',?jaiolekua_aitaL)"/] v15 --o bind28 bind28 --as--o v17 bind29[/"'FFCC33'"/] bind29 --as--o v26 bind30[/"'Aita'"/] bind30 --as--o v26 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f31[["?jaiolekua_amaL = 'eu'"]] f31 --> v1 f32[["?veteranL = 'eu'"]] f32 --> v2 v3 --"wdt:P241"--> c3 v3 --"wdt:P172"--> c5 v3 --"wdt:P19"--> v4 v3 --"wdt:P20"--> v5 v3 --"wdt:P25"--> v6 v3 --"wdt:P22"--> v7 subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v7 -."wdt:P22".-> v8 end v6 --"wdt:P19"--> v9 v9 --"wdt:P625"--> v10 v3 --"rdfs:label"--> v2 bind33[/"concat('Beteranoa: ',?veteranL)"/] v2 --o bind33 bind33 --as--o v25 v9 --"rdfs:label"--> v1 bind34[/"concat('Amaren jaiolekua: ',?jaiolekua_amaL)"/] v1 --o bind34 bind34 --as--o v12 bind35[/"'3366CC'"/] bind35 --as--o v26 bind36[/"'Ama'"/] bind36 --as--o v26 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c16 end