Project:SPARQL/examples: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 134: Line 134:
}
}
ORDER BY ?pronounSetLabel
ORDER BY ?pronounSetLabel
</sparql>
=== Places ===
==== Places in New York City ====
This query returns all instances of places with addresses in New York City.
<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/>
SELECT ?item ?itemLabel
WHERE
{
  ?item p:P698 ?addressObject .
  ?addressObject pq:P701 wd:Q18321 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
</sparql>
==== Places in California ====
This query returns all instances of places with addresses in the state of California.
<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/>
SELECT ?item ?itemLabel
WHERE
{
  ?item p:P698 ?addressObject .
  ?addressObject pq:P700 wd:Q11578 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
</sparql>
==== Places in the United States ====
This query returns all instances of places with addresses in the United States.
<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/>
SELECT ?item ?itemLabel
WHERE
{
  ?item p:P698 ?addressObject .
  ?addressObject pq:P699 wd:Q94 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
</sparql>
</sparql>


Navigation menu