Example #1
0
 /**
  * Parses an RDF collection.
  *
  * @param  TriplePattern $trp
  *
  * @return Node          The first parsed label
  */
 protected function parseCollection(&$trp)
 {
     $tmpLabel = $this->query->getBlanknodeLabel();
     $firstLabel = $this->parseNode($tmpLabel);
     $this->_fastForward();
     $i = 0;
     while (current($this->tokens) != ")") {
         if ($i > 0) {
             $trp[] = new QueryTriple($this->parseNode($tmpLabel), new Resource("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"), $this->parseNode($tmpLabel = $this->query->getBlanknodeLabel()));
         }
         $trp[] = new QueryTriple($this->parseNode($tmpLabel), new Resource("http://www.w3.org/1999/02/22-rdf-syntax-ns#first"), $this->parseNode());
         $this->_fastForward();
         $i++;
     }
     $trp[] = new QueryTriple($this->parseNode($tmpLabel), new Resource("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"), new Resource("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"));
     return $firstLabel;
 }