BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
SMWSerializer Class Reference
Inheritance diagram for SMWSerializer:

Public Member Functions

 __construct ()
 clear ()
 startSerialization ()
 finishSerialization ()
 serializeDeclarations ()
 serializeDeclaration ($uri, $typename)
 serializeExpData (SMWExpData $data)
 flushContent ()

Protected Member Functions

 serializeHeader ()
 serializeFooter ()
 serializeNamespaces ()
 serializeNamespace ($shortname, $uri)
 requireNamespace ($nsshort, $nsuri)
 requireDeclaration (SMWExpResource $resource, $decltype)
 recordDeclarationTypes (SMWExpData $expData)
 declarationDone (SMWExpResource $element, $typeflag)
 isOWLClassTypeProperty (SMWExpNsResource $property)

Protected Attributes


Detailed Description

Abstract class for serializing exported data (encoded as SMWExpData object) in a concrete syntactic format such as Turtle or RDF/XML. The serializer adds object serialisations to an internal string that can be retrieved for pushing it to an output. This abstract class does not define this string as implementations may want to use their own scheme (e.g. using two buffers as in the case of SMWRDFXMLSerializer). The function flushContent() returns the string serialized so far so as to enable incremental serialization.

RDF and OWL have two types of dependencies that are managed by this class: namespaces (and similar abbreviation schemes) and element declarations. The former need to be defined before being used, while the latter can occur at some later point in the serialization. Declarations are relevant to the OWL data model, being one of Class, DatatypeProperty, and ObjectProperty (only the latter two are mutually exclusive). This class determines the required declaration from the context in which an element is used.

Constructor & Destructor Documentation

SMWSerializer::__construct ( )


Member Function Documentation

SMWSerializer::clear ( )

Clear internal states to start a new serialization.

SMWSerializer::declarationDone ( SMWExpResource  $element,

Update the declaration "todo" and "done" lists to reflect the fact that the given element has been declared to has the given type.

$elementSMWExpResource specifying the element to update
$typeflaginteger specifying the type (e.g. SMW_SERIALIZER_DECL_CLASS)
SMWSerializer::finishSerialization ( )

Complete the serialization so that calling flushContent() will return the final part of the output, leading to a complete serialization with all necessary declarations. No further serialization functions must be called after this.

SMWSerializer::flushContent ( )

Get the string that has been serialized so far. This function also resets the internal buffers for serilized strings and namespaces (what is flushed is gone).

SMWSerializer::isOWLClassTypeProperty ( SMWExpNsResource  $property)

Check if the given property is one of the special properties of the OWL language that require their values to be classes or RDF lists of classes. In these cases, it is necessary to declare this in the exported data.

The list of properties checked here is not complete for the OWL language but covers what is used in SMW.
OWL 2 allows URIs to refer to both classes and individual elements in different contexts. We only need declarations for classes that are used as such, hence it is enough to check the property. Moreover, we do not use OWL Datatypes in SMW, so rdf:type, rdfs:domain, etc. always refer to classes.
SMWSerializer::recordDeclarationTypes ( SMWExpData  $expData)

Update the declaration "todo" and "done" lists for the case that the given data has been serialized with the type information it provides.

$expDataspecifying the type data upon which declarations are based
SMWSerializer::requireDeclaration ( SMWExpResource  $resource,

State that a certain declaration is needed. The method checks if the declaration is already available, and records a todo otherwise.

SMWSerializer::requireNamespace (   $nsshort,

Require an additional namespace to be declared in the serialization. The function checks whether the required namespace is available globally and add it to the list of required namespaces otherwise.

SMWSerializer::serializeDeclaration (   $uri,

Serialize a single declaration for the given $uri (expanded) and type (given as a QName).

$uristring URI of the thing to declare
$typenamestring one of owl:Class, owl:ObjectProperty, and owl:datatypeProperty
SMWSerializer::serializeDeclarations ( )

Serialize any declarations that have been found to be missing while serializing other elements.

SMWSerializer::serializeExpData ( SMWExpData  $data)

Serialise the given SMWExpData object. The method must not assume that the exported data refers to wiki pages or other SMW data, and it must ensure that all required auxiliary declarations for obtaining proper OWL are included in any case (this can be done using requireDeclaration()).

$dataSMWExpData containing the data to be serialised.
SMWSerializer::serializeFooter ( )

Serialise the footer (i.e. write it to the internal buffer).

SMWSerializer::serializeHeader ( )

Serialize the header (i.e. write it to the internal buffer). May include standard syntax to start output but also declare some common namespaces globally.

SMWSerializer::serializeNamespace (   $shortname,

Serialize a single namespace. Namespaces that were serialized in such a way that they remain available for all following output should be added to $global_namespaces.

$shortnamestring abbreviation/prefix to declare
$uristring URI prefix that the namespace encodes
SMWSerializer::serializeNamespaces ( )

Include collected namespace information into the serialization.

SMWSerializer::startSerialization ( )

Start a new serialization, resetting all internal data and serializing necessary header elements.

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