You are here

class EasyRdf_Serialiser_RdfPhp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/RdfPhp.php \EasyRdf_Serialiser_RdfPhp

Class to serialise an EasyRdf_Graph to RDF/PHP with no external dependancies.

@package EasyRdf @copyright Copyright (c) 2009-2013 Nicholas J Humfrey @license http://www.opensource.org/licenses/bsd-license.php

Hierarchy

Expanded class hierarchy of EasyRdf_Serialiser_RdfPhp

1 string reference to 'EasyRdf_Serialiser_RdfPhp'
Format.php in vendor/easyrdf/easyrdf/lib/EasyRdf/Format.php

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/RdfPhp.php, line 46

View source
class EasyRdf_Serialiser_RdfPhp extends EasyRdf_Serialiser {

  /**
   * Method to serialise an EasyRdf_Graph to RDF/PHP
   *
   * http://n2.talis.com/wiki/RDF_PHP_Specification
   * docs/appendix-a-rdf-formats-php.md
   *
   * @param EasyRdf_Graph $graph   An EasyRdf_Graph object.
   * @param string        $format  The name of the format to convert to.
   * @param array         $options
   * @throws EasyRdf_Exception
   * @return string The RDF in the new desired format.
   */
  public function serialise($graph, $format, array $options = array()) {
    parent::checkSerialiseParams($graph, $format);
    if ($format != 'php') {
      throw new EasyRdf_Exception("EasyRdf_Serialiser_RdfPhp does not support: {$format}");
    }

    // Graph is already stored as RDF/PHP resource-centric array internally within the EasyRdf_Graph object
    return $graph
      ->toRdfPhp();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EasyRdf_Serialiser::$prefixes protected property
EasyRdf_Serialiser::addPrefix protected function Keep track of the prefixes used while serialising @ignore
EasyRdf_Serialiser::checkSerialiseParams protected function Check and cleanup parameters passed to serialise() method @ignore
EasyRdf_Serialiser::reversePropertyCount protected function Protected method to get the number of reverse properties for a resource If a resource only has a single property, the number of values for that property is returned instead. @ignore
EasyRdf_Serialiser::__construct public function 4
EasyRdf_Serialiser_RdfPhp::serialise public function Method to serialise an EasyRdf_Graph to RDF/PHP Overrides EasyRdf_Serialiser::serialise 2