query-d4d1b3a4ca5e58793a25a02f87d2e5bc

rq turtle/ttl

query.csv

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT 
    ?id ?item ?itemLabel ?itemDescription ?itemAltLabel
    (group_concat(distinct SUBSTR(STR(?class), 32)) as ?class)
    (group_concat(distinct SUBSTR(STR(?county), 32)) as ?county)
    (group_concat(distinct ?grid_ref) as ?grid_ref)
    (group_concat(distinct ?coords) as ?coords)
    (group_concat(distinct ?esl) as ?esl)
    (group_concat(distinct ?drop) as ?drop)
    (group_concat(distinct ?ie_grid_ref) as ?ie_grid_ref)
WHERE
{
    ?item wdt:P6515 ?id .
    OPTIONAL { ?item wdt:P31 ?class } .
    OPTIONAL { ?item wdt:P131 ?county } .
    OPTIONAL { ?item wdt:P613 ?grid_ref } .
    OPTIONAL { ?item wdt:P625 ?coords } .
    OPTIONAL { ?item wdt:P2044 ?esl } .
    OPTIONAL { ?item wdt:P2660 ?drop } .
    OPTIONAL { ?item wdt:P4091 ?ie_grid_ref } .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en"  }    
}
GROUP BY ?id ?item ?itemLabel ?itemDescription ?itemAltLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v10("?class"):::projected v10("?coords"):::projected v10("?county"):::projected v10("?drop"):::projected v10("?esl"):::projected v10("?grid_ref"):::projected v2("?id"):::projected v10("?ie_grid_ref"):::projected v1("?item"):::projected c12(["en,en"]):::literal c10(["bd:serviceParam"]):::iri v1 --"wdt:P6515"--> v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P31".-> v10 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P131".-> v10 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P613".-> v10 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P625".-> v10 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P2044".-> v10 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P2660".-> v10 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P4091".-> v10 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind7[/"substring(str(?class),'32^^xsd:integer')"/] v10 --o bind7 bind7 --as--o v10 bind8[/"substring(str(?county),'32^^xsd:integer')"/] v10 --o bind8 bind8 --as--o v10 bind9[/"?grid_ref"/] v10 --o bind9 bind9 --as--o v10 bind10[/"?coords"/] v10 --o bind10 bind10 --as--o v10 bind11[/"?esl"/] v10 --o bind11 bind11 --as--o v10 bind12[/"?drop"/] v10 --o bind12 bind12 --as--o v10 bind13[/"?ie_grid_ref"/] v10 --o bind13 bind13 --as--o v10