Template:Wdquery

From Wikidata
Jump to: navigation, search
Documentation icon Template documentation[view] [edit] [history] [purge]

Usage[edit]

Parameter 1 is the Sparql query, and parameter 2 is the text to display.

  • {{wdquery|
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wikibase: <http://wikiba.se/ontology#>
    PREFIX p: <http://www.wikidata.org/prop/>
    PREFIX v: <http://www.wikidata.org/prop/statement/>
    PREFIX q: <http://www.wikidata.org/prop/qualifier/>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    
    SELECT ?property ?alias ?occurences WHERE {
      hint:Query hint:optimizer "None" .
    
      {
        SELECT ?alias (COUNT (?alias) as ?occurences) WHERE {	
          ?tmp a wikibase:Property .
          ?tmp skos:altLabel ?alias FILTER (LANG (?alias) = "en")
        } GROUP BY ?alias
      }
    
      ?property a wikibase:Property .
      ?property skos:altLabel ?alias FILTER (?occurences > 1) .
    } ORDER BY ?alias|an example query}}
    

[1]

See also[edit]

[2]