Template:Multiple values

Documentation icon Template documentation[view · edit · history · purge ]

Partial query to find items with several different main values for statements of one specified property. You can retrieve two sample value if you want.

Usage edit

Generated fragment for items with several values for instance of (P31) View with SQID

    ?item wdt:P31  ?item_P31_val1, ?item_P31_val2
                       filter(?item_P31_val1 != ?item_P31_val2) . 
  • {{SPARQL|query=select ?multipleclass where { {{tl|multiple values|instance of|?multipleclass}} } limit 10
    }}
    

The previous example in context, items with several values for instance of (P31) View with SQID (click on "try it!")

select ?multipleclass where { 
     ?multipleclass wdt:P31  ?multipleclass_instance_of_val1, ?multipleclass_instance_of_val2
                        filter(?multipleclass_instance_of_val1 != ?multipleclass_instance_of_val2) . } limit 10
Try it!

Variable naming edit

The pattern is ?<class name><Pid or name>val1 and ?<class name><Pid or name>val2 for the two witness that there are different values. Their value is the value of the statement.

In the previous example you can retrieve the two values


  • {{SPARQL|query=select ?multipleclass ?multipleclass_instance_of_val1 ?multipleclass_instance_of_val2 where { {{tl|multiple values|instance of|?multipleclass}} } limit 10
    }}
    
select ?multipleclass ?multipleclass_instance_of_val1 ?multipleclass_instance_of_val2 where { 
     ?multipleclass wdt:P31  ?multipleclass_instance_of_val1, ?multipleclass_instance_of_val2
                        filter(?multipleclass_instance_of_val1 != ?multipleclass_instance_of_val2) . } limit 10
Try it!

See also edit

Partial query template to help write queries that search for items who have several values for a property (two statement with the same value count as only one value)

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
property1

the property Pid we want to have multiple main values for an item

Example
P31
Unknownrequired
variable name2 subject

the variable name for the subject item

Default
?item
Example
?person
Unknownoptional
    ?item wdt:  ?item_{{{1}}}_val1, ?item_{{{1}}}_val2
                       filter(?item_{{{1}}}_val1 != ?item_{{{1}}}_val2) .