private function searchForResultsThatCompareEqualToOnlySingularPropertyOf(DIProperty $property)
 {
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($property);
     $description = new SomeProperty($property, new ThingDescription());
     $description->addPrintRequest(new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue));
     $query = new Query($description);
     $query->querymode = Query::MODE_INSTANCES;
     return $this->getStore()->getQueryResult($query);
 }
Example #2
0
 /**
  * @dataProvider somePropertyProvider
  */
 public function testCommonMethods($property, $description, $expected)
 {
     $instance = new SomeProperty($property, $description);
     $this->assertEquals($expected['property'], $instance->getProperty());
     $this->assertEquals($expected['description'], $instance->getDescription());
     $this->assertEquals($expected['queryString'], $instance->getQueryString());
     $this->assertEquals($expected['queryStringAsValue'], $instance->getQueryString(true));
     $this->assertEquals($expected['isSingleton'], $instance->isSingleton());
     $this->assertEquals(array(), $instance->getPrintRequests());
     $this->assertEquals($expected['size'], $instance->getSize());
     $this->assertEquals($expected['depth'], $instance->getDepth());
     $this->assertEquals($expected['queryFeatures'], $instance->getQueryFeatures());
 }
 public function testSubjects_onCategoryCondition()
 {
     $property = new DIProperty('_INST');
     $dataValue = $this->dataValueFactory->newPropertyObjectValue($property, 'SomeCategory');
     $semanticData = $this->semanticDataFactory->newEmptySemanticData(__METHOD__);
     $semanticData->addDataValue($dataValue);
     $this->getStore()->updateData($semanticData);
     $this->assertArrayHasKey($property->getKey(), $this->getStore()->getSemanticData($semanticData->getSubject())->getProperties());
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($property);
     $description = new SomeProperty($property, new ThingDescription());
     $description->addPrintRequest(new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue));
     $query = new Query($description, false, false);
     $query->querymode = Query::MODE_INSTANCES;
     $queryResult = $this->getStore()->getQueryResult($query);
     $this->queryResultValidator->assertThatQueryResultHasSubjects($semanticData->getSubject(), $this->searchForResultsThatCompareEqualToClassOf('SomeCategory'));
     $this->queryResultValidator->assertThatQueryResultContains($dataValue, $this->searchForResultsThatCompareEqualToClassOf('SomeCategory'));
 }
 public function testUserDefinedBlobProperty()
 {
     $property = new DIProperty('SomeBlobProperty');
     $property->setPropertyTypeId('_txt');
     $dataItem = new DIBlob('SomePropertyBlobValue');
     $semanticData = $this->semanticDataFactory->newEmptySemanticData(__METHOD__);
     $semanticData->addDataValue($this->dataValueFactory->newDataItemValue($dataItem, $property));
     $this->getStore()->updateData($semanticData);
     $this->assertArrayHasKey($property->getKey(), $this->getStore()->getSemanticData($semanticData->getSubject())->getProperties());
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($property);
     $description = new SomeProperty($property, new ThingDescription());
     $description->addPrintRequest(new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue));
     $query = new Query($description, false, false);
     $query->querymode = Query::MODE_INSTANCES;
     $queryResult = $this->getStore()->getQueryResult($query);
     $this->queryResultValidator->assertThatQueryResultContains($dataItem, $queryResult);
 }
 public function testCreatePageWithSubobjectParserFunctionForQueryResultLookup()
 {
     $this->titles[] = Title::newFromText('CreatePageWithSubobjectParserFunction');
     $pageCreator = new PageCreator();
     $pageCreator->createPage(Title::newFromText('Has subobject parser function test', SMW_NS_PROPERTY))->doEdit('[[Has type::Page]]');
     $property = DIProperty::newFromUserLabel('Has subobject parser function test');
     $pageCreator->createPage($this->titles[0])->doEdit('{{#subobject:|Has subobject parser function test=WXYZ|@sortkey=B}}' . '{{#subobject:|Has subobject parser function test=ABCD|@sortkey=A}}' . '{{#subobject:|Has subobject parser function test=ABCD|@sortkey=A}}' . '{{#subobject:|Has subobject parser function test=ABCD|@sortkey=C}}');
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($property);
     $description = new SomeProperty($property, new ThingDescription());
     $description->addPrintRequest(new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue));
     $query = new Query($description, false, false);
     $query->querymode = Query::MODE_COUNT;
     $result = $this->getStore()->getQueryResult($query);
     $this->assertEquals(3, $result instanceof \SMWQueryResult ? $result->getCountValue() : $result);
     $query->querymode = Query::MODE_INSTANCES;
     $this->assertCount(3, $this->getStore()->getQueryResult($query)->getResults());
 }
 public function testRandomOrder()
 {
     $factsheet = $this->fixturesProvider->getFactsheet('Berlin');
     $populationValue = $factsheet->getPopulationValue();
     $this->getStore()->updateData($factsheet->asEntity());
     /**
      * @query [[Population::+]]
      */
     $property = $this->fixturesProvider->getProperty('Population');
     $description = new SomeProperty($property, new ThingDescription());
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($property);
     $description->addPrintRequest(new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue));
     $query = new Query($description, false, false);
     $query->querymode = Query::MODE_INSTANCES;
     $query->sort = true;
     $query->sortkeys = array('Population' => 'RANDOM');
     $queryResult = $this->getStore()->getQueryResult($query);
     $this->assertEquals(3, $queryResult->getCount());
 }
 /**
  * @dataProvider specialCharactersNameProvider
  */
 public function testSpecialCharactersInQuery($subject, $subobjectId, $property, $dataItem)
 {
     $dataValue = $this->dataValueFactory->newDataItemValue($dataItem, $property);
     $semanticData = $this->semanticDataFactory->newEmptySemanticData($subject);
     $semanticData->addDataValue($dataValue);
     $subobject = new Subobject($semanticData->getSubject()->getTitle());
     $subobject->setEmptyContainerForId($subobjectId);
     $subobject->addDataValue($dataValue);
     $semanticData->addSubobject($subobject);
     $this->getStore()->updateData($semanticData);
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($property);
     $description = new SomeProperty($property, new ThingDescription());
     $description->addPrintRequest(new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue));
     $query = new Query($description, false, false);
     $query->querymode = Query::MODE_INSTANCES;
     $this->queryResultValidator->assertThatQueryResultHasSubjects(array($semanticData->getSubject(), $subobject->getSubject()), $this->getStore()->getQueryResult($query));
     $this->queryResultValidator->assertThatQueryResultContains($dataValue, $this->getStore()->getQueryResult($query));
     $this->subjectsToBeCleared = array($semanticData->getSubject(), $subobject->getSubject(), $property->getDIWikiPage());
 }
 public function testUserDefinedDateProperty()
 {
     $property = new DIProperty('SomeDateProperty');
     $property->setPropertyTypeId('_dat');
     $dataValue = $this->dataValueFactory->newDataValueByProperty($property, '1 January 1970');
     $semanticData = $this->semanticDataFactory->newEmptySemanticData(__METHOD__);
     $semanticData->addDataValue($dataValue);
     $this->getStore()->updateData($semanticData);
     Exporter::getInstance()->clear();
     $this->assertArrayHasKey($property->getKey(), $this->getStore()->getSemanticData($semanticData->getSubject())->getProperties());
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($property);
     $description = new SomeProperty($property, new ThingDescription());
     $description->addPrintRequest(new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue));
     $query = new Query($description, false, false);
     $query->querymode = Query::MODE_INSTANCES;
     $queryResult = $this->getStore()->getQueryResult($query);
     $this->queryResultValidator->assertThatQueryResultContains($dataValue, $queryResult);
     $this->subjectsToBeCleared[] = $semanticData->getSubject();
 }
 public function testSubpropertyToQueryFromTopHierarchy()
 {
     if (!$this->getStore() instanceof \SMWSQLStore3) {
         $this->markTestSkipped("Subproperty/property hierarchies are currently only supported by the SQLStore");
     }
     $semanticDataOfSpouse = $this->semanticDataFactory->setSubject(new DIWikiPage('Spouse', SMW_NS_PROPERTY, ''))->newEmptySemanticData();
     $property = new DIProperty('Wife');
     $property->setPropertyTypeId('_wpg');
     $this->addPropertyHierarchy($property, 'Spouse');
     $dataValue = $this->dataValueFactory->newPropertyObjectValue($property, 'Lien');
     $semanticData = $this->semanticDataFactory->newEmptySemanticData(__METHOD__);
     $semanticData->addDataValue($dataValue);
     $this->getStore()->updateData($semanticDataOfSpouse);
     $this->getStore()->updateData($semanticData);
     $description = new SomeProperty(new DIProperty('Spouse'), new ThingDescription());
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($property);
     $description->addPrintRequest(new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue));
     $query = new Query($description, false, false);
     $query->querymode = Query::MODE_INSTANCES;
     $queryResult = $this->getStore()->getQueryResult($query);
     $this->queryResultValidator->assertThatQueryResultContains($dataValue, $queryResult);
     $this->subjectsToBeCleared = array($semanticData->getSubject(), $semanticDataOfSpouse->getSubject(), $property->getDiWikiPage());
 }
 private function doMapSomeProperty(SomeProperty $description, &$exact)
 {
     $result = new ExpData(new ExpResource(''));
     $result->addPropertyObjectValue($this->exporter->getSpecialNsResource('rdf', 'type'), new ExpData($this->exporter->getSpecialNsResource('owl', 'Restriction')));
     $property = $description->getProperty();
     if ($property->isInverse()) {
         $property = new DIProperty($property->getKey());
     }
     $result->addPropertyObjectValue($this->exporter->getSpecialNsResource('owl', 'onProperty'), new ExpData($this->exporter->getResourceElementForProperty($property)));
     $subdata = $this->getExpDataFromDescription($description->getDescription(), $exact);
     if ($description->getDescription() instanceof ValueDescription && $description->getDescription()->getComparator() === SMW_CMP_EQ) {
         $result->addPropertyObjectValue($this->exporter->getSpecialNsResource('owl', 'hasValue'), $subdata);
     } else {
         if ($subdata === false) {
             $owltype = $this->exporter->getOWLPropertyType($description->getProperty()->findPropertyTypeID());
             if ($owltype == 'ObjectProperty') {
                 $subdata = new ExpData($this->exporter->getSpecialNsResource('owl', 'Thing'));
             } elseif ($owltype == 'DatatypeProperty') {
                 $subdata = new ExpData($this->exporter->getSpecialNsResource('rdfs', 'Literal'));
             } else {
                 // no restrictions at all with annotation properties ...
                 return new ExpData($this->exporter->getSpecialNsResource('owl', 'Thing'));
             }
         }
         $result->addPropertyObjectValue($this->exporter->getSpecialNsResource('owl', 'someValuesFrom'), $subdata);
     }
     return $result;
 }
 public function queryProvider()
 {
     $subject = DIWikiPage::newFromText('Foo');
     #0
     $description = new SomeProperty(new DIProperty('Foobar'), new ValueDescription(DIWikiPage::newFromText('Bar')));
     $query = new Query($description);
     $query->setSubject($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('Bar'), DIWikiPage::newFromText('Foobar', SMW_NS_PROPERTY)));
     #1
     $description = new SomeProperty(new DIProperty('Foobar'), new ValueDescription(new DIBlob('Bar')));
     $query = new Query($description);
     $query->setSubject($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('Foobar', SMW_NS_PROPERTY)));
     #2 uses inverse property declaration
     $description = new SomeProperty(new DIProperty('Foobar', true), new ValueDescription(DIWikiPage::newFromText('Bar')));
     $query = new Query($description);
     $query->setSubject($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('Bar'), DIWikiPage::newFromText('Foobar', SMW_NS_PROPERTY)));
     #3 Conjunction
     $description = new SomeProperty(new DIProperty('Foobar'), new ValueDescription(DIWikiPage::newFromText('Bar')));
     $query = new Query(new Conjunction(array($description, new NamespaceDescription(NS_MAIN))));
     $query->setSubject($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('Bar'), DIWikiPage::newFromText('Foobar', SMW_NS_PROPERTY)));
     #4 Disjunction
     $description = new SomeProperty(new DIProperty('Foobar'), new ValueDescription(DIWikiPage::newFromText('Bar')));
     $query = new Query(new Disjunction(array($description, new NamespaceDescription(NS_MAIN))));
     $query->setSubject($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('Bar'), DIWikiPage::newFromText('Foobar', SMW_NS_PROPERTY)));
     #5
     $description = new ClassDescription(DIWikiPage::newFromText('Foocat', NS_CATEGORY));
     $query = new Query($description);
     $query->setSubject($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('Foocat', NS_CATEGORY)));
     #6
     $description = new ConceptDescription(DIWikiPage::newFromText('FooConcept', SMW_NS_CONCEPT));
     $query = new Query($description);
     $query->setSubject($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('FooConcept', SMW_NS_CONCEPT)));
     #7 Printrequest
     $pv = \SMWPropertyValue::makeUserProperty('Foobaz');
     $description = new SomeProperty(new DIProperty('Foobar', true), new ValueDescription(DIWikiPage::newFromText('Bar')));
     $description->addPrintRequest(new PrintRequest(PrintRequest::PRINT_PROP, '', $pv));
     $query = new Query($description);
     $query->setSubject($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('Bar'), DIWikiPage::newFromText('Foobar', SMW_NS_PROPERTY), DIWikiPage::newFromText('Foobaz', SMW_NS_PROPERTY)));
     #8 Inverse printrequest
     $pv = \SMWPropertyValue::makeUserProperty('Foobaz');
     $pv->setInverse(true);
     $description = new SomeProperty(new DIProperty('Foobar', true), new ValueDescription(DIWikiPage::newFromText('Bar')));
     $description->addPrintRequest(new PrintRequest(PrintRequest::PRINT_PROP, '', $pv));
     $query = new Query($description);
     $query->setSubject($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('Bar'), DIWikiPage::newFromText('Foobar', SMW_NS_PROPERTY), DIWikiPage::newFromText('Foobaz', SMW_NS_PROPERTY)));
     return $provider;
 }
 public function testUserDefinedTemperatureProperty()
 {
     $semanticData = $this->semanticDataFactory->newEmptySemanticData(__METHOD__);
     $this->subjects[] = $semanticData->getSubject();
     $factsheet = $this->fixturesProvider->getFactsheet('Berlin');
     $factsheet->setTargetSubject($semanticData->getSubject());
     $temperatureValue = $factsheet->getAverageHighTemperatureValue();
     $temperatureProperty = $temperatureValue->getProperty();
     $semanticData->addDataValue($temperatureValue);
     $this->getStore()->updateData($semanticData);
     $this->assertArrayHasKey($temperatureProperty->getKey(), $this->getStore()->getSemanticData($semanticData->getSubject())->getProperties());
     /**
      * @query [[Temperature::+]]|?Temperature
      */
     $description = new SomeProperty($temperatureProperty, new ThingDescription());
     $description->addPrintRequest($this->printRequestFactory->newPropertyPrintRequest($temperatureProperty));
     $query = new Query($description, false, false);
     $query->querymode = Query::MODE_INSTANCES;
     $queryResult = $this->getStore()->getQueryResult($query);
     $this->queryResultValidator->assertThatQueryResultContains($temperatureValue, $queryResult);
 }
 public function prune(&$maxsize, &$maxdepth, &$log)
 {
     if ($maxsize <= 0 || $maxdepth <= 0) {
         $log[] = $this->getQueryString();
         return new ThingDescription();
     }
     $maxsize--;
     $maxdepth--;
     $result = new SomeProperty($this->property, $this->description->prune($maxsize, $maxdepth, $log));
     $result->setPrintRequests($this->getPrintRequests());
     return $result;
 }
 /**
  * {{#ask: [[SomeNumericPropertyToDifferentSubject::9999]]
  *  |?SomeNumericPropertyToDifferentSubject
  * }}
  */
 public function testQueryToCompareEqualNumericPropertyValuesAssignedToDifferentSubject()
 {
     $semanticDataWithSubobject = $this->semanticDataFactory->setTitle(__METHOD__ . '-withSobj')->newEmptySemanticData();
     $semanticDataWithoutSubobject = $this->semanticDataFactory->setTitle(__METHOD__ . '-wwithoutSobj')->newEmptySemanticData();
     $expectedDataValueToMatchCondition = $this->newDataValueForNumericPropertyValue('SomeNumericPropertyToDifferentSubject', 9999);
     $dataValueWithSamePropertyButDifferentValue = $this->newDataValueForNumericPropertyValue('SomeNumericPropertyToDifferentSubject', 1111);
     $subobject = new Subobject($semanticDataWithSubobject->getSubject()->getTitle());
     $subobject->setEmptyContainerForId('SomeSubobjectToDifferentSubject');
     $subobject->addDataValue($expectedDataValueToMatchCondition);
     $semanticDataWithSubobject->addPropertyObjectValue($subobject->getProperty(), $subobject->getContainer());
     $semanticDataWithSubobject->addDataValue($dataValueWithSamePropertyButDifferentValue);
     $semanticDataWithoutSubobject->addDataValue($expectedDataValueToMatchCondition);
     $this->getStore()->updateData($semanticDataWithSubobject);
     $this->getStore()->updateData($semanticDataWithoutSubobject);
     $property = new DIProperty('SomeNumericPropertyToDifferentSubject');
     $property->setPropertyTypeId('_num');
     $dataItem = new DINumber(9999);
     $description = new SomeProperty($property, new ValueDescription($dataItem, null, SMW_CMP_EQ));
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($property);
     $description->addPrintRequest(new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue));
     $query = new Query($description, false, false);
     $queryResult = $this->getStore()->getQueryResult($query);
     $this->assertEquals(2, $queryResult->getCount());
     $this->queryResultValidator->assertThatQueryResultContains($expectedDataValueToMatchCondition, $queryResult);
     $expectedSubjects = array($subobject->getSemanticData()->getSubject(), $semanticDataWithoutSubobject->getSubject());
     $this->queryResultValidator->assertThatQueryResultHasSubjects($expectedSubjects, $queryResult);
     $this->subjectsToBeCleared = array($semanticDataWithoutSubobject->getSubject(), $semanticDataWithSubobject->getSubject());
 }
 public function createQueryForSamplePagesThatContain($property, array &$expectedSubjects)
 {
     foreach ($expectedSubjects as $key => $expectedSubject) {
         $subjectTitle = $expectedSubject->getTitle()->getText() . '-' . __METHOD__;
         $semanticData = $this->semanticDataFactory->newEmptySemanticData($subjectTitle);
         $semanticData->addPropertyObjectValue($property, $expectedSubject);
         $this->subjectsToBeCleared[] = $semanticData->getSubject();
         $expectedSubjects[$key] = $semanticData->getSubject();
         $this->getStore()->updateData($semanticData);
     }
     $description = new SomeProperty($property, new ThingDescription());
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($property);
     $description->addPrintRequest(new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue));
     $query = new Query($description, false, false);
     $query->querymode = Query::MODE_INSTANCES;
     return $query;
 }
 /**
  * Modify the given query object to account for some property condition for
  * the given property. If it is not possible to generate a query for the
  * given data, the query type is changed to QueryContainer::Q_NOQUERY. Callers need
  * to check for this and discard the query in this case.
  *
  * @note This method does not support sortkey (_SKEY) property queries,
  * since they do not have a normal property table. This should not be a
  * problem since comparators on sortkeys are supported indirectly when
  * using comparators on wikipages. There is no reason to create any
  * query with _SKEY ad users cannot do so either (no user label).
  *
  * @since 1.8
  */
 private function interpretPropertyConditionForDescription(QuerySegment $query, SomeProperty $description)
 {
     $db = $this->queryBuilder->getStore()->getConnection('mw.db');
     $property = $description->getProperty();
     $tableid = $this->queryBuilder->getStore()->findPropertyTableID($property);
     if ($tableid === '') {
         // Give up
         $query->type = QuerySegment::Q_NOQUERY;
         return;
     }
     $proptables = $this->queryBuilder->getStore()->getPropertyTables();
     $proptable = $proptables[$tableid];
     if (!$proptable->usesIdSubject()) {
         // no queries with such tables
         // (only redirects are affected in practice)
         $query->type = QuerySegment::Q_NOQUERY;
         return;
     }
     $typeid = $property->findPropertyTypeID();
     $diType = DataTypeRegistry::getInstance()->getDataItemId($typeid);
     if ($property->isInverse() && $diType !== DataItem::TYPE_WIKIPAGE) {
         // can only invert properties that point to pages
         $query->type = QuerySegment::Q_NOQUERY;
         return;
     }
     $diHandler = $this->queryBuilder->getStore()->getDataItemHandlerForDIType($diType);
     $indexField = $diHandler->getIndexField();
     // TODO: strictly speaking, the DB key is not what we want here,
     // since sortkey is based on a "wiki value"
     $sortkey = $property->getKey();
     // *** Now construct the query ... ***//
     $query->joinTable = $proptable->getName();
     // *** Add conditions for selecting rows for this property ***//
     if (!$proptable->isFixedPropertyTable()) {
         $pid = $this->queryBuilder->getStore()->getObjectIds()->getSMWPropertyID($property);
         // Construct property hierarchy:
         $pqid = QuerySegment::$qnum;
         $pquery = new QuerySegment();
         $pquery->type = QuerySegment::Q_PROP_HIERARCHY;
         $pquery->joinfield = array($pid);
         $query->components[$pqid] = "{$query->alias}.p_id";
         $this->queryBuilder->addQuerySegmentForId($pqid, $pquery);
         // Alternative code without property hierarchies:
         // $query->where = "{$query->alias}.p_id=" . $this->m_dbs->addQuotes( $pid );
     }
     // else: no property column, no hierarchy queries
     // *** Add conditions on the value of the property ***//
     if ($diType === DataItem::TYPE_WIKIPAGE) {
         $o_id = $indexField;
         if ($property->isInverse()) {
             $s_id = $o_id;
             $o_id = 's_id';
         } else {
             $s_id = 's_id';
         }
         $query->joinfield = "{$query->alias}.{$s_id}";
         // process page description like main query
         $sub = $this->queryBuilder->buildQuerySegmentFor($description->getDescription());
         if ($sub >= 0) {
             $query->components[$sub] = "{$query->alias}.{$o_id}";
         }
         if (array_key_exists($sortkey, $this->queryBuilder->getSortKeys())) {
             // TODO: This SMW IDs table is possibly duplicated in the query.
             // Example: [[has capital::!Berlin]] with sort=has capital
             // Can we prevent that? (PERFORMANCE)
             $query->from = ' INNER JOIN ' . $db->tableName(SMWSql3SmwIds::tableName) . " AS ids{$query->alias} ON ids{$query->alias}.smw_id={$query->alias}.{$o_id}";
             $query->sortfields[$sortkey] = "ids{$query->alias}.smw_sortkey";
         }
     } else {
         // non-page value description
         $query->joinfield = "{$query->alias}.s_id";
         $this->interpretInnerValueDescription($query, $description->getDescription(), $proptable, $diHandler, 'AND');
         if (array_key_exists($sortkey, $this->queryBuilder->getSortKeys())) {
             $query->sortfields[$sortkey] = "{$query->alias}.{$indexField}";
         }
     }
 }