Project:SPARQL/examples: Difference between revisions

 
(2 intermediate revisions by the same user not shown)
Line 12: Line 12:
   }
   }
</SPARQL>
</SPARQL>
==Food Items with SMILING Thailand Food Code and Reference==
<SPARQL>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wbt: <https://wikifcd.wikibase.cloud/prop/direct/>
PREFIX wb: <https://wikifcd.wikibase.cloud/entity/>
PREFIX p: <https://wikifcd.wikibase.cloud/prop/>
PREFIX pr: <https://wikifcd.wikibase.cloud/prop/reference/>
PREFIX prov: <http://www.w3.org/ns/prov#>
SELECT ?food ?foodLabel ?code WHERE {
?food wbt:P315 ?code;
  p:P315 [ prov:wasDerivedFrom [pr:P62 wb:Q568274]].
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
</SPARQL>
==Timeline View of FCTs with Publication Dates==
==Timeline View of FCTs with Publication Dates==
<SPARQL>
<SPARQL>
Line 149: Line 166:
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
}
</SPARQL>
==Ranked List of Food Items Containing Most to Least DHA (Docosahexaenoic acid)==
<SPARQL>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wbt: <https://wikifcd.wikibase.cloud/prop/direct/>
PREFIX wb: <https://wikifcd.wikibase.cloud/entity/>
PREFIX p: <https://wikifcd.wikibase.cloud/prop/>
PREFIX psv: <https://wikifcd.wikibase.cloud/prop/statement/value/>
SELECT ?itemLabel ?_DHA ?unitLabel    WHERE {
?item p:P135/psv:P135 ?DHA.
?DHA wikibase:quantityAmount ?_DHA.
?DHA wikibase:quantityUnit ?unit.
     
{ SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en"} }}
ORDER BY DESC(?_DHA)
</SPARQL>
</SPARQL>