query-0d87b6b01af471aed5cb4a2b1a6d2926
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 schema: <http://schema.org/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?id ?idLabel ?country ?countryLabel ?parentId ?optionAward ?optionAwardLabel ?mgid ?optionNotable_work ?optionNotable_workLabel ?optionWikipedia_article ?occupation ?influencer (SAMPLE(?student) AS ?student) (SAMPLE(?img) AS ?img) WHERE {
{
?id wdt:P106 wd:Q170790;
wdt:P27 ?country.
VALUES ?occupation {
wd:Q170790
}
OPTIONAL {
?optionWikipedia_article schema:about ?id;
schema:isPartOf <https://en.wikipedia.org/>.
}
OPTIONAL { ?id wdt:P18 ?img. }
OPTIONAL {
?id p:P800 _:b102.
_:b102 ps:P800 ?optionNotable_work.
}
OPTIONAL { ?id wdt:P166 ?optionAward. }
OPTIONAL {
?id (wdt:P802|wdt:P185) ?student.
?student wdt:P106 wd:Q170790.
}
}
UNION
{
?id wdt:P549 ?mgid;
wdt:P27 ?country.
}
OPTIONAL {
?id (p:P1066|p:P184) _:b103.
_:b103 (ps:P1066|ps:P184) ?parentId.
?parentId wdt:P106 wd:Q170790.
}
OPTIONAL { ?id wdt:P737 ?influencer. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?id ?idLabel ?country ?countryLabel ?occupation ?parentId ?optionAward ?optionAwardLabel ?mgid ?optionNotable_work ?optionNotable_workLabel ?optionWikipedia_article ?influencer
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?country"):::projected
v1("?id"):::projected
v12("?img"):::projected
v11("?influencer"):::projected
v9("?mgid"):::projected
v3("?occupation"):::projected
v7("?optionAward"):::projected
v6("?optionNotable_work"):::projected
v4("?optionWikipedia_article"):::projected
v10("?parentId"):::projected
v12("?student"):::projected
a1((" "))
a2((" "))
c2(["wd:Q170790"]):::iri
c22(["en"]):::literal
c6([https://en.wikipedia.org/]):::iri
c20(["bd:serviceParam"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"p:direct/P549"--> v9
v1 --"p:direct/P27"--> v2
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"p:direct/P106"--> c2
v1 --"p:direct/P27"--> v2
bind0[/VALUES ?occupation/]
bind0-->v3
bind00(["wd:Q170790"])
bind00 --> bind0
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."schema:about".-> v1
v4 --"schema:isPartOf"--> c6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P18".-> v12
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P800".-> a1
a1 --"p:statement/P800"--> v6
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P166".-> v7
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v1 -."p:direct/P185".-> v12
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v1 --"p:direct/P802"--> v12
end
union1r <== or ==> union1l
end
v12 --"p:direct/P106"--> c2
end
end
union0r <== or ==> union0l
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
v1 -."p:P184".-> a2
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v1 --"p:P1066"--> a2
end
union2r <== or ==> union2l
end
subgraph union3[" Union "]
subgraph union3l[" "]
style union3l fill:#abf,stroke-dasharray: 3 3;
a2 --"p:statement/P184"--> v10
end
subgraph union3r[" "]
style union3r fill:#abf,stroke-dasharray: 3 3;
a2 --"p:statement/P1066"--> v10
end
union3r <== or ==> union3l
end
v10 --"p:direct/P106"--> c2
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P737".-> v11
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c20 --"wikibase:language"--> c22
end
bind3[/"sample(?student)"/]
v12 --o bind3
bind3 --as--o v12
bind4[/"sample(?img)"/]
v12 --o bind4
bind4 --as--o v12