You are here

public function EasyRdf_Serialiser_Rapper::serialise in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Rapper.php \EasyRdf_Serialiser_Rapper::serialise()

Serialise an EasyRdf_Graph to the RDF format of choice.

Parameters

EasyRdf_Graph $graph An EasyRdf_Graph object.:

string $format The name of the format to convert to.:

array $options:

Return value

string The RDF in the new desired format.

Overrides EasyRdf_Serialiser_Ntriples::serialise

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Rapper.php, line 78

Class

EasyRdf_Serialiser_Rapper
Class to serialise an EasyRdf_Graph to RDF using the 'rapper' command line tool.

Code

public function serialise($graph, $format, array $options = array()) {
  parent::checkSerialiseParams($graph, $format);
  $ntriples = parent::serialise($graph, 'ntriples');

  // Hack to produce more concise RDF/XML
  if ($format == 'rdfxml') {
    $format = 'rdfxml-abbrev';
  }
  return EasyRdf_Utils::execCommandPipe($this->rapperCmd, array(
    '--quiet',
    '--input',
    'ntriples',
    '--output',
    $format,
    '-',
    'unknown://',
  ), $ntriples);
}