SPARQL Examples: Difference between revisions

From Semantic Lab
Jump to navigation Jump to search
(Created page with "=== Cats === This query looks at all items whose value of {{P|31}} is {{Q|146}}. It uses the service wikibase:label to return the labels in your default language or in English. {{SPARQL|query=# All records associated with our various projects on Wikibase SELECT DISTINCT ?item ?itemLabel ?type ?typeLabel ?project ?projectLabel WHERE { ?item wdt:P1 ?type. ?item wdt:P11 ?project. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en"....")
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== Cats ===
=== All records ===


All records associated with our various projects on Wikibase


This query looks at all items whose value of {{P|31}} is {{Q|146}}. It uses the service wikibase:label to return the labels in your default language or in English.
{{SPARQL|query=<nowiki># All records associated with our various projects on Wikibase
 
{{SPARQL|query=# All records associated with our various projects on Wikibase


SELECT DISTINCT ?item ?itemLabel ?type ?typeLabel ?project ?projectLabel WHERE {
SELECT DISTINCT ?item ?itemLabel ?type ?typeLabel ?project ?projectLabel WHERE {
Line 12: Line 11:
    
    
}
}
ORDER BY ?projectLabel
ORDER BY ?projectLabel</nowiki>
}}
 
=== All person records ===
 
 
{{SPARQL|query=<nowiki>#All person records associated with our projects on Wikibase
 
SELECT ?person ?personLabel ?project ?projectLabel
WHERE
{
  ?person  wdt:P1 wd:Q1.
  ?person wdt:P11 ?project.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
 
ORDER BY ?projectLabel</nowiki>
}}
 
=== All city records ===
 
 
{{SPARQL|query=<nowiki>#All city records associated with our projects on Wikibase
 
SELECT ?city ?cityLabel WHERE {
  ?city wdt:P1 wd:Q19058.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}</nowiki>
}}
}}

Latest revision as of 14:32, 8 March 2024

All records

All records associated with our various projects on Wikibase


 # All records associated with our various projects on Wikibase

SELECT DISTINCT ?item ?itemLabel ?type ?typeLabel ?project ?projectLabel WHERE {
    ?item wdt:P1 ?type.
    ?item wdt:P11 ?project.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  
}
ORDER BY ?projectLabel

All person records

 #All person records associated with our projects on Wikibase

SELECT ?person ?personLabel ?project ?projectLabel
WHERE 
{
  ?person  wdt:P1 wd:Q1.
  ?person wdt:P11 ?project.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

ORDER BY ?projectLabel

All city records

 #All city records associated with our projects on Wikibase

SELECT ?city ?cityLabel WHERE {
  ?city wdt:P1 wd:Q19058.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}