query-ae9f8597c44651918832367b1f240484
Defining Formulas User:Toni 001Adapted from
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
select
?quantity
(sample(?label) as ?label)
(sample(?desc) as ?desc)
(sample(?symbol) as ?symbol)
(sample(?formula) as ?formula)
(
strdt(
concat(
"<", "math><mtable columnalign=left>",
group_concat(?symbolAndLabel),
"</mtable></math>"
),
<http://www.w3.org/1998/Math/MathML>
) as ?otherSymbols
)
where {
?quantity wdt:P279+ wd:Q71550118 .
optional { ?quantity rdfs:label ?label . filter (lang(?label) = "en") }
optional { ?quantity schema:description ?desc . filter (lang(?desc) = "en") }
?quantity wdt:P2534 ?formula .
?quantity wdt:P7235 ?symbol .
{
select distinct * where {
?quantity p:P4934 [ pq:P7235 ?otherSymbol ; ps:P4934 / rdfs:label ?otherLabel ] .
filter (lang(?otherLabel) = "en")
bind (
concat(
"<mrow>",
str(?otherSymbol), "<mtext>", ": ", ?otherLabel, "</mtext>",
"</mrow>"
) as ?symbolAndLabel
)
}
}
} group by ?quantity ?formula