Class QNameOutputMapper
Class for representing Mappings from URIs to QNames.
Inherited Members
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
public class QNameOutputMapper : NamespaceMapper, INamespaceMapper, IDisposable
Remarks
Used primarily in outputting RDF syntax.
Constructors
| Edit this page View SourceQNameOutputMapper(INamespaceMapper, IUriFactory)
Creates a new QName Output Mapper using the given Namespace Map.
Declaration
public QNameOutputMapper(INamespaceMapper nsmapper, IUriFactory uriFactory = null)
Parameters
Type | Name | Description |
---|---|---|
INamespaceMapper | nsmapper | Namespace Map. |
IUriFactory | uriFactory | The factory to use when creating new Uri instances. If not specified, defaults to Root. |
QNameOutputMapper(IUriFactory)
Creates a new QName Output Mapper which has an empty Namespace Map.
Declaration
public QNameOutputMapper(IUriFactory uriFactory = null)
Parameters
Type | Name | Description |
---|---|---|
IUriFactory | uriFactory | The factory to use when creating new Uri instances. If not specified, defaults to Root. |
Fields
| Edit this page View SourceMapping
Mapping of URIs to QNames.
Declaration
protected readonly MultiDictionary<string, QNameMapping> Mapping
Field Value
Type | Description |
---|---|
MultiDictionary<string, QNameMapping> |
Methods
| Edit this page View SourceAddToCache(string, QNameMapping)
Adds a QName mapping to the cache.
Declaration
protected virtual void AddToCache(string uri, QNameMapping mapping)
Parameters
Type | Name | Description |
---|---|---|
string | uri | URI. |
QNameMapping | mapping | Mapping. |
ReduceToQName(string, out string, Func<string, bool>)
A Function which attempts to reduce a Uri to a QName.
Declaration
public override bool ReduceToQName(string uri, out string qname, Func<string, bool> validationFunction = null)
Parameters
Type | Name | Description |
---|---|---|
string | uri | The Uri to attempt to reduce. |
string | qname | The value to output the QName to if possible. |
Func<string, bool> | validationFunction | OPTIONAL: a function which when applied to a candidate QName string returns true if the string is acceptable, and false otherwise. |
Returns
Type | Description |
---|---|
bool |
Overrides
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.
ReduceToQName(string, out string, out string)
A Function which attempts to reduce a Uri to a QName and issues a Temporary Namespace if required.
Declaration
public bool ReduceToQName(string uri, out string qName, out string tempNamespace)
Parameters
Type | Name | Description |
---|---|---|
string | uri | The Uri to attempt to reduce. |
string | qName | The value to output the QName to if possible. |
string | tempNamespace | The Temporary Namespace issued (if any). |
Returns
Type | Description |
---|---|
bool |
Remarks
This function will always returns a possible QName for the URI if the format of the URI permits it. It doesn't guarantee that the QName will be valid for the syntax it is being written to - it is up to implementers of writers to validate the QNames returned.
Where necessary a Temporary Namespace will be issued and the tempNamespace
parameter will be set to the prefix of the new temporary namespace.