本文整理汇总了PHP中SMW\DIProperty::getKey方法的典型用法代码示例。如果您正苦于以下问题:PHP DIProperty::getKey方法的具体用法?PHP DIProperty::getKey怎么用?PHP DIProperty::getKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMW\DIProperty
的用法示例。
在下文中一共展示了DIProperty::getKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: testPredefinedProperty
public function testPredefinedProperty()
{
$instance = new HashBuilder();
$property = new DIProperty('_MDAT');
$dataItem = $property->getDiWikiPage();
$this->assertEquals($dataItem, $instance->newDiWikiPageFromHash($instance->getHashIdForDiWikiPage($dataItem)));
$this->assertEquals($dataItem, $instance->newDiWikiPageFromHash($instance->createHashIdFromSegments($property->getKey(), SMW_NS_PROPERTY)));
}
示例3: doCheckInternalPropertyIndices
/**
* Create some initial DB entries for important built-in properties. Having the DB contents predefined
* allows us to safe DB calls when certain data is needed. At the same time, the entries in the DB
* make sure that DB-based functions work as with all other properties.
*/
private function doCheckInternalPropertyIndices($connection)
{
$this->messageReporter->reportMessage("\nSetting up internal property indices ...\n");
$this->doCheckPredefinedPropertyBorder($connection);
// now write actual properties; do that each time, it is cheap enough and we can update sortkeys by current language
$this->messageReporter->reportMessage(" ... writing entries for internal properties ...\n");
foreach (SMWSql3SmwIds::$special_ids as $prop => $id) {
$property = new DIProperty($prop);
$connection->replace(SQLStore::ID_TABLE, array('smw_id'), array('smw_id' => $id, 'smw_title' => $property->getKey(), 'smw_namespace' => SMW_NS_PROPERTY, 'smw_iw' => $this->store->getObjectIds()->getPropertyInterwiki($property), 'smw_subobject' => '', 'smw_sortkey' => $property->getCanonicalLabel()), __METHOD__);
}
$this->messageReporter->reportMessage(" ... done.\n");
}
示例4: getPropertyValues
/**
* @since 2.4
*
* @param DIWikiPage $subject
* @param DIProperty $property
* @param RequestOptions|null $requestOptions
*
* @return array
*/
public function getPropertyValues(DIWikiPage $subject, DIProperty $property, RequestOptions $requestOptions = null)
{
$key = $property->getKey() . ':' . $subject->getSubobjectName() . ':' . ($requestOptions !== null ? $requestOptions->getHash() : null);
$container = $this->blobStore->read($this->getRootHashFrom($subject));
if ($container->has($key)) {
return $container->get($key);
}
$dataItems = $this->store->getPropertyValues($subject, $property, $requestOptions);
$container->set($key, $dataItems);
$this->blobStore->save($container);
return $dataItems;
}
示例5: addResourceValue
/**
* @since 2.5
*
* {@inheritDoc}
*/
public function addResourceValue(ExpData $expData, DIProperty $property, DataItem $dataItem)
{
$diSubject = $expData->getSubject()->getDataItem();
if ($diSubject === null) {
return;
}
$expNsResource = $this->exporter->getSpecialPropertyResource($property->getKey(), $diSubject->getNamespace());
$expElement = $this->exporter->getDataItemExpElement($dataItem);
if ($expElement === null || $expNsResource === null) {
return;
}
$expData->addPropertyObjectValue($expNsResource, $expElement);
$this->addResourceHelperValue($expData, $property, $dataItem);
}
示例6: addResourceValue
/**
* @since 2.5
*
* {@inheritDoc}
*/
public function addResourceValue(ExpData $expData, DIProperty $property, DataItem $dataItem)
{
$expElement = $this->exporter->getDataItemExpElement($dataItem);
if ($expElement === null) {
return;
}
if ($property->getKey() === $property->findPropertyTypeID()) {
// Ensures that Boolean remains Boolean and not localized canonical
// representation such as "Booléen" when the content languageis not
// English
$expNsResource = $this->getResourceElementForProperty(new DIProperty($property->getCanonicalDiWikiPage()->getDBKey()));
} else {
$expNsResource = $this->getResourceElementHelperForProperty($property);
}
$expData->addPropertyObjectValue($expNsResource, $expElement);
$this->addResourceHelperValue($expData, $property, $dataItem);
}
示例7: addResourceValue
/**
* @since 2.5
*
* {@inheritDoc}
*/
public function addResourceValue(ExpData $expData, DIProperty $property, DataItem $dataItem)
{
$diSubject = $expData->getSubject()->getDataItem();
if ($diSubject === null) {
return;
}
$expNsResource = $this->exporter->getSpecialPropertyResource($property->getKey(), $diSubject->getNamespace());
if ($expNsResource === null) {
return;
}
$dataValue = DataValueFactory::getInstance()->newDataValueByItem($dataItem, $property);
if (!$dataValue instanceof ImportValue) {
return;
}
$expData->addPropertyObjectValue($expNsResource, $this->exporter->getDataItemExpElement(new DIBlob($dataValue->getImportReference())));
$this->addResourceHelperValue($expData, $property, $dataItem);
}
示例8: getDataItemId
/**
* Returns DataItemId for a property
*
* @note findPropertyTypeID is calling the Store to find the
* typeId reference this is costly but at the moment there is no other
* way to determine the typeId
*
* This check is to ensure that during unserialization the correct item
* in terms of its definition is being sought otherwise inconsistencies
* can occur due to type changes of a property between the time of
* the serialization and the deserialization (e.g for when the
* serialization object is stored in cache, DB etc.)
*
* @return integer
*/
protected function getDataItemId(DIProperty $property)
{
if (!isset($this->dataItemTypeIdCache[$property->getKey()])) {
$this->dataItemTypeIdCache[$property->getKey()] = DataTypeRegistry::getInstance()->getDataItemId($property->findPropertyTypeID());
}
return $this->dataItemTypeIdCache[$property->getKey()];
}
示例9: findPropertyTableID
/**
* Retrieve the id of the property table that is to be used for storing
* values for the given property object.
*
* @since 1.8
* @param DIProperty $diProperty
* @return string
*/
public function findPropertyTableID(DIProperty $diProperty)
{
$propertyKey = $diProperty->getKey();
// This is needed to initialize the $fixedPropertyTableIds field
$this->getPropertyTables();
if (array_key_exists($propertyKey, self::$fixedPropertyTableIds)) {
return self::$fixedPropertyTableIds[$propertyKey];
} else {
return $this->findTypeTableId($diProperty->findPropertyTypeID());
}
}
示例10: 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);
}
示例11: 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;
}
}
示例12: assertContainsPropertyLabels
private function assertContainsPropertyLabels($labels, DIProperty $property)
{
$this->assertContains($property->getLabel(), $labels, __METHOD__ . " asserts property label for '{$property->getKey()}' with ({$this->formatAsString($labels)})");
}
示例13: 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();
}
}
示例14: 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);
}
示例15: isResourceBuilderFor
/**
* @since 2.5
*
* {@inheritDoc}
*/
public function isResourceBuilderFor(DIProperty $property)
{
return $property->getKey() === '_CONC';
}