query-0534cc343916eff9138d94c507dfefab

rq turtle/ttl

Concat all authors of articleHi there, 18:44, 2 June 2019 (UTC)) talk (Julia.athen. --(P2093)author name string and names from statements within (P50)author I'm trying to get column with concated names of all authors for article. The problem is there are two property for authors: how concat labels of authors from statements within property ). (P50)author So that what I've now (concated names within

Use at

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").

  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; v2("?any_article"):::projected v7("?authors") v4("?element_author") v1("?element_author_label") v3("?full_st_author") v6("?result_label"):::projected v5("?short_author") c7(["bd:serviceParam"]):::iri c9(["#91;AUTO_LANGUAGE#93;"]):::literal f0[["?element_author_label = 'en'"]] f0 --> v1 bind1[/"'wd:Q48589333'"/] bind1 --as--o v2 v2 --"p:P50"--> v3 v3 --"p:statement/P50"--> v4 v4 --"rdfs:label"--> v1 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 v1 --o bind2 bind2 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end bind4[/"?result_label"/] v6 --o bind4 bind4 --as--o v7