query-f95901a5ff61c3ae35ac85dfd4c24e0a
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
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 (sample(?mass_kg_) as ?mass_kg) (sample(?constellation_) as ?constellation) (sample(?constellation_Label) as ?constellationLabel) (sample(?PM_) as ?PM)
(sample(?Rad_Vel_) as ?Rad_Vel) (sample(?Spectral_Class_) as ?Spectral_Class) (sample(?lumin_) as ?lumin) (sample(?metal_) as ?metal)
(sample(?parallax_) as ?parallax) (sample(?LY_) as ?LY) (sample(?RA_) as ?RA) (sample(?declination_) as ?declination) (sample(?Eff_Temp_) as ?Eff_Temp)
(sample(?SIMBAD_) as ?SIMBAD) WHERE
{
{
SELECT ?item WHERE
{
?item wdt:P31 wd:Q523 .
} LIMIT 200000 } OPTIONAL {?item wdt:P59 ?constellation_. }
OPTIONAL {?item wdt:P2214 ?parallax_. }
OPTIONAL {?item p:P2583/psn:P2583 ?stat .
?stat wikibase:quantityAmount ?dist_to_earth.
BIND((?dist_to_earth * 0.00000000000000010570) as ?LY_)}
# OPTIONAL {?item wdt:P2067 ?mass_. }
OPTIONAL {?item p:P2067/psn:P2067 ?stat1 .
?stat1 wikibase:quantityAmount ?mass_kg_.
# ?stat1 wikibase:quantityUnit ?unit.
}
OPTIONAL {?item wdt:P2215 ?PM_.}
OPTIONAL {?item wdt:P2216 ?Rad_Vel_. }
OPTIONAL {?item wdt:P215 ?Spectral_Class_ .}
OPTIONAL {?item wdt:P2060 ?lumin_. }
OPTIONAL {?item wdt:P2227 ?metal_. }
OPTIONAL {?item wdt:P6257 ?RA_. }
OPTIONAL {?item wdt:P6258 ?declination_ .}
OPTIONAL {?item wdt:P6879 ?Eff_Temp_. }
OPTIONAL {?item wdt:P3083 ?SIMBAD_. }
filter(?LY_ <30|| ?parallax_ > 100)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?constellation_ rdfs:label ?constellation_Label.
?item rdfs:label ?itemLabel .}
} group by ?item ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v32("?Eff_Temp")
v16("?Eff_Temp_"):::projected
v29("?LY")
v7("?LY_"):::projected
v23("?PM")
v9("?PM_"):::projected
v30("?RA")
v14("?RA_"):::projected
v24("?Rad_Vel")
v10("?Rad_Vel_"):::projected
v33("?SIMBAD")
v17("?SIMBAD_"):::projected
v25("?Spectral_Class")
v11("?Spectral_Class_"):::projected
v21("?constellation")
v22("?constellationLabel")
v4("?constellation_"):::projected
v18("?constellation_Label"):::projected
v31("?declination")
v15("?declination_"):::projected
v6("?dist_to_earth")
v3("?item"):::projected
v19("?itemLabel"):::projected
v26("?lumin")
v12("?lumin_"):::projected
v20("?mass_kg")
v8("?mass_kg_"):::projected
v27("?metal")
v13("?metal_"):::projected
v28("?parallax")
v2("?parallax_"):::projected
v5("?stat")
v7("?stat1")
a1((" "))
a2((" "))
c22(["bd:serviceParam"]):::iri
c4(["wd:Q523"]):::iri
c24(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["(?LY_ < '30^^xsd:integer' || ?parallax_ > '100^^xsd:integer')"]]
f0 --> v7
f0 --> v2
v3 --"p:direct/P31"--> c4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P59".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P2214".-> v2
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:P2583".-> a1
a1 --"p:statement/value-normalized/P2583"--> v5
v5 --"wikibase:quantityAmount"--> v6
bind1[/"?dist_to_earth * '0.00000000000000010570^^xsd:decimal'"/]
v6 --o bind1
bind1 --as--o v7
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:P2067".-> a2
a2 --"p:statement/value-normalized/P2067"--> v7
v7 --"wikibase:quantityAmount"--> v8
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P2215".-> v9
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P2216".-> v10
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P215".-> v11
end
subgraph optional7["(optional)"]
style optional7 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P2060".-> v12
end
subgraph optional8["(optional)"]
style optional8 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P2227".-> v13
end
subgraph optional9["(optional)"]
style optional9 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P6257".-> v14
end
subgraph optional10["(optional)"]
style optional10 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P6258".-> v15
end
subgraph optional11["(optional)"]
style optional11 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P6879".-> v16
end
subgraph optional12["(optional)"]
style optional12 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P3083".-> v17
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c22 --"wikibase:language"--> c24
v4 --"rdfs:label"--> v18
v3 --"rdfs:label"--> v19
end
bind16[/"sample(?mass_kg_)"/]
v8 --o bind16
bind16 --as--o v20
bind17[/"sample(?constellation_)"/]
v4 --o bind17
bind17 --as--o v21
bind18[/"sample(?constellation_Label)"/]
v18 --o bind18
bind18 --as--o v22
bind19[/"sample(?PM_)"/]
v9 --o bind19
bind19 --as--o v23
bind20[/"sample(?Rad_Vel_)"/]
v10 --o bind20
bind20 --as--o v24
bind21[/"sample(?Spectral_Class_)"/]
v11 --o bind21
bind21 --as--o v25
bind22[/"sample(?lumin_)"/]
v12 --o bind22
bind22 --as--o v26
bind23[/"sample(?metal_)"/]
v13 --o bind23
bind23 --as--o v27
bind24[/"sample(?parallax_)"/]
v2 --o bind24
bind24 --as--o v28
bind25[/"sample(?LY_)"/]
v7 --o bind25
bind25 --as--o v29
bind26[/"sample(?RA_)"/]
v14 --o bind26
bind26 --as--o v30
bind27[/"sample(?declination_)"/]
v15 --o bind27
bind27 --as--o v31
bind28[/"sample(?Eff_Temp_)"/]
v16 --o bind28
bind28 --as--o v32
bind29[/"sample(?SIMBAD_)"/]
v17 --o bind29
bind29 --as--o v33