Class Tools
Tools class which contains a number of utility methods which are declared as static methods.
Inheritance
Inherited Members
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
public static class Tools
Methods
| Improve this Doc View SourceCombineHashCodes(params object[])
Does a quick and simple combination of the Hash Codes of two or more objects.
Declaration
public static int CombineHashCodes(params object[] objects)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | objects | The objects whose hash codes are to be combined. |
Returns
Type | Description |
---|---|
int |
IsValidBaseUri(Uri)
Checks whether a Uri is valid as a Base Uri for resolving Relative URIs against.
Declaration
public static bool IsValidBaseUri(Uri baseUri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | baseUri | Base Uri to test. |
Returns
Type | Description |
---|---|
System.Boolean | True if the Base Uri can be used to resolve Relative URIs against. |
Remarks
A Base Uri is valid if it is an absolute Uri and not using the mailto: scheme.
ResolveQName(string, INamespaceMapper, Uri, bool)
Resolves a QName into a Uri using the Namespace Mapper and Base Uri provided.
Declaration
public static string ResolveQName(string qname, INamespaceMapper nsmap, Uri baseUri, bool allowDefaultPrefixFallback)
Parameters
Type | Name | Description |
---|---|---|
string | qname | QName to resolve. |
INamespaceMapper | nsmap | Namespace Map to resolve against. |
System.Uri | baseUri | Base Uri to resolve against. |
System.Boolean | allowDefaultPrefixFallback | Whether when the default prefix is used but not defined it can fallback to Base URI. |
Returns
Type | Description |
---|---|
string |
ResolveQName(string, INamespaceMapper, Uri)
Resolves a QName into a Uri using the Namespace Mapper and Base Uri provided.
Declaration
public static string ResolveQName(string qname, INamespaceMapper nsmap, Uri baseUri)
Parameters
Type | Name | Description |
---|---|---|
string | qname | QName to resolve. |
INamespaceMapper | nsmap | Namespace Map to resolve against. |
System.Uri | baseUri | Base Uri to resolve against. |
Returns
Type | Description |
---|---|
string |
ResolveUri(string, string, IUriFactory)
Generic Helper Function which Resolves Uri References against a Base Uri.
Declaration
public static string ResolveUri(string uriref, string baseUri, IUriFactory uriFactory = null)
Parameters
Type | Name | Description |
---|---|---|
string | uriref | Uri Reference to resolve. |
string | baseUri | Base Uri to resolve against. |
IUriFactory | uriFactory | The factory to use to create the temporary URI created internally by this method. If not specified, defaults to Root. |
Returns
Type | Description |
---|---|
string | Resolved Uri as a String. |
Exceptions
Type | Condition |
---|---|
RdfParseException | RDF Parse Exception if the Uri cannot be resolved for a know reason. |
System.UriFormatException | Uri Format Exception if one/both of the URIs is malformed. |
ResolveUri(Uri, Uri)
Generic Helper Function which Resolves Uri References against a Base Uri.
Declaration
public static Uri ResolveUri(Uri uriref, Uri baseUri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | uriref | Uri Reference to resolve. |
System.Uri | baseUri | Base Uri to resolve against. |
Returns
Type | Description |
---|---|
System.Uri | Resolved Uri as a String. |
Exceptions
Type | Condition |
---|---|
System.UriFormatException | Uri Format Exception if one/both of the URIs is malformed. |
ResolveUriOrQName(IToken, INamespaceMapper, Uri)
Resolves a QName/Uri into a Uri using the Namespace Mapper and Base Uri provided.
Declaration
public static string ResolveUriOrQName(IToken t, INamespaceMapper nsmap, Uri baseUri)
Parameters
Type | Name | Description |
---|---|---|
IToken | t | QName/Uri to resolve. |
INamespaceMapper | nsmap | Namespace Map to resolve against. |
System.Uri | baseUri | Base Uri to resolve against. |
Returns
Type | Description |
---|---|
string |
StripUriFragment(Uri, IUriFactory)
Returns a URI with any Fragment ID removed from it.
Declaration
public static Uri StripUriFragment(Uri u, IUriFactory uriFactory = null)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | u | URI. |
IUriFactory | uriFactory | The factory to use to create the returned URI. If not specified, defaults to Root. |
Returns
Type | Description |
---|---|
System.Uri |