query-6df52f9d2334c8e46e3a050fe15b0057

rq turtle/ttl

Display geo:wktLiterals Hello, I want to do something like the following to be able to visually compare points in Wikidata with points pulled from other sources:

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 wds: <http://www.wikidata.org/entity/statement/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?place ?placeLabel ?location ?layer WHERE {
  VALUES (?ps ?place ?gnisPt ?gnisid ?distance) {
    (wds:q7335953-42836CD9-7979-4F71-87D7-91F1519254E6 wd:Q7335953 "Point(-84.7642201,45.1918512)"^^geo:wktLiteral "1614835" "0.6701477714685942"^^xsd:double)
    (wds:q6475804-48CD1BCD-4573-4385-95CD-8C3BDB15FEA1 wd:Q6475804 "Point(-113.9135721,48.7499294)"^^geo:wktLiteral "771253" "0.07547227642263711"^^xsd:double)
    (wds:q6477077-08DF184C-258E-4FD8-84BB-F811EC7427A2 wd:Q6477077 "Point(-76.4369827,43.3081268)"^^geo:wktLiteral "958316" "0.038288271056463825"^^xsd:double)
    (wds:q6475271-A124F3C5-56DE-4F4A-A8FE-56FDC80B5612 wd:Q6475271 "Point(-93.2347173,30.2282451)"^^geo:wktLiteral "553954" "0.11095681412047988"^^xsd:double)
    (wds:q6477136-35814F23-B203-439A-A0B7-6F38CD948C79 wd:Q6477136 "Point(-87.9080654,45.2566848)"^^geo:wktLiteral "1570331" "0.1083946745211315"^^xsd:double)
    (wds:q6477143-763568E7-6158-4A91-BCB3-A7FAB06F660E wd:Q6477143 "Point(-81.5410478,28.939347)"^^geo:wktLiteral "306117" "0.16027131623330992"^^xsd:double)
    (wds:q6693772-8075AC7F-DA34-4570-8D35-634FE0D19BFA wd:Q6693772 "Point(-74.1931089,44.3028384)"^^geo:wktLiteral "956107" "0.41559208749788973"^^xsd:double)
    (wds:q6476251-89FAD984-5259-452C-A87A-AEE4B803AE36 wd:Q6476251 "Point(-84.2390238,30.6312498)"^^geo:wktLiteral "284452" "0.1788844992337819"^^xsd:double)
    (wds:q5665721-81992C6B-A823-430F-9504-091EBFE78FFF wd:Q5665721 "Point(-113.7705404,48.5167701)"^^geo:wktLiteral "784584" "0.1789714719728492"^^xsd:double)
  }
  {
    ?place wdt:P625 ?location.
    BIND("wiki" AS ?layer)
  }
  UNION
  {
    BIND(?gnisPt AS ?location)
    BIND("gnis" AS ?layer)
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?distance") v3("?gnisPt") v4("?gnisid") v8("?layer"):::projected v8("?location"):::projected v2("?place"):::projected v1("?ps") c3(["bd:serviceParam"]):::iri c5(["en"]):::literal bind0[/VALUES ?distance ?gnisPt ?gnisid ?place ?ps/] bind0-->v1 bind0-->v2 bind0-->v3 bind0-->v4 bind0-->v5 bind00(["wd:statement/q7335953-42836CD9-7979-4F71-87D7-91F1519254E6"]) bind00 --> bind0 bind01(["wd:Q7335953"]) bind01 --> bind0 bind02([sPoint(-84.7642201,45.1918512)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]) bind02 --> bind0 bind03(["1614835"]) bind03 --> bind0 bind04(["0.6701477714685942^^xsd:double"]) bind04 --> bind0 bind05(["wd:statement/q6475804-48CD1BCD-4573-4385-95CD-8C3BDB15FEA1"]) bind05 --> bind0 bind06(["wd:Q6475804"]) bind06 --> bind0 bind07([sPoint(-113.9135721,48.7499294)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]) bind07 --> bind0 bind08(["771253"]) bind08 --> bind0 bind09(["0.07547227642263711^^xsd:double"]) bind09 --> bind0 bind010(["wd:statement/q6477077-08DF184C-258E-4FD8-84BB-F811EC7427A2"]) bind010 --> bind0 bind011(["wd:Q6477077"]) bind011 --> bind0 bind012([sPoint(-76.4369827,43.3081268)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]) bind012 --> bind0 bind013(["958316"]) bind013 --> bind0 bind014(["0.038288271056463825^^xsd:double"]) bind014 --> bind0 bind015(["wd:statement/q6475271-A124F3C5-56DE-4F4A-A8FE-56FDC80B5612"]) bind015 --> bind0 bind016(["wd:Q6475271"]) bind016 --> bind0 bind017([sPoint(-93.2347173,30.2282451)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]) bind017 --> bind0 bind018(["553954"]) bind018 --> bind0 bind019(["0.11095681412047988^^xsd:double"]) bind019 --> bind0 bind020(["wd:statement/q6477136-35814F23-B203-439A-A0B7-6F38CD948C79"]) bind020 --> bind0 bind021(["wd:Q6477136"]) bind021 --> bind0 bind022([sPoint(-87.9080654,45.2566848)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]) bind022 --> bind0 bind023(["1570331"]) bind023 --> bind0 bind024(["0.1083946745211315^^xsd:double"]) bind024 --> bind0 bind025(["wd:statement/q6477143-763568E7-6158-4A91-BCB3-A7FAB06F660E"]) bind025 --> bind0 bind026(["wd:Q6477143"]) bind026 --> bind0 bind027([sPoint(-81.5410478,28.939347)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]) bind027 --> bind0 bind028(["306117"]) bind028 --> bind0 bind029(["0.16027131623330992^^xsd:double"]) bind029 --> bind0 bind030(["wd:statement/q6693772-8075AC7F-DA34-4570-8D35-634FE0D19BFA"]) bind030 --> bind0 bind031(["wd:Q6693772"]) bind031 --> bind0 bind032([sPoint(-74.1931089,44.3028384)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]) bind032 --> bind0 bind033(["956107"]) bind033 --> bind0 bind034(["0.41559208749788973^^xsd:double"]) bind034 --> bind0 bind035(["wd:statement/q6476251-89FAD984-5259-452C-A87A-AEE4B803AE36"]) bind035 --> bind0 bind036(["wd:Q6476251"]) bind036 --> bind0 bind037([sPoint(-84.2390238,30.6312498)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]) bind037 --> bind0 bind038(["284452"]) bind038 --> bind0 bind039(["0.1788844992337819^^xsd:double"]) bind039 --> bind0 bind040(["wd:statement/q5665721-81992C6B-A823-430F-9504-091EBFE78FFF"]) bind040 --> bind0 bind041(["wd:Q5665721"]) bind041 --> bind0 bind042([sPoint(-113.7705404,48.5167701)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]) bind042 --> bind0 bind043(["784584"]) bind043 --> bind0 bind044(["0.1789714719728492^^xsd:double"]) bind044 --> bind0 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; bind1[/"?gnisPt"/] v3 --o bind1 bind1 --as--o v8 bind2[/"'gnis'"/] bind2 --as--o v8 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P625"--> v8 bind3[/"'wiki'"/] bind3 --as--o v8 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c3 --"wikibase:language"--> c5 end