Project:SPARQL/examples: Difference between revisions

Jump to navigation Jump to search
Line 221: Line 221:
=== Line Charts ===
=== Line Charts ===
==== MAP Overall Policy Tallies Over Time ====
==== MAP Overall Policy Tallies Over Time ====
This query returns a line chart showcasing how the MAP (Movement Advancement Project) Overall Tally (P863) has changed in the U.S. state of Alabama 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) Overall Tally (P863) 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.


<sparql tryit="1">PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
<sparql tryit="1">PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
Line 230: Line 230:


#defaultView:LineChart
#defaultView:LineChart
SELECT DISTINCT ?PointInTime ?OverallTally
SELECT ?USState ?PointInTime ?OverallTally ?USStateLabel
WHERE  
WHERE
{
{
   wd:Q31554 p:P863 ?OverallTallyProp .
   ?USState p:P863 ?OverallTallyProp .
   ?OverallTallyProp pq:P19 ?PointInTime ;
   ?OverallTallyProp pq:P19 ?PointInTime ;
                     ps:P863 ?OverallTally .
                     ps:P863 ?OverallTally .
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
}
ORDER BY ?USStateLabel ?PointInTime
</sparql>
</sparql>


Navigation menu