/**
  * @since 2.2
  *
  * {@inheritDoc}
  */
 public function interpretDescription(Description $description)
 {
     $joinVariable = $this->compoundConditionBuilder->getJoinVariable();
     $orderByProperty = $this->compoundConditionBuilder->getOrderByProperty();
     $nspropExpElement = $this->exporter->getSpecialNsResource('swivt', 'wikiNamespace');
     $nsExpElement = new ExpLiteral(strval($description->getNamespace()), 'http://www.w3.org/2001/XMLSchema#integer');
     $nsName = TurtleSerializer::getTurtleNameForExpElement($nsExpElement);
     $condition = "{ ?{$joinVariable} " . $nspropExpElement->getQName() . " {$nsName} . }\n";
     $result = new WhereCondition($condition, true, array());
     $this->compoundConditionBuilder->addOrderByDataForProperty($result, $joinVariable, $orderByProperty, DataItem::TYPE_WIKIPAGE);
     return $result;
 }
 /**
  * @since 2.2
  *
  * {@inheritDoc}
  */
 public function interpretDescription(Description $description)
 {
     $joinVariable = $this->compoundConditionBuilder->getJoinVariable();
     $orderByProperty = $this->compoundConditionBuilder->getOrderByProperty();
     list($condition, $namespaces) = $this->mapCategoriesToConditionElements($description->getCategories(), $joinVariable);
     // empty disjunction: always false, no results to order
     if ($condition === '') {
         return new FalseCondition();
     }
     $result = new WhereCondition($condition, true, $namespaces);
     $this->compoundConditionBuilder->addOrderByDataForProperty($result, $joinVariable, $orderByProperty, DataItem::TYPE_WIKIPAGE);
     return $result;
 }
 /**
  * @since 2.2
  *
  * {@inheritDoc}
  */
 public function interpretDescription(Description $description)
 {
     $joinVariable = $this->compoundConditionBuilder->getJoinVariable();
     $orderByProperty = $this->compoundConditionBuilder->getOrderByProperty();
     $dataItem = $description->getDataItem();
     $property = $description->getProperty();
     switch ($description->getComparator()) {
         case SMW_CMP_EQ:
             $comparator = '=';
             break;
         case SMW_CMP_LESS:
             $comparator = '<';
             break;
         case SMW_CMP_GRTR:
             $comparator = '>';
             break;
         case SMW_CMP_LEQ:
             $comparator = '<=';
             break;
         case SMW_CMP_GEQ:
             $comparator = '>=';
             break;
         case SMW_CMP_NEQ:
             $comparator = '!=';
             break;
         case SMW_CMP_LIKE:
             $comparator = 'regex';
             break;
         case SMW_CMP_NLKE:
             $comparator = '!regex';
             break;
         default:
             $comparator = '';
             // unkown, unsupported
     }
     if ($comparator === '') {
         return $this->createConditionForEmptyComparator($joinVariable, $orderByProperty);
     } elseif ($comparator == '=') {
         return $this->createConditionForEqualityComparator($dataItem, $property, $joinVariable, $orderByProperty);
     } elseif ($comparator == 'regex' || $comparator == '!regex') {
         return $this->createConditionForRegexComparator($dataItem, $joinVariable, $orderByProperty, $comparator);
     }
     return $this->createFilterConditionForAnyOtherComparator($dataItem, $joinVariable, $orderByProperty, $comparator);
 }
 /**
  * @since 2.2
  *
  * {@inheritDoc}
  */
 public function interpretDescription(Description $description)
 {
     $joinVariable = $this->compoundConditionBuilder->getJoinVariable();
     $orderByProperty = $this->compoundConditionBuilder->getOrderByProperty();
     $subDescriptions = $description->getDescriptions();
     $result = $this->doPreliminarySubDescriptionCheck($subDescriptions, $joinVariable, $orderByProperty);
     if ($result !== null) {
         return $result;
     }
     $subConditionElements = $this->doResolveSubDescriptionsRecursively($subDescriptions, $joinVariable);
     if ($subConditionElements instanceof FalseCondition) {
         return $subConditionElements;
     }
     $result = $this->createConditionFromSubConditionElements($subConditionElements);
     $result->weakConditions = $subConditionElements->weakConditions;
     $result->orderVariables = $subConditionElements->orderVariables;
     $this->compoundConditionBuilder->addOrderByDataForProperty($result, $joinVariable, $orderByProperty);
     return $result;
 }
 /**
  * @since 2.2
  *
  * {@inheritDoc}
  */
 public function interpretDescription(Description $description)
 {
     $joinVariable = $this->compoundConditionBuilder->getJoinVariable();
     $orderByProperty = $this->compoundConditionBuilder->getOrderByProperty();
     $conceptDescription = $this->getConceptDescription($description->getConcept());
     if ($conceptDescription === '') {
         return new FalseCondition();
     }
     $hash = 'concept-' . $conceptDescription->getQueryString();
     $this->compoundConditionBuilder->getCircularReferenceGuard()->mark($hash);
     if ($this->compoundConditionBuilder->getCircularReferenceGuard()->isCircularByRecursionFor($hash)) {
         $this->compoundConditionBuilder->addError(wfMessage('smw-query-condition-circular', $conceptDescription->getQueryString())->text());
         return new FalseCondition();
     }
     $this->compoundConditionBuilder->setJoinVariable($joinVariable);
     $this->compoundConditionBuilder->setOrderByProperty($orderByProperty);
     $condition = $this->compoundConditionBuilder->mapDescriptionToCondition($conceptDescription);
     $this->compoundConditionBuilder->getCircularReferenceGuard()->unmark($hash);
     return $condition;
 }
 /**
  * @since 2.2
  *
  * {@inheritDoc}
  */
 public function interpretDescription(Description $description)
 {
     $joinVariable = $this->compoundConditionBuilder->getJoinVariable();
     $orderByProperty = $this->compoundConditionBuilder->getOrderByProperty();
     $property = $description->getProperty();
     list($innerOrderByProperty, $innerCondition, $innerJoinVariable) = $this->doResolveInnerConditionRecursively($property, $description->getDescription());
     if ($innerCondition instanceof FalseCondition) {
         return new FalseCondition();
     }
     $namespaces = $innerCondition->namespaces;
     $objectName = $this->findObjectNameFromInnerCondition($innerCondition, $innerJoinVariable, $namespaces);
     list($subjectName, $objectName, $nonInverseProperty) = $this->doExchangeForWhenInversePropertyIsUsed($property, $objectName, $joinVariable);
     $propertyName = $this->getPropertyNameByUsingTurtleSerializer($property, $nonInverseProperty, $namespaces);
     $condition = $this->concatenateToConditionString($subjectName, $propertyName, $objectName, $innerCondition);
     $result = new WhereCondition($condition, true, $namespaces);
     // Record inner ordering variable if found
     $result->orderVariables = $innerCondition->orderVariables;
     if ($innerOrderByProperty !== null && $innerCondition->orderByVariable !== '') {
         $result->orderVariables[$property->getKey()] = $innerCondition->orderByVariable;
     }
     $this->compoundConditionBuilder->addOrderByDataForProperty($result, $joinVariable, $orderByProperty, DataItem::TYPE_WIKIPAGE);
     return $result;
 }
 /**
  * @since 2.2
  *
  * {@inheritDoc}
  */
 public function interpretDescription(Description $description)
 {
     return $this->compoundConditionBuilder->newTrueCondition($this->compoundConditionBuilder->getJoinVariable(), $this->compoundConditionBuilder->getOrderByProperty());
 }