private function tryFindMatchResultFor($hash, $dataValue) { $descriptionFactory = $this->queryFactory->newDescriptionFactory(); $contextPage = $dataValue->getContextPage(); // Exclude the current page from the result match to check whether another // page matches the condition and if so then the value can no longer be // assigned and is not unique $description = $descriptionFactory->newConjunction(array($descriptionFactory->newFromDataValue($dataValue), $descriptionFactory->newValueDescription($contextPage, null, SMW_CMP_NEQ))); $query = $this->queryFactory->newQuery($description); $query->setLimit(1); $dataItems = $this->cachedPropertyValuesPrefetcher->queryPropertyValuesFor($query); if (!is_array($dataItems) || $dataItems === array()) { // No other assignments were found therefore it is assumed that at // the time of the query request, the "contextPage" holds a unique // value for the property $page = $contextPage; } else { $page = end($dataItems); } // Create a linked list so that when the subject is altered or deleted // the related uniqueness container can be removed as well $blobStore = $this->cachedPropertyValuesPrefetcher->getBlobStore(); $container = $blobStore->read($this->cachedPropertyValuesPrefetcher->getRootHashFrom($page)); $container->addToLinkedList($hash); $blobStore->save($container); return $page; }