You are here

protected function EasyRdf_Parser_Turtle::parseTriples in Zircon Profile 8.0

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

Parse triples [6] @ignore

1 call to EasyRdf_Parser_Turtle::parseTriples()
EasyRdf_Parser_Turtle::parseStatement in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parse a statement [2] @ignore

File

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

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function parseTriples() {
  $c = $this
    ->peek();

  // If the first character is an open bracket we need to decide which of
  // the two parsing methods for blank nodes to use
  if ($c == '[') {
    $c = $this
      ->read();
    $this
      ->skipWSC();
    $c = $this
      ->peek();
    if ($c == ']') {
      $c = $this
        ->read();
      $this->subject = $this
        ->createBNode();
      $this
        ->skipWSC();
      $this
        ->parsePredicateObjectList();
    }
    else {
      $this
        ->unread('[');
      $this->subject = $this
        ->parseImplicitBlank();
    }
    $this
      ->skipWSC();
    $c = $this
      ->peek();

    // if this is not the end of the statement, recurse into the list of
    // predicate and objects, using the subject parsed above as the subject
    // of the statement.
    if ($c != '.') {
      $this
        ->parsePredicateObjectList();
    }
  }
  else {
    $this
      ->parseSubject();
    $this
      ->skipWSC();
    $this
      ->parsePredicateObjectList();
  }
  $this->subject = null;
  $this->predicate = null;
  $this->object = null;
}