query-de9cc089f15fe658e50cc76156b85b40
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?light_years_from_earth
WHERE
{
{
SELECT ?P2583_statement ?dist_to_earth
{
?P2583_statement psn:P2583 ?nvalue .
?nvalue wikibase:quantityAmount ?dist_to_earth .
FILTER (?dist_to_earth > 9460730472580800.0 && ?dist_to_earth <= 283821914177424000.0) # Distance is 1 to 30 light years
}
} ?P2583_statement a wikibase:BestRank. # Do only use best rank values
?item p:P2583 ?P2583_statement .
?item wdt:P31/wdt:P279* wd:Q523 . # Check that ?item is a star (remember to include subclasses of star!)
BIND (?dist_to_earth * 0.000000000000000105700083402461546370946 AS ?light_years_from_earth)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE,en]" . }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?P2583_statement")
v1("?dist_to_earth")
v4("?item"):::projected
v5("?light_years_from_earth"):::projected
v3("?nvalue")
a1((" "))
c6(["wikibase:BestRank"]):::iri
c10(["wd:Q523"]):::iri
c14(["#91;AUTO_LANGUAGE,en#93;"]):::literal
c12(["bd:serviceParam"]):::iri
f0[["?dist_to_earth > '9460730472580800.0^^xsd:decimal'?dist_to_earth <= '283821914177424000.0^^xsd:decimal'"]]
f0 --> v1
v2 --"p:statement/value-normalized/P2583"--> v3
v3 --"wikibase:quantityAmount"--> v1
v2 --"a"--> c6
v4 --"p:P2583"--> v2
v4 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c10
bind1[/"?dist_to_earth * '0.000000000000000105700083402461546370946^^xsd:decimal'"/]
v1 --o bind1
bind1 --as--o v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end