Show / Hide Table of Contents

Class UriLoader

Static Helper Class for dereferencing URIs and attempting to parse the results of a HTTP GET request to the URI into RDF.

Inheritance
System.Object
UriLoader
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: VDS.RDF.Parsing
Assembly: dotNetRdf.dll
Syntax
[Obsolete("The UriLoader class has been deprecated and will be removed in a future release. Please use the Loader class as a replacement.")]
public static class UriLoader
Remarks

Caching

As of the 0.2.2 release the loader has support for caching retrieved data locally built into it (for Graphs only), caching is done using ETags where the remote server provides them or just by a user-defineable 'freshness' criteria (i.e. number of hours retrieved resources should be cached for). By default this caching happens in the system temporary directory which means it is non-persistent i.e. if you run your application using dotNetRDF it may cache stuff during the session but once the application is closed the operating system may freely delete the cached data. If you wish to have a persistent cache then you can use the CacheDirectory property to set your own cache directory. Even when you set your own cache directory dotNetRDF will delete obsolete data from it over time though this will only happen when a new request invalidates previously cached data.

If you wish to completely control the Cache you can implement your own IUriLoaderCache implementation and use it by setting the Cache property.

As of the 3.0 release, this class is now deprecated and will be removed in a future version. The replacement for this class is the Loader class.

Properties

| Improve this Doc View Source

Cache

Gets/Sets the Cache that is in use.

Declaration
public static IUriLoaderCache Cache { get; set; }
Property Value
Type Description
IUriLoaderCache
Remarks

Setting the Cache to null does not disable it, to disable caching use the CacheEnabled property.

| Improve this Doc View Source

CacheDirectory

Gets/Sets the Directory used for caching Graphs loaded from URIs.

Declaration
public static string CacheDirectory { get; set; }
Property Value
Type Description
string
Remarks

Caching

As of the 0.2.2 release the loader has support for caching retrieved data locally built into it (for Graphs only), caching is done using ETags where the remote server provides them or just by a user-defineable 'freshness' criteria (i.e. number of hours retrieved resources should be cached for). By default this caching happens in the system temporary directory which means it is non-persistent i.e. if you run your application using dotNetRDF it may cache stuff during the session but once the application is closed the operating system may freely delete the cached data. If you wish to have a persistent cache then you can use the CacheDirectory property to set your own cache directory. Even when you set your own cache directory dotNetRDF will delete obsolete data from it over time though this will only happen when a new request invalidates previously cached data.

If you wish to completely control the Cache you can implement your own IUriLoaderCache implementation and use it by setting the Cache property.

As of the 3.0 release, this class is now deprecated and will be removed in a future version. The replacement for this class is the Loader class.

| Improve this Doc View Source

CacheDuration

Gets/Sets the amount of time Graphs are cached for.

Declaration
public static TimeSpan CacheDuration { get; set; }
Property Value
Type Description
System.TimeSpan
Remarks

This duration only applies to URIs which don't return an ETag as part of the HTTP response when they are deferenced.

| Improve this Doc View Source

CacheEnabled

Get or set the flag that controls whether or not the cache is enabled.

Declaration
public static bool CacheEnabled { get; set; }
Property Value
Type Description
System.Boolean
Remarks

Caching

As of the 0.2.2 release the loader has support for caching retrieved data locally built into it (for Graphs only), caching is done using ETags where the remote server provides them or just by a user-defineable 'freshness' criteria (i.e. number of hours retrieved resources should be cached for). By default this caching happens in the system temporary directory which means it is non-persistent i.e. if you run your application using dotNetRDF it may cache stuff during the session but once the application is closed the operating system may freely delete the cached data. If you wish to have a persistent cache then you can use the CacheDirectory property to set your own cache directory. Even when you set your own cache directory dotNetRDF will delete obsolete data from it over time though this will only happen when a new request invalidates previously cached data.

If you wish to completely control the Cache you can implement your own IUriLoaderCache implementation and use it by setting the Cache property.

As of the 3.0 release, this class is now deprecated and will be removed in a future version. The replacement for this class is the Loader class.

| Improve this Doc View Source

Timeout

Get or set the timeout (in milliseconds) for reading content from a URL.

Declaration
public static int Timeout { get; set; }
Property Value
Type Description
int
Remarks

Caching

As of the 0.2.2 release the loader has support for caching retrieved data locally built into it (for Graphs only), caching is done using ETags where the remote server provides them or just by a user-defineable 'freshness' criteria (i.e. number of hours retrieved resources should be cached for). By default this caching happens in the system temporary directory which means it is non-persistent i.e. if you run your application using dotNetRDF it may cache stuff during the session but once the application is closed the operating system may freely delete the cached data. If you wish to have a persistent cache then you can use the CacheDirectory property to set your own cache directory. Even when you set your own cache directory dotNetRDF will delete obsolete data from it over time though this will only happen when a new request invalidates previously cached data.

If you wish to completely control the Cache you can implement your own IUriLoaderCache implementation and use it by setting the Cache property.

As of the 3.0 release, this class is now deprecated and will be removed in a future version. The replacement for this class is the Loader class.

| Improve this Doc View Source

UserAgent

Gets/Sets an optional User Agent string that will be appended to HTTP Requests.

Declaration
public static string UserAgent { get; set; }
Property Value
Type Description
string
Remarks

Caching

As of the 0.2.2 release the loader has support for caching retrieved data locally built into it (for Graphs only), caching is done using ETags where the remote server provides them or just by a user-defineable 'freshness' criteria (i.e. number of hours retrieved resources should be cached for). By default this caching happens in the system temporary directory which means it is non-persistent i.e. if you run your application using dotNetRDF it may cache stuff during the session but once the application is closed the operating system may freely delete the cached data. If you wish to have a persistent cache then you can use the CacheDirectory property to set your own cache directory. Even when you set your own cache directory dotNetRDF will delete obsolete data from it over time though this will only happen when a new request invalidates previously cached data.

If you wish to completely control the Cache you can implement your own IUriLoaderCache implementation and use it by setting the Cache property.

As of the 3.0 release, this class is now deprecated and will be removed in a future version. The replacement for this class is the Loader class.

Methods

| Improve this Doc View Source

IsCached(Uri)

Determines whether the RDF behind the given URI is cached.

Declaration
public static bool IsCached(Uri u)
Parameters
Type Name Description
System.Uri u

URI.

Returns
Type Description
System.Boolean
Remarks

Note: This does not guarantee that the cached content will be used if you load from the URI using the UriLoader. Whether the cached copy is used will depend on whether.

| Improve this Doc View Source

Load(IGraph, Uri, GraphCallback, object)

Attempts to load a RDF Graph from a URI asynchronously.

Declaration
public static void Load(IGraph g, Uri u, GraphCallback callback, object state)
Parameters
Type Name Description
IGraph g

Graph to assert triple in.

System.Uri u

URI to load from.

GraphCallback callback

Callback to invoke when the operation completes.

System.Object state

State to pass to the callback.

Remarks

Will attempt to autodetect the format of the RDF based on the Content-Type header of the HTTP response.

In the event that the URI is a File URI the FileLoader will be used instead. If the URI is a Data URI then the DataUriLoader will be used instead.

Note: UriLoader will assign the Graph the source URI as it's Base URI unless the Graph already has a Base URI or is non-empty prior to attempting parsing. Note that any Base URI specified in the RDF contained in the file will override this initial Base URI. In some cases this may lead to invalid RDF being accepted and generating strange relative URIs, if you encounter this either set a Base URI prior to calling this method or create an instance of the relevant parser and invoke it directly.

If the loading completes normally the callback will be invoked normally, if an error occurs it will be invoked and passed an instance of AsyncError as the state which contains details of the error and the original state.

| Improve this Doc View Source

Load(IGraph, Uri, IRdfReader, GraphCallback, object)

Attempts to load a RDF Graph from a URI asynchronously.

Declaration
public static void Load(IGraph g, Uri u, IRdfReader parser, GraphCallback callback, object state)
Parameters
Type Name Description
IGraph g

Graph to assert triple in.

System.Uri u

URI to load from.

IRdfReader parser

Parser to use.

GraphCallback callback

Callback to invoke when the operation completes.

System.Object state

State to pass to the callback.

Remarks

Uses the supplied parser to attempt parsing regardless of the actual Content Type returned.

In the event that the URI is a File URI the FileLoader will be used instead. If the URI is a Data URI then the DataUriLoader will be used instead.

Note: UriLoader will assign the Graph the source URI as it's Base URI unless the Graph already has a Base URI or is non-empty prior to attempting parsing. Note that any Base URI specified in the RDF contained in the file will override this initial Base URI. In some cases this may lead to invalid RDF being accepted and generating strange relative URIs, if you encounter this either set a Base URI prior to calling this method or create an instance of the relevant parser and invoke it directly.

If the loading completes normally the callback will be invoked normally, if an error occurs it will be invoked and passed an instance of AsyncError as the state which contains details of the error and the original state.

| Improve this Doc View Source

Load(IGraph, Uri, IRdfReader)

Attempts to load a RDF Graph from the given URI into the given Graph.

Declaration
public static void Load(IGraph g, Uri u, IRdfReader parser)
Parameters
Type Name Description
IGraph g

Graph to assert Triples in.

System.Uri u

URI to attempt to get RDF from.

IRdfReader parser

Parser to use.

Remarks

Uses the supplied parser to attempt parsing regardless of the actual Content Type returned.

In the event that the URI is a File URI the FileLoader will be used instead. If the URI is a Data URI then the DataUriLoader will be used instead.

Note: UriLoader will assign the Graph the source URI as it's Base URI unless the Graph already has a Base URI or is non-empty prior to attempting parsing. Note that any Base URI specified in the RDF contained in the file will override this initial Base URI. In some cases this may lead to invalid RDF being accepted and generating strange relative URIs, if you encounter this either set a Base URI prior to calling this method or create an instance of the relevant parser and invoke it directly.

| Improve this Doc View Source

Load(IGraph, Uri)

Attempts to load a RDF Graph from the given URI into the given Graph.

Declaration
public static void Load(IGraph g, Uri u)
Parameters
Type Name Description
IGraph g

Graph to assert Triples in.

System.Uri u

URI to attempt to get RDF from.

Remarks

Attempts to select the relevant Parser based on the Content Type header returned in the HTTP Response.

If you know ahead of time the Content Type you can just open a HTTP Stream yourself and pass it to an instance of the correct Parser.

In the event that the URI is a File URI the FileLoader will be used instead. If the URI is a Data URI then the DataUriLoader will be used instead.

Note: UriLoader will assign the Graph the source URI as it's Base URI unless the Graph already has a Base URI or is non-empty prior to attempting parsing. Note that any Base URI specified in the RDF contained in the file will override this initial Base URI. In some cases this may lead to invalid RDF being accepted and generating strange relative URIs, if you encounter this either set a Base URI prior to calling this method or create an instance of the relevant parser and invoke it directly.

| Improve this Doc View Source

Load(IRdfHandler, Uri, IRdfReader, RdfHandlerCallback, object)

Attempts to load a RDF Graph from a URI asynchronously using an RDF Handler.

Declaration
public static void Load(IRdfHandler handler, Uri u, IRdfReader parser, RdfHandlerCallback callback, object state)
Parameters
Type Name Description
IRdfHandler handler

RDF Handler to use.

System.Uri u

URI to load from.

IRdfReader parser

Parser to use.

RdfHandlerCallback callback

Callback to invoke when the operation completes.

System.Object state

State to pass to the callback.

Remarks

Uses the supplied parser to attempt parsing regardless of the actual Content Type returned.

In the event that the URI is a File URI the FileLoader will be used instead.

If the URI is a Data URI then the DataUriLoader will be used instead.

If the loading completes normally the callback will be invoked normally, if an error occurs it will be invoked and passed an instance of AsyncError as the state which contains details of the error and the original state.

| Improve this Doc View Source

Load(IRdfHandler, Uri, IRdfReader)

Attempts to load a RDF Graph from the given URI using a RDF Handler.

Declaration
public static void Load(IRdfHandler handler, Uri u, IRdfReader parser)
Parameters
Type Name Description
IRdfHandler handler

RDF Handler to use.

System.Uri u

URI to attempt to get RDF from.

IRdfReader parser

Parser to use.

Remarks

Uses the supplied parser to attempt parsing regardless of the actual Content Type returned.

In the event that the URI is a File URI the FileLoader will be used instead.

If the URI is a Data URI then the DataUriLoader will be used instead.

| Improve this Doc View Source

Load(IRdfHandler, Uri, IStoreReader, RdfHandlerCallback, object)

Attempts to load a RDF dataset asynchronously from the given URI using a RDF Handler.

Declaration
public static void Load(IRdfHandler handler, Uri u, IStoreReader parser, RdfHandlerCallback callback, object state)
Parameters
Type Name Description
IRdfHandler handler

RDF Handler to use.

System.Uri u

URI to attempt to get a RDF dataset from.

IStoreReader parser

Parser to use to parse the RDF dataset.

RdfHandlerCallback callback

Callback to invoke when the operation completes.

System.Object state

State to pass to the callback.

Remarks

If the parser parameter is set to null then this method attempts to select the relevant Store Parser based on the Content Type header returned in the HTTP Response.

If you know ahead of time the Content Type you can explicitly pass in the parser to use.

If the loading completes normally the callback will be invoked normally, if an error occurs it will be invoked and passed an instance of AsyncError as the state which contains details of the error and the original state.

| Improve this Doc View Source

Load(IRdfHandler, Uri, IStoreReader)

Attempts to load a RDF dataset from the given URI using a RDF Handler.

Declaration
public static void Load(IRdfHandler handler, Uri u, IStoreReader parser)
Parameters
Type Name Description
IRdfHandler handler

RDF Handler to use.

System.Uri u

URI to attempt to get a RDF dataset from.

IStoreReader parser

Parser to use to parse the RDF dataset.

Remarks

If the parser parameter is set to null then this method attempts to select the relevant Store Parser based on the Content Type header returned in the HTTP Response.

If you know ahead of time the Content Type you can explicitly pass in the parser to use.

| Improve this Doc View Source

Load(IRdfHandler, Uri, RdfHandlerCallback, object)

Attempts to load a RDF Graph from a URI asynchronously using an RDF Handler.

Declaration
public static void Load(IRdfHandler handler, Uri u, RdfHandlerCallback callback, object state)
Parameters
Type Name Description
IRdfHandler handler

RDF Handler to use.

System.Uri u

URI to load from.

RdfHandlerCallback callback

Callback to invoke when the operation completes.

System.Object state

State to pass to the callback.

Remarks

Attempts to autodetect the RDF format based on the Content-Type header of the HTTP response.

If the loading completes normally the callback will be invoked normally, if an error occurs it will be invoked and passed an instance of AsyncError as the state which contains details of the error and the original state.

| Improve this Doc View Source

Load(IRdfHandler, Uri)

Attempts to load a RDF Graph from the given URI using a RDF Handler.

Declaration
public static void Load(IRdfHandler handler, Uri u)
Parameters
Type Name Description
IRdfHandler handler

RDF Handler to use.

System.Uri u

URI to attempt to get RDF from.

Remarks

Attempts to select the relevant Parser based on the Content Type header returned in the HTTP Response.

If you know ahead of time the Content Type you can just open a HTTP Stream yourself and pass it to an instance of the correct Parser.

In the event that the URI is a File URI the FileLoader will be used instead. If the URI is a Data URI then the DataUriLoader will be used instead.

| Improve this Doc View Source

Load(ITripleStore, Uri, IStoreReader, TripleStoreCallback, object)

Attempts to load a RDF dataset asynchronously from the given URI into the given Triple Store.

Declaration
public static void Load(ITripleStore store, Uri u, IStoreReader parser, TripleStoreCallback callback, object state)
Parameters
Type Name Description
ITripleStore store

Triple Store to load into.

System.Uri u

URI to attempt to get a RDF dataset from.

IStoreReader parser

Parser to use to parse the RDF dataset.

TripleStoreCallback callback

Callback to invoke when the operation completes.

System.Object state

State to pass to the callback.

Remarks

If the parser parameter is set to null then this method attempts to select the relevant Store Parser based on the Content Type header returned in the HTTP Response.

If you know ahead of time the Content Type you can explicitly pass in the parser to use.

If the loading completes normally the callback will be invoked normally, if an error occurs it will be invoked and passed an instance of AsyncError as the state which contains details of the error and the original state.

| Improve this Doc View Source

Load(ITripleStore, Uri, IStoreReader)

Attempts to load a RDF dataset from the given URI into the given Triple Store.

Declaration
public static void Load(ITripleStore store, Uri u, IStoreReader parser)
Parameters
Type Name Description
ITripleStore store

Triple Store to load into.

System.Uri u

URI to attempt to get a RDF dataset from.

IStoreReader parser

Parser to use to parse the RDF dataset.

Remarks

If the parser parameter is set to null then this method attempts to select the relevant Store Parser based on the Content Type header returned in the HTTP Response.

If you know ahead of time the Content Type you can explicitly pass in the parser to use.

| Improve this Doc View Source

Load(ITripleStore, Uri, TripleStoreCallback, object)

Attempts to load a RDF dataset asynchronously from the given URI into the given Triple Store.

Declaration
public static void Load(ITripleStore store, Uri u, TripleStoreCallback callback, object state)
Parameters
Type Name Description
ITripleStore store

Triple Store to load into.

System.Uri u

URI to attempt to get a RDF dataset from.

TripleStoreCallback callback

Callback to invoke when the operation completes.

System.Object state

State to pass to the callback.

Remarks

Attempts to select the relevant Store Parser based on the Content Type header returned in the HTTP Response.

If the loading completes normally the callback will be invoked normally, if an error occurs it will be invoked and passed an instance of AsyncError as the state which contains details of the error and the original state.

| Improve this Doc View Source

Load(ITripleStore, Uri)

Attempts to load a RDF dataset from the given URI into the given Triple Store.

Declaration
public static void Load(ITripleStore store, Uri u)
Parameters
Type Name Description
ITripleStore store

Triple Store to load into.

System.Uri u

URI to attempt to get a RDF dataset from.

Remarks

Attempts to select the relevant Store Parser based on the Content Type header returned in the HTTP Response.

| Improve this Doc View Source

LoadDataset(IRdfHandler, Uri, RdfHandlerCallback, object)

Attempts to load a RDF dataset asynchronously from the given URI using a RDF Handler.

Declaration
public static void LoadDataset(IRdfHandler handler, Uri u, RdfHandlerCallback callback, object state)
Parameters
Type Name Description
IRdfHandler handler

RDF Handler to use.

System.Uri u

URI to attempt to get a RDF dataset from.

RdfHandlerCallback callback

Callback to invoke when the operation completes.

System.Object state

State to pass to the callback.

Remarks

Attempts to select the relevant Store Parser based on the Content Type header returned in the HTTP Response.

If the loading completes normally the callback will be invoked normally, if an error occurs it will be invoked and passed an instance of AsyncError as the state which contains details of the error and the original state.

| Improve this Doc View Source

LoadDataset(IRdfHandler, Uri)

Attempts to load a RDF dataset from the given URI using a RDF Handler.

Declaration
public static void LoadDataset(IRdfHandler handler, Uri u)
Parameters
Type Name Description
IRdfHandler handler

RDF Handler to use.

System.Uri u

URI to attempt to get a RDF dataset from.

Remarks

Attempts to select the relevant Store Parser based on the Content Type header returned in the HTTP Response.

Events

| Improve this Doc View Source

StoreWarning

Event which is raised when a store parser that is invoked by the UriLoader notices a non-fatal issue with the RDF dataset syntax

Declaration
public static event StoreReaderWarning StoreWarning
Event Type
Type Description
StoreReaderWarning
Remarks

Caching

As of the 0.2.2 release the loader has support for caching retrieved data locally built into it (for Graphs only), caching is done using ETags where the remote server provides them or just by a user-defineable 'freshness' criteria (i.e. number of hours retrieved resources should be cached for). By default this caching happens in the system temporary directory which means it is non-persistent i.e. if you run your application using dotNetRDF it may cache stuff during the session but once the application is closed the operating system may freely delete the cached data. If you wish to have a persistent cache then you can use the CacheDirectory property to set your own cache directory. Even when you set your own cache directory dotNetRDF will delete obsolete data from it over time though this will only happen when a new request invalidates previously cached data.

If you wish to completely control the Cache you can implement your own IUriLoaderCache implementation and use it by setting the Cache property.

As of the 3.0 release, this class is now deprecated and will be removed in a future version. The replacement for this class is the Loader class.

| Improve this Doc View Source

Warning

Event which is raised when a parser that is invoked by the UriLoader notices a non-fatal issue with the RDF syntax

Declaration
public static event RdfReaderWarning Warning
Event Type
Type Description
RdfReaderWarning
Remarks

Caching

As of the 0.2.2 release the loader has support for caching retrieved data locally built into it (for Graphs only), caching is done using ETags where the remote server provides them or just by a user-defineable 'freshness' criteria (i.e. number of hours retrieved resources should be cached for). By default this caching happens in the system temporary directory which means it is non-persistent i.e. if you run your application using dotNetRDF it may cache stuff during the session but once the application is closed the operating system may freely delete the cached data. If you wish to have a persistent cache then you can use the CacheDirectory property to set your own cache directory. Even when you set your own cache directory dotNetRDF will delete obsolete data from it over time though this will only happen when a new request invalidates previously cached data.

If you wish to completely control the Cache you can implement your own IUriLoaderCache implementation and use it by setting the Cache property.

As of the 3.0 release, this class is now deprecated and will be removed in a future version. The replacement for this class is the Loader class.

  • Improve this Doc
  • View Source
In This Article
  • Properties
    • Cache
    • CacheDirectory
    • CacheDuration
    • CacheEnabled
    • Timeout
    • UserAgent
  • Methods
    • IsCached(Uri)
    • Load(IGraph, Uri, GraphCallback, object)
    • Load(IGraph, Uri, IRdfReader, GraphCallback, object)
    • Load(IGraph, Uri, IRdfReader)
    • Load(IGraph, Uri)
    • Load(IRdfHandler, Uri, IRdfReader, RdfHandlerCallback, object)
    • Load(IRdfHandler, Uri, IRdfReader)
    • Load(IRdfHandler, Uri, IStoreReader, RdfHandlerCallback, object)
    • Load(IRdfHandler, Uri, IStoreReader)
    • Load(IRdfHandler, Uri, RdfHandlerCallback, object)
    • Load(IRdfHandler, Uri)
    • Load(ITripleStore, Uri, IStoreReader, TripleStoreCallback, object)
    • Load(ITripleStore, Uri, IStoreReader)
    • Load(ITripleStore, Uri, TripleStoreCallback, object)
    • Load(ITripleStore, Uri)
    • LoadDataset(IRdfHandler, Uri, RdfHandlerCallback, object)
    • LoadDataset(IRdfHandler, Uri)
  • Events
    • StoreWarning
    • Warning
Back to top Generated by DocFX