User:Jsamwrites/SPARQL

From Wikidata
Jump to navigation Jump to search

Example SPARQL Queries[edit]

Heritage sites[edit]

SELECT ?id ?geo{
  ?id wdt:P31 wd:Q358;
        wdt:P625 ?coord.
}
LIMIT 1000
Map
Caption text


Queries[edit]

Malayalam[edit]

PREFIX ഡിസി: <http://purl.org/dc/terms/>
PREFIX വിക്കിഡാറ്റ: <http://www.wikidata.org/entity/>

SELECT ?ലെക്സീമുകൾ { 
   ?ലെക്സീമുകൾ ഡിസി:language വിക്കിഡാറ്റ:Q36236 
}

Properties[edit]

Instances[edit]

SELECT ?item ?itemLabel
WHERE
{
        ?item wdt:P31 wd:Q5.
        SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
LIMIT 100

On Wikidata Query

Properties, their labels and description in different languages[edit]

SELECT ?property ?propertyLabel ?propertyDescription (lang(?propertyLabel) as ?lang)
WHERE
{
    ?property a wikibase:Property 
    ; rdfs:label ?propertyLabel
    ; schema:description ?propertyDescription.
    filter(lang(?propertyLabel) = lang(?propertyDescription)).
} 
LIMIT 100

On Wikidata Query

Finding Lists and their Wikipedia Links[edit]

SELECT DISTINCT ?item ?itemLabel ?sitelink
WHERE
{
        ?item rdfs:label ?label; wdt:P31 wd:Q13406463.
        ?sitelink schema:about  ?item; schema:inLanguage "en"; schema:isPartOf <https://en.wikipedia.org/>
        FILTER CONTAINS(?label,"programming") .
        SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
LIMIT 100

On Wikidata Query

Programming languages with missing English Labels[edit]

SELECT ?item ?label
WHERE {?item wdt:P31 wd:Q9143.
        FILTER NOT EXISTS{
          ?item rdfs:label ?label.
           FILTER (lang(?label)='en').
         }     
}