query-548482434ef532017b188b6e9bbdf136

rq turtle/ttl

Stars up to 18 light years away sorted by the nearest SELECT ?star ?starLabel ?distance WHERE { ?star wdt:P31 wd:Q523 ; wdt:P2583 ?distance; FILTER( ?distance < 19 ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } ORDER BY ?distance

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Stars up to 18 light years away sorted by the nearest
SELECT ?star ?starLabel ?distance
WHERE
{
    ?star wdt:P31 wd:Q523 ;
          wdt:P2583 ?distance;
    FILTER( ?distance < 19 )
        SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
ORDER BY ?distance

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?distance"):::projected v2("?star"):::projected c3(["wd:Q523"]):::iri c6(["bd:serviceParam"]):::iri c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?distance < '19^^xsd:integer'"]] f0 --> v1 v2 --"wdt:P31"--> c3 v2 --"wdt:P2583"--> v1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end