Parse an RDF/XML document into an EasyRdf_Graph
object EasyRdf_Graph $graph the graph to load the data into:
string $data the RDF document data:
string $format the format of the input data:
string $baseUri the base URI of the data being parsed:
integer The number of triples added to the graph
Overrides EasyRdf_Parser::parse
public function parse($graph, $data, $format, $baseUri) {
parent::checkParseParams($graph, $data, $format, $baseUri);
if ($format != 'rdfxml') {
throw new EasyRdf_Exception("EasyRdf_Parser_RdfXml does not support: {$format}");
}
$this
->init($graph, $baseUri);
$this
->resetBnodeMap();
/* xml parser */
$this
->initXMLParser();
/* parse */
if (!xml_parse($this->xmlParser, $data, false)) {
throw new EasyRdf_Exception('XML error: "' . xml_error_string(xml_get_error_code($this->xmlParser)) . '" at line ' . xml_get_current_line_number($this->xmlParser));
}
xml_parser_free($this->xmlParser);
return $this->tripleCount;
}