class EasyRdf_Namespace
A namespace registry and manipulation class.
Methods
static array |
namespaces()
Return all the namespaces registered |
|
static |
resetNamespaces()
Resets list of namespaces to the one, which is provided by EasyRDF useful for tests, among other things |
|
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 113
static public array
namespaces()
Return all the namespaces registered
at line 126
static public
resetNamespaces()
Resets list of namespaces to the one, which is provided by EasyRDF useful for tests, among other things
at line 137
static public string
get(string $prefix)
Return a namespace given its prefix.
at line 167
static public
set(string $prefix, string $long)
Register a new namespace.
at line 229
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 245
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 269
static public
delete(string $prefix)
Delete an existing namespace.
at line 287
static public
reset()
Delete the anonymous namespaces and reset the counter to 0
at line 308
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 358
static public string
prefixOfUri(string $uri)
Return the prefix namespace that a URI belongs to.
at line 378
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 394
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.