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()
EasyRdf_Graph::dumpResource in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Return a human readable view of a resource and its properties
EasyRdf_Graph::properties in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Get a list of all the shortened property names (qnames) for a resource.
EasyRdf_Graph::type in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Get the resource type of the graph
EasyRdf_Graph::types in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Get a list of types for a resource
EasyRdf_Literal::getDatatype in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Literal.php
Returns the shortened datatype URI of the literal.

... See full list

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