query-42e314bcb9fed5235f7ae2737620a095

rq turtle/ttl

Propertiesinstance of (P31)formatter URL (P1630)Wikidata item of this property (P1629)

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
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 ?item ?qid (GROUP_CONCAT( DISTINCT ?sitelink) as ?sitelinks) (GROUP_CONCAT( DISTINCT ?identifier) as ?identifiers) {
  VALUES ?gametype {wd:Q7889 wd:Q16070115 wd:Q7058673} .
  ?item wdt:P31 ?gametype .
  BIND (xsd:integer(STRAFTER(str(?item), "Q")) AS ?qid)
  FILTER (?qid > 51090000) . 
  OPTIONAL { 
    # Get sitelinks
    ?s schema:about ?item ; schema:inLanguage ?lang . 
    BIND(CONCAT("[", str(?s), " ", ?lang, "]") as ?sitelink)

    # Get external identifiers
    ?item ?prop ?id.
    ?propItem wikibase:directClaim ?prop.
    ?propItem wikibase:propertyType wikibase:ExternalId.
    ?propItem wdt:P31 wd:Q28147643 .
    ?propItem wdt:P1630 ?formatterurl . 
    ?propItem wdt:P1629 ?website .
    ?propItem rdfs:label ?propItemLabel .
    FILTER (lang(?propItemLabel) = "en"). 
    BIND(IRI(REPLACE(?id, '^(.+)$', ?formatterurl)) AS ?url).
    BIND(CONCAT("[", str(?url), " ", ?propItemLabel, "]") as ?identifier)
  } 
} GROUP BY ?item ?qid ORDER BY DESC(?qid) LIMIT 50

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v11("?formatterurl") v3("?gametype") v9("?id") v14("?identifier"):::projected v16("?identifiers") v4("?item"):::projected v6("?lang") v8("?prop") v10("?propItem") v2("?propItemLabel") v5("?qid"):::projected v5("?s") v7("?sitelink"):::projected v15("?sitelinks") v13("?url") v12("?website") c9(["wd:Q28147643"]):::iri c8(["wikibase:ExternalId"]):::iri f0[["?qid > '51090000^^xsd:integer'"]] f0 --> v5 bind1[/VALUES ?gametype/] bind1-->v3 bind10(["wd:Q7889"]) bind10 --> bind1 bind11(["wd:Q16070115"]) bind11 --> bind1 bind12(["wd:Q7058673"]) bind12 --> bind1 v4 --"wdt:P31"--> v3 bind2[/"http://www.w3.org/2001/XMLSchema#integer(substring-after(str(?item),'Q'))"/] v4 --o bind2 bind2 --as--o v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."schema:about".-> v4 v5 --"schema:inLanguage"--> v6 bind3[/"concat('#91;',str(?s),' ',?lang,'#93;')"/] v5 --o bind3 v6 --o bind3 bind3 --as--o v7 v4 -->v8--> v9 v10 --"wikibase:directClaim"--> v8 v10 --"wikibase:propertyType"--> c8 v10 --"wdt:P31"--> c9 v10 --"wdt:P1630"--> v11 v10 --"wdt:P1629"--> v12 v10 --"rdfs:label"--> v2 bind4[/"replace(?id,'^(.+)$',?formatterurl)"/] v9 --o bind4 v11 --o bind4 bind4 --as--o v13 bind5[/"concat('#91;',str(?url),' ',?propItemLabel,'#93;')"/] v13 --o bind5 v2 --o bind5 bind5 --as--o v14 end bind8[/"?sitelink"/] v7 --o bind8 bind8 --as--o v15 bind9[/"?identifier"/] v14 --o bind9 bind9 --as--o v16