/** * Parses the FROM clause. * * @return void * @throws SparqlParserException */ protected function parseFrom() { $this->_fastForward(); if (strtolower(current($this->tokens)) != 'named') { if ($this->iriCheck(current($this->tokens)) || $this->qnameCheck(current($this->tokens))) { $this->query->addFrom(new Resource(substr(current($this->tokens), 1, -1))); } else { if ($this->varCheck(current($this->tokens))) { $this->query->addFrom(current($this->tokens)); } else { throw new SparqlParserException("Variable, Iri or qname expected in FROM ", null, key($this->tokens)); } } $this->query->addFrom(current($this->tokens)); } else { $this->_fastForward(); if ($this->iriCheck(current($this->tokens)) || $this->qnameCheck(current($this->tokens))) { $this->query->addFromNamed(new Resource(substr(current($this->tokens), 1, -1))); } else { if ($this->varCheck(current($this->tokens))) { $this->query->addFromNamed(current($this->tokens)); } else { throw new SparqlParserException("Variable, Iri or qname expected in FROM NAMED ", null, key($this->tokens)); } } } }