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


PHP SMWQuery::setContextPage方法代码示例

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


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

示例1: processQueryCase

 /**
  * @since  2.2
  *
  * @param QueryTestCaseInterpreter $queryTestCaseInterpreter
  */
 public function processQueryCase(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, false);
     $query->querymode = $queryTestCaseInterpreter->getQueryMode();
     $query->setLimit($queryTestCaseInterpreter->getLimit());
     $query->setOffset($queryTestCaseInterpreter->getOffset());
     $query->setExtraPrintouts($queryTestCaseInterpreter->getExtraPrintouts());
     $query->setSortKeys($queryTestCaseInterpreter->getSortKeys());
     $query->setContextPage($queryTestCaseInterpreter->getSubject());
     if ($queryTestCaseInterpreter->isRequiredToClearStoreCache()) {
         $this->getStore()->clear();
     }
     $queryResult = $this->getStore()->getQueryResult($query);
     $this->printQueryResultToOutput($queryResult);
     if (is_string($queryResult)) {
         return;
     }
     $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());
     if ($queryTestCaseInterpreter->getExpectedErrorCount() > 0) {
         return null;
     }
     if ($queryTestCaseInterpreter->isFromCache() !== null) {
         $this->assertEquals($queryTestCaseInterpreter->isFromCache(), $queryResult->isFromCache(), 'Failed asserting isFromCache for ' . $queryTestCaseInterpreter->isAbout());
     }
     $this->queryResultValidator->assertThatQueryResultHasSubjects($queryTestCaseInterpreter->getExpectedSubjects(), $queryResult, $queryTestCaseInterpreter->isAbout());
     $this->queryResultValidator->assertThatDataItemIsSet($queryTestCaseInterpreter->getExpectedDataItems(), $queryResult, $queryTestCaseInterpreter->isAbout());
     $this->queryResultValidator->assertThatDataValueIsSet($queryTestCaseInterpreter->getExpectedDataValues(), $queryResult, $queryTestCaseInterpreter->isAbout());
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:39,代码来源:QueryTestCaseProcessor.php

示例2: queryProvider

 public function queryProvider()
 {
     $subject = DIWikiPage::newFromText('Foo');
     #0
     $description = new SomeProperty(new DIProperty('Foobar'), new ValueDescription(DIWikiPage::newFromText('Bar')));
     $query = new Query($description);
     $query->setContextPage($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('Bar'), 'Foobar#102#' => DIWikiPage::newFromText('Foobar', SMW_NS_PROPERTY)));
     #1
     $description = new SomeProperty(new DIProperty('Foobar'), new ValueDescription(new DIBlob('Bar')));
     $query = new Query($description);
     $query->setContextPage($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), 'Foobar#102#' => 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->setContextPage($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('Bar'), 'Foobar#102#' => 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->setContextPage($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('Bar'), 'Foobar#102#' => 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->setContextPage($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('Bar'), 'Foobar#102#' => DIWikiPage::newFromText('Foobar', SMW_NS_PROPERTY)));
     #5
     $description = new ClassDescription(DIWikiPage::newFromText('Foocat', NS_CATEGORY));
     $query = new Query($description);
     $query->setContextPage($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->setContextPage($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->setContextPage($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('Bar'), DIWikiPage::newFromText('Foobaz', SMW_NS_PROPERTY), 'Foobar#102#' => DIWikiPage::newFromText('Foobar', 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->setContextPage($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('Bar'), DIWikiPage::newFromText('Foobaz', SMW_NS_PROPERTY), 'Foobar#102#' => DIWikiPage::newFromText('Foobar', SMW_NS_PROPERTY)));
     #9 SMW_CMP_EQ comparator
     $description = new SomeProperty(new DIProperty('Foobar'), new ValueDescription(DIWikiPage::newFromText('EQ_Comparator'), null, SMW_CMP_EQ));
     $query = new Query($description);
     $query->setContextPage($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), DIWikiPage::newFromText('EQ_Comparator'), 'Foobar#102#' => DIWikiPage::newFromText('Foobar', SMW_NS_PROPERTY)));
     #10 Ignore entity with SMW_CMP_EQ comparator
     $description = new SomeProperty(new DIProperty('Foobar'), new ValueDescription(DIWikiPage::newFromText('LIKE_Comparator'), null, SMW_CMP_LIKE));
     $query = new Query($description);
     $query->setContextPage($subject);
     $provider[] = array($query, array(DIWikiPage::newFromText('Foo'), 'Foobar#102#' => DIWikiPage::newFromText('Foobar', SMW_NS_PROPERTY)));
     return $provider;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:65,代码来源:QueryResultDependencyListResolverTest.php


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