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


PHP DIProperty::isInverse方法代码示例

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


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

示例1: testCorrectInversePrefixForPredefinedProperty

 public function testCorrectInversePrefixForPredefinedProperty()
 {
     $property = new DIProperty('_SOBJ', true);
     $this->assertTrue($property->isInverse());
     $label = $property->getLabel();
     $this->assertEquals('-', $label[0]);
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:7,代码来源:DIPropertyTest.php

示例2: getContainerFor

 /**
  * @since 2.4
  *
  * @param DIProperty $property
  * @param array|string $errorMsg
  *
  * @return DIContainer
  */
 public function getContainerFor(DIProperty $property = null, $errorMsg = '')
 {
     if ($property !== null && $property->isInverse()) {
         $property = new DIProperty($property->getKey());
     }
     $errorMsg = is_array($errorMsg) ? implode(' ', $errorMsg) : $errorMsg;
     $subject = new DIWikiPage($this->subject->getDBkey(), $this->subject->getNamespace(), $this->subject->getInterwiki(), '_ERR' . md5(($property !== null ? $property->getKey() : 'UNKNOWN') . $errorMsg));
     // Encode brackets to avoid an annotion is created/included
     return $this->newDiContainer($subject, $property, InTextAnnotationParser::obscureAnnotation($errorMsg));
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:18,代码来源:Error.php

示例3: doMatchProperty

 private function doMatchProperty(&$subjects, DIProperty $property)
 {
     if ($property->isInverse()) {
         $property = new DIProperty($property->getKey());
     }
     if ($this->propertyHierarchyLookup->hasSubpropertyFor($property)) {
         $this->doMatchSubproperty($subjects, $property);
     }
     $key = str_replace(' ', '_', $property->getKey());
     if (!isset($this->propertyDependencyDetectionBlacklist[$key])) {
         $subjects[] = $property->getDiWikiPage();
     }
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:13,代码来源:EmbeddedQueryDependencyListResolver.php

示例4: removePropertyObjectValue

 /**
  * Remove a value for a property identified by its SMWDataItem object.
  * This method removes a property-value specified by the property and
  * dataitem. If there are no more property-values for this property it
  * also removes the property from the mProperties.
  *
  * @note There is no check whether the type of the given data item
  * agrees with the type of the property. Since property types can
  * change, all parts of SMW are prepared to handle mismatched data item
  * types anyway.
  *
  * @param $property DIProperty
  * @param $dataItem SMWDataItem
  *
  * @since 1.8
  */
 public function removePropertyObjectValue(DIProperty $property, SMWDataItem $dataItem)
 {
     //delete associated subSemanticData
     if ($dataItem instanceof SMWDIContainer) {
         $this->removeSubSemanticData($dataItem->getSemanticData());
         $dataItem = $dataItem->getSemanticData()->getSubject();
     }
     if ($property->isInverse()) {
         // inverse properties cannot be used for annotation
         return;
     }
     if (!array_key_exists($property->getKey(), $this->mPropVals) || !array_key_exists($property->getKey(), $this->mProperties)) {
         return;
     }
     if ($this->mNoDuplicates) {
         //this didn't get checked for my tests, but should work
         unset($this->mPropVals[$property->getKey()][$dataItem->getHash()]);
     } else {
         foreach ($this->mPropVals[$property->getKey()] as $index => $di) {
             if ($di->equals($dataItem)) {
                 unset($this->mPropVals[$property->getKey()][$index]);
             }
         }
         $this->mPropVals[$property->getKey()] = array_values($this->mPropVals[$property->getKey()]);
     }
     if ($this->mPropVals[$property->getKey()] === array()) {
         unset($this->mProperties[$property->getKey()]);
         unset($this->mPropVals[$property->getKey()]);
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:46,代码来源:SemanticData.php

示例5: newPropertyObjectValue

 /**
  * Create a value for the given property, provided as an SMWDIProperty
  * object. If no value is given, an empty container is created, the
  * value of which can be set later on.
  *
  * @param $property SMWDIProperty property object for which this value is made
  * @param $valueString mixed user value string, or false if unknown
  * @param $caption mixed user-defined caption, or false if none given
  * @param $contextPage SMWDIWikiPage that provides a context for parsing the value string, or null
  *
  * @return DataValue
  */
 public static function newPropertyObjectValue(DIProperty $property, $valueString = false, $caption = false, $contextPage = null)
 {
     $typeId = $property->isInverse() ? '_wpg' : $property->findPropertyTypeID();
     return self::newTypeIdValue($typeId, $valueString, $caption, $property, $contextPage);
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:17,代码来源:DataValueFactory.php

示例6: doExchangeForWhenInversePropertyIsUsed

 private function doExchangeForWhenInversePropertyIsUsed(DIProperty $property, $objectName, $joinVariable)
 {
     $subjectName = '?' . $joinVariable;
     $nonInverseProperty = $property;
     // Exchange arguments when property is inverse
     // don't check if this really makes sense
     if ($property->isInverse()) {
         $subjectName = $objectName;
         $objectName = '?' . $joinVariable;
         $nonInverseProperty = new DIProperty($property->getKey(), false);
     }
     return array($subjectName, $objectName, $nonInverseProperty);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:13,代码来源:SomePropertyInterpreter.php

示例7: doMatchProperty

 private function doMatchProperty(&$subjects, DIProperty $property)
 {
     if ($property->isInverse()) {
         $property = new DIProperty($property->getKey());
     }
     $subject = $property->getCanonicalDiWikiPage();
     if ($this->propertyHierarchyLookup->hasSubpropertyFor($property)) {
         $this->doMatchSubproperty($subjects, $subject, $property);
     }
     // Use the key here do match against pre-defined properties (e.g. _MDAT)
     $key = str_replace(' ', '_', $property->getKey());
     if (!isset($this->propertyDependencyExemptionlist[$key])) {
         $subjects[$subject->getHash()] = $subject;
     }
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:15,代码来源:QueryResultDependencyListResolver.php

示例8: getPropertyValues

 /**
  * Get the array of all stored values for some property.
  *
  * @since 1.8
  *
  * @param DIProperty $property
  *
  * @return array of SMWDataItem
  */
 public function getPropertyValues(DIProperty $property)
 {
     if ($property->isInverse()) {
         // we never have any data for inverses
         return array();
     }
     if (array_key_exists($property->getKey(), $this->mStubPropVals)) {
         // Not catching exception here; the
         $this->unstubProperty($property->getKey(), $property);
         $propertyTypeId = $property->findPropertyTypeID();
         $propertyDiId = DataTypeRegistry::getInstance()->getDataItemId($propertyTypeId);
         foreach ($this->mStubPropVals[$property->getKey()] as $dbkeys) {
             try {
                 $diHandler = $this->store->getDataItemHandlerForDIType($propertyDiId);
                 $di = $diHandler->dataItemFromDBKeys($dbkeys);
                 if ($this->mNoDuplicates) {
                     $this->mPropVals[$property->getKey()][$di->getHash()] = $di;
                 } else {
                     $this->mPropVals[$property->getKey()][] = $di;
                 }
             } catch (SMWDataItemException $e) {
                 // ignore data
             }
         }
         unset($this->mStubPropVals[$property->getKey()]);
     }
     return parent::getPropertyValues($property);
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:37,代码来源:SMW_Sql3StubSemanticData.php

示例9: getErrorContainerFromMsg

 /**
  * @since 2.5
  *
  * @param array|string $errorMsg
  * @param DIProperty|null $property
  *
  * @return DIContainer|null
  */
 public function getErrorContainerFromMsg($error, DIProperty $property = null)
 {
     if ($property !== null && $property->isInverse()) {
         $property = new DIProperty($property->getKey());
     }
     $error = Message::encode($error);
     $hash = $error;
     if ($property !== null) {
         $hash .= $property->getKey();
     }
     $containerSemanticData = $this->newContainerSemanticData($hash);
     $this->addToContainerSemanticData($containerSemanticData, $property, $error);
     return new DIContainer($containerSemanticData);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:22,代码来源:ProcessingErrorMsgHandler.php

示例10: newDataValueByProperty

 /**
  * Create a value for the given property, provided as an SMWDIProperty
  * object. If no value is given, an empty container is created, the
  * value of which can be set later on.
  *
  * @param $property SMWDIProperty property object for which this value is made
  * @param $valueString mixed user value string, or false if unknown
  * @param $caption mixed user-defined caption, or false if none given
  * @param $contextPage SMWDIWikiPage that provides a context for parsing the value string, or null
  *
  * @return DataValue
  */
 public function newDataValueByProperty(DIProperty $property, $valueString = false, $caption = false, $contextPage = null)
 {
     $typeId = $property->isInverse() ? '_wpg' : $property->findPropertyTypeID();
     return $this->newDataValueByType($typeId, $valueString, $caption, $property, $contextPage);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:17,代码来源:DataValueFactory.php


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