I'm trying to retrieve some basic informations from chemical elements stored in wikidata to create an interactive periodic table.
It's my first attempt to use wikidata, so I've understood how to get properties stored directly inside a chemical element(here is the hydrogen wikidata page) like atomic number
or symbol
, here's the code modified from the example:
Chemical elements and their isotopes by number of neutrons (min/max)
SELECT ?element (SAMPLE(?symbol) AS ?symbol) (SAMPLE(?protons) AS ?protons) (SAMPLE(?mass) AS ?mass) (SAMPLE(?group) AS ?group) (SAMPLE(?period) AS ?period)
WHERE
{
?element wdt:P31 wd:Q11344;
wdt:P1086 ?protons;
wdt:P246 ?symbol.
}
GROUP BY ?element
ORDER BY ?protons
But I also need to get the position inside the periodic table know as group and period.
The chemical element page states that for example the hydrogen element is an instance of group 1 element (Q19557)
, and period 1 element (Q191936)
but I can't figure out how to get these numbers, directly in the json response.
Edit 1 I tried to add a series ordinal property to groups in order to retrieve these numbers. For example see Group 15. However, I can't figure out how to get these numbers. Sorry for my ignorance!