コード例 #1
0
ファイル: QueryBuilder.php プロジェクト: babarinde/asparagus
 /**
  * Returns the plain SPARQL string of this query.
  *
  * @param bool $includePrefixes
  * @return string
  * @throws InvalidArgumentException
  * @throws RangeException
  */
 public function getSPARQL($includePrefixes = true)
 {
     if (!is_bool($includePrefixes)) {
         throw new InvalidArgumentException('$includePrefixes has to be a bool');
     }
     $this->usageValidator->validate();
     $sparql = $includePrefixes ? $this->prefixBuilder->getSPARQL() : '';
     $sparql .= 'SELECT ' . $this->uniqueness . $this->formatSelects() . ' WHERE';
     $sparql .= ' {' . $this->graphBuilder->getSPARQL() . ' }';
     $sparql .= $this->modifierBuilder->getSPARQL();
     return $sparql;
 }
コード例 #2
0
 /**
  * @dataProvider provideTrackPrefixesParsing
  */
 public function testTrackPrefixesParsing($input, $expected)
 {
     $usageValidator = new UsageValidator();
     $usageValidator->trackUsedPrefixes($input);
     $this->setExpectedException('RangeException', $expected);
     $usageValidator->validate();
 }