Class Tools
Tools class which contains a number of utility methods which are declared as static methods.
Inheritance
System.Object
Tools
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 static class Tools
Methods
| Improve this Doc View SourceCombineHashCodes(Object, Object)
Does a quick and simple combination of the Hash Codes of two Objects.
Declaration
public static int CombineHashCodes(object x, object y)
Parameters
Type | Name | Description |
---|---|---|
System.Object | x | First Object. |
System.Object | y | Second Object. |
Returns
Type | Description |
---|---|
System.Int32 |
CopyNode(INode, IGraph)
Copies a Node so it can be used in another Graph since by default Triples cannot contain Nodes from more than one Graph.
Declaration
public static INode CopyNode(INode original, IGraph target)
Parameters
Type | Name | Description |
---|---|---|
INode | original | Node to Copy. |
IGraph | target | Graph to Copy into. |
Returns
Type | Description |
---|---|
INode |
Remarks
Warning: Copying Blank Nodes may lead to unforseen circumstances since no remapping of IDs between Graphs is done.
CopyNode(INode, IGraph, Boolean)
Copies a Node so it can be used in another Graph since by default Triples cannot contain Nodes from more than one Graph.
Declaration
public static INode CopyNode(INode original, IGraph target, bool keepOriginalGraphUri)
Parameters
Type | Name | Description |
---|---|---|
INode | original | Node to Copy. |
IGraph | target | Graph to Copy into. |
System.Boolean | keepOriginalGraphUri | Indicates whether the Copy should preserve the Graph Uri of the Node being copied. |
Returns
Type | Description |
---|---|
INode |
CopyNode(INode, INodeFactory)
Copies a Node using another Node Factory.
Declaration
public static INode CopyNode(INode original, INodeFactory target)
Parameters
Type | Name | Description |
---|---|---|
INode | original | Node to copy. |
INodeFactory | target | Factory to copy into. |
Returns
Type | Description |
---|---|
INode |
Remarks
Warning: Copying Blank Nodes may lead to unforseen circumstances since no remapping of IDs between Factories is done.
CopyTriple(Triple, IGraph)
Copies a Triple from one Graph to another.
Declaration
public static Triple CopyTriple(Triple t, IGraph target)
Parameters
Type | Name | Description |
---|---|---|
Triple | t | Triple to copy. |
IGraph | target | Graph to copy to. |
Returns
Type | Description |
---|---|
Triple |
CopyTriple(Triple, IGraph, Boolean)
Copies a Triple from one Graph to another.
Declaration
public static Triple CopyTriple(Triple t, IGraph target, bool keepOriginalGraphUri)
Parameters
Type | Name | Description |
---|---|---|
Triple | t | Triple to copy. |
IGraph | target | Graph to copy to. |
System.Boolean | keepOriginalGraphUri | Indicates whether the Copy should preserve the Graph Uri of the Nodes being copied. |
Returns
Type | Description |
---|---|
Triple |
HttpDebugRequest(HttpWebRequest)
Prints Debugging Output to the Console Standard Out for a HTTP Web Request.
Declaration
public static void HttpDebugRequest(HttpWebRequest httpRequest)
Parameters
Type | Name | Description |
---|---|---|
System.Net.HttpWebRequest | httpRequest | HTTP Web Request. |
Remarks
Only available in Debug builds
|
Improve this Doc
View Source
HttpDebugResponse(HttpWebResponse)
Prints Debugging Output to the Console Standard Out for a HTTP Web Response.
Declaration
public static void HttpDebugResponse(HttpWebResponse httpResponse)
Parameters
Type | Name | Description |
---|---|---|
System.Net.HttpWebResponse | httpResponse | HTTP Web Response. |
Remarks
Only available in Debug builds
|
Improve this Doc
View Source
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.
|
Improve this Doc
View Source
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 |
---|---|---|
System.String | qname | QName to resolve. |
INamespaceMapper | nsmap | Namespace Map to resolve against. |
System.Uri | baseUri | Base Uri to resolve against. |
Returns
Type | Description |
---|---|
System.String |
ResolveQName(String, INamespaceMapper, Uri, Boolean)
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 |
---|---|---|
System.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 |
---|---|
System.String |
ResolveUri(String, String)
Generic Helper Function which Resolves Uri References against a Base Uri.
Declaration
public static string ResolveUri(string uriref, string baseUri)
Parameters
Type | Name | Description |
---|---|---|
System.String | uriref | Uri Reference to resolve. |
System.String | baseUri | Base Uri to resolve against. |
Returns
Type | Description |
---|---|
System.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 |
---|---|
System.String |
StripUriFragment(Uri)
Returns a URI with any Fragment ID removed from it.
Declaration
public static Uri StripUriFragment(Uri u)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | u | URI. |
Returns
Type | Description |
---|---|
System.Uri |