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

Public Member Functions

 __construct ($key, $inverse=false)
 
 getDIType ()
 
 getKey ()
 
 isInverse ()
 
 getSortKey ()
 
 isShown ()
 
 isUserDefined ()
 
 isUnrestricted ()
 
 getLabel ()
 
 getCanonicalLabel ()
 
 getPreferredLabel ($languageCode= '')
 
 setInterwiki ($interwiki)
 
 getDiWikiPage ($subobjectName= '')
 
 getCanonicalDiWikiPage ($subobjectName= '')
 
 getRedirectTarget ()
 
 setPropertyTypeId ($propertyTypeId)
 
 findPropertyTypeID ()
 
 getSerialization ()
 
 equals (SMWDataItem $di)
 
- Public Member Functions inherited from SMWDataItem
 getDIType ()
 
 getSortKey ()
 
 equals (SMWDataItem $di)
 
 getSortKeyDataItem ()
 
 getSerialization ()
 
 getHash ()
 
 __toString ()
 
 setOption ($key, $value)
 
 getOption ($key)
 

Static Public Member Functions

static doUnserialize ($serialization)
 
static newFromUserLabel ($label, $inverse=false, $languageCode=false)
 
static findPropertyID ($label, $useAlias=true)
 
static getPredefinedPropertyTypeId ($key)
 
static findPropertyLabel ($id)
 
static registerProperty ($id, $typeid, $label=false, $show=false)
 
static registerPropertyAlias ($id, $label)
 
- Static Public Member Functions inherited from SMWDataItem
static newFromSerialization ($diType, $serialization)
 
static getDataItemClassNameForId ($diType)
 

Public Attributes

const TYPE_SUBOBJECT = '_SOBJ'
 
const TYPE_ERROR = '_ERRP'
 
const TYPE_CATEGORY = '_INST'
 
const TYPE_SUBCATEGORY = '_SUBC'
 
const TYPE_SORTKEY = '_SKEY'
 
const TYPE_MODIFICATION_DATE = '_MDAT'
 
const TYPE_CREATION_DATE = '_CDAT'
 
const TYPE_LAST_EDITOR = '_LEDT'
 
const TYPE_NEW_PAGE = '_NEWP'
 
const TYPE_HAS_TYPE = '_TYPE'
 
const TYPE_CONVERSION = '_CONV'
 
const TYPE_ASKQUERY = '_ASK'
 
const TYPE_MEDIA = '_MEDIA'
 
const TYPE_MIME = '_MIME'
 
const TYPE_DISPLAYTITLE = '_DTITLE'
 
- Public Attributes inherited from SMWDataItem
const TYPE_NOTYPE = 0
 Data item ID that can be used to indicate that no data item class is appropriate. More...
 
const TYPE_NUMBER = 1
 Data item ID for SMWDINumber. More...
 
const TYPE_STRING = 2
 
const TYPE_BLOB = 2
 Data item ID for SMWDIBlob. More...
 
const TYPE_BOOLEAN = 4
 Data item ID for SMWDIBoolean. More...
 
const TYPE_URI = 5
 Data item ID for SMWDIUri. More...
 
const TYPE_TIME = 6
 Data item ID for SMWDITimePoint. More...
 
const TYPE_GEO = 7
 Data item ID for SMWDIGeoCoord. More...
 
const TYPE_CONTAINER = 8
 Data item ID for SMWDIContainer. More...
 
const TYPE_WIKIPAGE = 9
 Data item ID for SMWDIWikiPage. More...
 
const TYPE_CONCEPT = 10
 Data item ID for SMWDIConcept. More...
 
const TYPE_PROPERTY = 11
 Data item ID for SMWDIProperty. More...
 
const TYPE_ERROR = 12
 Data item ID for SMWDIError. More...
 

Detailed Description

This class implements Property data items.

Note
PropertyRegistry class manages global registrations of predefined (built-in) properties, and maintains an association of property IDs, localized labels, and aliases.
Since
1.6
Author
Markus Krötzsch
Jeroen De Dauw
mwjames

Constructor & Destructor Documentation

SMW\DIProperty::__construct (   $key,
  $inverse = false 
)

Initialise a property. This constructor checks that keys of predefined properties do really exist (in the current configuration of the wiki). No check is performed to see if a user label is in fact the label or alias of a predefined property. If this should be done, the function self::newFromUserLabel() can be used.

Parameters
$keystring key for the property (internal SMW key or wikipage DB key)
$inverseboolean states if the inverse of the property is constructed

Member Function Documentation

static SMW\DIProperty::doUnserialize (   $serialization)
static

Create a data item from the provided serialization string and type ID.

Parameters
string$serialization
Returns
DIProperty
SMW\DIProperty::equals ( SMWDataItem  $di)
Parameters
SMWDataItem$di
Returns
boolean
static SMW\DIProperty::findPropertyID (   $label,
  $useAlias = true 
)
static
static SMW\DIProperty::findPropertyLabel (   $id)
static
SMW\DIProperty::findPropertyTypeID ( )

Find the property's type ID, either by looking up its predefined ID (if any) or by retrieving the relevant information from the store. If no type is stored for a user defined property, the global default type will be used.

Returns
string type ID
SMW\DIProperty::getCanonicalDiWikiPage (   $subobjectName = '')
Since
2.4
Parameters
string$subobjectName
Returns
DIWikiPage|null
SMW\DIProperty::getCanonicalLabel ( )
Since
2.4
Returns
string
SMW\DIProperty::getDIType ( )
Returns
integer
SMW\DIProperty::getDiWikiPage (   $subobjectName = '')

Get an object of type DIWikiPage that represents the page which relates to this property, or null if no such page exists. The latter can happen for special properties without user-readable label.

It is possible to construct subobjects of the property's wikipage by providing an optional subobject name.

Parameters
string$subobjectName
Returns
DIWikiPage|null
SMW\DIProperty::getKey ( )
Returns
string
SMW\DIProperty::getLabel ( )

Find a user-readable label for this property, or return '' if it is a predefined property that has no label. For inverse properties, the label starts with a "-".

Returns
string
static SMW\DIProperty::getPredefinedPropertyTypeId (   $key)
static
SMW\DIProperty::getPreferredLabel (   $languageCode = '')

Borrowing the skos:prefLabel definition where a preferred label is expected to have only one label per given language (skos:altLabel can have many alternative labels)

An empty string signals that no preferred label is available in the current user language.

Since
2.5
Parameters
string$languageCode
Returns
string
SMW\DIProperty::getRedirectTarget ( )
Since
2.4
Returns
DIProperty
SMW\DIProperty::getSerialization ( )
SMW\DIProperty::getSortKey ( )
Returns
string
SMW\DIProperty::isInverse ( )
Returns
boolean
SMW\DIProperty::isShown ( )

Specifies whether values of this property should be shown in the Factbox. A property may wish to prevent this if either (1) its information is really dull, e.g. being a mere copy of information that is obvious from other things that are shown, or (2) the property is set in a hook after parsing, so that it is not reliably available when Factboxes are displayed. If a property is internal so it should never be observed by users, then it is better to just not associate any translated label with it, so it never appears anywhere.

Examples of properties that are not shown include Modification date (not available in time), and Has improper value for (errors are shown directly on the page anyway).

Returns
boolean
SMW\DIProperty::isUnrestricted ( )

Whether a user can freely use this property for value declarations or not.

Note
A user defined property is generally assumed to be unrestricted for usage
Since
2.2
Returns
boolean
SMW\DIProperty::isUserDefined ( )

Return true if this is a usual wiki property that is defined by a wiki page, and not a property that is pre-defined in the wiki.

Returns
boolean
static SMW\DIProperty::newFromUserLabel (   $label,
  $inverse = false,
  $languageCode = false 
)
static

Construct a property from a user-supplied label. The main difference to the normal constructor of DIProperty is that it is checked whether the label refers to a known predefined property. Note that this function only gives access to the registry data that DIProperty stores, but does not do further parsing of user input.

To process wiki input, SMWPropertyValue should be used.

Parameters
$labelstring label for the property
$inverseboolean states if the inverse of the property is constructed
Returns
DIProperty object
static SMW\DIProperty::registerProperty (   $id,
  $typeid,
  $label = false,
  $show = false 
)
static
static SMW\DIProperty::registerPropertyAlias (   $id,
  $label 
)
static
SMW\DIProperty::setInterwiki (   $interwiki)
Since
2.4
Parameters
string$interwiki
SMW\DIProperty::setPropertyTypeId (   $propertyTypeId)
Since
2.0
Returns
self
Exceptions
PropertyDataTypeLookupExeption
InvalidArgumentException

Member Data Documentation

const SMW\DIProperty::TYPE_ASKQUERY = '_ASK'
const SMW\DIProperty::TYPE_CATEGORY = '_INST'
const SMW\DIProperty::TYPE_CONVERSION = '_CONV'
const SMW\DIProperty::TYPE_CREATION_DATE = '_CDAT'
const SMW\DIProperty::TYPE_DISPLAYTITLE = '_DTITLE'
const SMW\DIProperty::TYPE_ERROR = '_ERRP'
const SMW\DIProperty::TYPE_HAS_TYPE = '_TYPE'
const SMW\DIProperty::TYPE_LAST_EDITOR = '_LEDT'
const SMW\DIProperty::TYPE_MEDIA = '_MEDIA'
const SMW\DIProperty::TYPE_MIME = '_MIME'
const SMW\DIProperty::TYPE_MODIFICATION_DATE = '_MDAT'
const SMW\DIProperty::TYPE_NEW_PAGE = '_NEWP'
const SMW\DIProperty::TYPE_SORTKEY = '_SKEY'
const SMW\DIProperty::TYPE_SUBCATEGORY = '_SUBC'
const SMW\DIProperty::TYPE_SUBOBJECT = '_SOBJ'

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