You are here

protected function EasyRdf_Parser_Turtle::parseSubject in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php \EasyRdf_Parser_Turtle::parseSubject()

Parse a subject [10] @ignore

1 call to EasyRdf_Parser_Turtle::parseSubject()
EasyRdf_Parser_Turtle::parseTriples in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parse triples [6] @ignore

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php, line 318

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function parseSubject() {
  $c = $this
    ->peek();
  if ($c == '(') {
    $this->subject = $this
      ->parseCollection();
  }
  elseif ($c == '[') {
    $this->subject = $this
      ->parseImplicitBlank();
  }
  else {
    $value = $this
      ->parseValue();
    if ($value['type'] == 'uri' or $value['type'] == 'bnode') {
      $this->subject = $value;
    }
    else {
      throw new EasyRdf_Parser_Exception("Turtle Parse Error: illegal subject type: " . $value['type'], $this->line, $this->column);
    }
  }
}