SemWeb : SemWeb Namespace
NamespaceManager Class

A class that maintains a mapping between namespace prefixes and URIs.

public class NamespaceManager

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.0, 1.0.6.2

Members

See Also: Inherited members from object.

Public Constructors

Creates a new namespace manager.
Creates a new namespace manager who will look in another namespace manager when it cannot find a matching prefix or URI.

Public Methods

AddFrom (NamespaceManager)
Adds all of the namespace declarations from another NamespaceManager.
AddNamespace (string, string)
Adds a prefix-URI mapping to the table.
GetNamespace (string) : string
Returns the namespace associated with a prefix.
GetNamespaces () : ICollection
Gets all of the namespace URIs known to the namespace manager.
GetPrefix (string) : string
Gets the prefix associated with a namespace URI.
GetPrefixes () : ICollection
Gets all of the prefixes known to the namespace manager.
Normalize (string) : string
Normalizes a URI in N3 format.
Normalize (string, out string, out string) : bool
Splits a URI into a prefix and local name.
Resolve (string) : string
Converts a QName into a full URI.

Member Details

NamespaceManager Constructor

Creates a new namespace manager.

public NamespaceManager ()

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

NamespaceManager Constructor

Creates a new namespace manager who will look in another namespace manager when it cannot find a matching prefix or URI.

public NamespaceManager (NamespaceManager parent)

Parameters

parent
Another namespace manager.

Remarks

When the new namespace manager cannot find a prefix or URI in its own table, it will consult parent's table.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

AddFrom Method

Adds all of the namespace declarations from another NamespaceManager.

public void AddFrom (NamespaceManager nsmgr)

Parameters

nsmgr
The NamespaceManager to copy the declarations from.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

AddNamespace Method

Adds a prefix-URI mapping to the table.

public virtual void AddNamespace (string uri, string prefix)

Parameters

uri
A URI.
prefix
A namespace prefix for the URI.

Remarks

If prefix was already used in a call to this method, the previous prefix-to-URI mapping will be overwritten. Likewise, if uri was used before, the previous uri-to-prefix mapping will be overwritten.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

GetNamespace Method

Returns the namespace associated with a prefix.

public virtual string GetNamespace (string prefix)

Parameters

prefix
The prefix to look up.

Returns

The corresponding namespace, or null if the prefix is not in the table.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

GetNamespaces Method

Gets all of the namespace URIs known to the namespace manager.

public ICollection GetNamespaces ()

Returns

A collection of all namespace URIs known to this namespace manager.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

GetPrefix Method

Gets the prefix associated with a namespace URI.

public virtual string GetPrefix (string uri)

Parameters

uri
A URI.

Returns

The prefix associated with this namespace, or null if the URI is not associated with a prefix.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

GetPrefixes Method

Gets all of the prefixes known to the namespace manager.

public ICollection GetPrefixes ()

Returns

A collection of all prefixes known to this namespace manager.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Normalize Method

Normalizes a URI in N3 format.

public string Normalize (string uri)

Parameters

uri
A URI to normalize.

Returns

If a namespace matches part of this URI, a QName (prefix:localname) is returned. Otherwise, the URI is returned in angled brackets (<uri>).

Remarks

A QName will only be returned if the localname consists only of valid characters for a QName.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Normalize Method

Splits a URI into a prefix and local name.

public bool Normalize (string uri, out string prefix, out string localname)

Parameters

uri
The URI to split.
prefix
This parameter is set to a namespace prefix.
localname
This parameter is set to a local name.

Returns

True if the URI could be split into a prefix and local name, false otherwise.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Resolve Method

Converts a QName into a full URI.

public string Resolve (string qname)

Parameters

qname
A QName, e.g. "dc:title."

Returns

A URI equivalent to the QName.

Remarks

The QName is split on its colon. The prefix and colon are replaced by the namespace corresponding to the prefix. An exception is thrown if the prefix is not known to the namespace manager.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2