Example #1
0
 /**
  * Parses a value constraint.
  *
  * @param GraphPattern $pattern
  * @param boolean $outer     If the constraint is an outer one.
  * @return void
  */
 protected function parseConstraint(&$pattern, $outer)
 {
     $constraint = new Constraint();
     $constraint->setOuterFilter($outer);
     $this->_fastForward();
     $this->_rewind();
     $nBeginKey = key($this->tokens);
     $constraint->setTree($t = $this->parseConstraintTree());
     $nEndKey = key($this->tokens);
     if (current($this->tokens) == '}') {
         prev($this->tokens);
     }
     //for backwards compatibility with the normal sparql engine
     // which does not use the tree array currently
     $expression = trim(implode('', array_slice($this->tokens, $nBeginKey + 1, $nEndKey - $nBeginKey - 1)));
     if ($expression[0] == '(' && substr($expression, -1) == ')') {
         $expression = trim(substr($expression, 1, -1));
     }
     $constraint->addExpression($expression);
     $pattern->addConstraint($constraint);
 }
Example #2
0
 /**
  * Parses a value constraint.
  *
  * @param GraphPattern $pattern
  * @param boolean $outer If the constraint is an outer one.
  */
 protected function _parseConstraint(&$pattern, $outer)
 {
     require_once 'Erfurt/Sparql/Constraint.php';
     $constraint = new Erfurt_Sparql_Constraint();
     $constraint->setOuterFilter($outer);
     $constraint->setTree($this->_parseConstraintTree());
     if (current($this->_tokens) === '}') {
         prev($this->_tokens);
     }
     $pattern->addConstraint($constraint);
 }
Example #3
0
 /**
  * Parses a value constraint.
  *
  * @param  GraphPattern $pattern
  * @return void
  */
 protected function parseConstraint($pattern, $outer)
 {
     $constraint = new Constraint();
     $constraint->setOuterFilter($outer);
     $this->_fastForward();
     if (current($this->tokens) == '(') {
         $this->parseBrackettedExpression(&$constraint);
     } else {
         $this->parseExpression(&$constraint);
     }
     $pattern->addConstraint(&$constraint);
 }