class EasyRdf_Namespace
A namespace registry and manipulation class.
Methods
static array |
namespaces()
Return all the namespaces registered |
|
static string |
get(string $prefix)
Return a namespace given its prefix. |
|
static |
set(string $prefix, string $long)
Register a new namespace. |
|
static string |
getDefault()
Get the default namespace |
|
static |
setDefault(string $namespace)
Set the default namespace |
|
static |
delete(string $prefix)
Delete an existing namespace. |
|
static |
reset()
Delete the anonymous namespaces and reset the counter to 0 |
|
static array |
splitUri(string $uri, bool $createNamespace = false)
Try and breakup a URI into a prefix and local part |
|
static string |
prefixOfUri(string $uri)
Return the prefix namespace that a URI belongs to. |
|
static string |
shorten(string $uri, bool $createNamespace = false)
Shorten a URI by substituting in the namespace prefix. |
|
static string |
expand(string $shortUri)
Expand a shortened URI (qname) back into a full URI. |
Details
at line 105
static public array
namespaces()
Return all the namespaces registered
at line 116
static public string
get(string $prefix)
Return a namespace given its prefix.
at line 144
static public
set(string $prefix, string $long)
Register a new namespace.
at line 176
static public string
getDefault()
Get the default namespace
Returns the URI of the default namespace or null if no default namespace is defined.
at line 192
static public
setDefault(string $namespace)
Set the default namespace
Set the default namespace to either a URI or the prefix of an already defined namespace.
Example: EasyRdf_Namespace::setDefault('http://schema.org/');
at line 214
static public
delete(string $prefix)
Delete an existing namespace.
at line 231
static public
reset()
Delete the anonymous namespaces and reset the counter to 0
at line 252
static public array
splitUri(string $uri, bool $createNamespace = false)
Try and breakup a URI into a prefix and local part
If $createNamespace is true, and the URI isn't part of an existing namespace, then EasyRdf will attempt to create a new namespace and return the name of the new prefix (for example 'ns0', 'term').
If it isn't possible to split the URI, then null will be returned.
at line 293
static public string
prefixOfUri(string $uri)
Return the prefix namespace that a URI belongs to.
at line 313
static public string
shorten(string $uri, bool $createNamespace = false)
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.
at line 329
static public string
expand(string $shortUri)
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.