Class UriLoader
Inheritance
Inherited Members
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 SourceCache
Declaration
public static IUriLoaderCache Cache { get; set; }
Property Value
Type | Description |
---|---|
IUriLoaderCache |
Remarks
CacheDirectory
Declaration
public static string CacheDirectory { get; set; }
Property Value
Type | Description |
---|---|
System.String |
CacheDuration
Declaration
public static TimeSpan CacheDuration { get; set; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
Remarks
UserAgent
Declaration
public static string UserAgent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceIsCached(Uri)
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.
Load(IGraph, Uri)
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.
Load(IGraph, Uri, GraphCallback, Object)
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.
Load(IGraph, Uri, IRdfReader)
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.
Load(IGraph, Uri, IRdfReader, GraphCallback, Object)
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.
Load(IRdfHandler, Uri)
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.
Load(IRdfHandler, Uri, IRdfReader)
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.
Load(IRdfHandler, Uri, IRdfReader, RdfHandlerCallback, Object)
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.
Load(IRdfHandler, Uri, IStoreReader)
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.
Load(IRdfHandler, Uri, IStoreReader, RdfHandlerCallback, Object)
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.
Load(IRdfHandler, Uri, RdfHandlerCallback, Object)
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.
Load(ITripleStore, Uri)
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.
Load(ITripleStore, Uri, IStoreReader)
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.
Load(ITripleStore, Uri, IStoreReader, TripleStoreCallback, Object)
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.
Load(ITripleStore, Uri, TripleStoreCallback, Object)
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.
LoadDataset(IRdfHandler, Uri)
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.
LoadDataset(IRdfHandler, Uri, RdfHandlerCallback, Object)
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 SourceStoreWarning
Declaration
public static event StoreReaderWarning StoreWarning
Event Type
Type | Description |
---|---|
StoreReaderWarning |
Warning
Declaration
public static event RdfReaderWarning Warning
Event Type
Type | Description |
---|---|
RdfReaderWarning |