query-74c5ec1387f6081c5db6ec175f97ac2d

rq turtle/ttl

title:Wikisource pages about specific Memory of the World inscriptions SELECT ?langname (COUNT(?item) AS ?count) WHERE { ?item p:P1435 ?s. ?s ps:P1435 wd:Q473858. # Heritage designation: MotW ?site schema:about/wdt:P629? ?item ; schema:inLanguage ?langcode. FILTER(CONTAINS(str(?site), ".wikisource.org/") ) OPTIONAL { ?language wdt:P218 ?langcode; rdfs:label ?langlabel FILTER(lang(?langlabel) = "en") } # Convert short code to full language name BIND(COALESCE(?langlabel, ?langcode) AS ?langname) } GROUP BY ?langname ORDER BY DESC(?count)

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#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
#title:Wikisource pages about specific Memory of the World inscriptions
SELECT ?langname (COUNT(?item) AS ?count)  WHERE {
  ?item p:P1435 ?s. ?s ps:P1435 wd:Q473858. # Heritage designation: MotW
 ?site schema:about/wdt:P629? ?item ; schema:inLanguage ?langcode. FILTER(CONTAINS(str(?site), ".wikisource.org/") )
OPTIONAL { ?language wdt:P218 ?langcode; rdfs:label ?langlabel FILTER(lang(?langlabel) = "en") } # Convert short code to full language name
BIND(COALESCE(?langlabel, ?langcode) AS ?langname)
} GROUP BY ?langname
ORDER BY DESC(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?count") v4("?item"):::projected v6("?langcode") v3("?langlabel") v8("?langname"):::projected v7("?language") v5("?s") v2("?site") a1((" ")) c5(["wd:Q473858"]):::iri f0[["contains(str(?site),'.wikisource.org/')"]] f0 --> v2 v4 --"p:P1435"--> v5 v5 --"p:statement/P1435"--> c5 v2 --"schema:about"--> a1 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; a1 --"p:direct/P629"--> v4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; end union0r <== or ==> union0l end v2 --"schema:inLanguage"--> v6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v7 -."p:direct/P218".-> v6 v7 --"rdfs:label"--> v3 end bind1[/"?langlabel?langcode"/] v3 --o bind1 v6 --o bind1 bind1 --as--o v8 bind3[/"count(?item)"/] v4 --o bind3 bind3 --as--o v9