query-8d92284d51cb84797bdd0d7dd97c9f7c
Group_concat
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT
?i ?iLabel ?iDescription ?nickname
(GROUP_CONCAT(DISTINCT ?iAlias; SEPARATOR=", ") AS ?iAliases)
?P19Label ?P20Label ?P21Label
?P569p ?P569v ?P570p ?P570v ?P18
(GROUP_CONCAT(DISTINCT ?okkMa; SEPARATOR=", ") AS ?okkupMas)
(GROUP_CONCAT(DISTINCT ?okkFe; SEPARATOR=", ") AS ?okkupFes)
WHERE {
BIND(wd:Q1616094 AS ?i)
OPTIONAL { ?i wdt:P21 ?P21 . } # genere
OPTIONAL { ?i wdt:P18 ?P18 . } # foto
OPTIONAL { ?i wdt:P19 ?P19 . } # luogo nascita
OPTIONAL { ?i wdt:P20 ?P20 . } # luogo morte
OPTIONAL { ?i p:P569 [ a wikibase:BestRank ; psv:P569 [ wikibase:timePrecision ?P569p ; wikibase:timeValue ?P569v ] ] . } # data nascita
OPTIONAL { ?i p:P570 [ a wikibase:BestRank ; psv:P570 [ wikibase:timePrecision ?P570p ; wikibase:timeValue ?P570v ] ] . } # data morte
OPTIONAL { ?i wdt:P1449 ?nickname . } # soprannome
OPTIONAL { ?i skos:altLabel ?iAlias . } # aliases
OPTIONAL { ?i wdt:P106 ?okkup . ?okkup rdfs:label ?okkMa . FILTER(LANG(?okkMa) = "it")
OPTIONAL { ?okkup wdt:P2521 ?okkFe . FILTER(LANG(?okkFe) = "it") }
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "it,en". }
}
GROUP BY ?i ?iLabel ?iDescription ?nickname
?P19Label ?P20Label ?P21Label
?P569p ?P569v ?P570p ?P570v ?P18
Query found at
- https://www.wikidata.org/wiki/User:Ep%C3%ACdosis/Queries
- https://www.wikidata.org/wiki/User:Ep%C3%ACdosis/sandbox
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?P18"):::projected
v5("?P19")
v6("?P20")
v3("?P21")
v7("?P569p"):::projected
v8("?P569v"):::projected
v9("?P570p"):::projected
v10("?P570v"):::projected
v2("?i"):::projected
v12("?iAlias"):::projected
v15("?iAliases")
v11("?nickname"):::projected
v13("?okkFe"):::projected
v1("?okkMa"):::projected
v14("?okkup")
v17("?okkupFes")
v16("?okkupMas")
a1((" "))
a2((" "))
a3((" "))
a4((" "))
c7(["wikibase:BestRank"]):::iri
c20(["bd:serviceParam"]):::iri
c22(["it,en"]):::literal
bind0[/"'wd:Q1616094'"/]
bind0 --as--o v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P21".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P18".-> v4
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P19".-> v5
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P20".-> v6
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
a1 -."a".-> c7
a2 --"wikibase:timePrecision"--> v7
a2 --"wikibase:timeValue"--> v8
a1 --"p:statement/value/P569"--> a2
v2 --"p:P569"--> a1
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
a3 -."a".-> c7
a4 --"wikibase:timePrecision"--> v9
a4 --"wikibase:timeValue"--> v10
a3 --"p:statement/value/P570"--> a4
v2 --"p:P570"--> a3
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P1449".-> v11
end
subgraph optional7["(optional)"]
style optional7 fill:#bbf,stroke-dasharray: 5 5;
v2 -."skos:altLabel".-> v12
end
subgraph optional8["(optional)"]
style optional8 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P106".-> v14
v14 --"rdfs:label"--> v1
subgraph optional9["(optional)"]
style optional9 fill:#bbf,stroke-dasharray: 5 5;
v14 -."p:direct/P2521".-> v13
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c20 --"wikibase:language"--> c22
end
bind4[/"?iAlias"/]
v12 --o bind4
bind4 --as--o v15
bind5[/"?okkMa"/]
v1 --o bind5
bind5 --as--o v16
bind6[/"?okkFe"/]
v13 --o bind6
bind6 --as--o v17