Class EasyRdf_Literal

Description

Class that represents an RDF Literal

Located in /EasyRdf/Literal.php (line 46)


	
			
Direct descendents
Class Description
EasyRdf_Literal_Boolean Class that represents an RDF Literal of datatype xsd:boolean
EasyRdf_Literal_Date Class that represents an RDF Literal of datatype xsd:date
EasyRdf_Literal_Decimal Class that represents an RDF Literal of datatype xsd:decimal
EasyRdf_Literal_HexBinary Class that represents an RDF Literal of datatype xsd:hexBinary
EasyRdf_Literal_Integer Class that represents an RDF Literal of datatype xsd:integer
Method Summary
static object EasyRdf_Literal create (mixed $value, [string $lang = NULL], [string $datatype = NULL])
static void deleteDatatypeMapping (string $datatype)
static string getDatatypeForValue ( $value)
static void setDatatypeMapping (string $datatype, string $class)
object EasyRdf_Literal __construct (string $value, [string $lang = NULL], [string $datatype = NULL])
string dumpValue ([bool $html = true], [string $color = 'black'])
string getDatatype ()
string getDatatypeUri ()
string getLang ()
string getValue ()
array toArray ()
string __toString ()
Methods
static method create (line 80)

Create a new literal object

PHP values of type bool, int or float, will automatically be converted to the corresponding datatype and PHP sub-class.

If a registered datatype is given, then the registered subclass of EasyRdf_Literal will instantiated.

Note that literals are not required to have a language or datatype. Literals cannot have both a language and a datatype.

  • return: (or subclass of EasyRdf_Literal)
  • access: public
static object EasyRdf_Literal create (mixed $value, [string $lang = NULL], [string $datatype = NULL])
  • mixed $value: The value of the literal or an associative array
  • string $lang: The natural language of the literal or NULL (e.g. 'en')
  • string $datatype: The datatype of the literal or NULL (e.g. 'xsd:integer')
static method deleteDatatypeMapping (line 152)

Remove the mapping between an RDF datatype and a PHP class name

  • access: public
static void deleteDatatypeMapping (string $datatype)
  • string $datatype: The RDF datatype (e.g. xsd:dateTime)
static method getDatatypeForValue (line 177)

Get datatype URI for a PHP value.

This static function is intended for internal use. Given a PHP value, it will return an XSD datatype URI for that value, for example: http://www.w3.org/2001/XMLSchema#integer

  • return: A URI for the datatype of $value.
  • access: public
static string getDatatypeForValue ( $value)
  • $value
static method setDatatypeMapping (line 129)

Register an RDF datatype with a PHP class name

When parsing registered class will be used whenever the datatype is seen.

When serialising a registered class, the mapping will be used to set the datatype in the RDF.

Example: EasyRdf_Literal::registerDatatype('xsd:dateTime', 'My_DateTime_Class');

  • access: public
static void setDatatypeMapping (string $datatype, string $class)
  • string $datatype: The RDF datatype (e.g. xsd:dateTime)
  • string $class: The PHP class name (e.g. My_DateTime_Class)
Constructor __construct (line 201)

Constructor for creating a new literal

  • access: public
object EasyRdf_Literal __construct (string $value, [string $lang = NULL], [string $datatype = NULL])
  • string $value: The value of the literal
  • string $lang: The natural language of the literal or NULL (e.g. 'en')
  • string $datatype: The datatype of the literal or NULL (e.g. 'xsd:string')

Redefined in descendants as:
dumpValue (line 309)

Return pretty-print view of the literal

  • access: public
string dumpValue ([bool $html = true], [string $color = 'black'])
  • bool $html: Set to true to format the dump using HTML
  • string $color: The colour of the text
getDatatype (line 253)

Returns the shortened datatype URI of the literal.

  • return: Datatype of this literal (e.g. xsd:integer).
  • access: public
string getDatatype ()
getDatatypeUri (line 244)

Returns the full datatype URI of the literal.

  • return: Datatype URI of this literal.
  • access: public
string getDatatypeUri ()
getLang (line 266)

Returns the language of the literal.

  • return: Language of this literal.
  • access: public
string getLang ()
getValue (line 235)

Returns the value of the literal.

  • return: Value of this literal.
  • access: public
string getValue ()

Redefined in descendants as:
toArray (line 278)

Returns the properties of the literal as an associative array

For example: array('type' => 'literal', 'value' => 'string value')

  • return: The properties of the literal
  • access: public
array toArray ()
__toString (line 298)

Magic method to return the value of a literal as a string

  • return: The value of the literal
  • access: public
string __toString ()

Documentation generated on Wed, 16 Jan 2013 19:16:38 +0000 by phpDocumentor 1.4.4