query-1f5610ede57b819164c3fbe435fbb091

rq turtle/ttl

  1. Show information about works of the author

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
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 ?work ?date ?workLabel ?info (GROUP_CONCAT(?author_label; separator=", ") AS ?authors)
WHERE {
  ?work wdt:P921 wd:Q4153449. 
  {
    ?work p:P50 ?author_statement.
    ?author_statement ps:P50 ?item_author.
    ?item_author rdfs:label ?item_author_label.
    FILTER(LANG(?item_author_label) = "ru").
    OPTIONAL {?author_statement pq:P1932 ?short_author.}
    BIND(IF(BOUND(?short_author), ?short_author, ?item_author_label) as ?author_label)
  }
  UNION
  { ?work wdt:P2093 ?author_label. }

  ?work wdt:P1433 ?journal.
  ?journal wdt:P1476 ?journal_label.

  OPTIONAL {?work wdt:P478 ?volume.}
  OPTIONAL {?work wdt:P433 ?issue.}
  OPTIONAL {?work wdt:P304 ?pages.}
  OPTIONAL {?work wdt:P577 ?date.}

  BIND(IF(LANG(?journal_label) = "ru", "Т. ", "vol. ") AS ?volume_prefix)
  BIND(IF(LANG(?journal_label) = "ru", "№ ", "No. ") AS ?issue_prefix)
  BIND(IF(LANG(?journal_label) = "ru", "C. ", "pp. ") AS ?pages_prefix)

  BIND(COALESCE (CONCAT(", ", str(YEAR(?date)), ", "), "") as ?str_date).
  BIND(COALESCE (CONCAT(?volume_prefix, ?volume, ", "), "") as ?str_volume).
  BIND(COALESCE (CONCAT(?issue_prefix, ?issue, ", "), "") as ?str_issue).
  BIND(COALESCE (CONCAT(?pages_prefix, ?pages, "."), "") as ?str_pages).
  BIND(CONCAT(?journal_label, ?str_date, ?str_volume, ?str_issue, ?str_pages) AS ?info)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ru, en". }  
}
GROUP BY ?work ?date ?workLabel ?info
ORDER BY DESC(?date)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?author_label"):::projected v4("?author_statement") v21("?authors") v1("?date"):::projected v20("?info"):::projected v11("?issue") v14("?issue_prefix") v5("?item_author") v3("?item_author_label") v8("?journal") v9("?journal_label") v12("?pages") v15("?pages_prefix") v6("?short_author") v16("?str_date") v18("?str_issue") v19("?str_pages") v17("?str_volume") v10("?volume") v13("?volume_prefix") v2("?work"):::projected c2(["wd:Q4153449"]):::iri c18(["ru, en"]):::literal c16(["bd:serviceParam"]):::iri v2 --"p:direct/P921"--> c2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v2 --"p:direct/P2093"--> v7 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f0[["?item_author_label = 'ru'"]] f0 --> v3 v2 --"p:P50"--> v4 v4 --"p:statement/P50"--> v5 v5 --"rdfs:label"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P1932".-> v6 end bind1[/"if(bound(?short_author),?short_author,?item_author_label)"/] v6 --o bind1 v3 --o bind1 bind1 --as--o v7 end union0r <== or ==> union0l end v2 --"p:direct/P1433"--> v8 v8 --"p:direct/P1476"--> v9 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P478".-> v10 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P433".-> v11 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P304".-> v12 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P577".-> v1 end bind2[/"if(?journal_label = 'ru','Т. ','vol. ')"/] v9 --o bind2 bind2 --as--o v13 bind3[/"if(?journal_label = 'ru','№ ','No. ')"/] v9 --o bind3 bind3 --as--o v14 bind4[/"if(?journal_label = 'ru','C. ','pp. ')"/] v9 --o bind4 bind4 --as--o v15 bind5[/"concat(', ',str(year-from-dateTime(?date)),', ')''"/] v1 --o bind5 bind5 --as--o v16 bind6[/"concat(?volume_prefix,?volume,', ')''"/] v13 --o bind6 v10 --o bind6 bind6 --as--o v17 bind7[/"concat(?issue_prefix,?issue,', ')''"/] v14 --o bind7 v11 --o bind7 bind7 --as--o v18 bind8[/"concat(?pages_prefix,?pages,'.')''"/] v15 --o bind8 v12 --o bind8 bind8 --as--o v19 bind9[/"concat(?journal_label,?str_date,?str_volume,?str_issue,?str_pages)"/] v9 --o bind9 v16 --o bind9 v17 --o bind9 v18 --o bind9 v19 --o bind9 bind9 --as--o v20 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c16 --"wikibase:language"--> c18 end bind11[/"?author_label"/] v7 --o bind11 bind11 --as--o v21