protected function 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 drupal/core/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

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php, line 906

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function parseNodeID() {

  // Node ID should start with "_:"
  $this
    ->verifyCharacter($this
    ->read(), "_");
  $this
    ->verifyCharacter($this
    ->read(), ":");

  // Read the node ID
  $c = $this
    ->read();
  if ($c == -1) {
    throw new EasyRdf_Exception("Turtle Parse Error: unexpected end of file while reading node id");
  }
  elseif (!self::isNameStartChar($c)) {
    throw new EasyRdf_Exception("Turtle Parse Error: expected a letter, found '{$c}'");
  }

  // 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),
  );
}