Project:SPARQL/examples: Difference between revisions

Jump to navigation Jump to search
Line 220: Line 220:
== Visualization Queries ==
== Visualization Queries ==
=== Line Charts ===
=== Line Charts ===
==== GAI Values Over Time ====
This query returns a line chart showcasing how the Williams Institute's Global Acceptance Index (GAI; P870) has changed in all regions over the past two decades. It uses the service wikibase:label to return the labels in your default language or in English.
<sparql tryit="1">PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
PREFIX p: <https://lgbtdb.wikibase.cloud/prop/>
PREFIX pq: <https://lgbtdb.wikibase.cloud/prop/qualifier/>
PREFIX ps: <https://lgbtdb.wikibase.cloud/prop/statement/>
#defaultView:LineChart
SELECT ?Region ?CoverageDate ?GAIValue ?RegionLabel
WHERE
{
  ?Region p:P870 ?GAI .
  ?GAI pq:P570|pq:P571 ?CoverageDate ;
      ps:P870 ?GAIValue .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?RegionLabel ?CoverageDate
</sparql>
==== MAP Sexual Orientation Policy Tallies Over Time ====
==== MAP Sexual Orientation Policy Tallies Over Time ====
This query returns a line chart showcasing how the MAP (Movement Advancement Project) Sexual Orientation Policy Tally (P861) has changed in all U.S. states and territories over the past decade. It uses the service wikibase:label to return the labels in your default language or in English.
This query returns a line chart showcasing how the MAP (Movement Advancement Project) Sexual Orientation Policy Tally (P861) has changed in all U.S. states and territories over the past decade. It uses the service wikibase:label to return the labels in your default language or in English.

Navigation menu