Semantic MediaWiki and related extensions
Public Member Functions | Public Attributes | Protected Attributes | List of all members
SMW\SQLStore\EntityStore\DataItemHandler Class Reference
Inheritance diagram for SMW\SQLStore\EntityStore\DataItemHandler:
Inheritance graph
[legend]

Public Member Functions

 __construct (SQLStore $store)
 
 setFieldTypeFeatures ( $fieldTypeFeatures)
 
 hasFeature ( $feature)
 
 isDbType ( $dbType)
 
 getTableFields ()
 
 getFetchFields ()
 
 getTableIndexes ()
 
 getIndexHint ( $key)
 
 getWhereConds (DataItem $dataItem)
 
 getInsertValues (DataItem $dataItem)
 
 getIndexField ()
 
 getLabelField ()
 
 getSortField ()
 
 dataItemFromDBKeys ( $dbkeys)
 
 newFromDBKeys ( $dbkeys)
 

Public Attributes

const IHINT_PSUBJECTS = 'ihint.psubjects'
 

Protected Attributes

 $store
 
 $fieldTypeFeatures = false
 

Detailed Description

Classes extending this represent all store layout that is known about a certain dataitem

GNU GPL v2+

Since
1.8
Author
Nischay Nahata

Constructor & Destructor Documentation

◆ __construct()

SMW\SQLStore\EntityStore\DataItemHandler::__construct ( SQLStore  $store)
Since
1.8
Parameters
SQLStore$store

Member Function Documentation

◆ dataItemFromDBKeys()

SMW\SQLStore\EntityStore\DataItemHandler::dataItemFromDBKeys (   $dbkeys)
abstract

Create a dataitem from an array of DB keys or a single DB key string. May throw an DataItemException if the given DB keys cannot be converted back into a dataitem. Each implementation of this method must otherwise run without errors for both array and string inputs.

Since
1.8
Parameters
array | string$dbkeys
Exceptions
DataItemException
Returns
DataItem

◆ getFetchFields()

SMW\SQLStore\EntityStore\DataItemHandler::getFetchFields ( )
abstract

Return an array with all the field names and types that need to be retrieved from the database in order to create a dataitem using dataItemFromDBKeys(). The result format is the same as for getTableFields(), but usually with fewer field names.

Note
In the future, we will most likely use a method that return only a single field name. Currently, we still need an array for concepts.
Since
1.8
Returns
array

◆ getIndexField()

SMW\SQLStore\EntityStore\DataItemHandler::getIndexField ( )
abstract

Return the field used to select this type of DataItem. In particular, this identifies the column that is used to sort values of this kind. Every type of data returns a non-empty string here.

Since
1.8
Returns
string

◆ getIndexHint()

SMW\SQLStore\EntityStore\DataItemHandler::getIndexHint (   $key)

Provides a possibility to return a specific index hint for a domain.

Since
3.0
Parameters
string$key
Returns
string

◆ getInsertValues()

SMW\SQLStore\EntityStore\DataItemHandler::getInsertValues ( DataItem  $dataItem)
abstract

Return an array of fields=>values that is to be inserted when writing the given DataItem to the database. Values should be set for all columns, even if NULL. This array is used to perform all insert operations into the DB.

Since
1.8
Parameters
DataItem$dataItem
Returns
array

◆ getLabelField()

SMW\SQLStore\EntityStore\DataItemHandler::getLabelField ( )
abstract

Return the label field for this type of DataItem. This should be a string column in the database table that can be used for selecting values using criteria such as "starts with". The return value can be empty if this is not supported. This is preferred for DataItem classes that do not have an obvious canonical string writing anyway.

The return value can be a column name or the empty string (if the give type of DataItem does not have a label field).

Since
1.8
Returns
string

◆ getSortField()

SMW\SQLStore\EntityStore\DataItemHandler::getSortField ( )

Returns the expected sort field.

Since
3.0
Returns
string

◆ getTableFields()

SMW\SQLStore\EntityStore\DataItemHandler::getTableFields ( )
abstract

Return array of fields for a DI type.

Tables declare value columns ("object fields") by specifying their name and type. Types are given using letters:

  • t for strings of the same maximal length as MediaWiki title names,
  • l for arbitrarily long strings; searching/sorting with such data may be limited for performance reasons,
  • w for strings as used in MediaWiki for encoding interwiki prefixes
  • n for namespace numbers (or other similar integers)
  • f for floating point numbers of double precision
  • p for a reference to an SMW ID as stored in the SMW IDs table; this corresponds to a data entry of ID "tnwt".
Since
1.8
Returns
array

◆ getTableIndexes()

SMW\SQLStore\EntityStore\DataItemHandler::getTableIndexes ( )

Return an array of additional indexes that should be provided for the table using this DI handler. By default, SMWSQLStore3 will already create indexes for all standard select operations, based on the indexfield provided by getIndexField(). Hence, most handlers do not need to define any indexes.

Since
1.8
Returns
array

◆ getWhereConds()

SMW\SQLStore\EntityStore\DataItemHandler::getWhereConds ( DataItem  $dataItem)
abstract

Return an array of fields=>values to conditions (WHERE part) in SQL queries for the given DataItem. This method can return fewer fields than getInstertValues as long as they are enough to identify an item for search.

Since
1.8
Parameters
DataItem$dataItem
Returns
array

◆ hasFeature()

SMW\SQLStore\EntityStore\DataItemHandler::hasFeature (   $feature)
Since
3.0
Parameters
integer$feature
Returns
boolean

◆ isDbType()

SMW\SQLStore\EntityStore\DataItemHandler::isDbType (   $dbType)
Since
3.0
Parameters
boolean

◆ newFromDBKeys()

SMW\SQLStore\EntityStore\DataItemHandler::newFromDBKeys (   $dbkeys)
Since
3.1
Parameters
array | string$dbkeys
Returns
DataItem
Exceptions
DataItemException

◆ setFieldTypeFeatures()

SMW\SQLStore\EntityStore\DataItemHandler::setFieldTypeFeatures (   $fieldTypeFeatures)
Since
3.0
Parameters
integer$fieldTypeFeatures

Member Data Documentation

◆ IHINT_PSUBJECTS

const SMW\SQLStore\EntityStore\DataItemHandler::IHINT_PSUBJECTS = 'ihint.psubjects'

Specifies a property subject index hint.


The documentation for this class was generated from the following file:

About | General disclaimer | Privacy policy