Template:All instances/doc

From Wikidata
Jump to navigation Jump to search

Experimental template.

Generates a query to lists instances of some classes, in an expanded way. More precisely explore the possibility to do something similar to what does Reasonator with « is a list of (P360) View with SQID » with classes item of Wikidata. The idea is to find items from statements in the class item.

Explanation[edit]

Simple example[edit]

A concrete example with: COMMAND.COM command (Q50320434) (inspired from : this discussion). This items has the statement:

⟨ COMMAND.COM command (Q50320434)  View with Reasonator View with SQID ⟩ has quality Search ⟨ Q47524457 ⟩
part of (P361) View with SQID ⟨ COMMAND.COM (Q971787)  View with Reasonator View with SQID ⟩

The template call {{All instances|Q50320434}} will generate this WDQS query that will find all items that either have an instance of (P31) statement to COMMAND.COM command (Q50320434) or are commands and have a statement part of (P361) View with SQID : COMMAND.COM command (Q50320434).

General principle[edit]

The general idea is to use such statement in the class item and in its parent classes as well to find additional instances of that class. The statements are currently statements of the form

⟨ class ⟩ has quality Search ⟨ Q47524457 ⟩
property1 Search ⟨ value1 ⟩
property2 Search ⟨ value2 ⟩
Search ⟨  ⟩


Statements of this forms in the parent classes are also used.


The statements of the additional instances looks like :

  • ⟨ instance of class ⟩ property1 Search ⟨ value1 ⟩
  • ⟨ instance of class ⟩ property2 Search ⟨ value2 ⟩
  • ⟨ instance of class ⟩ Search ⟨  ⟩


Definitions:

explicit instance item of a class
an explicit instance item is an item of a class-item C an item who has a instance of (P31) statement with value C or to any of its (explicit) subclasses-item.
implicit instance item of a class
an implicit instance item which is not an explicit instance of C, but is an instance (either explicit or implicit) of some explicit parent class of C and has one statement for each qualifier/value pairs of the
⟨ class ⟩ has quality Search ⟨ Q47524457 ⟩
property1 Search ⟨ value1 ⟩
property2 Search ⟨ value2 ⟩
Search ⟨  ⟩
-like statements of C whose main snak has the same values as the qualifier/value pair.


The generated query computes the set of implicit and explicit instances of the class

Future work[edit]

They includes :

  • generating a (partial ?) query to find all the instances, explicit or not (make the union of ?item instance of/subclass of* <class> and the result of the presently computed query)
  • submit the idea to community, what is the status wrt. « is a list of » ? is has quality Search a good choice to do this, or maybe properties for this type (P1963) View with SQID_? The advantage of the latter is that it has a property datatype. This allows to put the property as the main value of the statement and allows a richer description of the statements than just the main snak, like describing qualifiers or value restriction like in owl value restriction. It may become quite complex and overlap with the wikidata constaint system, however.

Usage[edit]

all instances of COMMAND.COM command

See also[edit]