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


PHP SMWExporter::getSpecialPropertyResource方法代码示例

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


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

示例1: mapCategoriesToConditionElements

 private function mapCategoriesToConditionElements(array $categories, $joinVariable)
 {
     $condition = '';
     $namespaces = array();
     $instExpElement = $this->exporter->getSpecialPropertyResource('_INST');
     foreach ($categories as $category) {
         $categoryExpElement = $this->exporter->getResourceElementForWikiPage($category);
         $categoryName = TurtleSerializer::getTurtleNameForExpElement($categoryExpElement);
         $namespaces[$categoryExpElement->getNamespaceId()] = $categoryExpElement->getNamespace();
         $newcondition = "{ ?{$joinVariable} " . $instExpElement->getQName() . " {$categoryName} . }\n";
         if ($condition === '') {
             $condition = $newcondition;
         } else {
             $condition .= "UNION\n{$newcondition}";
         }
     }
     return array($condition, $namespaces);
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:18,代码来源:ClassDescriptionInterpreter.php

示例2: tryToAddPropertyPathForSaturatedHierarchy

 /**
  * @note rdfs:subPropertyOf* where * means a property path of arbitrary length
  * can be found using the "zero or more" will resolve the complete path
  *
  * @see http://www.w3.org/TR/sparql11-query/#propertypath-arbitrary-length
  */
 private function tryToAddPropertyPathForSaturatedHierarchy(&$condition, DIProperty $property, &$propertyName)
 {
     if (!$this->compoundConditionBuilder->canUseQFeature(SMW_SPARQL_QF_SUBP) || !$property->isUserDefined()) {
         return null;
     }
     if ($this->compoundConditionBuilder->getPropertyHierarchyLookup() == null || !$this->compoundConditionBuilder->getPropertyHierarchyLookup()->hasSubpropertyFor($property)) {
         return null;
     }
     $subPropExpElement = $this->exporter->getSpecialPropertyResource('_SUBP', SMW_NS_PROPERTY);
     $propertyByVariable = '?' . $this->compoundConditionBuilder->getNextVariable('sp');
     $condition->weakConditions[$propertyName] = "\n" . "{$propertyByVariable} " . $subPropExpElement->getQName() . "*" . " {$propertyName} .\n" . "";
     $propertyName = $propertyByVariable;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:19,代码来源:SomePropertyInterpreter.php

示例3: tryToAddClassHierarchyPattern

 private function tryToAddClassHierarchyPattern($category, &$categoryExpName)
 {
     if (!$this->compoundConditionBuilder->canUseQFeature(SMW_SPARQL_QF_SUBC)) {
         return '';
     }
     if ($this->compoundConditionBuilder->getPropertyHierarchyLookup() === null || !$this->compoundConditionBuilder->getPropertyHierarchyLookup()->hasSubcategoryFor($category)) {
         return '';
     }
     $subClassExpElement = $this->exporter->getSpecialPropertyResource('_SUBC');
     $classHierarchyByVariable = "?" . $this->compoundConditionBuilder->getNextVariable('sc');
     $condition = "{$classHierarchyByVariable} " . $subClassExpElement->getQName() . "*" . " {$categoryExpName} .\n";
     $categoryExpName = "{$classHierarchyByVariable}";
     return $condition;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:14,代码来源:ClassDescriptionInterpreter.php

示例4: addOrderByData

 /**
  * Extend the given SPARQL condition by a suitable order by variable,
  * possibly adding conditions if required for the type of data.
  *
  * @param SMWSparqlCondition $sparqlCondition condition to modify
  * @param string $mainVariable the variable that represents the value to be ordered
  * @param integer $diType DataItem type id
  */
 protected function addOrderByData(SMWSparqlCondition &$sparqlCondition, $mainVariable, $diType)
 {
     if ($diType == SMWDataItem::TYPE_WIKIPAGE) {
         $sparqlCondition->orderByVariable = $mainVariable . 'sk';
         $skeyExpElement = SMWExporter::getSpecialPropertyResource('_SKEY');
         $sparqlCondition->weakConditions = array($sparqlCondition->orderByVariable => "?{$mainVariable} " . $skeyExpElement->getQName() . " ?{$sparqlCondition->orderByVariable} .\n");
     } else {
         $sparqlCondition->orderByVariable = $mainVariable;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:18,代码来源:SMW_SparqlStoreQueryEngine.php

示例5: getSparqlRedirectTarget

 /**
  * Find the redirect target of an SMWExpNsResource.
  * Returns an SMWExpNsResource object the input redirects to,
  * the input itself if there is no redirect (or it cannot be
  * used for making a resource with a prefix).
  *
  * @since 1.6
  * @param $expNsResource string URI to check
  * @param $exists boolean that is set to true if $expNsResource is in the
  * store; always false for blank nodes; always true for subobjects
  * @return SMWExpNsResource
  */
 protected function getSparqlRedirectTarget(SMWExpNsResource $expNsResource, &$exists)
 {
     if ($expNsResource->isBlankNode()) {
         $exists = false;
         return $expNsResource;
     } elseif ($expNsResource->getDataItem() instanceof SMWDIWikiPage && $expNsResource->getDataItem()->getSubobjectName() !== '') {
         $exists = true;
         return $expNsResource;
     }
     $resourceUri = SMWTurtleSerializer::getTurtleNameForExpElement($expNsResource);
     $rediUri = SMWTurtleSerializer::getTurtleNameForExpElement(SMWExporter::getSpecialPropertyResource('_REDI'));
     $skeyUri = SMWTurtleSerializer::getTurtleNameForExpElement(SMWExporter::getSpecialPropertyResource('_SKEY'));
     $sparqlResult = smwfGetSparqlDatabase()->select('*', "{$resourceUri} {$skeyUri} ?s  OPTIONAL { {$resourceUri} {$rediUri} ?r }", array('LIMIT' => 1), array($expNsResource->getNamespaceId() => $expNsResource->getNamespace()));
     $firstRow = $sparqlResult->current();
     if ($firstRow === false) {
         $exists = false;
         return $expNsResource;
     } elseif (count($firstRow) > 1 && !is_null($firstRow[1])) {
         $exists = true;
         $rediTargetElement = $firstRow[1];
         $rediTargetUri = $rediTargetElement->getUri();
         $wikiNamespace = SMWExporter::getNamespaceUri('wiki');
         if (strpos($rediTargetUri, $wikiNamespace) === 0) {
             return new SMWExpNsResource(substr($rediTargetUri, 0, strlen($wikiNamespace)), $wikiNamespace, 'wiki');
         } else {
             return $expNsResource;
         }
     } else {
         $exists = true;
         return $expNsResource;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:44,代码来源:SMW_SparqlStore.php

示例6: lookupResourceUriTargetFromDatabase

 private function lookupResourceUriTargetFromDatabase(ExpNsResource $expNsResource)
 {
     $resourceUri = TurtleSerializer::getTurtleNameForExpElement($expNsResource);
     $rediUri = TurtleSerializer::getTurtleNameForExpElement(Exporter::getSpecialPropertyResource('_REDI'));
     $skeyUri = TurtleSerializer::getTurtleNameForExpElement(Exporter::getSpecialPropertyResource('_SKEY'));
     $federateResultSet = $this->connection->select('*', "{$resourceUri} {$skeyUri} ?s  OPTIONAL { {$resourceUri} {$rediUri} ?r }", array('LIMIT' => 1), array($expNsResource->getNamespaceId() => $expNsResource->getNamespace()));
     return $federateResultSet->current();
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:8,代码来源:RedirectLookup.php

示例7: testExportSubSemanticData

 public function testExportSubSemanticData()
 {
     $semanticData = $this->semanticDataFactory->newEmptySemanticData(__METHOD__);
     $factsheet = $this->fixturesProvider->getFactsheet('berlin');
     $factsheet->setTargetSubject($semanticData->getSubject());
     $demographicsSubobject = $factsheet->getDemographics();
     $semanticData->addPropertyObjectValue($demographicsSubobject->getProperty(), $demographicsSubobject->getContainer());
     $exportData = Exporter::makeExportData($semanticData->findSubSemanticData($demographicsSubobject->getSubobjectId()));
     $this->assertCount(1, $exportData->getValues(Exporter::getSpecialPropertyResource('_SKEY')));
     $this->assertCount(1, $exportData->getValues(Exporter::getSpecialNsResource('swivt', 'wikiNamespace')));
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:11,代码来源:ExportSemanticDataTest.php

示例8: createFilterConditionToMatchRegexPattern

 private function createFilterConditionToMatchRegexPattern($dataItem, &$joinVariable, $comparator, $pattern)
 {
     if ($dataItem instanceof DIBlob) {
         return new FilterCondition("{$comparator}( ?{$joinVariable}, \"{$pattern}\", \"s\")", array());
     }
     if ($dataItem instanceof DIUri) {
         return new FilterCondition("{$comparator}( str( ?{$joinVariable} ), \"{$pattern}\", \"i\")", array());
     }
     // Pattern search for a wikipage object can only be done on the sortkey
     // literal and not on it's resource
     $skeyExpElement = Exporter::getSpecialPropertyResource('_SKEY');
     $expElement = $this->exporter->getDataItemExpElement($dataItem->getSortKeyDataItem());
     $condition = new SingletonCondition($expElement);
     $filterVariable = $this->compoundConditionBuilder->getNextVariable();
     $condition->condition = "?{$joinVariable} " . $skeyExpElement->getQName() . " ?{$filterVariable} .\n";
     $condition->matchElement = "?{$joinVariable}";
     $filterCondition = new FilterCondition("{$comparator}( ?{$filterVariable}, \"{$pattern}\", \"s\")", array());
     $condition->weakConditions = array($filterVariable => $filterCondition->getCondition());
     return $condition;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:20,代码来源:ValueConditionBuilder.php

示例9: addOrderByData

 /**
  * Extend the given SPARQL condition by a suitable order by variable,
  * possibly adding conditions if required for the type of data.
  *
  * @param Condition $sparqlCondition condition to modify
  * @param string $mainVariable the variable that represents the value to be ordered
  * @param integer $diType DataItem type id
  */
 public function addOrderByData(Condition &$condition, $mainVariable, $diType)
 {
     if ($diType !== DataItem::TYPE_WIKIPAGE) {
         return $condition->orderByVariable = $mainVariable;
     }
     $condition->orderByVariable = $mainVariable . 'sk';
     $skeyExpElement = Exporter::getSpecialPropertyResource('_SKEY');
     $weakConditions = array($condition->orderByVariable => "?{$mainVariable} " . $skeyExpElement->getQName() . " ?{$condition->orderByVariable} .\n");
     $condition->weakConditions += $weakConditions;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:18,代码来源:CompoundConditionBuilder.php


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