SMWRDFXMLSerializer Class Reference
[Semantic MediaWiki]

Class for serializing exported data (encoded as SMWExpData object) in RDF/XML. More...

Inherits SMWSerializer.

List of all members.

Public Member Functions

 clear ()
 Clear internal states to start a new serialization.
 serializeDeclaration ($uri, $typename)
 Serialize a single declaration for the given $uri (expanded) and type (given as a QName).
 serializeExpData (SMWExpData $expData)
 Serialise the given SMWExpData object.
 flushContent ()
 Get the string that has been serialized so far.

Protected Member Functions

 serializeHeader ()
 Serialize the header (i.e.
 serializeFooter ()
 Serialise the footer (i.e.
 serializeNamespace ($shortname, $uri)
 Serialize a single namespace.
 serializeNestedExpData (SMWExpData $expData, $indent)
 Serialize the given SMWExpData object, possibly recursively with increased indentation.
 serializeExpLiteral (SMWExpNsResource $expResourceProperty, SMWExpLiteral $expLiteral, $indent)
 Add to the output a serialization of a property assignment where an SMWExpLiteral is the object.
 serializeExpResource (SMWExpNsResource $expResourceProperty, SMWExpResource $expResource, $indent, $isClassTypeProp)
 Add to the output a serialization of a property assignment where an SMWExpResource is the object.
 serializeExpCollection (SMWExpNsResource $expResourceProperty, array $collection, $indent, $isClassTypeProp)
 Add a serialization of the given SMWExpResource to the output, assuming that an opening property tag is alerady there.
 makeValueEntityString ($string)
 Escape a string in the special form that is required for values in DTD entity declarations in XML.
 makeAttributeValueString ($string)
 Escape a string as required for using it in XML attribute values.

Protected Attributes

 $namespace_block_started
 True if the $pre_ns_buffer contains the beginning of a namespace declaration block to which further declarations for the current context can be appended.
 $namespaces_are_global
 True if the namespaces that are added at the current serialization stage become global, i.e.


Detailed Description

Class for serializing exported data (encoded as SMWExpData object) in RDF/XML.

Definition at line 19 of file SMW_Serializer_RDFXML.php.


Member Function Documentation

SMWRDFXMLSerializer::clear (  ) 

Clear internal states to start a new serialization.

Reimplemented from SMWSerializer.

Definition at line 36 of file SMW_Serializer_RDFXML.php.

SMWRDFXMLSerializer::serializeHeader (  )  [protected]

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.

Reimplemented from SMWSerializer.

Definition at line 42 of file SMW_Serializer_RDFXML.php.

References SMWExporter::expandURI(), and makeValueEntityString().

SMWRDFXMLSerializer::serializeFooter (  )  [protected]

Serialise the footer (i.e.

write it to the internal buffer).

Reimplemented from SMWSerializer.

Definition at line 69 of file SMW_Serializer_RDFXML.php.

SMWRDFXMLSerializer::serializeDeclaration ( uri,
typename 
)

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

Parameters:
$uri string URI of the thing to declare
$typename string one of owl:Class, owl:ObjectProperty, and owl:datatypeProperty

Reimplemented from SMWSerializer.

Definition at line 74 of file SMW_Serializer_RDFXML.php.

SMWRDFXMLSerializer::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()).

Parameters:
$data SMWExpData containing the data to be serialised.

Reimplemented from SMWSerializer.

Definition at line 78 of file SMW_Serializer_RDFXML.php.

References SMWSerializer::serializeNamespaces(), and serializeNestedExpData().

SMWRDFXMLSerializer::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).

Reimplemented from SMWSerializer.

Definition at line 88 of file SMW_Serializer_RDFXML.php.

SMWRDFXMLSerializer::serializeNamespace ( shortname,
uri 
) [protected]

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.

Parameters:
$shortname string abbreviation/prefix to declare
$uri string URI prefix that the namespace encodes

Reimplemented from SMWSerializer.

Definition at line 95 of file SMW_Serializer_RDFXML.php.

SMWRDFXMLSerializer::serializeNestedExpData ( SMWExpData expData,
indent 
) [protected]

Serialize the given SMWExpData object, possibly recursively with increased indentation.

Parameters:
$expData SMWExpData containing the data to be serialised.
$indent string specifying a prefix for indentation (usually a sequence of tabs)

Definition at line 112 of file SMW_Serializer_RDFXML.php.

References SMWExpData::extractMainType(), SMWExpData::getSubject(), SMWSerializer::isOWLClassTypeProperty(), SMWSerializer::recordDeclarationTypes(), SMWSerializer::requireDeclaration(), SMWSerializer::requireNamespace(), serializeExpCollection(), serializeExpLiteral(), and serializeExpResource().

Referenced by serializeExpCollection(), and serializeExpData().

SMWRDFXMLSerializer::serializeExpLiteral ( SMWExpNsResource expResourceProperty,
SMWExpLiteral expLiteral,
indent 
) [protected]

Add to the output a serialization of a property assignment where an SMWExpLiteral is the object.

It is assumed that a suitable subject block has already been openend.

Parameters:
$expResourceProperty SMWExpNsResource the property to use
$expLiteral SMWExpLiteral the data value to use
$indent string specifying a prefix for indentation (usually a sequence of tabs)

Definition at line 180 of file SMW_Serializer_RDFXML.php.

References SMWExpLiteral::getDatatype(), SMWExpNsResource::getQName(), and makeAttributeValueString().

Referenced by serializeNestedExpData().

SMWRDFXMLSerializer::serializeExpResource ( SMWExpNsResource expResourceProperty,
SMWExpResource expResource,
indent,
isClassTypeProp 
) [protected]

Add to the output a serialization of a property assignment where an SMWExpResource is the object.

It is assumed that a suitable subject block has already been openend.

Parameters:
$expResourceProperty SMWExpNsResource the property to use
$expResource SMWExpResource the data value to use
$indent string specifying a prefix for indentation (usually a sequence of tabs)
$isClassTypeProp boolean whether the resource must be declared as a class

Definition at line 199 of file SMW_Serializer_RDFXML.php.

References SMWExpNsResource::getQName(), makeAttributeValueString(), and SMWSerializer::requireDeclaration().

Referenced by serializeNestedExpData().

SMWRDFXMLSerializer::serializeExpCollection ( SMWExpNsResource expResourceProperty,
array $  collection,
indent,
isClassTypeProp 
) [protected]

Add a serialization of the given SMWExpResource to the output, assuming that an opening property tag is alerady there.

Parameters:
$expResourceProperty SMWExpNsResource the property to use
$expResource array of (SMWExpResource or SMWExpData)
$indent string specifying a prefix for indentation (usually a sequence of tabs)
$isClassTypeProp boolean whether the resource must be declared as a class
Bug:
The $isClassTypeProp parameter is not properly taken into account.
Bug:
Individual resources are not serialised properly.

Definition at line 228 of file SMW_Serializer_RDFXML.php.

References SMWExpNsResource::getQName(), and serializeNestedExpData().

Referenced by serializeNestedExpData().

SMWRDFXMLSerializer::makeValueEntityString ( string  )  [protected]

Escape a string in the special form that is required for values in DTD entity declarations in XML.

Namely, this require the percent sign to be replaced.

Parameters:
$string string to be escaped
Returns:
string

Definition at line 253 of file SMW_Serializer_RDFXML.php.

Referenced by serializeHeader().

SMWRDFXMLSerializer::makeAttributeValueString ( string  )  [protected]

Escape a string as required for using it in XML attribute values.

Parameters:
$string string to be escaped
Returns:
string

Definition at line 263 of file SMW_Serializer_RDFXML.php.

Referenced by serializeExpLiteral(), and serializeExpResource().


Member Data Documentation

SMWRDFXMLSerializer::$namespace_block_started [protected]

True if the $pre_ns_buffer contains the beginning of a namespace declaration block to which further declarations for the current context can be appended.

Definition at line 25 of file SMW_Serializer_RDFXML.php.

SMWRDFXMLSerializer::$namespaces_are_global [protected]

True if the namespaces that are added at the current serialization stage become global, i.e.

remain available for all later contexts. This is the case in RDF/XML only as long as the header has not been streamed to the client (reflected herein by calling flushContent()). Later, namespaces can only be added locally to individual elements, thus requiring them to be re-added multiple times if used in many elements.

Definition at line 34 of file SMW_Serializer_RDFXML.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