本文整理汇总了PHP中SMW\DIProperty::isUserDefined方法的典型用法代码示例。如果您正苦于以下问题:PHP DIProperty::isUserDefined方法的具体用法?PHP DIProperty::isUserDefined怎么用?PHP DIProperty::isUserDefined使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMW\DIProperty
的用法示例。
在下文中一共展示了DIProperty::isUserDefined方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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);
}
示例3: addPropertyObjectValue
/**
* Store a value for a property identified by its SMWDataItem object.
*
* @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
*/
public function addPropertyObjectValue(DIProperty $property, SMWDataItem $dataItem)
{
if ($dataItem instanceof SMWDIContainer) {
$this->addSubSemanticData($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)) {
$this->mPropVals[$property->getKey()] = array();
$this->mProperties[$property->getKey()] = $property;
}
if ($this->mNoDuplicates) {
$this->mPropVals[$property->getKey()][$dataItem->getHash()] = $dataItem;
} else {
$this->mPropVals[$property->getKey()][] = $dataItem;
}
if (!$property->isUserDefined()) {
if ($property->isShown()) {
$this->mHasVisibleSpecs = true;
$this->mHasVisibleProps = true;
}
} else {
$this->mHasVisibleProps = true;
}
}
示例4: addPropertyObjectValue
/**
* Store a value for a property identified by its SMWDataItem object.
*
* @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
*/
public function addPropertyObjectValue(DIProperty $property, SMWDataItem $dataItem)
{
$this->hash = null;
if ($dataItem instanceof SMWDIContainer) {
$this->addSubSemanticData($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)) {
$this->mPropVals[$property->getKey()] = array();
$this->mProperties[$property->getKey()] = $property;
}
if ($this->mNoDuplicates) {
$this->mPropVals[$property->getKey()][$dataItem->getHash()] = $dataItem;
} else {
$this->mPropVals[$property->getKey()][] = $dataItem;
}
if (!$property->isUserDefined()) {
if ($property->isShown()) {
$this->mHasVisibleSpecs = true;
$this->mHasVisibleProps = true;
}
} else {
$this->mHasVisibleProps = true;
}
// Inherit the sortkey from the root if not explicitly given
if ($this->mSubject->getSubobjectName() === '' && $property->getKey() === DIProperty::TYPE_SORTKEY) {
foreach ($this->subSemanticData as $subSemanticData) {
if (!$subSemanticData->hasProperty($property)) {
$subSemanticData->addPropertyObjectValue($property, $dataItem);
}
}
}
}
示例5: tryToAddPropertyPathForSaturatedHierarchy
/**
* @note rdfs:subPropertyOf* where * means a property path of arbitrary length
* can be found using the "zero or more" will resolve the complete path
*
* @see http://www.w3.org/TR/sparql11-query/#propertypath-arbitrary-length
*/
private function tryToAddPropertyPathForSaturatedHierarchy(&$condition, DIProperty $property, &$propertyName)
{
if (!$this->compoundConditionBuilder->canUseQFeature(SMW_SPARQL_QF_SUBP) || !$property->isUserDefined()) {
return null;
}
if ($this->compoundConditionBuilder->getPropertyHierarchyLookup() == null || !$this->compoundConditionBuilder->getPropertyHierarchyLookup()->hasSubpropertyFor($property)) {
return null;
}
$subPropExpElement = $this->exporter->getSpecialPropertyResource('_SUBP', SMW_NS_PROPERTY);
$propertyByVariable = '?' . $this->compoundConditionBuilder->getNextVariable('sp');
$condition->weakConditions[$propertyName] = "\n" . "{$propertyByVariable} " . $subPropExpElement->getQName() . "*" . " {$propertyName} .\n" . "";
$propertyName = $propertyByVariable;
}
示例6: unstubProperty
/**
* Unstub a single property from the stub data array. If available, an
* existing object for that property might be provided, so we do not
* need to make a new one. It is not checked if the object matches the
* property name.
*
* @since 1.8
*
* @param string $propertyKey
* @param SMWDIProperty $diProperty if available
* @throws SMWDataItemException if property key is not valid
* and $diProperty is null
*/
protected function unstubProperty($propertyKey, $diProperty = null)
{
if (!array_key_exists($propertyKey, $this->mProperties)) {
if (is_null($diProperty)) {
$diProperty = new DIProperty($propertyKey, false);
}
$this->mProperties[$propertyKey] = $diProperty;
if (!$diProperty->isUserDefined()) {
if ($diProperty->isShown()) {
$this->mHasVisibleSpecs = true;
$this->mHasVisibleProps = true;
}
} else {
$this->mHasVisibleProps = true;
}
}
}
示例7: formatPropertyItem
/**
* Produce a formatted string representation for showing a property and
* its usage count in the list of used properties.
*
* @since 1.8
*
* @param DIProperty $property
* @param integer $useCount
* @return string
*/
protected function formatPropertyItem(DIProperty $property, $useCount)
{
// Clear formatter before invoking messages
$this->getMessageFormatter()->clear();
$diWikiPage = $property->getDiWikiPage();
$title = $diWikiPage !== null ? $diWikiPage->getTitle() : null;
if ($useCount == 0 && !$this->settings->get('smwgPropertyZeroCountDisplay')) {
return '';
}
if ($property->isUserDefined()) {
if ($title === null) {
// Show even messed up property names.
$typestring = '';
$proplink = $property->getLabel();
$this->getMessageFormatter()->addFromKey('smw_notitle', $proplink);
} else {
list($typestring, $proplink) = $this->getUserDefinedPropertyInfo($title, $property, $useCount);
}
} else {
list($typestring, $proplink) = $this->getPredefinedPropertyInfo($property);
}
if ($typestring === '') {
// Built-ins have no type
// @todo Should use numParams for $useCount?
return $this->msg('smw_property_template_notype')->rawParams($proplink)->numParams($useCount)->text() . ' ' . $this->getMessageFormatter()->setType('warning')->escape(false)->getHtml();
} else {
// @todo Should use numParams for $useCount?
return $this->msg('smw_property_template')->rawParams($proplink, $typestring)->numParams($useCount)->escaped() . ' ' . $this->getMessageFormatter()->setType('warning')->escape(false)->getHtml();
}
}
示例8: formatPropertyItem
/**
* Produce a formatted string representation for showing a property and
* its usage count in the list of used properties.
*
* @since 1.8
*
* @param DIProperty $property
* @param integer $useCount
* @return string
*/
protected function formatPropertyItem(DIProperty $property, $useCount)
{
// Clear formatter before invoking messages
$this->getMessageFormatter()->clear();
$diWikiPage = $property->getDiWikiPage();
$title = $diWikiPage !== null ? $diWikiPage->getTitle() : null;
if ($useCount == 0 && !$this->settings->get('smwgPropertyZeroCountDisplay')) {
return '';
}
if ($property->isUserDefined()) {
if ($title === null) {
// Show even messed up property names.
$typestring = '';
$proplink = $property->getLabel();
$this->getMessageFormatter()->addFromArray(array('ID: ' . (isset($property->id) ? $property->id : 'N/A')))->addFromKey('smw_notitle', $proplink);
} else {
list($typestring, $proplink) = $this->getUserDefinedPropertyInfo($title, $property, $useCount);
}
$infoLink = '';
// Add a link to SearchByProperty to hopefully identify the
// "hidden" reference
if ($useCount < 1) {
$infoLink = ' ' . \SMWInfolink::newPropertySearchLink('+', $property->getLabel(), '')->getHTML($this->getLinker());
}
$proplink .= $infoLink;
} else {
list($typestring, $proplink) = $this->getPredefinedPropertyInfo($property);
}
if ($typestring === '') {
// Built-ins have no type
// @todo Should use numParams for $useCount?
return $this->msg('smw_property_template_notype')->rawParams($proplink)->numParams($useCount)->text() . ' ' . $this->getMessageFormatter()->setType('warning')->escape(false)->getHtml();
} else {
// @todo Should use numParams for $useCount?
return $this->msg('smw_property_template')->rawParams($proplink, $typestring)->numParams($useCount)->escaped() . ' ' . $this->getMessageFormatter()->setType('warning')->escape(false)->getHtml();
}
}
示例9: isResourceBuilderFor
/**
* @since 2.5
*
* {@inheritDoc}
*/
public function isResourceBuilderFor(DIProperty $property)
{
return !$property->isUserDefined() && $this->requiresAuxiliary($property->getKey());
}
示例10: isResourceBuilderFor
/**
* @since 2.5
*
* {@inheritDoc}
*/
public function isResourceBuilderFor(DIProperty $property)
{
return !$property->isUserDefined();
}