User:Wiljes/chemistry

From Wikidata
Jump to navigation Jump to search

Links[edit]

Other resources[edit]

Basics[edit]

Gib mir alle Stoffeigenschaften![edit]

SELECT ?p ?pLabel
WHERE 
{
  ?p wdt:P31 wd:Q764285 . 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} ORDER BY ?pLabel
Try it!

Gib mir alle Wikidata property to identify substances (Q19833835)![edit]

SELECT ?p ?pLabel
WHERE 
{
  ?p wdt:P31 wd:Q19833835 . 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} ORDER BY ?pLabel
Try it!

Questions[edit]

Give me all chemical elements![edit]

SELECT ?ordnungszahl ?p ?pLabel ?symbol
WHERE 
{
  ?p wdt:P31 wd:Q11344 . 
  ?p wdt:P246 ?symbol .
  ?p wdt:P1086 ?ordnungszahl .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} ORDER BY ASC(?ordnungszahl)
Try it!

Give me all chemical compounds![edit]

SELECT ?p ?pLabel ?formel
WHERE 
{
  ?p wdt:P31 wd:Q11173 . 
  OPTIONAL {?p wdt:P274 ?formel}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} LIMIT 1000
Try it!

.. all chemical substances![edit]

SELECT ?p ?pLabel
WHERE 
{
  ?p wdt:P31 wd:Q79529 . 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} ORDER BY ASC(?pLabel)
Try it!

Give me all chemical compounds or elements with glass transition temperatures![edit]

SELECT ?p ?pLabel ?value ?unitLabel
WHERE 
{
  {?p wdt:P31 wd:Q11173} UNION {?p wdt:P31 wd:Q11344}
  ?p          p:P5670                     ?stmnode.    # length
  ?stmnode       psv:P5670                   ?valuenode.
  ?valuenode     wikibase:quantityAmount     ?value.
  ?valuenode     wikibase:quantityUnit       ?unit.
  ?valuenode     wikibase:quantityLowerBound ?lowerbound.
  ?valuenode     wikibase:quantityUpperBound ?upperbound.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} ORDER BY ASC(?q)
Try it!

Give me all chemical compounds or elements with melting points (in Celsius)![edit]

SELECT ?p ?pLabel ?value ?unitLabel
WHERE 
{
  {?p wdt:P31 wd:Q11173} UNION {?p wdt:P31 wd:Q11344} 
  ?p          p:P2101                     ?stmnode.
  ?stmnode       psv:P2101                   ?valuenode.
  ?valuenode     wikibase:quantityAmount     ?value.
  ?valuenode     wikibase:quantityUnit       ?unit.
  ?valuenode     wikibase:quantityUnit       wd:Q25267 .   # in Celsius only
  ?valuenode     wikibase:quantityLowerBound ?lowerbound.
  ?valuenode     wikibase:quantityUpperBound ?upperbound.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} ORDER BY ASC(?value)
Try it!

Give me all name reactions![edit]

SELECT ?p ?pLabel
WHERE 
{
  ?p wdt:P31 wd:Q1049494 . 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} ORDER BY ASC(?pLabel)
Try it!


Give me all chemists![edit]

SELECT ?p ?pLabel ?birthdate
WHERE 
{
  ?p wdt:P106 wd:Q593644 . 
  OPTIONAL { ?p wdt:P569 ?birthdate }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} ORDER BY DESC(?birthdate)
Try it!

...female chemists only![edit]

SELECT ?p ?pLabel ?birthdate
WHERE 
{
  ?p wdt:P106 wd:Q593644 . 
  ?p wdt:P21 wd:Q6581072 .
  OPTIONAL { ?p wdt:P569 ?birthdate }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} ORDER BY DESC(?birthdate)
Try it!

...Nobel Prize winners in chemistry![edit]

SELECT ?p ?pLabel ?year
WHERE 
{
  ?p wdt:P106 wd:Q593644 . 
  ?p p:P166 ?statement . 
  ?statement ps:P166  wd:Q44585 .
  ?statement pq:P585  ?year .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} ORDER BY ASC(?year)
Try it!

Give me entities that have a IUPAC Goldbook identifier![edit]

SELECT ?p ?pLabel ?qLabel
WHERE 
{
  ?p wdt:P4732 ?q . 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} ORDER BY ASC(?pLabel)
Try it!


Give me all Wikipedia pages that are using using Wikidata property IUPAC Gold Book ID (P4732)![edit]

SELECT ?p ?pLabel
WHERE 
{
  ?p wdt:P31 wd:Q47455437 . 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} ORDER BY ASC(?pLabel)
Try it!

Exploring + Statistics[edit]

Properties most often pointing to Name reactions[edit]

modelled after [1]

UNDER CONSTRUCTION

SELECT ?property (COUNT(?item) AS ?count)
  WHERE {
    ?item ?statement wd:Q1049494 . # items pointing to Q3324507 through a statement
    ?property wikibase:statementProperty ?statement . # property used for that statement
  } 
GROUP BY ?property # count usage for each property pointing to that entity
ORDER BY DESC(?count) # show in descending order of uses
Try it!

...all properties used by name reactions![edit]

SELECT DISTINCT ?prop ?propLabel (COUNT(?prop) AS ?number)
WHERE {
  hint:Query hint:optimizer "None" . # recommended to display the property's label
  ?prop wikibase:directClaim ?p .    # needed to display the property's label
  ?instance wdt:P31 wd:Q1049494 .   
  ?instance ?p ?o .
  SERVICE wikibase:label {bd:serviceParam wikibase:language "en,de"}
} GROUP BY ?prop ?propLabel 
ORDER BY DESC(?number)
Try it!

...all properties that are used by chemical elements or chemical compounds![edit]

TIMEOUT

SELECT DISTINCT ?prop ?propLabel (COUNT(?prop) AS ?number)
WHERE {
  hint:Query hint:optimizer "None" . # recommended to display the property's label
  ?prop wikibase:directClaim ?p .    # needed to display the property's label
  {?instance wdt:P31 wd:Q11344} UNION {?instance wdt:P31 wd:Q11173}  
  ?instance ?p ?o .
  SERVICE wikibase:label {bd:serviceParam wikibase:language "en,de"}
} GROUP BY ?prop ?propLabel 
ORDER BY DESC(?number)
Try it!

...stripped down to optimize, but still TIMEOUT</soan):

SELECT DISTINCT ?p (COUNT(?p) AS ?number)
WHERE {
  ?instance wdt:P31 wd:Q11173 .
  ?instance ?p ?o .
} GROUP BY ?p 
ORDER BY DESC(?number)
Try it!

...all properties of type Wikidata property to identify substances (Q19833835) that are used by chemical elements or chemical compounds![edit]

elements only, to prevent timeout

SELECT DISTINCT ?prop ?propLabel (COUNT(?prop) AS ?number)
WHERE {
  hint:Query hint:optimizer "None" . # recommended to display the property's label
  ?prop wikibase:directClaim ?p .    # needed to display the property's label
  # {?instance wdt:P31 wd:Q11344} UNION {?instance wdt:P31 wd:Q11173}  
  ?instance wdt:P31 wd:Q11344 . 
  ?instance ?p ?o .
  ?prop wdt:P31 wd:Q19833835 .
  SERVICE wikibase:label {bd:serviceParam wikibase:language "en,de"}
} GROUP BY ?prop ?propLabel 
ORDER BY DESC(?number)
Try it!

Housekeeping[edit]

Give me all chemical elements that are also chemical compounds![edit]

This should not happen!

SELECT ?p ?pLabel
WHERE 
{
  ?p wdt:P31 wd:Q11344 . 
  ?p wdt:P31 wd:Q11173 . 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} ORDER BY ASC(?pLabel)
Try it!