Template:Query no qualifier

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

Partial query to get values of statements of some given property that has no qualifier at all, or to filter item if they have such a statement.

Variable naming[edit]

The statement is named by default by the pattern ?<item>_<property>_statement and the value ?<item>_<property>_value.

Usage[edit]

  • {{query no qualifier|item=?class|property=number|value=?number_of_instances}}
    
 ?class p:P1114 ?class_number_statement .
?class_number_statement ps:P1114 ?number_of_instances .
FILTER NOT EXISTS {
   ?class_number_statement ?classnumberpq_pred [] . # a triple involving our statement ...     
   [] wikibase:qualifier ?classnumberpq_pred .                                                        # ... with a predicate ?pq_pred that is a qualifier

}

In context:

select ?class ?number_of_instances {
 # get all the classes with an unqualified "number" statement, the cardinality of the class
  ?class p:P1114 ?class_number_statement .
 ?class_number_statement ps:P1114 ?number_of_instances .
 FILTER NOT EXISTS {
    ?class_number_statement ?classnumberpq_pred [] . # a triple involving our statement ...     
    [] wikibase:qualifier ?classnumberpq_pred .                                                        # ... with a predicate ?pq_pred that is a qualifier
}
}
Try it!

selects in a sparql query only statements with no qualifier at all

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
itemitem subject

subject of the statement we want no qualifier into

Default
?item
Stringsuggested
valuevalue

values of statement with no qualifiers

Stringoptional
propertyproperty

property for the claim we are interested into

Default
?property
Example
number
Stringrequired

See also[edit]