Template:Wdquery/doc

From Wikidata
Jump to navigation Jump to search

This template generates a link to perform a SPARQL query in the Wikidata:SPARQL query service.

Usage[edit]

Parameter 1 is the SPARQL query (you can also use the |query= parameter for this), and parameter 2 is the text to display.

Wikicode:

{{wdquery|query=

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}}

Result: an example query

See also[edit]

  • {{SPARQL Inline}} — same as this template, but the primary link is to the query results page (with a secondary link to the non-executed query)


Inline link to a Wikidata Query Service SPARQL query

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
11

The link text

Suggested values
Show query results
Example
Show results
Linesuggested
queryquery

The SPARQL query to use

Stringrequired