This page is currently a draft. More information pertaining to this may be available on the talk page. Translation admins: Normally, drafts should not be marked for translation. |
This document is meant to provide an overview of how several MediaWiki extensions work together, especially those associated with Wikibase and SMW. It is limited to components not specific to any extension.
It describes some already existing components, plans which are pretty certain and very preliminary thoughts. This is useful for discussion on how we will proceed, not as a manual of what we will end up with, since this is very prone to change.
DataValues
editThe extensions/DataValues.git repo contains several extensions, each holding a collection of low level components of a specific type.
- Holds DataValue objects, which are simple immutable objects to represent values. For instance QuantityValue or GeocoordinateValue.
- Is stand alone
- Used by Wikibase as part of PropertyValueSnak objects
- Can be used to replace the conceptually similar DataItem objects in SMW
- Holds ValueParser objects, which take some input and parse it to a DataValue. For instance GeoCoordinateParser.
- Depends on DataValues
- Used by Wikibase for constructing DataValues from user input
- Can be used by SMW to partially replace the current SMWDataValue classes (not to be confused with the DataValue classes discussed here)
- Used by Validator when processing string parameters
- Holds ValueFormatter objects, which take some input and format it. For instance GeoCoordinateFormatter.
- Depends on DataValues
- Used by Wikibase for formatting DataValues at various places
- Can be used by SMW to partially replace the current SMWDataValue classes (not to be confused with the DataValue classes discussed here)
- Used by Validator for formatting certain parameter types
- Holds ValueValidator objects, which take some input and validate in against some criteria. For instance RangeValidator.
- Depends on DataValues
- Used to construct DataTypes such as "positive number" which would consist out of a Numeric(Data)Value and a RangeValidator with lower bound 0.
- Used by Validator for the validation step in it's parameter processing process
- Holds a DataType class of which instances represent a type of value, such as "positive integer" or "float number".
- Depends on DataValues, ValueParsers, ValueFomatters and ValueValidators
- Used by Wikibase to expose supported types to the user (Wikibase limits the set of data types it supports internally)
- Could perhaps be used by SMW and other extensions. This is a very simple construct that can easily be duplicated in case something more complex is needed. Validator has ParameterDefinition objects which are conceptually similar to DataType objects but hold a lot more info.
- Not clear where this will reside. Possibly it will be in DataTypes, or perhaps its own extension (depending on DataTypes) in the DataValues repo.
- Contains:
- A collection of valueview.widget JavaScript widgets that each provide an editing interface for a single DataValue. These widgets just represent the value in the DOM and allow editing the value. They add nothing specific for editing (toolbar etc.) to the interface.
- A valueview jQuery widget which serves as a factory, initiating the right ValueEditor widget for a given DataValue or DataType.
- A general complete editing UI widget, valueeditor. This will provide things such as toolbars, live preview area and value type selector. The implementation would be based on the valueview widget.
- Will be used by Wikibase for user input
- Could be used by any tool that deals with value inputs, for instance Semantic Forms
- Could be used for modifying values in dynamic result printers in cases where the source of the value is known and can be modified
The above components are generally usable so usage is not restricted to Wikibase, SMW and Validator in any way. An example of this is the Maps extension which is making use of the GeoCoordinate value, parser and formatter.
Result formats
edit- Query results
If SMW and Wikibase are to share result formats, then having common query result objects seems like something we want to have. The existing SMW query result objects are likely not easily generalizable, but we can create new ones from scratch only conceptually based on the existing ones. We need to figure out how to accommodate results from both systems, as they have a different structure and either systems might support values that the other does not.
These new result objects would contain DataValue objects to represent the results.
To facilitate dynamic result printers we would need these result objects available in JS. This enables clean live manipulation of the results (see below) as well as nicely handling extra data obtained via live continuation query.
- Result printers
SMW has a lot of result printers (most of them in extensions to SMW). Would be great if these could be shared between SMW and Wikibase. This will require some work, at the very least updating them to use the new query result objects.
- Query API
For dynamic result formats to work, they need to be able to fetch additional results both as continuation of the same query and by running different queries. It is not certain that we want to allow the later in Wikibase. Still, an API is needed for obtaining such additional results. This API would have a server side component, but also ought to have a client side interface the result formats can talk to.
- Filters
For dynamic result formats we need filtering on the client side of values in the query result object(s). The filtered format of Semantic Result Formats already contains similar functionality which perhaps can be modified to work with these result objects.
- Sorters
For dynamic result formats we need sorting on the client side of values in the query result object(s). The filtered format of Semantic Result Formats already contains similar functionality which perhaps can be modified to work with these result objects.
- Further notes
When we have the low level components such as DataValues, ValueFormatters and ValueEditors available in JS, result formats can do many neat things such as changing the display of coordinates in a table on the fly.
Parameter processing
editAt least for result formats we need a way to process all the parameters they support. In SMW this is currently done using the Validator extension, which should also be usable by Wikibase. Much of the Validator extension is being rewritten to make use of the low level components provided by the various extensions in the DataValues repo.
Other components
edit- Query descriptions
The query descriptions of SMW could be generalized and put into their own library so they can be used by both SMW and Wikibase.
Having these descriptions in JavaScript would facilitate dynamic result printers where users can modify query conditions on the fly. Such objects in JS are perhaps needed anyway for the query construction and query viewing interfaces in Wikibase.