/**
  * @since 2.3
  *
  * @param integer $queryFeatureFlag
  *
  * @return boolean
  */
 public function canUseQFeature($queryFeatureFlag)
 {
     $canUse = true;
     // Adhere additional condition
     if ($queryFeatureFlag === SMW_SPARQL_QF_SUBP) {
         $canUse = $this->engineOptions->get('smwgQSubpropertyDepth') > 0;
     }
     if ($queryFeatureFlag === SMW_SPARQL_QF_SUBC) {
         $canUse = $this->engineOptions->get('smwgQSubcategoryDepth') > 0;
     }
     return $this->engineOptions->get('smwgSparqlQFeatures') === ($this->engineOptions->get('smwgSparqlQFeatures') | $queryFeatureFlag) && $canUse;
 }
 /**
  * Get a SPARQL option array for the given query.
  *
  * @param Query $query
  * @param Condition $compoundCondition (storing order by variable names)
  *
  * @return array
  */
 protected function getOptions(Query $query, Condition $compoundCondition)
 {
     $result = array('LIMIT' => $query->getLimit() + 1, 'OFFSET' => $query->getOffset());
     // Build ORDER BY options using discovered sorting fields.
     if ($this->engineOptions->get('smwgQSortingSupport')) {
         $orderByString = '';
         foreach ($query->sortkeys as $propkey => $order) {
             if (!is_string($propkey)) {
                 throw new RuntimeException("Expected a string value as sortkey");
             }
             if ($order != 'RANDOM' && array_key_exists($propkey, $compoundCondition->orderVariables)) {
                 $orderByString .= "{$order}(?" . $compoundCondition->orderVariables[$propkey] . ") ";
             } elseif ($order == 'RANDOM' && $this->engineOptions->get('smwgQRandSortingSupport')) {
                 // not supported in SPARQL; might be possible via function calls in some stores
             }
         }
         if ($orderByString !== '') {
             $result['ORDER BY'] = $orderByString;
         }
     }
     return $result;
 }
 public function testUnregisteredKeyThrowsException()
 {
     $instance = new EngineOptions();
     $this->setExpectedException('InvalidArgumentException');
     $instance->get('Foo');
 }