当前位置: 首页>>代码示例>>PHP>>正文


PHP SMWQuery::setLimit方法代码示例

本文整理汇总了PHP中SMWQuery::setLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWQuery::setLimit方法的具体用法?PHP SMWQuery::setLimit怎么用?PHP SMWQuery::setLimit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SMWQuery的用法示例。


在下文中一共展示了SMWQuery::setLimit方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetHash

 public function testGetHash()
 {
     $description = $this->getMockForAbstractClass('\\SMW\\Query\\Language\\Description');
     $instance = new Query($description, Query::INLINE_QUERY);
     $instance->setLimit(50);
     $hash = $instance->getHash();
     $this->assertInternalType('string', $hash);
     $instance->setLimit(100);
     $this->assertNotEquals($hash, $instance->getHash());
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:10,代码来源:QueryTest.php

示例2: testQueryForInterwikiAnnotation

 public function testQueryForInterwikiAnnotation()
 {
     $this->stringBuilder->addString('[[Has type::Page]]');
     $this->pageCreator->createPage(Title::newFromText('Use for interwiki annotation', SMW_NS_PROPERTY))->doEdit($this->stringBuilder->getString());
     $this->pageCreator->createPage(Title::newFromText(__METHOD__ . '-1'))->doEdit('[[Use for interwiki annotation::Interwiki link]]');
     $this->pageCreator->createPage(Title::newFromText(__METHOD__ . '-2'))->doEdit('[[Use for interwiki annotation::iw-test:Interwiki link]]');
     $this->stringBuilder->addString('[[Use for interwiki annotation::iw-test:Interwiki link]]');
     $description = $this->queryParser->getQueryDescription($this->stringBuilder->getString());
     $query = new Query($description, false, false);
     $query->querymode = Query::MODE_INSTANCES;
     $query->setLimit(10);
     // Expects only one result with an interwiki being used as differentiator
     $this->subjects[] = DIWikiPage::newFromTitle(Title::newFromText(__METHOD__ . '-2'));
     $this->queryResultValidator->assertThatQueryResultHasSubjects($this->subjects, $this->getStore()->getQueryResult($query));
     $this->subjects[] = DIWikiPage::newFromTitle(Title::newFromText(__METHOD__ . '-1'));
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:16,代码来源:InterwikiDBIntegrationTest.php

示例3: testSortableRecordQuery

 public function testSortableRecordQuery()
 {
     $this->getStore()->updateData($this->fixturesProvider->getFactsheet('Berlin')->asEntity());
     $this->getStore()->updateData($this->fixturesProvider->getFactsheet('Paris')->asEntity());
     /**
      * PopulationDensity is specified as `_rec`
      *
      * @query {{#ask: [[PopulationDensity::SomeDistinctValue]] }}
      */
     $populationDensityValue = $this->fixturesProvider->getFactsheet('Berlin')->getPopulationDensityValue();
     $description = new SomeProperty($populationDensityValue->getProperty(), $populationDensityValue->getQueryDescription($populationDensityValue->getWikiValue()));
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($populationDensityValue->getProperty());
     $query = new Query($description, false, false);
     $query->querymode = Query::MODE_INSTANCES;
     $query->sortkeys = array($populationDensityValue->getProperty()->getKey() => 'ASC');
     $query->setLimit(100);
     $query->setExtraPrintouts(array(new PrintRequest(PrintRequest::PRINT_THIS, ''), new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue)));
     $expected = array($this->fixturesProvider->getFactsheet('Berlin')->asSubject(), $this->fixturesProvider->getFactsheet('Berlin')->getDemographics()->getSubject());
     $this->queryResultValidator->assertThatQueryResultHasSubjects($expected, $this->getStore()->getQueryResult($query));
 }
开发者ID:ReachingOut,项目名称:SemanticMediaWiki,代码行数:21,代码来源:RecordTypeQueryTest.php

示例4: createQuery

 /**
  * Parse a query string given in SMW's query language to create
  * an SMWQuery. Parameters are given as key-value-pairs in the
  * given array. The parameter $context defines in what context the
  * query is used, which affects ceretain general settings.
  * An object of type SMWQuery is returned.
  *
  * The format string is used to specify the output format if already
  * known. Otherwise it will be determined from the parameters when
  * needed. This parameter is just for optimisation in a common case.
  *
  * @param string $queryString
  * @param array $params These need to be the result of a list fed to getProcessedParams
  * @param $context
  * @param string $format
  * @param array $extraPrintouts
  *
  * @return SMWQuery
  */
 public static function createQuery($queryString, array $params, $context = self::INLINE_QUERY, $format = '', array $extraPrintouts = array())
 {
     global $smwgQDefaultNamespaces, $smwgQFeatures, $smwgQConceptFeatures;
     // parse query:
     $queryfeatures = $context == self::CONCEPT_DESC ? $smwgQConceptFeatures : $smwgQFeatures;
     $qp = new SMWQueryParser($queryfeatures);
     $qp->setDefaultNamespaces($smwgQDefaultNamespaces);
     $desc = $qp->getQueryDescription($queryString);
     if ($format === '' || is_null($format)) {
         $format = $params['format']->getValue();
     }
     if ($format == 'count') {
         $querymode = SMWQuery::MODE_COUNT;
     } elseif ($format == 'debug') {
         $querymode = SMWQuery::MODE_DEBUG;
     } else {
         $printer = self::getResultPrinter($format, $context);
         $querymode = $printer->getQueryMode($context);
     }
     $query = new SMWQuery($desc, $context != self::SPECIAL_PAGE, $context == self::CONCEPT_DESC);
     $query->setQueryString($queryString);
     $query->setExtraPrintouts($extraPrintouts);
     $query->setMainLabel($params['mainlabel']->getValue());
     $query->addErrors($qp->getErrors());
     // keep parsing errors for later output
     // set mode, limit, and offset:
     $query->querymode = $querymode;
     if (array_key_exists('offset', $params) && is_int($params['offset']->getValue() + 0)) {
         $query->setOffset(max(0, trim($params['offset']->getValue()) + 0));
     }
     if ($query->querymode == SMWQuery::MODE_COUNT) {
         // largest possible limit for "count", even inline
         global $smwgQMaxLimit;
         $query->setOffset(0);
         $query->setLimit($smwgQMaxLimit, false);
     } else {
         if (array_key_exists('limit', $params) && is_int(trim($params['limit']->getValue()) + 0)) {
             $query->setLimit(max(0, trim($params['limit']->getValue()) + 0));
             if (trim($params['limit']->getValue()) + 0 < 0) {
                 // limit < 0: always show further results link only
                 $query->querymode = SMWQuery::MODE_NONE;
             }
         } else {
             global $smwgQDefaultLimit;
             $query->setLimit($smwgQDefaultLimit);
         }
     }
     $defaultSort = $format === 'rss' ? 'DESC' : 'ASC';
     $sort = self::getSortKeys($params['sort']->getValue(), $params['order']->getValue(), $defaultSort);
     $query->sortkeys = $sort['keys'];
     $query->addErrors($sort['errors']);
     $query->sort = count($query->sortkeys) > 0;
     // TODO: Why would we do this here?
     return $query;
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:74,代码来源:SMW_QueryProcessor.php

示例5: serializePage


//.........这里部分代码省略.........
     foreach ($additionalDataArray as $additionalData) {
         $this->serializer->serializeExpData($additionalData);
         // serialise
     }
     if ($recursiondepth != 0) {
         $subrecdepth = $recursiondepth > 0 ? $recursiondepth - 1 : ($recursiondepth == 0 ? 0 : -1);
         foreach ($expData->getProperties() as $property) {
             if ($property->getDataItem() instanceof SMWWikiPageValue) {
                 $this->queuePage($property->getDataItem(), 0);
                 // no real recursion along properties
             }
             $wikipagevalues = false;
             foreach ($expData->getValues($property) as $valueExpElement) {
                 $valueResource = $valueExpElement instanceof SMWExpData ? $valueExpElement->getSubject() : $valueExpElement;
                 if (!$wikipagevalues && $valueResource->getDataItem() instanceof SMWWikiPageValue) {
                     $wikipagevalues = true;
                 } elseif (!$wikipagevalues) {
                     break;
                 }
                 $this->queuePage($valueResource->getDataItem(), $subrecdepth);
             }
         }
         // Add backlinks:
         // Note: Backlinks are different from recursive serialisations, since
         // stub declarations (recdepth==0) still need to have the property that
         // links back to the object. So objects that would be exported with
         // recdepth 0 cannot be put into the main queue but must be done right
         // away. They also might be required many times, if they link back to
         // many different objects in many ways (we cannot consider them "Done"
         // if they were serialised at recdepth 0 only).
         if ($this->add_backlinks) {
             $inprops = \SMW\StoreFactory::getStore()->getInProperties($diWikiPage);
             foreach ($inprops as $inprop) {
                 $propWikiPage = $inprop->getCanonicalDiWikiPage();
                 if (!is_null($propWikiPage)) {
                     $this->queuePage($propWikiPage, 0);
                     // no real recursion along properties
                 }
                 $inSubs = \SMW\StoreFactory::getStore()->getPropertySubjects($inprop, $diWikiPage);
                 foreach ($inSubs as $inSub) {
                     if (!$this->isPageDone($inSub, $subrecdepth)) {
                         $semdata = $this->getSemanticData($inSub, true);
                         if (!$semdata instanceof SMWSemanticData) {
                             continue;
                         }
                         $semdata->addPropertyObjectValue($inprop, $diWikiPage);
                         $expData = SMWExporter::getInstance()->makeExportData($semdata);
                         $this->serializer->serializeExpData($expData, $subrecdepth);
                     }
                 }
             }
             if (NS_CATEGORY === $diWikiPage->getNamespace()) {
                 // also print elements of categories
                 $options = new SMWRequestOptions();
                 $options->limit = 100;
                 // Categories can be large, always use limit
                 $instances = \SMW\StoreFactory::getStore()->getPropertySubjects(new SMW\DIProperty('_INST'), $diWikiPage, $options);
                 $pinst = new SMW\DIProperty('_INST');
                 foreach ($instances as $instance) {
                     if (!array_key_exists($instance->getHash(), $this->element_done)) {
                         $semdata = $this->getSemanticData($instance, true);
                         if (!$semdata instanceof SMWSemanticData) {
                             continue;
                         }
                         $semdata->addPropertyObjectValue($pinst, $diWikiPage);
                         $expData = SMWExporter::getInstance()->makeExportData($semdata);
                         $this->serializer->serializeExpData($expData, $subrecdepth);
                     }
                 }
             } elseif (SMW_NS_CONCEPT === $diWikiPage->getNamespace()) {
                 // print concept members (slightly different code)
                 $desc = new SMWConceptDescription($diWikiPage);
                 $desc->addPrintRequest(new PrintRequest(PrintRequest::PRINT_THIS, ''));
                 $query = new SMWQuery($desc);
                 $query->setLimit(100);
                 $res = \SMW\StoreFactory::getStore()->getQueryResult($query);
                 $resarray = $res->getNext();
                 $pinst = new SMW\DIProperty('_INST');
                 while ($resarray !== false) {
                     $instance = end($resarray)->getNextDataItem();
                     if (!$instance instanceof \SMWDataItem) {
                         $resarray = $res->getNext();
                         continue;
                     }
                     if (!array_key_exists($instance->getHash(), $this->element_done)) {
                         $semdata = $this->getSemanticData($instance, true);
                         if (!$semdata instanceof \SMW\SemanticData) {
                             $resarray = $res->getNext();
                             continue;
                         }
                         $semdata->addPropertyObjectValue($pinst, $diWikiPage);
                         $expData = SMWExporter::getInstance()->makeExportData($semdata);
                         $this->serializer->serializeExpData($expData);
                     }
                     $resarray = $res->getNext();
                 }
             }
         }
     }
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:101,代码来源:SMW_ExportController.php

示例6: doQueryForNearbyResults

 /**
  * Returns all results that have a value near to the searched for value
  * on the property, ordered, and sorted by ending with the smallest
  * one.
  *
  * @param QueryOptions $pageRequestOptions
  * @param integer $count How many entities have the exact same value on the property?
  * @param integer $greater Should the values be bigger? Set false for smaller values.
  *
  * @return array of array of SMWWikiPageValue, SMWDataValue with the
  * first being the entity, and the second the value
  */
 public function doQueryForNearbyResults(PageRequestOptions $pageRequestOptions, $count, $greater = true)
 {
     $comparator = $greater ? SMW_CMP_GRTR : SMW_CMP_LESS;
     $sortOrder = $greater ? 'ASC' : 'DESC';
     if ($pageRequestOptions->value !== null && $pageRequestOptions->value->getTypeID() === '_txt' && strlen($pageRequestOptions->valueString) > 72) {
         $comparator = SMW_CMP_LIKE;
     }
     if ($pageRequestOptions->valueString === '' || $pageRequestOptions->valueString === null) {
         $description = new ThingDescription();
     } else {
         $description = new ValueDescription($pageRequestOptions->value->getDataItem(), $pageRequestOptions->property->getDataItem(), $comparator);
     }
     $someProperty = new SomeProperty($pageRequestOptions->property->getDataItem(), $description);
     $query = new Query($someProperty);
     $query->setLimit($pageRequestOptions->limit);
     $query->setOffset($pageRequestOptions->offset);
     $query->sort = true;
     $query->sortkeys = array($pageRequestOptions->property->getDataItem()->getKey() => $sortOrder);
     // Note: printrequests change the caption of properties they
     // get (they expect properties to be given to them).
     // Since we want to continue using the property for our
     // purposes, we give a clone to the print request.
     $printouts = array(new PrintRequest(PrintRequest::PRINT_THIS, ''), new PrintRequest(PrintRequest::PRINT_PROP, '', clone $pageRequestOptions->property));
     $query->setExtraPrintouts($printouts);
     $queryResults = $this->store->getQueryResult($query);
     $result = array();
     while ($resultArrays = $queryResults->getNext()) {
         $r = array();
         foreach ($resultArrays as $resultArray) {
             $r[] = $resultArray->getNextDataValue();
         }
         // Note: if results have multiple values for the property
         // then this code just pick the first, which may not be
         // the reason why the result is shown here, i.e., it could
         // be out of order.
         $result[] = $r;
     }
     if (!$greater) {
         $result = array_reverse($result);
     }
     return $result;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:54,代码来源:QueryResultLookup.php

示例7: getQuery

 /**
  * Make SMWQuery suitable for obtaining a list of results based on the
  * given description, limit, and from or until string. One more result
  * than the limit will be created, and the results may have to be
  * reversed in order if $until is nonempty.
  *
  * @param $description SMWDescription main query description
  * @param $limit integer
  * @param $from string can be empty if no from condition is desired
  * @param $until string can be empty if no until condition is desired
  * @return SMWQuery
  */
 public static function getQuery(SMWDescription $description, $limit, $from, $until)
 {
     if ($from !== '') {
         $diWikiPage = new SMWDIWikiPage($from, NS_MAIN, '');
         // make a dummy wiki page as boundary
         $fromDescription = new SMWValueDescription($diWikiPage, null, SMW_CMP_GEQ);
         $queryDescription = new SMWConjunction(array($description, $fromDescription));
         $order = 'ASC';
     } elseif ($until !== '') {
         $diWikiPage = new SMWDIWikiPage($until, NS_MAIN, '');
         // make a dummy wiki page as boundary
         $untilDescription = new SMWValueDescription($diWikiPage, null, SMW_CMP_LESS);
         // do not include boundary in this case
         $queryDescription = new SMWConjunction(array($description, $untilDescription));
         $order = 'DESC';
     } else {
         $queryDescription = $description;
         $order = 'ASC';
     }
     $queryDescription->addPrintRequest(new SMWPrintRequest(SMWPrintRequest::PRINT_THIS, ''));
     $query = new SMWQuery($queryDescription);
     $query->sortkeys[''] = $order;
     $query->setLimit($limit + 1);
     return $query;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:37,代码来源:SMW_PageLister.php

示例8: processConceptCase

 /**
  * @since  2.2
  *
  * @param QueryTestCaseInterpreter $queryTestCaseInterpreter
  */
 public function processConceptCase(QueryTestCaseInterpreter $queryTestCaseInterpreter)
 {
     if (!$queryTestCaseInterpreter->hasCondition()) {
         $this->markTestSkipped('Found no condition for ' . $queryTestCaseInterpreter->isAbout());
     }
     $description = $this->queryParser->getQueryDescription($queryTestCaseInterpreter->getCondition());
     $this->printDescriptionToOutput($queryTestCaseInterpreter->isAbout(), $description);
     $query = new Query($description, false, true);
     $query->querymode = $queryTestCaseInterpreter->getQueryMode();
     $query->setLimit($queryTestCaseInterpreter->getLimit());
     $query->setOffset($queryTestCaseInterpreter->getOffset());
     $queryResult = $this->getStore()->getQueryResult($query);
     $this->printQueryResultToOutput($queryResult);
     $this->assertEquals($queryTestCaseInterpreter->getExpectedCount(), $queryResult->getCount(), 'Failed asserting query result count on ' . $queryTestCaseInterpreter->isAbout());
     $this->assertCount($queryTestCaseInterpreter->getExpectedErrorCount(), $queryResult->getErrors(), 'Failed asserting error count ' . $queryTestCaseInterpreter->isAbout());
     foreach ($queryTestCaseInterpreter->getExpectedConceptCache() as $expectedConceptCache) {
         $concept = Title::newFromText($expectedConceptCache['concept'], SMW_NS_CONCEPT);
         $this->getStore()->refreshConceptCache($concept);
         $this->assertEquals($expectedConceptCache['count'], $this->getStore()->getConceptCacheStatus($concept)->getCacheCount(), 'Failed asserting conceptcache count on ' . $queryTestCaseInterpreter->isAbout());
     }
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:26,代码来源:QueryTestCaseProcessor.php

示例9: getAllPagesForConcept

 public static function getAllPagesForConcept($conceptName, $substring = null)
 {
     global $sfgMaxAutocompleteValues, $sfgAutocompleteOnAllChars;
     $store = smwfGetStore();
     $conceptTitle = Title::makeTitleSafe(SMW_NS_CONCEPT, $conceptName);
     if (!is_null($substring)) {
         $substring = strtolower($substring);
     }
     // Escape if there's no such concept.
     if ($conceptTitle == null || !$conceptTitle->exists()) {
         return "Could not find concept: {$conceptName}";
     }
     $conceptDI = SMWDIWikiPage::newFromTitle($conceptTitle);
     $desc = new SMWConceptDescription($conceptDI);
     $printout = new SMWPrintRequest(SMWPrintRequest::PRINT_THIS, "");
     $desc->addPrintRequest($printout);
     $query = new SMWQuery($desc);
     $query->setLimit($sfgMaxAutocompleteValues);
     $query_result = $store->getQueryResult($query);
     $pages = array();
     while ($res = $query_result->getNext()) {
         $pageName = $res[0]->getNextText(SMW_OUTPUT_WIKI);
         if (is_null($substring)) {
             $pages[] = $pageName;
         } else {
             // Filter on the substring manually. It would
             // be better to do this filtering in the
             // original SMW query, but that doesn't seem
             // possible yet.
             $lowercasePageName = strtolower($pageName);
             if ($sfgAutocompleteOnAllChars) {
                 if (strpos($lowercasePageName, $substring) >= 0) {
                     $pages[] = $pageName;
                 }
             } else {
                 if (strpos($lowercasePageName, $substring) === 0 || strpos($lowercasePageName, ' ' . $substring) > 0) {
                     $pages[] = $pageName;
                 }
             }
         }
     }
     sort($pages);
     return $pages;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:44,代码来源:SF_Utils.php

示例10: getNearbyResults

 /**
  * Returns all results that have a value near to the searched for value
  * on the property, ordered, and sorted by ending with the smallest
  * one.
  *
  * @param integer $count How many entities have the exact same value on the property?
  * @param integer $greater Should the values be bigger? Set false for smaller values.
  *
  * @return array of array of SMWWikiPageValue, SMWDataValue with the
  * first being the entity, and the second the value
  */
 protected function getNearbyResults($count, $greater = true)
 {
     $valueDescription = new SMWValueDescription($this->value->getDataItem(), $this->property->getDataItem(), $greater ? SMW_CMP_GRTR : SMW_CMP_LESS);
     $someProperty = new SMWSomeProperty($this->property->getDataItem(), $valueDescription);
     $query = new SMWQuery($someProperty);
     $query->setLimit($this->limit);
     $query->sort = true;
     $query->sortkeys = array($this->property->getDataItem()->getKey() => $greater ? 'ASC' : 'DESC');
     // Note: printrequests change the caption of properties they
     // get (they expect properties to be given to them).
     // Since we want to continue using the property for our
     // purposes, we give a clone to the print request.
     $printouts = array(new SMWPrintRequest(SMWPrintRequest::PRINT_THIS, ''), new SMWPrintRequest(SMWPrintRequest::PRINT_PROP, '', clone $this->property));
     $query->setExtraPrintouts($printouts);
     $queryResults = smwfGetStore()->getQueryResult($query);
     $result = array();
     while ($resultArrays = $queryResults->getNext()) {
         $r = array();
         foreach ($resultArrays as $resultArray) {
             $r[] = $resultArray->getNextDataValue();
         }
         // Note: if results have multiple values for the property
         // then this code just pick the first, which may not be
         // the reason why the result is shown here, i.e., it could
         // be out of order.
         $result[] = $r;
     }
     if (!$greater) {
         $result = array_reverse($result);
     }
     return $result;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:43,代码来源:SMW_SpecialSearchByProperty.php

示例11: testSortableDateQuery

 /**
  * #576
  */
 public function testSortableDateQuery()
 {
     $this->getStore()->updateData($this->fixturesProvider->getFactsheet('Berlin')->asEntity());
     // #576 introduced resource caching, therefore make sure that the
     // instance is cleared after data have been created before further
     // tests are carried out
     Exporter::clear();
     /**
      * @query {{#ask: [[Founded::SomeDistinctValue]] }}
      */
     $foundedValue = $this->fixturesProvider->getFactsheet('Berlin')->getFoundedValue();
     $description = new SomeProperty($foundedValue->getProperty(), new ValueDescription($foundedValue->getDataItem(), null, SMW_CMP_EQ));
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($foundedValue->getProperty());
     $query = new Query($description, false, false);
     $query->querymode = Query::MODE_INSTANCES;
     $query->sortkeys = array($foundedValue->getProperty()->getLabel() => 'ASC');
     // Be aware of
     // Virtuoso 22023 Error SR353: Sorted TOP clause specifies more then
     // 10001 rows to sort. Only 10000 are allowed. Either decrease the
     // offset and/or row count or use a scrollable cursor
     $query->setLimit(100);
     $query->setExtraPrintouts(array(new PrintRequest(PrintRequest::PRINT_THIS, ''), new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue)));
     $queryResult = $this->getStore()->getQueryResult($query);
     $this->queryResultValidator->assertThatQueryResultHasSubjects($this->fixturesProvider->getFactsheet('Berlin')->asSubject(), $queryResult);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:29,代码来源:DatePropertyValueQueryDBIntegrationTest.php

示例12: getPropertyFromDisplayTitle

 /**
  * @since 2.4
  *
  * @param string $displayTitle
  *
  * @return DIProperty|false
  */
 public function getPropertyFromDisplayTitle($displayTitle)
 {
     $descriptionFactory = new DescriptionFactory();
     $description = $descriptionFactory->newSomeProperty(new DIProperty('_DTITLE'), $descriptionFactory->newValueDescription(new DIBlob($displayTitle)));
     $query = new Query($description);
     $query->setLimit(1);
     $dataItems = $this->cachedPropertyValuesPrefetcher->queryPropertyValuesFor($query);
     if (is_array($dataItems) && $dataItems !== array()) {
         $dataItem = end($dataItems);
         // Cache results as a linked list attached to
         // the property so that it can be purged all together
         return new DIProperty($dataItem->getDBKey());
     }
     return false;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:22,代码来源:PropertySpecificationLookup.php


注:本文中的SMWQuery::setLimit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。