/dev/null", $output, $status); if ($status != 0) { throw new EasyRdf_Exception( "Failed to execute the command '$rapperCmd': $result" ); } elseif (version_compare($result, self::MINIMUM_RAPPER_VERSION) < 0) { throw new EasyRdf_Exception( "Version ".self::MINIMUM_RAPPER_VERSION." or higher of rapper is required." ); } else { $this->rapperCmd = $rapperCmd; } } /** * Parse an RDF document into an EasyRdf_Graph * * @param object EasyRdf_Graph $graph the graph to load the data into * @param string $data the RDF document data * @param string $format the format of the input data * @param string $baseUri the base URI of the data being parsed * @return integer The number of triples added to the graph */ public function parse($graph, $data, $format, $baseUri) { parent::checkParseParams($graph, $data, $format, $baseUri); $json = EasyRdf_Utils::execCommandPipe( $this->rapperCmd, array( '--quiet', '--input', $format, '--output', 'json', '--ignore-errors', '--input-uri', $baseUri, '--output-uri', '-', '-' ), $data ); // Parse in the JSON return parent::parse($graph, $json, 'json', $baseUri); } }