query-5d40651844320a4d6f6a58cea0df241d

rq turtle/ttl

Append to descriptions of an item

Use at

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 ?QID ?Dlang ?desc3 
WHERE 
{
  VALUES ?item { wd:Q88190330 }
  ?item schema:description ?description .
  ?item wdt:P217 ?inv .
  ?item wdt:P571 ?date . 
  ?item wdt:P195 ?gallery . 
  bind(str(YEAR(?date)) as ?year) 
  BIND(LANG(?description) as ?lang)

   OPTIONAL {
     ?gallery rdfs:label ?lab 
     FILTER((LANG(?lab)) = ?lang)
   }

  bind(strafter(str(?item),"http://www.wikidata.org/entity/")as ?QID)
  bind(concat("D",?lang) as ?Dlang)
  bind(concat('"',?description," (",?inv,')"') as ?desc1)
  bind(concat('"',?description,", ",?year,'"') as ?desc2)
  bind(concat('"',?description," (",?lab, ' ', ?inv,')"') as ?desc3)

}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v10("?Dlang"):::projected v9("?QID"):::projected v6("?date") v11("?desc1") v12("?desc2") v13("?desc3"):::projected v4("?description") v7("?gallery") v5("?inv") v3("?item") v1("?lab") v9("?lang") v8("?year") bind0[/VALUES ?item/] bind0-->v3 bind00(["wd:Q88190330"]) bind00 --> bind0 v3 --"schema:description"--> v4 v3 --"wdt:P217"--> v5 v3 --"wdt:P571"--> v6 v3 --"wdt:P195"--> v7 bind1[/"str(year-from-dateTime(?date))"/] v6 --o bind1 bind1 --as--o v8 bind2[/"?description"/] v4 --o bind2 bind2 --as--o v9 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v7 -."rdfs:label".-> v1 end bind3[/"substring-after(str(?item),'http://www.wikidata.org/entity/')"/] v3 --o bind3 bind3 --as--o v9 bind4[/"concat('D',?lang)"/] v9 --o bind4 bind4 --as--o v10 bind5[/"concat('"',?description,' (',?inv,')"')"/] v4 --o bind5 v5 --o bind5 bind5 --as--o v11 bind6[/"concat('"',?description,', ',?year,'"')"/] v4 --o bind6 v8 --o bind6 bind6 --as--o v12 bind7[/"concat('"',?description,' (',?lab,' ',?inv,')"')"/] v4 --o bind7 v1 --o bind7 v5 --o bind7 bind7 --as--o v13