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.

  • 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 443 2007-06-01 16:25:38Z cax $
  • access: public

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

Object
   |
   --RdfSerializer
Variable Summary
Method Summary
RdfSerializer RdfSerializer ()
void addNamespacePrefix (String $prefix, String $namespace)
void configSortModel (boolean $bool)
void configUseAttributes (boolean $bool)
void configUseEntities (boolean $bool)
void configUseQnames (boolean $bool)
void configUseXmlDeclaration (boolean $bool)
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)
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
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 (boolean $bool)
  • boolean $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 (boolean $bool)
  • boolean $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 (boolean $bool)
  • boolean $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 (boolean $bool)
  • boolean $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 (boolean $bool)
  • boolean $bool
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

Inherited Methods

Inherited From Object

Object::toString()

Documentation generated on Fri, 1 Jun 2007 16:50:50 +0200 by phpDocumentor 1.3.2