SMWExpData Class Reference
[Semantic MediaWiki]

SMWExpData is a data container for export-ready semantic content. More...

Inherits SMWExpElement.

List of all members.

Public Member Functions

 __construct (SMWExpResource $subject)
 Constructor.
 getSubject ()
 Return subject to which the stored semantic annotation refer to.
 addPropertyObjectValue (SMWExpNsResource $property, SMWExpElement $child)
 Store a value for a property identified by its title object.
 getProperties ()
 Return the list of SMWExpResource objects for all properties for which some values have been given.
 getValues (SMWExpResource $property)
 Return the list of SMWExpElement values associated to some property (element).
 getSpecialValues ($namespaceId, $localName)
 Return the list of SMWExpData values associated to some property that is specifed by a standard namespace id and local name.
 extractMainType ()
 This function finds the main type (class) element of the subject based on the current property assignments.
 getCollection ()
 Check if this element encodes an RDF list, and if yes return an array of SMWExpElements corresponding to the collection elements in the specified order.
 getTripleList (SMWExpElement $subject=null)
 Return an array of ternary arrays (subject predicate object) of SMWExpElements that represents the flattened version of this data.

Static Public Member Functions

static makeCollection (array $elements)
 Turn an array of SMWExpElements into an RDF collection.

Protected Attributes

 $m_subject
 $m_children = array()
 $m_edges = array()


Detailed Description

SMWExpData is a data container for export-ready semantic content.

It is organised as a tree-shaped data structure with one root subject and zero or more children connected with labelled edges to the root. Children are again SMWExpData objects, and edges are annotated with SMWExpNsElements specifying properties.

Note:
We do not allow property element without namespace abbreviation here. Property aabbreviations are mandatory for some serialisations.

Definition at line 22 of file SMW_Exp_Data.php.


Constructor & Destructor Documentation

SMWExpData::__construct ( SMWExpResource subject  ) 

Constructor.

$subject is the SMWExpResource for the subject about which this SMWExpData is.

Definition at line 44 of file SMW_Exp_Data.php.

References SMWExpElement::getDataItem().


Member Function Documentation

static SMWExpData::makeCollection ( array $  elements  )  [static]

Turn an array of SMWExpElements into an RDF collection.

Parameters:
$elements array of SMWExpElement
Returns:
SMWExpData

Definition at line 55 of file SMW_Exp_Data.php.

References SMWExporter::getSpecialNsResource().

Referenced by SMWConceptValue::descriptionToExpData().

SMWExpData::getSubject (  ) 

Return subject to which the stored semantic annotation refer to.

Returns:
SMWExpResource

Definition at line 75 of file SMW_Exp_Data.php.

Referenced by SMWExporter::addPropertyValues(), SMWSparqlStore::expandUpdateExpData(), getCollection(), and SMWRDFXMLSerializer::serializeNestedExpData().

SMWExpData::addPropertyObjectValue ( SMWExpNsResource property,
SMWExpElement child 
)

Store a value for a property identified by its title object.

No duplicate elimination as this is usually done in SMWSemanticData already (which is typically used to generate this object).

Parameters:
SMWExpNsResource $property
SMWExpData $child

Definition at line 87 of file SMW_Exp_Data.php.

References SMWExpResource::getUri().

Referenced by SMWExporter::addPropertyValues().

SMWExpData::getProperties (  ) 

Return the list of SMWExpResource objects for all properties for which some values have been given.

Returns:
array of SMWExpResource

Definition at line 101 of file SMW_Exp_Data.php.

SMWExpData::getValues ( SMWExpResource property  ) 

Return the list of SMWExpElement values associated to some property (element).

Returns:
array of SMWExpElement

Definition at line 111 of file SMW_Exp_Data.php.

References SMWExpResource::getUri().

Referenced by getSpecialValues().

SMWExpData::getSpecialValues ( namespaceId,
localName 
)

Return the list of SMWExpData values associated to some property that is specifed by a standard namespace id and local name.

Parameters:
$namespaceId string idetifying a known special namespace (e.g. "rdf")
$localName string of local name (e.g. "type")
Returns:
array of SMWExpData

Definition at line 127 of file SMW_Exp_Data.php.

References SMWExporter::getSpecialNsResource(), and getValues().

SMWExpData::extractMainType (  ) 

This function finds the main type (class) element of the subject based on the current property assignments.

It returns this type element (SMWExpElement) and removes the according type assignement from the data. If no type is assigned, the element for rdf:Resource is returned.

Note:
Under all normal conditions, the result will be an SMWExpResource.
Returns:
SMWExpElement

Definition at line 144 of file SMW_Exp_Data.php.

References SMWExporter::getSpecialNsResource().

Referenced by SMWRDFXMLSerializer::serializeNestedExpData().

SMWExpData::getCollection (  ) 

Check if this element encodes an RDF list, and if yes return an array of SMWExpElements corresponding to the collection elements in the specified order.

Otherwise return false. The method only returns lists that can be encoded using parseType="Collection" in RDF/XML, i.e. only lists of non-literal resources.

Returns:
mixed array of SMWExpElement (but not SMWExpLiteral) or false

Definition at line 168 of file SMW_Exp_Data.php.

References SMWExporter::getSpecialNsResource(), and getSubject().

SMWExpData::getTripleList ( SMWExpElement subject = null  ) 

Return an array of ternary arrays (subject predicate object) of SMWExpElements that represents the flattened version of this data.

Returns:
array of array of SMWExpElement

Definition at line 219 of file SMW_Exp_Data.php.

References SMWExpElement::getDataItem().


Member Data Documentation

SMWExpData::$m_subject [protected]

Definition at line 27 of file SMW_Exp_Data.php.

SMWExpData::$m_children = array() [protected]

Definition at line 33 of file SMW_Exp_Data.php.

SMWExpData::$m_edges = array() [protected]

Definition at line 38 of file SMW_Exp_Data.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