public static function EasyRdf_Namespace::expand

Expand a shortened URI (qname) back into a full URI.

If it isn't possible to expand the qname, for example if the namespace isn't registered, then the original string will be returned.

Parameters

string $shortUri The short URI (eg 'foaf:name'):

Return value

string The full URI (eg 'http://xmlns.com/foaf/0.1/name')

14 calls to EasyRdf_Namespace::expand()

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Namespace.php, line 330

Class

EasyRdf_Namespace
A namespace registry and manipulation class.

Code

public static function expand($shortUri) {
  if (!is_string($shortUri) or empty($shortUri)) {
    throw new InvalidArgumentException("\$shortUri should be a string and cannot be null or empty");
  }
  if (preg_match("/^(\\w+?):([\\w\\-]+)\$/", $shortUri, $matches)) {
    $long = self::get($matches[1]);
    if ($long) {
      return $long . $matches[2];
    }
  }
  elseif (preg_match("/^(\\w+)\$/", $shortUri) and isset(self::$default)) {
    return self::$default . $shortUri;
  }
  return $shortUri;
}