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


PHP SMWExporter::hasHelperExpElement方法代码示例

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


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

示例1: getPropertyNameByUsingTurtleSerializer

 private function getPropertyNameByUsingTurtleSerializer(DIProperty $property, DIProperty $nonInverseProperty, &$namespaces)
 {
     // Use helper properties in encoding values, refer to this helper property:
     if ($this->exporter->hasHelperExpElement($property)) {
         $propertyExpElement = $this->exporter->getResourceElementForProperty($nonInverseProperty, true);
     } else {
         $propertyExpElement = $this->exporter->getResourceElementForProperty($nonInverseProperty);
     }
     if ($propertyExpElement instanceof ExpNsResource) {
         $namespaces[$propertyExpElement->getNamespaceId()] = $propertyExpElement->getNamespace();
     }
     return TurtleSerializer::getTurtleNameForExpElement($propertyExpElement);
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:13,代码来源:SomePropertyInterpreter.php

示例2: findMostSuitablePropertyRepresentation

 private function findMostSuitablePropertyRepresentation(DIProperty $property, DIProperty $nonInverseProperty, &$namespaces)
 {
     $redirectByVariable = $this->compoundConditionBuilder->tryToFindRedirectVariableForDataItem($nonInverseProperty->getDiWikiPage());
     // If the property is represented by a redirect then use the variable instead
     if ($redirectByVariable !== null) {
         return $redirectByVariable;
     }
     // Use helper properties in encoding values, refer to this helper property:
     if ($this->exporter->hasHelperExpElement($property)) {
         $propertyExpElement = $this->exporter->getResourceElementForProperty($nonInverseProperty, true);
     } elseif (!$property->isUserDefined()) {
         $propertyExpElement = $this->exporter->getSpecialPropertyResource($nonInverseProperty->getKey(), SMW_NS_PROPERTY);
     } else {
         $propertyExpElement = $this->exporter->getResourceElementForProperty($nonInverseProperty);
     }
     if ($propertyExpElement instanceof ExpNsResource) {
         $namespaces[$propertyExpElement->getNamespaceId()] = $propertyExpElement->getNamespace();
     }
     return TurtleSerializer::getTurtleNameForExpElement($propertyExpElement);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:20,代码来源:SomePropertyInterpreter.php

示例3: buildPropertyCondition

 /**
  * Recursively create an SMWSparqlCondition from an SMWSomeProperty.
  *
  * @param $description SMWSomeProperty
  * @param $joinVariable string name, see buildSparqlCondition()
  * @param $orderByProperty mixed SMWDIProperty or null, see buildSparqlCondition()
  * @return SMWSparqlCondition
  */
 protected function buildPropertyCondition(SMWSomeProperty $description, $joinVariable, $orderByProperty)
 {
     $diProperty = $description->getProperty();
     //*** Find out if we should order by the values of this property ***//
     if (array_key_exists($diProperty->getKey(), $this->m_sortkeys)) {
         $innerOrderByProperty = $diProperty;
     } else {
         $innerOrderByProperty = null;
     }
     //*** Prepare inner condition ***//
     $innerJoinVariable = $this->getNextVariable();
     $innerCondition = $this->buildSparqlCondition($description->getDescription(), $innerJoinVariable, $innerOrderByProperty);
     $namespaces = $innerCondition->namespaces;
     if ($innerCondition instanceof SMWSparqlFalseCondition) {
         return new SMWSparqlFalseCondition();
     } elseif ($innerCondition instanceof SMWSparqlSingletonCondition) {
         $matchElement = $innerCondition->matchElement;
         $objectName = SMWTurtleSerializer::getTurtleNameForExpElement($matchElement);
         if ($matchElement instanceof SMWExpNsResource) {
             $namespaces[$matchElement->getNamespaceId()] = $matchElement->getNamespace();
         }
     } else {
         $objectName = '?' . $innerJoinVariable;
     }
     //*** Exchange arguments when property is inverse ***//
     if ($diProperty->isInverse()) {
         // don't check if this really makes sense
         $subjectName = $objectName;
         $objectName = '?' . $joinVariable;
         $diNonInverseProperty = new SMWDIProperty($diProperty->getKey(), false);
     } else {
         $subjectName = '?' . $joinVariable;
         $diNonInverseProperty = $diProperty;
     }
     //*** Build the condition ***//
     $typeId = $diProperty->findPropertyTypeID();
     $diType = SMWDataValueFactory::getDataItemId($typeId);
     // for types that use helper properties in encoding values, refer to this helper property:
     if (SMWExporter::hasHelperExpElement($diType)) {
         $propertyExpElement = SMWExporter::getResourceElementForProperty($diNonInverseProperty, true);
     } else {
         $propertyExpElement = SMWExporter::getResourceElementForProperty($diNonInverseProperty);
     }
     $propertyName = SMWTurtleSerializer::getTurtleNameForExpElement($propertyExpElement);
     if ($propertyExpElement instanceof SMWExpNsResource) {
         $namespaces[$propertyExpElement->getNamespaceId()] = $propertyExpElement->getNamespace();
     }
     $condition = "{$subjectName} {$propertyName} {$objectName} .\n";
     $innerConditionString = $innerCondition->getCondition() . $innerCondition->getWeakConditionString();
     if ($innerConditionString !== '') {
         if ($innerCondition instanceof SMWSparqlFilterCondition) {
             $condition .= $innerConditionString;
         } else {
             $condition .= "{ {$innerConditionString}}\n";
         }
     }
     $result = new SMWSparqlWhereCondition($condition, true, $namespaces);
     //*** Record inner ordering variable if found ***//
     $result->orderVariables = $innerCondition->orderVariables;
     if (!is_null($innerOrderByProperty) && $innerCondition->orderByVariable !== '') {
         $result->orderVariables[$diProperty->getKey()] = $innerCondition->orderByVariable;
     }
     $this->addOrderByDataForProperty($result, $joinVariable, $orderByProperty, SMWDataItem::TYPE_WIKIPAGE);
     return $result;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:73,代码来源:SMW_SparqlStoreQueryEngine.php

示例4: testExportSubobject

 public function testExportSubobject()
 {
     $semanticData = $this->semanticDataFactory->newEmptySemanticData(__METHOD__);
     $subobject = new Subobject($semanticData->getSubject()->getTitle());
     $subobject->setEmptyContainerForId('Foo');
     $semanticData->addPropertyObjectValue($subobject->getProperty(), $subobject->getContainer());
     $exportData = Exporter::makeExportData($semanticData);
     $expectedProperty = new ExpNsResource($this->transformPropertyLabelToAuxiliary($subobject->getProperty()), Exporter::getNamespaceUri('property'), 'property', new DIWikiPage('Has_subobject', SMW_NS_PROPERTY));
     $this->assertTrue(Exporter::hasHelperExpElement($subobject->getProperty()));
     $this->assertCount(1, $exportData->getValues($expectedProperty));
     $this->exportDataValidator->assertThatExportDataContainsProperty($expectedProperty, $exportData);
     $expectedResource = new ExpNsResource(Exporter::getEncodedPageName($subobject->getSemanticData()->getSubject()) . '-23' . 'Foo', Exporter::getNamespaceUri('wiki'), 'wiki', $subobject->getSemanticData()->getSubject());
     $this->exportDataValidator->assertThatExportDataContainsResource($expectedResource, $expectedProperty, $exportData);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:14,代码来源:ExportSemanticDataTest.php


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