query-4d18484c47169d9bddbd4f5817209250
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Table
SELECT ?any_article ?any_articleLabel (GROUP_CONCAT(?result_label; separator=", ") AS ?authors)
WHERE {
BIND(wd:Q48589333 as ?any_article)
{
?any_article p:P50 ?full_st_author.
#IF author have qualifier "stated as" then its value used in result else the label of the author
?full_st_author ps:P50 ?element_author.
?element_author rdfs:label ?element_author_label.
FILTER(LANG(?element_author_label) = "en").
} UNION {
?any_article p:P2093 ?full_st_author.
#IF author have qualifier "stated as" then its value used in result else the label of the author
?full_st_author ps:P2093 ?element_author_label.
} .
OPTIONAL {?full_st_author pq:P1932 ?short_author.}
BIND(IF(BOUND(?short_author), ?short_author, ?element_author_label) as ?result_label)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}
GROUP BY ?any_article ?any_articleLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?any_article"):::projected
v7("?authors")
v4("?element_author")
v2("?element_author_label")
v3("?full_st_author")
v6("?result_label"):::projected
v5("?short_author")
c9(["bd:serviceParam"]):::iri
c11(["#91;AUTO_LANGUAGE#93;"]):::literal
bind0[/"'wd:Q48589333'"/]
bind0 --as--o v1
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"p:P2093"--> v3
v3 --"p:statement/P2093"--> v2
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
f1[["?element_author_label = 'en'"]]
f1 --> v2
v1 --"p:P50"--> v3
v3 --"p:statement/P50"--> v4
v4 --"rdfs:label"--> v2
end
union0r <== or ==> union0l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P1932".-> v5
end
bind2[/"if(bound(?short_author),?short_author,?element_author_label)"/]
v5 --o bind2
v2 --o bind2
bind2 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end
bind4[/"?result_label"/]
v6 --o bind4
bind4 --as--o v7