RdfNamespace
class RdfNamespace
A namespace registry and manipulation class.
Methods
Return all the namespaces registered
Resets list of namespaces to the one, which is provided by EasyRDF useful for tests, among other things
Return a namespace given its prefix.
Register a new namespace.
Get the default namespace
Set the default namespace
Delete an existing namespace.
Delete the anonymous namespaces and reset the counter to 0
Try and breakup a URI into a prefix and local part
Return the prefix namespace that a URI belongs to.
Shorten a URI by substituting in the namespace prefix.
Expand a shortened URI (qname) back into a full URI.
Details
at line 125
static array
namespaces()
Return all the namespaces registered
at line 138
static
resetNamespaces()
Resets list of namespaces to the one, which is provided by EasyRDF useful for tests, among other things
at line 151
static string
get(string $prefix)
Return a namespace given its prefix.
at line 184
static
set(string $prefix, string $long)
Register a new namespace.
at line 246
static string
getDefault()
Get the default namespace
Returns the URI of the default namespace or null if no default namespace is defined.
at line 264
static
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\RdfNamespace::setDefault('http://schema.org/');
at line 290
static
delete(string $prefix)
Delete an existing namespace.
at line 308
static
reset()
Delete the anonymous namespaces and reset the counter to 0
at line 331
static 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 382
static string
prefixOfUri(string $uri)
Return the prefix namespace that a URI belongs to.
at line 403
static 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 421
static 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.