SMWDIContainer Class Reference
[SMWDataItems]

This class implements container data items that can store SMWSemanticData objects. More...

Inherits SMWDataItem.

List of all members.

Public Member Functions

 __construct (SMWContainerSemanticData $semanticData)
 Constructor.
 getDIType ()
 Convenience method that returns a constant that defines the concrete class that implements this data item.
 getSemanticData ()
 getSortKey ()
 Return a value that can be used for sorting data of this type.
 getSerialization ()
 Get a UTF-8 encoded string serialization of this data item.
 getHash ()
 Get a hash string for this data item.

Static Public Member Functions

static doUnserialize ($serialization)
 Create a data item from the provided serialization string and type ID.

Protected Attributes

 $m_semanticData


Detailed Description

This class implements container data items that can store SMWSemanticData objects.

Containers are not dataitems in the proper sense: they do not represent a single, opaque value that can be assigned to a property. Rather, a container represents a "subobject" with a number of property-value assignments. When a container is stored, these individual data assignments are stored -- the data managed by SMW never contains any "container", just individual property assignments for the subobject. Likewise, when a container is used in search, it is interpreted as a patterns of possible property assignments, and this pattern is searched for.

The data encapsulated in a container data item is essentially an SMWSemanticData object of class SMWContainerSemanticData. This class allows the subject to be kept anonymous if not known (if no context page is available for finding a suitable subobject name). See the repsective documentation for details.

Being a mere placeholder/template for other data, an SMWDIContainer is not immutable as the other basic data items. New property-value pairs can always be added to the internal SMWContainerSemanticData.

Since:
1.6
Author:
Markus Krötzsch

Definition at line 130 of file SMW_DI_Container.php.


Constructor & Destructor Documentation

SMWDIContainer::__construct ( SMWContainerSemanticData semanticData  ) 

Constructor.

The given SMWContainerSemanticData object will be owned by the constructed object afterwards, and in particular will not allow further changes.

Parameters:
$semanticData SMWContainerSemanticData

Definition at line 146 of file SMW_DI_Container.php.


Member Function Documentation

SMWDIContainer::getDIType (  ) 

Convenience method that returns a constant that defines the concrete class that implements this data item.

Used to switch when processing data items.

Returns:
integer that specifies the basic type of data item

Reimplemented from SMWDataItem.

Definition at line 150 of file SMW_DI_Container.php.

References SMWDataItem::TYPE_CONTAINER.

SMWDIContainer::getSemanticData (  ) 

Definition at line 154 of file SMW_DI_Container.php.

SMWDIContainer::getSortKey (  ) 

Return a value that can be used for sorting data of this type.

If the data is of a numerical type, the sorting must be done in numerical order. If the data is a string, the data must be sorted alphabetically.

Note:
Every data item returns a sort key, even if there is no natural linear order for the type. SMW must order listed data in some way in any case. If there is a natural order (e.g. for Booleans where false < true), then the sortkey must agree with this order (e.g. for Booleans where false maps to 0, and true maps to 1).

Wiki pages are a special case in SMW. They are ordered by a sortkey that is assigned to them as a property value. When pages are sorted, this data should be used if possible.

Returns:
float or string

Reimplemented from SMWDataItem.

Definition at line 158 of file SMW_DI_Container.php.

SMWDIContainer::getSerialization (  ) 

Get a UTF-8 encoded string serialization of this data item.

The serialisation should be concise and need not be pretty, but it must allow unserialization. Each subclass of SMWDataItem implements a static method doUnserialize() for this purpose.

Returns:
string

Reimplemented from SMWDataItem.

Definition at line 162 of file SMW_DI_Container.php.

SMWDIContainer::getHash (  ) 

Get a hash string for this data item.

Returns:
string

Reimplemented from SMWDataItem.

Definition at line 171 of file SMW_DI_Container.php.

static SMWDIContainer::doUnserialize ( serialization  )  [static]

Create a data item from the provided serialization string and type ID.

Returns:
SMWDIContainer

TODO May issue an E_NOTICE when problems occur; catch this

Definition at line 181 of file SMW_DI_Container.php.


Member Data Documentation

SMWDIContainer::$m_semanticData [protected]

Definition at line 137 of file SMW_DI_Container.php.


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

Generated on Sun Mar 18 07:15:43 2012 for Semantic MediaWiki by  doxygen 1.5.6