Class: NamespaceService

NamespaceService()

Service for namespace management.

Constructor

new NamespaceService()

Author:
  • Mihail Radkov
  • Svilen Velikov
Source:

Methods

deleteNamespace(prefix) → {Promise.<void>}

Deletes a namespace that corresponds to the given prefix.

For example if rdfs is provided as prefix that would delete the following namespace: http://www.w3.org/2000/01/rdf-schema#

Note: This method should be invoked only with prefixes. Anything else would result in an error from the server.

Parameters:
Name Type Description
prefix string

prefix of the namespace to be deleted

Source:
Throws:

if the prefix parameter is not provided

Type
Error
Returns:

promise that will be resolved if the deletion is successful

Type
Promise.<void>

deleteNamespaces() → {Promise.<void>}

Deletes all namespace declarations in the repository.

Source:
Returns:

promise that will be resolved after successful deletion

Type
Promise.<void>

getNamespace(prefix) → {ServiceRequest}

Retrieves the namespace for the given prefix as NamedNode.

For example if rdfs is provided as prefix that would result in a NamedNode corresponding to following namespace: http://www.w3.org/2000/01/rdf-schema#

Note: This method should be invoked only with prefixes. Anything else would result in an error from the server.

Parameters:
Name Type Description
prefix string

prefix of the namespace to be retrieved

Source:
Throws:

if the prefix parameter is not supplied

Type
Error
Returns:

service request resolving to NamedNode

Type
ServiceRequest

getNamespaces() → {ServiceRequest}

Retrieves all present namespaces as a collection of Namespace.

Source:
Returns:

a service request resolving to a collection of Namespace

Type
ServiceRequest

getServiceName()

Source:

saveNamespace(prefix, namespace) → {ServiceRequest}

Creates or updates the namespace for the given prefix.

If the provided prefix or namespace parameter is not a string or NamedNode then the method will throw an error.

Parameters:
Name Type Description
prefix string

prefix of the namespace to be created/updated

namespace string | NamedNode

the namespace to be created/updated

Source:
Throws:

if the prefix or namespace parameter are not provided

Type
Error
Returns:

service request that will be resolved if the create/update request is successful

Type
ServiceRequest