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
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.Parsing
Assembly: dotNetRDF.dll
Syntax
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.

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 UriLoaderCaching 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
System.String
| 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

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
System.String

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)

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(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)

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, 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(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(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, 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, 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, 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, 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(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

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, 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, 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

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.

| 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.

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
| 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
  • Improve this Doc
  • View Source
In This Article
  • Properties
    • Cache
    • CacheDirectory
    • CacheDuration
    • UserAgent
  • Methods
    • IsCached(Uri)
    • Load(IGraph, Uri)
    • Load(IGraph, Uri, GraphCallback, Object)
    • Load(IGraph, Uri, IRdfReader)
    • Load(IGraph, Uri, IRdfReader, GraphCallback, Object)
    • Load(IRdfHandler, Uri)
    • Load(IRdfHandler, Uri, IRdfReader)
    • Load(IRdfHandler, Uri, IRdfReader, RdfHandlerCallback, Object)
    • Load(IRdfHandler, Uri, IStoreReader)
    • Load(IRdfHandler, Uri, IStoreReader, RdfHandlerCallback, Object)
    • Load(IRdfHandler, Uri, RdfHandlerCallback, Object)
    • Load(ITripleStore, Uri)
    • Load(ITripleStore, Uri, IStoreReader)
    • Load(ITripleStore, Uri, IStoreReader, TripleStoreCallback, Object)
    • Load(ITripleStore, Uri, TripleStoreCallback, Object)
    • LoadDataset(IRdfHandler, Uri)
    • LoadDataset(IRdfHandler, Uri, RdfHandlerCallback, Object)
  • Events
    • StoreWarning
    • Warning
Back to top Generated by DocFX