-
Notifications
You must be signed in to change notification settings - Fork 3
add try it! button to Query documentation #46
Copy link
Copy link
Closed
Description
see also
Examples:
15 Random substances with CAS number
Wikidata SPARQL query showing the 15 random chemical substances with their CAS Number
query
# List of 15 random chemical components with CAS-Number, formula and structure
# see also https://github.com/WolfgangFahl/pyLoDStorage/issues/46
# WF 2021-08-23
SELECT ?substance ?substanceLabel ?formula ?structure ?CAS
WHERE {
?substance wdt:P31 wd:Q11173.
?substance wdt:P231 ?CAS.
?substance wdt:P274 ?formula.
?substance wdt:P117 ?structure.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 15
try it!
result
| substance | substanceLabel | formula | structure | CAS |
|---|---|---|---|---|
| Q32703 | aminomethylpropanol | C₄H₁₁NO | 2-amino-2-methyl-1-propanol.svg | 124-68-5 |
| Q32703 | aminomethylpropanol | C₄H₁₁NO | Isobutanolamine t.png | 124-68-5 |
| Q43656 | cholesterol | C₂₇H₄₆O | Structural formula of cholesterol.svg | 57-88-5 |
| Q45143 | fulminic acid | CHNO | Fulminezuur.png | 506-85-4 |
| Q49546 | acetone | C₃H₆O | Acetone-2D-skeletal.svg | 67-64-1 |
| Q49546 | acetone | C₃H₆O | Acetone-structural.png | 67-64-1 |
| Q52858 | ethane | C₂H₆ | Ethan Keilstrich.svg | 74-84-0 |
| Q58356 | amoxapine | C₁₇H₁₆ClN₃O | Amoxapine.svg | 14028-44-5 |
| Q58713 | clomipramine | C₁₉H₂₃ClN₂ | Clomipramine.svg | 303-49-1 |
| Q68484 | prucalopride | C₁₈H₂₆ClN₃O₃ | Prucalopride.svg | 179474-81-8 |
| Q68566 | mosapride | C₂₁H₂₅ClFN₃O₃ | Mosapride.svg | 112885-41-3 |
| Q80232 | cyclobutane | C₄H₈ | Cyclobutane2.svg | 287-23-0 |
| Q80868 | tolonium chloride | C₁₅H₁₆ClN₃S | Tolonium chloride.svg | 92-31-9 |
| Q83320 | nitric acid | HNO₃ | Nitric-acid.png | 12507-77-6 |
| Q83320 | nitric acid | HNO₃ | Nitric-acid.png | 7697-37-2 |
Ten largest cities of the world
Wikidata SPARQL query showing the 10 most populated cities of the world using the million city class Q1637706 for selection
query
# Ten Largest cities of the world
# WF 2021-08-23
# see also http://wiki.bitplan.com/index.php/PyLoDStorage#Examples
SELECT DISTINCT ?city ?cityLabel ?population ?country ?countryLabel
WHERE {
VALUES ?cityClass { wd:Q1637706}.
?city wdt:P31 ?cityClass .
?city wdt:P1082 ?population .
?city wdt:P17 ?country .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
ORDER BY DESC(?population)
LIMIT 10try it!
result
| city | cityLabel | population | country | countryLabel |
|---|---|---|---|---|
| Q1353 | Delhi | 26495000 | Q668 | India |
| Q8686 | Shanghai | 23390000 | Q148 | People's Republic of China |
| Q956 | Beijing | 21710000 | Q148 | People's Republic of China |
| Q1354 | Dhaka | 16800000 | Q902 | Bangladesh |
| Q1156 | Mumbai | 15414288 | Q668 | India |
| Q8660 | Karachi | 14910352 | Q843 | Pakistan |
| Q8673 | Lagos | 14862000 | Q1033 | Nigeria |
| Q406 | Istanbul | 14657434 | Q43 | Turkey |
| Q1490 | Tokyo | 13942024 | Q17 | Japan |
| Q11736 | Tianjin | 13245000 | Q148 | People's Republic of China |
count OpenStreetMap place type instances
This SPARQL query
determines the number of instances available in the OpenStreetMap for the placeTypes city,town and village
query
# count osm place type instances
# WF 2021-08-23
SELECT (count(?instance) as ?count) ?placeType ?placeTypeLabel
WHERE {
VALUES ?placeType {
"city"
"town"
"village"
}
?instance osmt:place ?placeType
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?placeType ?placeTypeLabel
ORDER BY ?counttry it!
result
| count | placeType | placeTypeLabel |
|---|---|---|
| 13614 | city | city |
| 23238 | town | town |
| 153380 | village | village |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request