Class NestedNamespaceMapper
A Namespace Mapper which has an explicit notion of Nesting.
Inheritance
Inherited Members
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
public class NestedNamespaceMapper : INestedNamespaceMapper, INamespaceMapper, IDisposable
Constructors
| Improve this Doc View SourceNestedNamespaceMapper()
Constructs a new Namespace Map.
Declaration
public NestedNamespaceMapper()
Remarks
The Prefixes rdf, rdfs and xsd are automatically defined.
NestedNamespaceMapper(bool)
Constructs a new Namespace Map which is optionally empty.
Declaration
protected NestedNamespaceMapper(bool empty)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | empty | Whether the Namespace Map should be empty, if set to false the Prefixes rdf, rdfs and xsd are automatically defined. |
NestedNamespaceMapper(IUriFactory, bool)
Creates a new namespace map with the specified URI factory.
Declaration
protected NestedNamespaceMapper(IUriFactory uriFactory, bool empty = false)
Parameters
Type | Name | Description |
---|---|---|
IUriFactory | uriFactory | The URI factory to use. |
System.Boolean | empty | Whether the Namespace Map should be empty, if set to false the Prefixes rdf, rdfs and xsd are automatically defined. |
Properties
| Improve this Doc View SourceNestingLevel
Gets the current Nesting Level.
Declaration
public int NestingLevel { get; }
Property Value
Type | Description |
---|---|
int |
Prefixes
Gets the Namespace Prefixes.
Declaration
public IEnumerable<string> Prefixes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><string> |
Methods
| Improve this Doc View SourceAddNamespace(string, Uri)
Adds a Namespace at the Current Nesting Level.
Declaration
public void AddNamespace(string prefix, Uri uri)
Parameters
Type | Name | Description |
---|---|---|
string | prefix | Prefix. |
System.Uri | uri | Namespace URI. |
Clear()
Clears the Namespace Map.
Declaration
public void Clear()
DecrementNesting()
Decrements the Nesting Level.
Declaration
public void DecrementNesting()
Remarks
When the Nesting Level is decremented any Namespaces defined at a greater Nesting Level are now out of scope and so are removed from the Mapper.
Dispose()
Disposes of the Namespace Map.
Declaration
public void Dispose()
GetNamespaceUri(string)
Gets the Namespace URI for the given Prefix at the current Nesting Level.
Declaration
public Uri GetNamespaceUri(string prefix)
Parameters
Type | Name | Description |
---|---|---|
string | prefix | Prefix. |
Returns
Type | Description |
---|---|
System.Uri |
GetNestingLevel(string)
Gets the Nesting Level at which the given Namespace is definition is defined.
Declaration
public int GetNestingLevel(string prefix)
Parameters
Type | Name | Description |
---|---|---|
string | prefix | Prefix. |
Returns
Type | Description |
---|---|
int |
GetPrefix(Uri)
Gets the Namespace Prefix for the given URI at the current Nesting Level.
Declaration
public string GetPrefix(Uri uri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | uri | Namespace URI. |
Returns
Type | Description |
---|---|
string |
HasNamespace(string)
Gets whether the given Namespace exists.
Declaration
public bool HasNamespace(string prefix)
Parameters
Type | Name | Description |
---|---|---|
string | prefix | Prefix. |
Returns
Type | Description |
---|---|
System.Boolean |
Import(INamespaceMapper)
Imports another Namespace Map into this one.
Declaration
public void Import(INamespaceMapper nsmap)
Parameters
Type | Name | Description |
---|---|---|
INamespaceMapper | nsmap | Namespace Map. |
IncrementNesting()
Increments the Nesting Level.
Declaration
public void IncrementNesting()
OnNamespaceRemoved(string, Uri)
Internal Helper for the NamespaceRemoved Event which raises it only when a Handler is registered.
Declaration
protected virtual void OnNamespaceRemoved(string prefix, Uri uri)
Parameters
Type | Name | Description |
---|---|---|
string | prefix | Namespace Prefix. |
System.Uri | uri | Namespace Uri. |
RaiseNamespaceAdded(string, Uri)
Internal Helper for the NamespaceAdded Event which raises it only when a Handler is registered.
Declaration
protected virtual void RaiseNamespaceAdded(string prefix, Uri uri)
Parameters
Type | Name | Description |
---|---|---|
string | prefix | Namespace Prefix. |
System.Uri | uri | Namespace Uri. |
RaiseNamespaceModified(string, Uri)
Internal Helper for the NamespaceModified Event which raises it only when a Handler is registered.
Declaration
protected virtual void RaiseNamespaceModified(string prefix, Uri uri)
Parameters
Type | Name | Description |
---|---|---|
string | prefix | Namespace Prefix. |
System.Uri | uri | Namespace Uri. |
ReduceToQName(string, out string, Func<string, bool>)
Tries to reduce a URI to a QName using this Namespace Map.
Declaration
public bool ReduceToQName(string uri, out string qname, Func<string, bool> validationFunction = null)
Parameters
Type | Name | Description |
---|---|---|
string | uri | URI. |
string | qname | Resulting QName. |
System.Func<T, TResult><string, System.Boolean> | validationFunction | A validation function to use to validate the QName. Only a QName value for which the validation function return true will be returned. |
Returns
Type | Description |
---|---|
System.Boolean |
RemoveNamespace(string)
Removes a Namespace provided that Namespace is defined on the current Nesting Level.
Declaration
public void RemoveNamespace(string prefix)
Parameters
Type | Name | Description |
---|---|---|
string | prefix | Prefix. |
Events
| Improve this Doc View SourceNamespaceAdded
Event which occurs when a Namespace is added
Declaration
public event NamespaceChanged NamespaceAdded
Event Type
Type | Description |
---|---|
NamespaceChanged |
NamespaceModified
Event which occurs when a Namespace is modified
Declaration
public event NamespaceChanged NamespaceModified
Event Type
Type | Description |
---|---|
NamespaceChanged |
NamespaceRemoved
Event which occurs when a Namespace is removed
Declaration
public event NamespaceChanged NamespaceRemoved
Event Type
Type | Description |
---|---|
NamespaceChanged |