public function EasyRdf_Parser_Turtle::parse in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php \EasyRdf_Parser_Turtle::parse()
Parse Turtle into an EasyRdf_Graph
Parameters
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:
Return value
integer The number of triples added to the graph
Overrides EasyRdf_Parser_Ntriples::parse
File
- vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ Turtle.php, line 84
Class
- EasyRdf_Parser_Turtle
- Class to parse Turtle with no external dependancies.
Code
public function parse($graph, $data, $format, $baseUri) {
parent::checkParseParams($graph, $data, $format, $baseUri);
if ($format != 'turtle') {
throw new EasyRdf_Exception("EasyRdf_Parser_Turtle does not support: {$format}");
}
$this->data = $data;
$this->namespaces = array();
$this->subject = null;
$this->predicate = null;
$this->object = null;
$this->line = 1;
$this->column = 1;
$this
->resetBnodeMap();
$c = $this
->skipWSC();
while ($c != -1) {
$this
->parseStatement();
$c = $this
->skipWSC();
}
return $this->tripleCount;
}