Documentation

RdfNamespaceInterface

Tags
author

zozlak

Table of Contents

Methods

add()  : string
Registers a given URL prefix.
expand()  : NamedNodeInterface
Expands a shortened IRI to a NamedNode.
get()  : string
Returns a IRI prefix for a given short name.
getAll()  : array<string, string>
Returns associative array of all registered namespaces with array keys being namespace short names and array values containing URL prefixes.
remove()  : void
Drops a given short name and IRI prefix associated with it.
shorten()  : string
Shortens provided NamedNode IRI.

Methods

add()

Registers a given URL prefix.

public add(string $iriPrefix[, string|null $shortName = null ]) : string
Parameters
$iriPrefix : string
$shortName : string|null = null

Short name to register the IRI prefix under. If null or empty, the short name is automatically generated.

Return values
string

The short name under which the URL prefix was registered.

expand()

Expands a shortened IRI to a NamedNode.

public expand(string $shortIri) : NamedNodeInterface

Throws an error if the short name used in the shortened IRI is unknown or when the $shortIri is not a shortened IRI.

Parameters
$shortIri : string
Tags
throws
OutOfBoundsException
throws
BadMethodCallException
Return values
NamedNodeInterface

get()

Returns a IRI prefix for a given short name.

public get(string $shortName) : string

Throws an exception if a given short name isn't registered.

Parameters
$shortName : string
Tags
throws
OutOfBoundsException
Return values
string

getAll()

Returns associative array of all registered namespaces with array keys being namespace short names and array values containing URL prefixes.

public getAll() : array<string, string>
Return values
array<string, string>

remove()

Drops a given short name and IRI prefix associated with it.

public remove(string $shortName) : void
Parameters
$shortName : string

shorten()

Shortens provided NamedNode IRI.

public shorten(NamedNodeInterface $Iri, bool $create) : string

If corresponding IRI prefix is not registered yet, the behavior depends on the $create parameter value. If it's true, a new short name is registered automatically. Otherwise an expception is thrown.

Parameters
$Iri : NamedNodeInterface
$create : bool

Should a new short name be registered for the IRI prefix if there is no matching one?

Tags
throws
OutOfBoundsException
Return values
string

        
On this page

Search results