API Docs for: 0.6.0
Show:

sgvizler.namespace Class

Defined in: src/namespace.js:2

Static class for handling prefixes and namespaces. Use for storing prefixes used in SPARQL queries and for formatting result sets, i.e., replacing namespaces with prefixes, which many chart functions automatically do.

Already defined prefixes are rdf, rdfs, owl and xsd.

Dependencies:

  • sgvizler.util

Methods

get

(
  • prefix
)
String protected

Defined in src/namespace.js:50

Available since 0.6.0

Get a namespace.

See also set.

Parameters:

  • prefix String

    The prefix to get the namespace for.

Returns:

String:

The namespace set for 'prefix'; undefined if 'prefix' does not exist.

Example:

get('xsd');  // returns "http://www.w3.org/2001/XMLSchema#"

getBaseURL

() String protected

Defined in src/namespace.js:86

Available since 0.6.0

Get Base URL value.

See also setBaseURL.

Returns:

String:

The base URL.

getBaseURL

(
  • url
)
protected

Defined in src/namespace.js:99

Available since 0.6.0

Set Base URL value.

See also setBaseURL.

Parameters:

prefixesSPARQL

() String protected

Defined in src/namespace.js:113

Available since 0.1

Get all prefixes in SPARQL format.

Returns:

String:

An SPARQL formatted prefix declaration text block containing all set prefixes.

prefixify

(
  • url
)
String protected

Defined in src/namespace.js:132

Available since 0.3.3

Replace a namespace with its prefix, for string which starts with a namespace. Typically used for URLs of resources.

Leaves other strings untouched.

See also unprefixify.

Parameters:

Returns:

Example:

prefixify("http://www.w3.org/2002/07/owl#Class");  // returns "owl:Class"
prefixify("Hello World!");   // returns "Hello World!"

set

(
  • prefix
  • namespace
)
protected

Defined in src/namespace.js:68

Available since 0.6.0

Set a namespace.

See also get.

Parameters:

  • prefix String

    The prefix to set.

  • namespace String

    The namespace to set.

Example:

set('foaf', "http://xmlns.com/foaf/0.1/");

sets 'foaf' as prefix for the FOAF namespace.

unprefixify

(
  • qname
)
String protected

Defined in src/namespace.js:163

Available since 0.3.3

Replace a prefix with its namespace, for string which starts with a prefix: Typically used for prefixed URLs (QNames) of resources.

Leaves other strings untouched.

See also prefixify.

Parameters:

Returns:

Example:

unprefixify("owl:Class");     // returns "http://www.w3.org/2002/07/owl#Class"
unprefixify("Hello World!");  // returns "Hello World!"

Properties

baseURL

String private

Defined in src/namespace.js:37

Available since 0.6.0

nss

Object private

Defined in src/namespace.js:23

Available since 0.1

Stores prefix--namespace pairs.