Help:Notes on record types

From semantic-mediawiki.org
Jump to: navigation, search
Type RecordHelp:Notes on record types

Record related datatypes rely on special treatment in SMW as the DataItem is stored as separate entity while display characteristics are that of a "flat" DataValue where in fact it is represented as DIContainer using ContainerSemanticData.

ResultArray1 2 contains special handing to allow to use the |+index=... output selector and QueryResultSerializer to contain extra export data necessary for the serialization for this datatype.

Extension

A new record type should be registered with the name to include `_rec` 1 so existing container related handling (as in case of ResultArray) can be make use of it.

Register a newly created record type as subtype 3.

$dataTypeRegistry->registerDatatype(
	'_sci_freq_rec',
	'\SCI\DataValues\CitationFrequencyValue',
	DataItem::TYPE_WIKIPAGE,
	false,
	true // subtype
);
  • SMW\DataValues\MonolingualTextValue as _mlt_rec
  • SCI\DataValues\CitationFrequencyValue as _sci_freq_rec