protected function EasyRdf_Parser_Turtle::parseNodeID in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php \EasyRdf_Parser_Turtle::parseNodeID()
Parses a blank node ID, e.g: _:node1 @ignore
1 call to EasyRdf_Parser_Turtle::parseNodeID()
- EasyRdf_Parser_Turtle::parseValue in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ Turtle.php - Parses an RDF value. This method parses uriref, qname, node ID, quoted literal, integer, double and boolean. @ignore
File
- vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ Turtle.php, line 1031
Class
- EasyRdf_Parser_Turtle
- Class to parse Turtle with no external dependancies.
Code
protected function parseNodeID() {
// Node ID should start with "_:"
$this
->verifyCharacterOrFail($this
->read(), "_");
$this
->verifyCharacterOrFail($this
->read(), ":");
// Read the node ID
$c = $this
->read();
if ($c == -1) {
throw new EasyRdf_Parser_Exception("Turtle Parse Error: unexpected end of file while reading node id", $this->line, $this->column);
}
elseif (!self::isNameStartChar($c)) {
throw new EasyRdf_Parser_Exception("Turtle Parse Error: expected a letter, found '{$c}'", $this->line, $this->column);
}
// Read all following letter and numbers, they are part of the name
$name = $c;
$c = $this
->read();
while (self::isNameChar($c)) {
$name .= $c;
$c = $this
->read();
}
$this
->unread($c);
return array(
'type' => 'bnode',
'value' => $this
->remapBnode($name),
);
}