public static function EasyRdf_Namespace::shorten

Shorten a URI by substituting in the namespace prefix.

If $createNamespace is true, and the URI isn't part of an existing namespace, then EasyRdf will attempt to create a new namespace and use that namespace to shorten the URI (for example ns0:term).

If it isn't possible to shorten the URI, then null will be returned.

Parameters

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

bool $createNamespace If true, a new namespace will be created:

Return value

string The shortened URI (eg 'foaf:name') or null

12 calls to EasyRdf_Namespace::shorten()

File

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

Class

EasyRdf_Namespace
A namespace registry and manipulation class.

Code

public static function shorten($uri, $createNamespace = false) {
  if ($parts = self::splitUri($uri, $createNamespace)) {
    return implode(':', $parts);
  }
}