コード例 #1
0
 private function createFilterConditionForAnyOtherComparator($dataItem, $joinVariable, $orderByProperty, $comparator)
 {
     $result = new FilterCondition('', array());
     $this->compoundConditionBuilder->addOrderByData($result, $joinVariable, $dataItem->getDIType());
     $orderByVariable = $result->orderByVariable;
     if ($dataItem instanceof DIWikiPage) {
         $expElement = $this->exporter->getDataItemExpElement($dataItem->getSortKeyDataItem());
     } else {
         $expElement = $this->exporter->getDataItemHelperExpElement($dataItem);
         if (is_null($expElement)) {
             $expElement = $this->exporter->getDataItemExpElement($dataItem);
         }
     }
     $valueName = TurtleSerializer::getTurtleNameForExpElement($expElement);
     if ($expElement instanceof ExpNsResource) {
         $result->namespaces[$expElement->getNamespaceId()] = $expElement->getNamespace();
     }
     $result->filter = "?{$orderByVariable} {$comparator} {$valueName}";
     return $result;
 }
コード例 #2
0
 public function testAddOrderByData_ForWikiPageType()
 {
     $condition = $this->getMockBuilder('\\SMW\\SPARQLStore\\QueryEngine\\Condition\\Condition')->disableOriginalConstructor()->getMockForAbstractClass();
     $instance = new CompoundConditionBuilder();
     $instance->addOrderByData($condition, 'foo', DataItem::TYPE_WIKIPAGE);
     $this->assertEquals('foosk', $condition->orderByVariable);
     $expectedConditionString = $this->stringBuilder->addString('?foo swivt:wikiPageSortKey ?foosk .')->addNewLine()->getString();
     $this->assertEquals($expectedConditionString, $condition->weakConditions['foosk']);
 }