Wikidata/Development/Data values and types
This page offers a draft of how data values and data types in Wikibase could interplay, and how this plays together with SMW's data values.
There are two main classes:
Type, and, from the ValueHandler extension,
TypeFactory is used to
- get a list of all
- get an instance of
Type is used to
- get labels of itself
- parse a string and get a
comes from the ValueHandler extension and is used to
- store a specific value (e.g. 3km+-50 meter)
DataValueis always stored within a
Snak, that keeps track of the
DataValueand can thus also provide formatting and parsing for the
Entitythat allows you to get its
Normally, developers using values and types do not need to understand the underlying implementation, but merely the above interfaces.
The ValueHandler extension provides four components:
Validator. These are shared with the Validator extension, and also between Semantic MediaWiki and Wikibase.
DataValuestores the actual value
DataValueinto a serialization
Parserturns a serialization into a
DataValuefor further conditions
Each of these four, and often are, subclassed, and many of them can be combined together. So, for example, there are subclasses of
DataValuefor geodata, numbers, etc.
In Wikibase, a
Typeis basically defined by composing it from the four different components provided in the ValueHandler extension. This composition is configured for
TypeFactoryand made programmatically accesible through it.
TypeFactoryuses this configuration and assembles the