Class RdfSerializer

Description

An RDF seralizer.

Seralizes models to RDF syntax. It supports the xml:base, xml:lang, rdf:datatype and rdf:nodeID directive. You can choose between different output syntaxes by using the configuration methods or changing the configuration default values in constants.php. This class is based on the java class edu.unika.aifb.rdf.api.syntax.RDFSerializer by Boris Motik.

  • access: public
  • author: Chris Bizer <chris@bizer.de>, Boris Motik <motik@fzi.de>, Daniel Westphal <dawe@gmx.de>, Leandro Mariano Lopez <llopez@xinergiaargentina.com>
  • version: $Id: RdfSerializer.html,v 1.15 2006/06/26 12:34:22 tgauss Exp $

Located in /syntax/RdfSerializer.php (line 23)

Object
   |
   --RdfSerializer
Variable Summary
Method Summary
RdfSerializer RdfSerializer ()
void addNamespacePrefix (String $prefix, String $namespace)
void canAbbreviateValue (object Node $node)
void checkForDoubleAttributes (object Node $predicate)
void collectNamespace (object Resource $resource)
void collectNamespaces (object MemModel $model)
void configSortModel (mixed $bool)
void configUseAttributes (mixed $bool)
void configUseEntities (mixed $bool)
void configUseQnames (mixed $bool)
void configUseXmlDeclaration (mixed $bool)
void getElementText (STRING $elementName)
void getValueQuoteType (STRING $textValue)
void relativizeURI (STRING $uri)
boolean saveAs ( &$model,  $filename, [String $encoding = DEFAULT_ENCODING], object MemModel $model)
string &serialize ( &$model, [ $xml_default_namespace = NULL], [String $encoding = DEFAULT_ENCODING], object MemModel $model)
void writeAbsoluteResourceReference (String $rebaseURI)
void writeEscapedCDATA (STRING $textValue)
void writeGroup ()
void writeResourceReference (Object $object_node)
void writeSubjectURI ( $subject_node, object Node $subject_node )
void writeTextValue (STRING $textValue)
Variables
mixed $m_attributeStatements = array() (line 44)
mixed $m_baseURI (line 37)
mixed $m_contentStatements = array() (line 45)
mixed $m_currentSubject (line 39)
mixed $m_defaultNamespaces = array() (line 33)
mixed $m_groupTypeStatement (line 43)
mixed $m_namespaces = array() (line 34)
mixed $m_nextAutomaticPrefixIndex (line 35)
mixed $m_out (line 36)
mixed $m_rdfAboutElementText (line 41)
mixed $m_rdfIDElementText (line 40)
mixed $m_rdfResourceElementText (line 42)
mixed $m_statements = array() (line 38)
mixed $rdf_qnames (line 29)
mixed $rdf_qname_prefix (line 46)
mixed $sort_model (line 28)
mixed $use_attributes (line 27)
mixed $use_entities (line 26)
mixed $use_xml_declaration (line 30)
Methods
Constructor RdfSerializer (line 53)

Constructor

  • access: public
RdfSerializer RdfSerializer ()
addNamespacePrefix (line 143)

Adds a new prefix/namespace combination.

  • access: public
void addNamespacePrefix (String $prefix, String $namespace)
  • String $prefix
  • String $namespace
canAbbreviateValue (line 631)
  • access: private
void canAbbreviateValue (object Node $node)
  • object Node $node
checkForDoubleAttributes (line 433)
  • access: private
void checkForDoubleAttributes (object Node $predicate)
  • object Node $predicate
collectNamespace (line 700)
  • access: private
void collectNamespace (object Resource $resource)
  • object Resource $resource
collectNamespaces (line 671)
  • access: private
void collectNamespaces (object MemModel $model)
  • object MemModel $model
configSortModel (line 79)

Serializer congiguration: Sort Model Flag if the serializer should sort the model by subject before serializing.

TRUE makes the RDF code more compact. TRUE is default. Default can be changed in constants.php.

  • access: public
void configSortModel (mixed $bool)
configUseAttributes (line 105)

Serializer congiguration: Use Attributes Flag if the serializer should serialize triples as XML attributes where possible.

TRUE makes the RDF code more compact. FALSE is default. Default can be changed in constants.php.

  • access: public
void configUseAttributes (mixed $bool)
configUseEntities (line 92)

Serializer congiguration: Use Entities Flag if the serializer should use entities for URIs.

TRUE makes the RDF code more compact. FALSE is default. Default can be changed in constants.php.

  • access: public
void configUseEntities (mixed $bool)
configUseQnames (line 118)

Serializer congiguration: Use Qnames Flag if the serializer should use qualified names for RDF reserved words.

TRUE makes the RDF code more compact. TRUE is default. Default can be changed in constants.php.

  • access: public
void configUseQnames (mixed $bool)
configUseXmlDeclaration (line 131)

Serializer congiguration: Use XML Declaration Flag if the serializer should start documents with the xml declaration <?xml version="1.0" encoding="UTF-8" ?>.

TRUE is default. Default can be changed in constants.php.

  • access: public
void configUseXmlDeclaration (mixed $bool)
getElementText (line 646)
  • access: private
void getElementText (STRING $elementName)
  • STRING $elementName
getNextNamespacePrefix (line 714)
  • access: private
void getNextNamespacePrefix ()
getValueQuoteType (line 603)
  • access: private
void getValueQuoteType (STRING $textValue)
  • STRING $textValue
relativizeURI (line 445)
  • access: private
void relativizeURI (STRING $uri)
  • STRING $uri
saveAs (line 287)

Serializes a model and saves it into a file.

Returns FALSE if the model couldn't be saved to the file.

  • access: public
boolean saveAs ( &$model,  $filename, [String $encoding = DEFAULT_ENCODING], object MemModel $model)
  • object MemModel $model
  • String $encoding
  • &$model
  • $filename
serialize (line 161)

Serializes a model to RDF syntax.

RDF syntax can be changed by config_use_attributes($boolean), config_use_entities($boolean), config_sort_model($boolean). NOTE: There is only one default namespace allowed within an XML document. Therefore if SER_RDF_QNAMES in constants.php is set to FALSE and you pass another $xml_default_namespace as parameter, the model will be serialized as if SER_RDF_QNAMES were set to TRUE.

  • access: public
string &serialize ( &$model, [ $xml_default_namespace = NULL], [String $encoding = DEFAULT_ENCODING], object MemModel $model)
  • object MemModel $model
  • String $encoding
  • &$model
  • $xml_default_namespace
writeAbsoluteResourceReference (line 569)
  • access: private
void writeAbsoluteResourceReference (String $rebaseURI)
  • String $rebaseURI
writeAttributeStatements (line 488)
  • access: private
void writeAttributeStatements ()
writeContentStatements (line 505)
  • access: private
void writeContentStatements ()
writeDescriptions (line 346)
  • access: private
void writeDescriptions ()
writeEntityDeclarations (line 305)
  • access: private
void writeEntityDeclarations ()
writeEscapedCDATA (line 595)
  • access: private
void writeEscapedCDATA (STRING $textValue)
  • STRING $textValue
writeGroup (line 393)
  • access: private
void writeGroup ()
writeNamespaceDeclarations (line 314)
  • access: private
void writeNamespaceDeclarations ()
writeResourceReference (line 543)
  • access: private
void writeResourceReference (Object $object_node)
writeSubjectURI (line 460)
  • access: private
void writeSubjectURI ( $subject_node, object Node $subject_node )
  • object Node $subject_node
  • $subject_node
writeTextValue (line 584)
  • access: private
void writeTextValue (STRING $textValue)
  • STRING $textValue

Inherited Methods

Inherited From Object

Object::toString()

Documentation generated on Mon, 26 Jun 2006 14:25:56 +0200 by phpDocumentor 1.3.0RC6