Semantic MediaWiki and related extensions
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
SMWExpData Class Reference
Inheritance diagram for SMWExpData:
Inheritance graph
[legend]
Collaboration diagram for SMWExpData:
Collaboration graph
[legend]

Public Member Functions

 __construct (SMWExpResource $subject)
 
 getDataItem ()
 
 getHash ()
 
 getSubject ()
 
 addPropertyObjectValue (SMWExpNsResource $property, Element $child)
 
 getProperties ()
 
 getValues (SMWExpResource $property)
 
 getSpecialValues ( $namespaceId, $localName)
 
 extractMainType ()
 
 getCollection ()
 
 getTripleList (Element $subject=null)
 

Static Public Member Functions

static makeCollection (array $elements)
 

Protected Attributes

 $m_subject
 
 $m_children = []
 
 $m_edges = []
 

Additional Inherited Members

- Public Attributes inherited from SMW\Exporter\Element
const TYPE_RESOURCE = 0
 
const TYPE_NSRESOURCE = 1
 
const TYPE_LITERAL = 2
 

Detailed Description

SMWExpData is a class representing semantic data that is ready for easy serialisation in OWL or RDF.

Author
Markus Krötzsch 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.

Constructor & Destructor Documentation

◆ __construct()

SMWExpData::__construct ( SMWExpResource  $subject)

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

Member Function Documentation

◆ addPropertyObjectValue()

SMWExpData::addPropertyObjectValue ( SMWExpNsResource  $property,
Element  $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
Element$child

◆ extractMainType()

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

◆ getCollection()

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

◆ getDataItem()

SMWExpData::getDataItem ( )
Since
2.2
Returns
DataItem|null

Implements SMW\Exporter\Element.

◆ getHash()

SMWExpData::getHash ( )
Since
2.2
Returns
string

Implements SMW\Exporter\Element.

◆ getProperties()

SMWExpData::getProperties ( )

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

Returns
array of SMWExpResource

◆ getSpecialValues()

SMWExpData::getSpecialValues (   $namespaceId,
  $localName 
)

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

Parameters
$namespaceIdstring idetifying a known special namespace (e.g. "rdf")
$localNamestring of local name (e.g. "type")
Returns
array of SMWExpData

◆ getSubject()

SMWExpData::getSubject ( )

Return subject to which the stored semantic annotation refer to.

Returns
SMWExpResource

◆ getTripleList()

SMWExpData::getTripleList ( Element  $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

◆ getValues()

SMWExpData::getValues ( SMWExpResource  $property)

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

Returns
array of SMWExpElement

◆ makeCollection()

static SMWExpData::makeCollection ( array  $elements)
static

Turn an array of SMWExpElements into an RDF collection.

Parameters
$elementsarray of SMWExpElement
Returns
SMWExpData

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

About | General disclaimer | Privacy policy