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

Public Member Functions

 __construct ( $key, $inverse=false)
 
 getDIType ()
 
 getKey ()
 
 isInverse ()
 
 getSha1 ()
 
 getSortKey ()
 
 isShown ()
 
 isUserDefined ()
 
 isUserAnnotable ()
 
 getLabel ()
 
 getCanonicalLabel ()
 
 getPreferredLabel (string $languageCode='')
 
 setInterwiki (string $interwiki)
 
 getDiWikiPage (string $subobjectName='')
 
 getCanonicalDiWikiPage (string $subobjectName='')
 
 getRedirectTarget ()
 
 setPropertyTypeId ( $valueType)
 
 setPropertyValueType (string $valueType)
 
 findPropertyTypeId ()
 
 findPropertyValueType ()
 
 getSerialization ()
 
 equals (SMWDataItem $di)
 
- Public Member Functions inherited from SMWDataItem
 getDIType ()
 
 getSortKey ()
 
 equals (SMWDataItem $di)
 
 getSortKeyDataItem ()
 
 getSerialization ()
 
 getSha1 ()
 
 getHash ()
 
 __toString ()
 
 setOption ( $key, $value)
 
 getOption ( $key, $default=null)
 

Static Public Member Functions

static doUnserialize (?string $serialization)
 
static newFromUserLabel (string $label, bool $inverse=false, $languageCode=false)
 
- 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'
 
const TYPE_CHANGE_PROP = '_CHGPRO'
 
- 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.
 
const TYPE_NUMBER = 1
 Data item ID for SMWDINumber.
 
const TYPE_BLOB = 2
 Data item ID for SMWDIBlob.
 
const TYPE_BOOLEAN = 4
 Data item ID for SMWDIBoolean.
 
const TYPE_URI = 5
 Data item ID for SMWDIUri.
 
const TYPE_TIME = 6
 Data item ID for SMWDITimePoint.
 
const TYPE_GEO = 7
 Data item ID for SMWDIGeoCoord.
 
const TYPE_CONTAINER = 8
 Data item ID for SMWDIContainer.
 
const TYPE_WIKIPAGE = 9
 Data item ID for SMWDIWikiPage.
 
const TYPE_CONCEPT = 10
 Data item ID for SMWDIConcept.
 
const TYPE_PROPERTY = 11
 Data item ID for SMWDIProperty.
 
const TYPE_ERROR = 12
 Data item ID for SMWDIError.
 

Detailed Description

This class implements Property item

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

◆ __construct()

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
string | bool | null$keyKey for the property (internal SMW key or wikipage DB key)
bool$inverseStates if the inverse of the property is constructed

Member Function Documentation

◆ doUnserialize()

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

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

Since
1.6
Parameters
?string$serialization
Returns
DIProperty

◆ equals()

SMW\DIProperty::equals ( SMWDataItem  $di)
See also
DataItem::equals
Since
1.6
Parameters
SMWDataItem$di
Returns
bool

◆ findPropertyTypeId()

SMW\DIProperty::findPropertyTypeId ( )

◆ findPropertyValueType()

SMW\DIProperty::findPropertyValueType ( )

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.

Since
3.0
Returns
string type ID

◆ getCanonicalDiWikiPage()

SMW\DIProperty::getCanonicalDiWikiPage ( string  $subobjectName = '')
Since
2.4
Parameters
string$subobjectName
Returns
DIWikiPage|null

◆ getCanonicalLabel()

SMW\DIProperty::getCanonicalLabel ( )
Since
2.4
Returns
string|null

◆ getDIType()

SMW\DIProperty::getDIType ( )
Since
1.6
Returns
int

◆ getDiWikiPage()

SMW\DIProperty::getDiWikiPage ( string  $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.

Since
1.6
Parameters
string$subobjectName
Returns
DIWikiPage|null

◆ getKey()

SMW\DIProperty::getKey ( )
Since
1.6
Returns
string|null

◆ getLabel()

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 "-".

Since
1.6
Returns
string

◆ getPreferredLabel()

SMW\DIProperty::getPreferredLabel ( string  $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

◆ getRedirectTarget()

SMW\DIProperty::getRedirectTarget ( )
Since
2.4
Returns
DIProperty

◆ getSerialization()

SMW\DIProperty::getSerialization ( )
See also
DataItem::getSerialization
Since
1.6
Returns
string|null

◆ getSha1()

SMW\DIProperty::getSha1 ( )
Since
3.1
Returns
string

◆ getSortKey()

SMW\DIProperty::getSortKey ( )
Since
1.6
Returns
string|null

◆ isInverse()

SMW\DIProperty::isInverse ( )
Since
1.6
Returns
bool

◆ isShown()

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).

Since
1.6
Returns
int

◆ isUserAnnotable()

SMW\DIProperty::isUserAnnotable ( )

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

Since
3.0
Returns
bool

◆ isUserDefined()

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.

Since
1.6
Returns
bool

◆ newFromUserLabel()

static SMW\DIProperty::newFromUserLabel ( string  $label,
bool  $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.

Since
1.6
Parameters
string$label
bool$inverse= false
$languageCode= false
Returns
DIProperty

◆ setInterwiki()

SMW\DIProperty::setInterwiki ( string  $interwiki)
Since
2.4
Parameters
string$interwiki

◆ setPropertyTypeId()

SMW\DIProperty::setPropertyTypeId (   $valueType)

◆ setPropertyValueType()

SMW\DIProperty::setPropertyValueType ( string  $valueType)
Since
3.0
Parameters
string$valueType
Returns
self
Exceptions
DataTypeLookupException
RuntimeException

Member Data Documentation

◆ TYPE_CHANGE_PROP

const SMW\DIProperty::TYPE_CHANGE_PROP = '_CHGPRO'

Change propagation

◆ TYPE_SUBOBJECT

const SMW\DIProperty::TYPE_SUBOBJECT = '_SOBJ'
See also
PropertyRegistry::registerPredefinedProperties

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

About | General disclaimer | Privacy policy