public static function EasyRdf_Literal::setDatatypeMapping

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');

Parameters

string $datatype The RDF datatype (e.g. xsd:dateTime):

string $class The PHP class name (e.g. My_DateTime_Class):

8 calls to EasyRdf_Literal::setDatatypeMapping()
Boolean.php in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Literal/Boolean.php
Date.php in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Literal/Date.php
DateTime.php in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Literal/DateTime.php
Decimal.php in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Literal/Decimal.php
HexBinary.php in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Literal/HexBinary.php

... See full list

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Literal.php, line 129

Class

EasyRdf_Literal
Class that represents an RDF Literal

Code

public static function setDatatypeMapping($datatype, $class) {
  if (!is_string($datatype) or $datatype == null or $datatype == '') {
    throw new InvalidArgumentException("\$datatype should be a string and cannot be null or empty");
  }
  if (!is_string($class) or $class == null or $class == '') {
    throw new InvalidArgumentException("\$class should be a string and cannot be null or empty");
  }
  $datatype = EasyRdf_Namespace::expand($datatype);
  self::$datatypeMap[$datatype] = $class;
  self::$classMap[$class] = $datatype;
}