query-951bd0479cd38fbb3f20224fb0b5b1a2
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?item ?author ?authorQID ?dob ?dod ?field ?description where
{
{
{
select (sample(?it) as ?item) ?author ?description (sample(?aut3) as ?authorQID) (group_concat(distinct ?fiel;separator=", ") as ?field) ?dob ?dod
WHERE
{
?it wdt:P1433 wd:Q35387261. # article was published in costume
?it wdt:P50 ?aut . # here's an author
bind(strafter(str(?aut),"http://www.wikidata.org/entity/") as ?aut2)
BIND (CONCAT ("[http://www.wikidata.org/entity/", ?aut2, " ", ?aut2,"]") as ?aut3) .
optional {?aut wdt:P569 ?dob .}
optional {?aut wdt:P570 ?dod .}
optional {?aut wdt:P101 ?fi . ?fi rdfs:label ?fiel . filter(lang(?fiel)="en")}
optional {?aut rdfs:label ?author . filter(lang(?author)="en")}
optional {?aut schema:description ?description . filter(lang(?description)="en")}
} group by ?author ?dob ?dod ?description
}}
UNION
{
{
select (sample(?it) as ?item) ?author ?authorQID ?field ?dob ?dod ?description WHERE
{
?it wdt:P1433 wd:Q35387261. # article was published in costume
?it wdt:P2093 ?author . # here's an author (without a Wikidata object)
} group by ?author ?authorQID ?field ?dob ?dod ?description
}}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?aut")
v6("?aut2")
v7("?aut3")
v2("?author"):::projected
v12("?authorQID"):::projected
v1("?description"):::projected
v8("?dob"):::projected
v9("?dod"):::projected
v10("?fi")
v3("?fiel")
v13("?field"):::projected
v4("?it")
v14("?item"):::projected
c3(["wd:Q35387261"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P1433"--> c3
v4 --"wdt:P2093"--> v2
bind1[/"sample(?it)"/]
v4 --o bind1
bind1 --as--o v14
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P1433"--> c3
v4 --"wdt:P50"--> v5
bind2[/"substring-after(str(?aut),'http://www.wikidata.org/entity/')"/]
v5 --o bind2
bind2 --as--o v6
bind3[/"concat('#91;http://www.wikidata.org/entity/',?aut2,' ',?aut2,'#93;')"/]
v6 --o bind3
bind3 --as--o v7
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P569".-> v8
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P570".-> v9
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P101".-> v10
v10 --"rdfs:label"--> v3
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v5 -."rdfs:label".-> v2
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v5 -."schema:description".-> v1
end
bind7[/"sample(?it)"/]
v4 --o bind7
bind7 --as--o v14
bind8[/"sample(?aut3)"/]
v7 --o bind8
bind8 --as--o v12
bind9[/"?fiel"/]
v3 --o bind9
bind9 --as--o v13
end
union0r <== or ==> union0l
end