Static Public Member Functions | |
| static | newTypeIdValue ($typeId, $valueString=false, $caption=false, $property=null, $contextPage=null) |
| Create a value from a type id. | |
| static | newDataItemValue (SMWDataItem $dataItem, $property, $caption=false) |
| Create a value for a data item. | |
| static | getDataItemId ($typeId) |
| Get the preferred data item ID for a given type. | |
| static | newPropertyObjectValue (SMWDIProperty $property, $valueString=false, $caption=false, $contextPage=null) |
| Create a value for the given property, provided as an SMWDIProperty object. | |
| static | registerDatatype ($id, $className, $dataItemId, $label=false) |
| A function for registering/overwriting datatypes for SMW. | |
| static | registerDatatypeAlias ($id, $label) |
| Add a new alias label to an existing datatype id. | |
| static | findTypeID ($label, $useAlias=true) |
| Look up the ID that identifies the datatype of the given label internally. | |
| static | findTypeLabel ($id) |
| Get the translated user label for a given internal ID. | |
| static | getKnownTypeLabels () |
| Return an array of all labels that a user might specify as the type of a property, and that are internal (i.e. | |
Static Protected Member Functions | |
| static | initDatatypes () |
| Gather all available datatypes and label<=>id<=>datatype associations. | |
Static Private Attributes | |
| static | $mTypeLabels |
| static | $mTypeAliases |
| static | $mTypeClasses |
| static | $mTypeDataItemIds |
| static | $mDefaultDataItemTypeIds |
The class has the main entry point newTypeIdValue(), which creates a new datavalue object, possibly with preset user values, captions and property names. To create suitable datavalues for a given property, the method newPropertyObjectValue() can be used.
Other than this, the class manages registration data for datatypes, and provides various methods to access this information.
Definition at line 26 of file SMW_DataValueFactory.php.
| static SMWDataValueFactory::newTypeIdValue | ( | $ | typeId, | |
| $ | valueString = false, |
|||
| $ | caption = false, |
|||
| $ | property = null, |
|||
| $ | contextPage = null | |||
| ) | [static] |
Create a value from a type id.
If no $value is given, an empty container is created, the value of which can be set later on.
| $typeId | string id string for the given type | |
| $valueString | mixed user value string, or false if unknown | |
| $caption | mixed user-defined caption, or false if none given | |
| $property | SMWDIProperty property object for which this value is made, or null | |
| $contextPage | SMWDIWikiPage that provides a context for parsing the value string, or null |
Definition at line 91 of file SMW_DataValueFactory.php.
Referenced by SMWParseData::storeData().
| static SMWDataValueFactory::newDataItemValue | ( | SMWDataItem $ | dataItem, | |
| $ | property, | |||
| $ | caption = false | |||
| ) | [static] |
Create a value for a data item.
| $dataItem | SMWDataItem | |
| $property | mixed null or SMWDIProperty property object for which this value is made | |
| $caption | mixed user-defined caption, or false if none given |
Definition at line 128 of file SMW_DataValueFactory.php.
Referenced by SMWSpecialBrowse::displayData(), SMWPageProperty::execute(), SMWWantedPropertiesPage::formatResult(), SMWUnusedPropertiesPage::formatResult(), SMWPropertiesPage::formatResult(), SMWPageLister::getColumnList(), SMWSearchByProperty::getExactResults(), SMWFactbox::getFactboxText(), SRFiCalendar::getIcalForItem(), SMWResultArray::getNextDataValue(), SMWValueDescription::getQueryString(), SMWConceptDescription::getQueryString(), SMWClassDescription::getQueryString(), SMGeoCoordsValueDescription::getQueryString(), SMAreaValueDescription::getQueryString(), SMWExporter::getResourceElementForWikiPage(), SRFArray::getResultText(), SMWEmbeddedResultPrinter::getResultText(), SMWPageLister::getShortList(), SMWPropertyValue::getWikiPageValue(), SMWResultArray::loadContent(), SMWRecordValue::makeOutputText(), SMWPropertyListValue::makeOutputText(), and SMWPropertyPage::subjectObjectList().
| static SMWDataValueFactory::getDataItemId | ( | $ | typeId | ) | [static] |
Get the preferred data item ID for a given type.
The ID defines the appropriate data item class for processing data of this type. See SMWDataItem for possible values.
| $typeId | string id string for the given type |
Definition at line 152 of file SMW_DataValueFactory.php.
References SMWDataItem::TYPE_NOTYPE.
Referenced by SMWSparqlStoreQueryEngine::addOrderByDataForProperty(), SMWSparqlStoreQueryEngine::buildPropertyCondition(), SMWCompatibilityHelpers::dataItemFromDBKeys(), SMWSQLStore2::findAllDiTypeTableIds(), SMWSQLStore2::findTypeTableId(), SMWSqlStubSemanticData::getPropertyValues(), SMWSQLStore2::getPropertyValues(), SMWSQLStore2::getTypeSignature(), and SMWSQLStore2::tableFitsType().
| static SMWDataValueFactory::newPropertyObjectValue | ( | SMWDIProperty $ | property, | |
| $ | valueString = false, |
|||
| $ | caption = false, |
|||
| $ | contextPage = null | |||
| ) | [static] |
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.
| $property | SMWDIProperty property object for which this value is made | |
| $valueString | mixed user value string, or false if unknown | |
| $caption | mixed user-defined caption, or false if none given | |
| $contextPage | SMWDIWikiPage that provides a context for parsing the value string, or null |
Definition at line 173 of file SMW_DataValueFactory.php.
References SMWDIProperty::findPropertyTypeID(), and SMWDIProperty::isInverse().
Referenced by SMWParseData::addProperty(), SMWSubobject::addPropertyValueToSemanticData(), SMWSearchByProperty::execute(), SMWQueryParser::getPropertyDescription(), SMWSQLStoreLight::getPropertyValues(), and SMWRecordValue::parseUserValueOrQuery().
| static SMWDataValueFactory::initDatatypes | ( | ) | [static, protected] |
Gather all available datatypes and label<=>id<=>datatype associations.
This method is called before most methods of this factory.
Definition at line 185 of file SMW_DataValueFactory.php.
References SMWDataItem::TYPE_BLOB, SMWDataItem::TYPE_BOOLEAN, SMWDataItem::TYPE_CONCEPT, SMWDataItem::TYPE_CONTAINER, SMWDataItem::TYPE_GEO, SMWDataItem::TYPE_NUMBER, SMWDataItem::TYPE_PROPERTY, SMWDataItem::TYPE_STRING, SMWDataItem::TYPE_TIME, SMWDataItem::TYPE_URI, and SMWDataItem::TYPE_WIKIPAGE.
| static SMWDataValueFactory::registerDatatype | ( | $ | id, | |
| $ | className, | |||
| $ | dataItemId, | |||
| $ | label = false | |||
| ) | [static] |
A function for registering/overwriting datatypes for SMW.
Should be called from within the hook 'smwInitDatatypes'.
| $id | string type ID for which this datatype is registered | |
| $className | string name of the according subclass of SMWDataValue | |
| $dataItemId | integer ID of the data item class that this data value uses, see SMWDataItem | |
| $label | mixed string label or false for types that cannot be accessed by users |
Definition at line 282 of file SMW_DataValueFactory.php.
Referenced by SMGeoCoordsHooks::initGeoCoordsType().
| static SMWDataValueFactory::registerDatatypeAlias | ( | $ | 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'.
| string | $id | |
| string | $label |
Definition at line 300 of file SMW_DataValueFactory.php.
| static SMWDataValueFactory::findTypeID | ( | $ | label, | |
| $ | useAlias = true | |||
| ) | [static] |
Look up the ID that identifies the datatype of the given label internally.
This id is used for all internal operations. If the label does not bleong to a known type, the empty string is returned.
This method may or may not take aliases into account, depeding on the parameter $useAlias.
| string | $label | |
| boolean | $useAlias |
Definition at line 316 of file SMW_DataValueFactory.php.
Referenced by SMWTypesValue::getDBkey(), SMWExporter::getOWLPropertyType(), SMWTypesValue::parseUserValue(), and SFTemplateField::setTypeAndPossibleValues().
| static SMWDataValueFactory::findTypeLabel | ( | $ | id | ) | [static] |
Get the translated user label for a given internal ID.
If the ID does not have a label associated with it in the current language, the empty string is returned. This is the case both for internal type ids and for invalid (unkown) type ids, so this method cannot be used to distinguish the two.
| string | $id |
Definition at line 338 of file SMW_DataValueFactory.php.
Referenced by SMWTypesValue::loadDataItem(), and SMWTypesValue::parseUserValue().
| static SMWDataValueFactory::getKnownTypeLabels | ( | ) | [static] |
Return an array of all labels that a user might specify as the type of a property, and that are internal (i.e.
not user defined). No labels are returned for internal types without user labels (e.g. the special types for some special properties), and for user defined types.
Definition at line 358 of file SMW_DataValueFactory.php.
Referenced by SMWSpecialTypes::getTypesList().
SMWDataValueFactory::$mTypeLabels [static, private] |
Definition at line 33 of file SMW_DataValueFactory.php.
SMWDataValueFactory::$mTypeAliases [static, private] |
Definition at line 40 of file SMW_DataValueFactory.php.
SMWDataValueFactory::$mTypeClasses [static, private] |
Definition at line 48 of file SMW_DataValueFactory.php.
SMWDataValueFactory::$mTypeDataItemIds [static, private] |
Definition at line 55 of file SMW_DataValueFactory.php.
SMWDataValueFactory::$mDefaultDataItemTypeIds [static, private] |
Initial value:
array(
SMWDataItem::TYPE_BLOB => '_txt', // Text type
SMWDataItem::TYPE_STRING => '_str', // String type
SMWDataItem::TYPE_URI => '_uri', // URL/URI type
SMWDataItem::TYPE_WIKIPAGE => '_wpg', // Page type
SMWDataItem::TYPE_NUMBER => '_num', // Number type
SMWDataItem::TYPE_TIME => '_dat', // Time type
SMWDataItem::TYPE_BOOLEAN => '_boo', // Boolean type
SMWDataItem::TYPE_CONTAINER => '_rec', // Value list type (replacing former nary properties)
SMWDataItem::TYPE_GEO => '_geo', // Geographical coordinates
SMWDataItem::TYPE_CONCEPT => '__con', // Special concept page type
SMWDataItem::TYPE_PROPERTY => '__pro', // Property type
// If either of the following two occurs, we want to see a PHP error:
//SMWDataItem::TYPE_NOTYPE => '',
//SMWDataItem::TYPE_ERROR => '',
)
Definition at line 62 of file SMW_DataValueFactory.php.
1.5.6