本文整理汇总了PHP中SMW\DIProperty::findPropertyTypeID方法的典型用法代码示例。如果您正苦于以下问题:PHP DIProperty::findPropertyTypeID方法的具体用法?PHP DIProperty::findPropertyTypeID怎么用?PHP DIProperty::findPropertyTypeID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMW\DIProperty
的用法示例。
在下文中一共展示了DIProperty::findPropertyTypeID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: formatPropertyItem
/**
* Produce a formatted string representation for showing a property in
* the list of unused properties.
*
* @since 1.8
*
* @param DIProperty $property
*
* @return string
*/
protected function formatPropertyItem(DIProperty $property)
{
// Clear formatter before invoking messages and
// avoid having previous data to be present
$this->getMessageFormatter()->clear();
if ($property->isUserDefined()) {
$title = $property->getDiWikiPage()->getTitle();
if (!$title instanceof \Title) {
return '';
}
$propertyLink = $this->getLinker()->link($title, $property->getLabel());
$types = $this->store->getPropertyValues($property->getDiWikiPage(), new DIProperty('_TYPE'));
if (count($types) >= 1) {
$typeDataValue = DataValueFactory::getInstance()->newDataItemValue(current($types), new DIProperty('_TYPE'));
} else {
$typeDataValue = SMWTypesValue::newFromTypeId('_wpg');
$this->getMessageFormatter()->addFromKey('smw_propertylackstype', $typeDataValue->getLongHTMLText());
}
} else {
$typeDataValue = SMWTypesValue::newFromTypeId($property->findPropertyTypeID());
$propertyLink = DataValueFactory::getInstance()->newDataItemValue($property, null)->getShortHtmlText($this->getLinker());
}
return $this->msg('smw_unusedproperty_template', $propertyLink, $typeDataValue->getLongHTMLText($this->getLinker()))->text() . ' ' . $this->getMessageFormatter()->getHtml();
}
示例3: 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);
}
示例4: hasHelperExpElement
/**
* Check whether the values of a given type of dataitem have helper
* values in the sense of SMWExporter::getInstance()->getDataItemHelperExpElement().
*
* @param DIProperty $property
*
* @return boolean
*/
public static function hasHelperExpElement(DIProperty $property)
{
return $property->findPropertyTypeID() === '_dat' || $property->findPropertyTypeID() === '_geo' || !$property->isUserDefined() && !self::hasSpecialPropertyResource($property);
}
示例5: testSetPropertyTypeIdOnPredefinedProperty
public function testSetPropertyTypeIdOnPredefinedProperty()
{
$property = new DIProperty('_MDAT');
$property->setPropertyTypeId('_dat');
$this->assertEquals('_dat', $property->findPropertyTypeID());
}
示例6: findTableIdForProperty
/**
* Retrieve the id of the property table that is to be used for storing
* values for the given property object.
*
* @since 2.2
*
* @param DIProperty $property
*
* @return string
*/
public function findTableIdForProperty(DIProperty $property)
{
if ($this->fixedPropertyTableIds === null) {
$this->buildDefinitionsForPropertyTables();
}
$propertyKey = $property->getKey();
if (array_key_exists($propertyKey, $this->fixedPropertyTableIds)) {
return $this->fixedPropertyTableIds[$propertyKey];
}
return $this->findTableIdForDataTypeTypeId($property->findPropertyTypeID());
}
示例7: isResourceBuilderFor
/**
* @since 2.5
*
* {@inheritDoc}
*/
public function isResourceBuilderFor(DIProperty $property)
{
return $property->findPropertyTypeID() === '_mlt_rec';
}
示例8: isExemptedProperty
/**
* @since 2.5
*
* @param DIProperty $property
*
* @return boolean
*/
public function isExemptedProperty(DIProperty $property)
{
$dataItemTypeId = DataTypeRegistry::getInstance()->getDataItemId($property->findPropertyTypeID());
// Is neither therefore is exempted
if ($dataItemTypeId !== DataItem::TYPE_BLOB && $dataItemTypeId !== DataItem::TYPE_URI) {
return true;
}
return isset($this->propertyExemptionList[$property->getKey()]);
}
示例9: 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()];
}
示例10: getPredefinedPropertyInfo
/**
* Returns information related to predefined properties
*
* @since 1.9
*
* @param DIProperty $property
*
* @return array
*/
private function getPredefinedPropertyInfo(DIProperty $property)
{
return array(SMWTypesValue::newFromTypeId($property->findPropertyTypeID())->getLongHTMLText($this->getLinker()), DataValueFactory::getInstance()->newDataItemValue($property, null)->getShortHtmlText($this->getLinker()));
}
示例11: 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;
}
示例12: mapPropertyToResourceElement
/**
* Create an ExpElement for some internal resource, given by an
* DIProperty object.
*
* This code is only applied to user-defined properties, since the
* code for special properties in
* Exporter::getSpecialPropertyResource may require information
* about the namespace in which some special property is used.
*
* @note $useAuxiliaryModifier is to determine whether an auxiliary
* property resource is to store a helper value
* (see Exporter::getDataItemHelperExpElement) should be generated
*
* @param DIProperty $property
* @param boolean $useAuxiliaryModifier
*
* @return ExpResource
* @throws RuntimeException
*/
public function mapPropertyToResourceElement(DIProperty $property, $useAuxiliaryModifier = false)
{
$diWikiPage = $property->getDiWikiPage();
if ($diWikiPage === null) {
throw new RuntimeException('Only non-inverse, user-defined properties are permitted.');
}
// No need for any aux properties besides those listed here
if (!$this->bcAuxiliaryUse && $property->findPropertyTypeID() !== '_dat' && $property->findPropertyTypeID() !== '_geo') {
$useAuxiliaryModifier = false;
}
return $this->mapWikiPageToResourceElement($diWikiPage, $useAuxiliaryModifier);
}
示例13: 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());
}
}
示例14: 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);
}
示例15: mapPropertyToResourceElement
/**
* Create an ExpElement for some internal resource, given by an
* DIProperty object.
*
* This code is only applied to user-defined properties, since the
* code for special properties in
* Exporter::getSpecialPropertyResource may require information
* about the namespace in which some special property is used.
*
* @note $useAuxiliaryModifier is to determine whether an auxiliary
* property resource is to store a helper value
* (see Exporter::getDataItemHelperExpElement) should be generated
*
* @param DIProperty $property
* @param boolean $useAuxiliaryModifier
* @param boolean $seekImportVocabulary
*
* @return ExpResource
* @throws RuntimeException
*/
public function mapPropertyToResourceElement(DIProperty $property, $useAuxiliaryModifier = false, $seekImportVocabulary = true)
{
// We want the a canonical representation to ensure that resources
// are language independent
$this->seekImportVocabulary = $seekImportVocabulary;
$diWikiPage = $property->getCanonicalDiWikiPage();
if ($diWikiPage === null) {
throw new RuntimeException('Only non-inverse, user-defined properties are permitted.');
}
// No need for any aux properties besides those listed here
if (!$this->bcAuxiliaryUse && $property->findPropertyTypeID() !== '_dat' && $property->findPropertyTypeID() !== '_geo') {
$useAuxiliaryModifier = false;
}
$expResource = $this->mapWikiPageToResourceElement($diWikiPage, $useAuxiliaryModifier);
$this->seekImportVocabulary = true;
return $expResource;
}