本文整理汇总了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;
}
示例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());
}
示例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);
}
示例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;
}
示例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);
}
示例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());
}
示例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());
}
示例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;
}