Semantic MediaWiki and related extensions
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
SMWPropertyValue Class Reference
Collaboration diagram for SMWPropertyValue:
Collaboration graph
[legend]

Public Member Functions

 __construct ($typeid=self::TYPE_ID)
 
 __clone ()
 
 getInceptiveProperty ()
 
 getPreferredLabel ()
 
 setLinkAttributes (array $linkAttributes)
 
 setCaption ($caption)
 
 setOutputFormat ($formatstring)
 
 setInverse ($isinverse)
 
 getWikiPageValue ()
 
 isVisible ()
 
 canUse ()
 
 getShortWikiText ($linker=null)
 
 getShortHTMLText ($linker=null)
 
 getLongWikiText ($linker=null)
 
 getLongHTMLText ($linker=null)
 
 getWikiValue ()
 
 getFormattedLabel ($format=DataValueFormatter::VALUE, $linker=null)
 
 getSearchLabel ()
 
 getPropertyID ()
 
 getTypesValue ()
 
 getPropertyTypeID ()
 
 isUserDefined ()
 
 isShown ()
 
 isInverse ()
 
 getDBkey ()
 
 getText ()
 
- Public Member Functions inherited from SMWDataValue
 __construct ($typeid)
 
 setUserValue ($value, $caption=false)
 
 setDataItem (SMWDataItem $dataItem)
 
 setDataValueServiceFactory ($dataValueServiceFactory)
 
 setProperty (SMWDIProperty $property)
 
 getProperty ()
 
 setContextPage (SMWDIWikiPage $contextPage=null)
 
 getContextPage ()
 
 setOptions (Options $options=null)
 
 setOption ($key, $value)
 
 getOption ($key)
 
 isEnabledFeature ($feature)
 
 setCaption ($caption)
 
 getCaption ()
 
 getPreferredCaption ()
 
 setOutputFormat ($formatString)
 
 getOutputFormat ()
 
 addError ($error)
 
 addErrorMsg ($parameters, $type=null)
 
 clearErrors ()
 
 getQueryDescription ($value)
 
 getDataItem ()
 
 __toString ()
 
 getShortWikiText ($linked=null)
 
 getShortHTMLText ($linker=null)
 
 getLongWikiText ($linked=null)
 
 getLongHTMLText ($linker=null)
 
 getShortText ($outputformat, $linker=null)
 
 getLongText ($outputformat, $linker=null)
 
 getInfolinkText ($outputformat, $linker=null)
 
 getWikiValue ()
 
 getTypeID ()
 
 getInfolinks ()
 
 getHash ()
 
 isNumeric ()
 
 isValid ()
 
 canUse ()
 
 getExtraneousFunctionFor ($name, array $parameters=array())
 
 getErrorText ()
 
 getErrors ()
 

Static Public Member Functions

static makeUserProperty ($propertyLabel)
 
static makeProperty ($propertyid)
 
static registerProperty ($id, $typeid, $label=false, $show=false)
 
static registerPropertyAlias ($id, $label)
 
- Static Public Member Functions inherited from SMWDataValue
static prepareValue (&$value, &$comparator)
 

Public Attributes

const TYPE_ID = '__pro'
 
const OPT_NO_HIGHLIGHT = 'no.highlight'
 
const OPT_HIGHLIGHT_LINKER = 'highlight.linker'
 
const OPT_NO_PREF_LHNT = 'no.preflabel.marker'
 
const FORMAT_LABEL = 'format.label'
 
const SEARCH_LABEL = 'search.label'
 
- Public Attributes inherited from SMWDataValue
const OPT_USER_LANGUAGE = 'user.language'
 
const OPT_CONTENT_LANGUAGE = 'content.language'
 
const OPT_QUERY_CONTEXT = 'query.context'
 
const OPT_QUERY_COMP_CONTEXT = 'query.comparator.context'
 
const OPT_DISABLE_INFOLINKS = 'disable.infolinks'
 

Protected Member Functions

 parseUserValue ($value)
 
 loadDataItem (SMWDataItem $dataItem)
 
- Protected Member Functions inherited from SMWDataValue
 parseUserValue ($value)
 
 loadDataItem (SMWDataItem $dataItem)
 
 getServiceLinkParams ()
 
 checkAllowedValues ()
 
 getOptions ()
 

Protected Attributes

 $m_wikipage = null
 
 $linkAttributes = array()
 
- Protected Attributes inherited from SMWDataValue
 $m_dataitem
 
 $m_property = null
 
 $m_contextPage = null
 
 $m_caption
 
 $m_typeid
 
 $m_outformat = false
 
 $dataValueServiceFactory
 

Detailed Description

Objects of this class represent properties in SMW.

This class represents both normal (user-defined) properties and predefined ("special") properties. Predefined properties may still have a standard label (and associated wiki article) and they will behave just like user-defined properties in most cases (e.g. when asking for a printout text, a link to the according page is produced). It is possible that predefined properties have no visible label at all, if they are used only internally and never specified by or shown to the user. Those will use their internal ID as DB key, and empty texts for most printouts. All other proeprties use their canonical DB key (even if they are predefined and have an id). Functions are provided to check whether a property is visible or user-defined, and to get the internal ID, if any.

Note
This datavalue is used only for representing properties and, possibly objects/values, but never for subjects (pages as such). Hence it does not provide a complete Title-like interface, or support for things like sortkey.
Author
Markus Krötzsch

Constructor & Destructor Documentation

SMWPropertyValue::__construct (   $typeid = self::TYPE_ID)
Since
2.4
Parameters
string$typeid

Member Function Documentation

SMWPropertyValue::__clone ( )

We use the internal wikipage object to store some of this objects data. Clone it to make sure that data can be modified independently from the original object's content.

SMWPropertyValue::canUse ( )
Since
2.2
Returns
boolean
SMWPropertyValue::getDBkey ( )

Return a DB-key-like string: for visible properties, it is the actual DB key, for internal (invisible) properties, it is the property ID. The value agrees with the first component of getDBkeys() and it can be used in its place.

See also
DIProperty::getKey()
Deprecated:
since 1.6
SMWPropertyValue::getFormattedLabel (   $format = DataValueFormatter::VALUE,
  $linker = null 
)

Outputs a formatted property label that takes into account preferred/ canonical label characteristics

Parameters
integer | string$format
Linker | null$linker
Returns
string
SMWPropertyValue::getInceptiveProperty ( )
Note
If the inceptive property and the property referenced in dataItem are not equal then the dataItem represents the end target to which the inceptive property has been redirected.
Since
2.4
Returns
DIProperty
SMWPropertyValue::getLongHTMLText (   $linker = null)
See also
DataValue::getLongHTMLText
Returns
string
SMWPropertyValue::getLongWikiText (   $linker = null)
See also
DataValue::getLongWikiText
Returns
string
SMWPropertyValue::getPreferredLabel ( )
Since
2.5
Returns
string
SMWPropertyValue::getPropertyID ( )

If this property was not user defined, return the internal ID string referring to that property. Otherwise return FALSE;

SMWPropertyValue::getPropertyTypeID ( )

Convenience method to find the type id of this property. Most callers should rather use DIProperty::findPropertyTypeId() directly. Note that this is not the same as getTypeID(), which returns the id of this property datavalue.

Returns
string
SMWPropertyValue::getSearchLabel ( )

Outputs a label that corresponds to the display and sort characteristics ( e.g. display title etc.) and can be used to initiate a match and search process.

Since
2.5
Returns
string
SMWPropertyValue::getShortHTMLText (   $linker = null)
See also
DataValue::getShortHTMLText
Returns
string
SMWPropertyValue::getShortWikiText (   $linker = null)
See also
DataValue::getShortWikiText
Returns
string
SMWPropertyValue::getText ( )
See also
DIProperty::getLabel()
Deprecated:
since 1.6
SMWPropertyValue::getTypesValue ( )

Return an SMWTypesValue object representing the datatype of this property.

Deprecated:
Types values are not a good way to exchange SMW type information. They are for input only. Use getPropertyTypeID() if you want the type id. This method will vanish in SMW 1.7.
SMWPropertyValue::getWikiPageValue ( )

Return a wiki page value that can be used for displaying this property, or null if no such wiki page exists (for predefined properties without any label).

Returns
SMWWikiPageValue or null
SMWPropertyValue::getWikiValue ( )
See also
DataValue::getWikiValue
Returns
string
SMWPropertyValue::isInverse ( )
See also
DIProperty::isInverse()
Deprecated:
since 1.6
SMWPropertyValue::isShown ( )
See also
DIProperty::isShown()
Deprecated:
since 1.6
SMWPropertyValue::isUserDefined ( )
See also
DIProperty::isUserDefined()
Deprecated:
since 1.6
SMWPropertyValue::isVisible ( )

Return TRUE if this is a property that can be displayed, and not a pre-defined property that is used only internally and does not even have a user-readable name.

Note
Every user defined property is necessarily visible.
SMWPropertyValue::loadDataItem ( SMWDataItem  $dataItem)
protected
See also
SMWDataValue::loadDataItem()
Parameters
$dataitemSMWDataItem
Returns
boolean
static SMWPropertyValue::makeProperty (   $propertyid)
static

Static function for creating a new property object from a property identifier (string) as it might be used internally. This might be the DB key version of some property title text or the id of a predefined property (such as '_TYPE').

Note
This function strictly requires an internal identifier, i.e. predefined properties must be referred to by their ID, and '-' is not supported for indicating inverses.
The resulting property object might be invalid if the provided name is not allowed. An object is returned in any case.
static SMWPropertyValue::makeUserProperty (   $propertyLabel)
static

Static function for creating a new property object from a propertyname (string) as a user might enter it.

Note
The resulting property object might be invalid if the provided name is not allowed. An object is returned in any case.
Parameters
string$propertyName
Returns
SMWPropertyValue
SMWPropertyValue::parseUserValue (   $value)
protected

Extended parsing function to first check whether value refers to pre-defined property, resolve aliases, and set internal property id accordingly.

Todo:
Accept/enforce property namespace.
static SMWPropertyValue::registerProperty (   $id,
  $typeid,
  $label = false,
  $show = false 
)
static

A function for registering/overwriting predefined properties for SMW. Should be called from within the hook 'smwInitProperties'. Ids should start with three underscores "___" to avoid current and future confusion with SMW built-ins.

Deprecated:
Use DIProperty::registerProperty(). Will vanish before SMW 1.7.
static SMWPropertyValue::registerPropertyAlias (   $id,
  $label 
)
static

Add a new alias label to an existing datatype id. Note that every ID should have a primary label, either provided by SMW or registered with registerDatatype. This function should be called from within the hook 'smwInitDatatypes'.

Deprecated:
Use DIProperty::registerPropertyAlias(). Will vanish before SMW 1.7.
SMWPropertyValue::setCaption (   $caption)
SMWPropertyValue::setInverse (   $isinverse)
SMWPropertyValue::setLinkAttributes ( array  $linkAttributes)
Since
2.4
Parameters
array$linkAttributes
SMWPropertyValue::setOutputFormat (   $formatstring)

Member Data Documentation

SMWPropertyValue::$linkAttributes = array()
protected
SMWPropertyValue::$m_wikipage = null
protected
const SMWPropertyValue::FORMAT_LABEL = 'format.label'

Special formatting of the label/preferred label

const SMWPropertyValue::OPT_HIGHLIGHT_LINKER = 'highlight.linker'

Use linker with the highlighter

const SMWPropertyValue::OPT_NO_HIGHLIGHT = 'no.highlight'

Avoid the display of a tooltip

const SMWPropertyValue::OPT_NO_PREF_LHNT = 'no.preflabel.marker'

Avoid the display of a preferred label marker

const SMWPropertyValue::SEARCH_LABEL = 'search.label'

Label to be used for matching a DB search

const SMWPropertyValue::TYPE_ID = '__pro'

DV identifier


The documentation for this class was generated from the following file: