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


PHP SemanticData::addDataValue方法代码示例

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


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

示例1: asEntity

 /**
  * @since 2.1
  *
  * @return SemanticData
  */
 public function asEntity()
 {
     $semanticData = new SemanticData($this->asSubject());
     $semanticData->addDataValue($this->getLocatedInValue());
     $countryCategory = new CountryCategory();
     $semanticData->addDataValue($countryCategory->getCategoryValue());
     return $semanticData;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:13,代码来源:FranceFactsheet.php

示例2: testAddUserDefinedPropertyAsDataValueToSemanticDataForStorage

 public function testAddUserDefinedPropertyAsDataValueToSemanticDataForStorage()
 {
     $propertyAsString = 'SomePropertyAsString';
     $this->subjects[] = $subject = DIWikiPage::newFromTitle(Title::newFromText(__METHOD__));
     $semanticData = new SemanticData($subject);
     $dataValue = DataValueFactory::getInstance()->newPropertyValue($propertyAsString, 'Foo', false, $subject);
     $semanticData->addDataValue($dataValue);
     $this->getStore()->updateData($semanticData);
     $this->assertArrayHasKey($propertyAsString, $this->getStore()->getSemanticData($subject)->getProperties());
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:10,代码来源:SemanticDataStorageDBIntegrationTest.php

示例3: testRedirectTragetLookupForExistingEntry

 public function testRedirectTragetLookupForExistingEntry()
 {
     $property = new DIProperty('RedirectLookupForExistingEntry');
     $semanticData = new SemanticData(new DIWikiPage(__METHOD__, NS_MAIN, ''));
     $semanticData->addDataValue(DataValueFactory::getInstance()->newPropertyObjectValue($property, 'Bar'));
     $this->store->doSparqlDataUpdate($semanticData);
     $expNsResource = new ExpNsResource('RedirectLookupForExistingEntry', Exporter::getNamespaceUri('property'), 'property');
     $instance = new RedirectLookup($this->sparqlDatabase);
     $instance->clear();
     $exists = null;
     $this->assertSame($expNsResource, $instance->findRedirectTargetResource($expNsResource, $exists));
     $this->assertTrue($exists);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:13,代码来源:RedirectLookupIntegrationTest.php

示例4: asEntity

 /**
  * @since 2.1
  *
  * @return SemanticData
  */
 public function asEntity()
 {
     $semanticData = new SemanticData($this->asSubject());
     $semanticData->addDataValue($this->getAreaValue());
     $semanticData->addDataValue($this->getAverageHighTemperatureValue());
     $semanticData->addDataValue($this->getPopulationValue());
     $semanticData->addDataValue($this->getPopulationDensityValue());
     $semanticData->addDataValue($this->getLocatedInValue());
     $semanticData->addDataValue($this->getFoundedValue());
     $semanticData->addSubobject($this->getDemographics());
     $cityCategory = new CityCategory();
     $semanticData->addDataValue($cityCategory->getCategoryValue());
     return $semanticData;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:19,代码来源:BerlinFactsheet.php

示例5: testAddDataValues

 /**
  * @dataProvider dataValueDataProvider
  */
 public function testAddDataValues($dataValues, $expected)
 {
     $title = Title::newFromText(__METHOD__);
     $instance = new SemanticData(DIWikiPage::newFromTitle($title));
     foreach ($dataValues as $dataValue) {
         $instance->addDataValue($dataValue);
     }
     if ($expected['error'] > 0) {
         return $this->assertCount($expected['error'], $instance->getErrors());
     }
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $instance);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:15,代码来源:SemanticDataTest.php

示例6: typeChangeSemanticDataProvider

 /**
  * @return array
  */
 public function typeChangeSemanticDataProvider()
 {
     $provider = array();
     $title = \Title::newFromText(__METHOD__);
     // #0 Single entry
     $foo = new SemanticData(DIWikiPage::newFromTitle($title));
     $foo->addDataValue(DataValueFactory::getInstance()->newPropertyValue('Has fooQuex', 'Bar'));
     $provider[] = array($foo, 'Has_fooQuex');
     // #1 Single subobject entry
     $foo = new SemanticData(DIWikiPage::newFromTitle($title));
     $subobject = new Subobject($title);
     $subobject->setSemanticData('Foo');
     $subobject->addDataValue(DataValueFactory::getInstance()->newPropertyValue('Has fomQuex', 'Bam'));
     $foo->addPropertyObjectValue($subobject->getProperty(), $subobject->getContainer());
     $provider[] = array($foo, 'Has_fomQuex');
     // #2 Combined
     $foo = new SemanticData(DIWikiPage::newFromTitle($title));
     $foo->addDataValue(DataValueFactory::getInstance()->newPropertyValue('Has fooQuex', 'Bar'));
     $foo->addPropertyObjectValue($subobject->getProperty(), $subobject->getContainer());
     $provider[] = array($foo, 'Has_fomQuex');
     return $provider;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:25,代码来源:SemanticDataSerializerDeserializerRoundtripTest.php

示例7: addDataValue

 /**
  * @see SemanticData::addDataValue
  *
  * @since 1.9
  *
  * @param SMWDataValue $dataValue
  */
 public function addDataValue(DataValue $dataValue)
 {
     $this->semanticData->addDataValue($dataValue);
     $this->addError($this->semanticData->getErrors());
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:12,代码来源:ParserData.php

示例8: testSetGetSemanticData

 public function testSetGetSemanticData()
 {
     $title = Title::newFromText(__METHOD__);
     $parserOutput = new ParserOutput();
     $instance = new ParserData($title, $parserOutput);
     $this->assertTrue($instance->getSemanticData()->isEmpty());
     $semanticData = new SemanticData(DIWikiPage::newFromTitle(Title::newFromText(__METHOD__)));
     $semanticData->addDataValue($this->dataValueFactory->newDataValueByText('Foo', 'Bar'));
     $instance->setSemanticData($semanticData);
     $this->assertFalse($instance->getSemanticData()->isEmpty());
     $this->assertEquals($semanticData->getHash(), $instance->getSemanticData()->getHash());
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:12,代码来源:ParserDataTest.php

示例9: getDependencies

 /**
  * @since 2.1
  *
  * @return SemanticData
  */
 public function getDependencies()
 {
     $semanticData = new SemanticData($this->property->getDiWikiPage());
     $semanticData->addDataValue(DataValueFactory::getInstance()->newPropertyObjectValue(new DIProperty('_TYPE'), $this->property->findPropertyTypeID()));
     return $semanticData;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:11,代码来源:FixtureProperty.php


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