Class NamespaceMapper
Class for representing Mappings between Prefixes and Namespace URIs.
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: VDS.RDF
Assembly: dotNetRDF.dll
Syntax
public class NamespaceMapper : INamespaceMapper, IDisposable
Constructors
| Improve this Doc View SourceNamespaceMapper()
Constructs a new Namespace Map.
Declaration
public NamespaceMapper()
Remarks
The Prefixes rdf, rdfs and xsd are automatically defined.
|
Improve this Doc
View Source
NamespaceMapper(Boolean)
Constructs a new Namespace Map which is optionally empty.
Declaration
public NamespaceMapper(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. |
NamespaceMapper(INamespaceMapper)
Constructs a new Namespace Map which is based on an existing map.
Declaration
protected NamespaceMapper(INamespaceMapper nsmapper)
Parameters
Type | Name | Description |
---|---|---|
INamespaceMapper | nsmapper |
Fields
| Improve this Doc View Source_prefixes
Mapping of URIs to Prefixes.
Declaration
protected Dictionary<int, List<string>> _prefixes
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.Int32, System.Collections.Generic.List<System.String>> |
_uris
Mapping of Prefixes to URIs.
Declaration
protected Dictionary<string, Uri> _uris
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.Uri> |
OWL
Constant Uri for the OWL Namespace.
Declaration
public const string OWL = "http://www.w3.org/2002/07/owl#"
Field Value
Type | Description |
---|---|
System.String |
RDF
Constant Uri for the RDF Namespace.
Declaration
public const string RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
Field Value
Type | Description |
---|---|
System.String |
RDFS
Constant Uri for the RDF Scheme Namespace.
Declaration
public const string RDFS = "http://www.w3.org/2000/01/rdf-schema#"
Field Value
Type | Description |
---|---|
System.String |
XMLSCHEMA
Constant Uri for the XML Scheme Namespace.
Declaration
public const string XMLSCHEMA = "http://www.w3.org/2001/XMLSchema#"
Field Value
Type | Description |
---|---|
System.String |
Properties
| Improve this Doc View SourcePrefixes
Gets a Enumerator of all the Prefixes.
Declaration
public IEnumerable<string> Prefixes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> |
Methods
| Improve this Doc View SourceAddNamespace(String, Uri)
Adds a Namespace to the Namespace Map.
Declaration
public virtual void AddNamespace(string prefix, Uri uri)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | Namespace Prefix. |
System.Uri | uri | Namespace Uri. |
Clear()
Clears the Namespace Map.
Declaration
public void Clear()
Dispose()
Disposes of a Namespace Map.
Declaration
public void Dispose()
GetNamespaceUri(String)
Returns the Namespace URI associated with the given Prefix.
Declaration
public virtual Uri GetNamespaceUri(string prefix)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The Prefix to lookup the Namespace URI for. |
Returns
Type | Description |
---|---|
System.Uri | URI for the Namespace. |
GetPrefix(Uri)
Returns the Prefix associated with the given Namespace URI.
Declaration
public virtual string GetPrefix(Uri uri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | uri | The Namespace URI to lookup the Prefix for. |
Returns
Type | Description |
---|---|
System.String | String prefix for the Namespace. |
HasNamespace(String)
Method which checks whether a given Namespace Prefix is defined.
Declaration
public virtual bool HasNamespace(string prefix)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | Prefix to test. |
Returns
Type | Description |
---|---|
System.Boolean |
HasNamespace(Uri)
Method which checks whether a given Namespace is defined.
Declaration
public virtual bool HasNamespace(Uri ns)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | ns | Namespace to test. |
Returns
Type | Description |
---|---|
System.Boolean |
Import(INamespaceMapper)
Imports the contents of another Namespace Map into this Namespace Map.
Declaration
public virtual void Import(INamespaceMapper nsmap)
Parameters
Type | Name | Description |
---|---|---|
INamespaceMapper | nsmap | Namespace Map to import. |
Remarks
Prefixes in the imported Map which are already defined in this Map are ignored, this may change in future releases.
|
Improve this Doc
View Source
OnNamespaceAdded(String, Uri)
Internal Helper for the NamespaceAdded Event which raises it only when a Handler is registered.
Declaration
protected virtual void OnNamespaceAdded(string prefix, Uri uri)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | Namespace Prefix. |
System.Uri | uri | Namespace Uri. |
OnNamespaceModified(String, Uri)
Internal Helper for the NamespaceModified Event which raises it only when a Handler is registered.
Declaration
protected virtual void OnNamespaceModified(string prefix, Uri uri)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | Namespace Prefix. |
System.Uri | uri | Namespace Uri. |
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 |
---|---|---|
System.String | prefix | Namespace Prefix. |
System.Uri | uri | Namespace Uri. |
ReduceToQName(String, out String)
A Function which attempts to reduce a Uri to a QName.
Declaration
public virtual bool ReduceToQName(string uri, out string qname)
Parameters
Type | Name | Description |
---|---|---|
System.String | uri | The Uri to attempt to reduce. |
System.String | qname | The value to output the QName to if possible. |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
This function will return a Boolean indicated whether it succeeded in reducing the Uri to a QName. If it did then the out parameter qname will contain the reduction, otherwise it will be the empty string.
|
Improve this Doc
View Source
RemoveNamespace(String)
Removes a Namespace from the NamespaceMapper.
Declaration
public virtual void RemoveNamespace(string prefix)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | Namespace Prefix of the Namespace to remove. |
Events
| Improve this Doc View SourceNamespaceAdded
Event which is raised when a Namespace is Added
Declaration
public event NamespaceChanged NamespaceAdded
Event Type
Type | Description |
---|---|
NamespaceChanged |
NamespaceModified
Event which is raised when a Namespace is Modified
Declaration
public event NamespaceChanged NamespaceModified
Event Type
Type | Description |
---|---|
NamespaceChanged |
NamespaceRemoved
Event which is raised when a Namespace is Removed
Declaration
public event NamespaceChanged NamespaceRemoved
Event Type
Type | Description |
---|---|
NamespaceChanged |
Implements
System.IDisposable