query-e5aa13c7e94881188e0c65f3036cac34
TODO
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX prv: <http://www.wikidata.org/prop/reference/value/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT distinct ?human ?humanLabel ?image ?date_of_birth ?place_of_birthLabel ?date_of_death ?place_of_deathLabel ?occupationLabel
#SELECT distinct ?human ?reftype19 ?from19
WHERE {
OPTIONAL { ?human wdt:P18 ?image. }
?human wdt:P27 wd:Q183 . # person is German
?human wdt:P106 wd:Q822146. # person is a lyricist
?human p:P19 ?statement19. # ?human must have a P19 value; get its statement
?statement19 ps:P19 ?place_of_birth. # get the ps: value for the statement
?statement19 prov:wasDerivedFrom ?ref19.# get the reference statement for P19
?ref19 ?reftype19 ?from19. # get the values/statements association with the reference statement
filter (?reftype19!=pr:P143) # exclude where there's a value/statement such as "imported from"
filter (?reftype19!=pr:P813) # or a date
filter (?reftype19!=prv:P813)
?human p:P569 ?statement569.
?statement569 ps:P569 ?date_of_birth.
?statement569 prov:wasDerivedFrom ?ref569.
?ref569 ?reftype569 ?from569.
filter (?reftype569!=pr:P143)
filter (?reftype569!=pr:P813)
filter (?reftype569!=prv:P813)
?human p:P20 ?statement20.
?statement20 ps:P20 ?place_of_death.
?statement20 prov:wasDerivedFrom ?ref20.
?ref20 ?reftype20 ?from20.
filter (?reftype20!=pr:P143)
filter (?reftype20!=pr:P813)
filter (?reftype20!=prv:P813)
?human p:P570 ?statement570.
?statement570 ps:P570 ?date_of_death.
?statement570 prov:wasDerivedFrom ?ref570.
?ref570 ?reftype570 ?from570.
filter (?reftype570!=pr:P143)
filter (?reftype570!=pr:P813)
filter (?reftype570!=prv:P813)
?human p:P106 ?statement106.
?statement106 ps:P106 ?occupation.
?statement106 prov:wasDerivedFrom ?ref106.
?ref106 ?reftype106 ?from106.
filter (?reftype106!=pr:P143)
filter (?reftype106!=pr:P813)
filter (?reftype106!=prv:P813)
# values ?human {wd:Q86701}.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v13("?date_of_birth"):::projected
v21("?date_of_death"):::projected
v27("?from106")
v11("?from19")
v19("?from20")
v15("?from569")
v23("?from570")
v6("?human"):::projected
v7("?image"):::projected
v25("?occupation")
v9("?place_of_birth")
v17("?place_of_death")
v26("?ref106")
v10("?ref19")
v18("?ref20")
v14("?ref569")
v22("?ref570")
v1("?reftype106")
v5("?reftype19")
v3("?reftype20")
v4("?reftype569")
v2("?reftype570")
v24("?statement106")
v8("?statement19")
v16("?statement20")
v12("?statement569")
v20("?statement570")
c23(["en"]):::literal
c21(["bd:serviceParam"]):::iri
c6(["wd:Q183"]):::iri
c8(["wd:Q822146"]):::iri
f0[["?reftype106 != 'p:reference/value/P813'"]]
f0 --> v1
f1[["?reftype106 != 'p:reference/P813'"]]
f1 --> v1
f2[["?reftype106 != 'p:reference/P143'"]]
f2 --> v1
f3[["?reftype570 != 'p:reference/value/P813'"]]
f3 --> v2
f4[["?reftype570 != 'p:reference/P813'"]]
f4 --> v2
f5[["?reftype570 != 'p:reference/P143'"]]
f5 --> v2
f6[["?reftype20 != 'p:reference/value/P813'"]]
f6 --> v3
f7[["?reftype20 != 'p:reference/P813'"]]
f7 --> v3
f8[["?reftype20 != 'p:reference/P143'"]]
f8 --> v3
f9[["?reftype569 != 'p:reference/value/P813'"]]
f9 --> v4
f10[["?reftype569 != 'p:reference/P813'"]]
f10 --> v4
f11[["?reftype569 != 'p:reference/P143'"]]
f11 --> v4
f12[["?reftype19 != 'p:reference/value/P813'"]]
f12 --> v5
f13[["?reftype19 != 'p:reference/P813'"]]
f13 --> v5
f14[["?reftype19 != 'p:reference/P143'"]]
f14 --> v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:direct/P18".-> v7
end
v6 --"p:direct/P27"--> c6
v6 --"p:direct/P106"--> c8
v6 --"p:P19"--> v8
v8 --"p:statement/P19"--> v9
v8 --"prov:wasDerivedFrom"--> v10
v10 -->v5--> v11
v6 --"p:P569"--> v12
v12 --"p:statement/P569"--> v13
v12 --"prov:wasDerivedFrom"--> v14
v14 -->v4--> v15
v6 --"p:P20"--> v16
v16 --"p:statement/P20"--> v17
v16 --"prov:wasDerivedFrom"--> v18
v18 -->v3--> v19
v6 --"p:P570"--> v20
v20 --"p:statement/P570"--> v21
v20 --"prov:wasDerivedFrom"--> v22
v22 -->v2--> v23
v6 --"p:P106"--> v24
v24 --"p:statement/P106"--> v25
v24 --"prov:wasDerivedFrom"--> v26
v26 -->v1--> v27
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c21 --"wikibase:language"--> c23
end