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()
EasyRdf_Graph::addType in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Add one or more rdf:type properties to a resource
EasyRdf_Graph::checkResourceParam in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Check that a URI/resource parameter is valid, and convert it to a string @ignore
EasyRdf_Graph::checkSinglePropertyParam in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Check that a single URI/property parameter (not a property path) is valid, and expand it if required @ignore
EasyRdf_Graph::classForResource in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Work out the class to instantiate a resource as @ignore
EasyRdf_Graph::delete in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Delete a property (or optionally just a specific value)

... See full list

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;
}