Class MimeTypesHelper
Helper Class containing definitions of MIME Types for the various RDF Concrete Syntaxes and Content Negotation Methods.
Inherited Members
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
public static class MimeTypesHelper
Fields
| Edit this page View SourceAny
MIME Type for accept any content Type.
Declaration
public const string Any = "*/*"
Field Value
Type | Description |
---|---|
string |
CharsetUtf16
Charset constants.
Declaration
public const string CharsetUtf16 = "utf-16"
Field Value
Type | Description |
---|---|
string |
CharsetUtf8
Charset constants.
Declaration
public const string CharsetUtf8 = "utf-8"
Field Value
Type | Description |
---|---|
string |
Csv
MIME Types for CSV.
Declaration
public static readonly string[] Csv
Field Value
Type | Description |
---|---|
string[] |
DefaultCsvExtension
Default File Extension for CSV.
Declaration
public const string DefaultCsvExtension = "csv"
Field Value
Type | Description |
---|---|
string |
DefaultGZipExtension
Default File Extension for GZip.
Declaration
public const string DefaultGZipExtension = "gz"
Field Value
Type | Description |
---|---|
string |
DefaultHtmlExtension
Default File Extension for HTML.
Declaration
public const string DefaultHtmlExtension = "html"
Field Value
Type | Description |
---|---|
string |
DefaultJsonExtension
Default File Extension for Json formats.
Declaration
public const string DefaultJsonExtension = "json"
Field Value
Type | Description |
---|---|
string |
DefaultJsonLdExtension
Default file extension for JSON-LD formats.
Declaration
public const string DefaultJsonLdExtension = "jsonld"
Field Value
Type | Description |
---|---|
string |
DefaultNQuadsExtension
Default File Extension for NQuads.
Declaration
public const string DefaultNQuadsExtension = "nq"
Field Value
Type | Description |
---|---|
string |
DefaultNTriplesExtension
Default File Extension for NTriples.
Declaration
public const string DefaultNTriplesExtension = "nt"
Field Value
Type | Description |
---|---|
string |
DefaultNotation3Extension
Default File Extension for Notation 3.
Declaration
public const string DefaultNotation3Extension = "n3"
Field Value
Type | Description |
---|---|
string |
DefaultRdfJsonExtension
Default File Extension for RDF/JSON.
Declaration
public const string DefaultRdfJsonExtension = "rj"
Field Value
Type | Description |
---|---|
string |
DefaultRdfXmlExtension
Default File Extension for RDF/XML.
Declaration
public const string DefaultRdfXmlExtension = "rdf"
Field Value
Type | Description |
---|---|
string |
DefaultSparqlJsonExtension
Default File Extension for SPARQL JSON Results Format.
Declaration
public const string DefaultSparqlJsonExtension = "srj"
Field Value
Type | Description |
---|---|
string |
DefaultSparqlQueryExtension
Default File Extension for SPARQL Queries.
Declaration
public const string DefaultSparqlQueryExtension = "rq"
Field Value
Type | Description |
---|---|
string |
DefaultSparqlUpdateExtension
Default File Extension for SPARQL Updates.
Declaration
public const string DefaultSparqlUpdateExtension = "ru"
Field Value
Type | Description |
---|---|
string |
DefaultSparqlXmlExtension
Default File Extension for SPARQL XML Results Format.
Declaration
public const string DefaultSparqlXmlExtension = "srx"
Field Value
Type | Description |
---|---|
string |
DefaultTriGExtension
Default File Extension for TriG.
Declaration
public const string DefaultTriGExtension = "trig"
Field Value
Type | Description |
---|---|
string |
DefaultTriXExtension
Default File Extension for TriX.
Declaration
public const string DefaultTriXExtension = "xml"
Field Value
Type | Description |
---|---|
string |
DefaultTsvExtension
Default File Extension for TSV.
Declaration
public const string DefaultTsvExtension = "tsv"
Field Value
Type | Description |
---|---|
string |
DefaultTurtleExtension
Default File Extension for Turtle Files.
Declaration
public const string DefaultTurtleExtension = "ttl"
Field Value
Type | Description |
---|---|
string |
DefaultXHtmlExtension
Default File Extension for XHTML.
Declaration
public const string DefaultXHtmlExtension = "xhtml"
Field Value
Type | Description |
---|---|
string |
FormMultipart
MIME Type for Multipart Form Data.
Declaration
public const string FormMultipart = "multipart/form-data"
Field Value
Type | Description |
---|---|
string |
Html
MIME Types for HTML.
Declaration
public static readonly string[] Html
Field Value
Type | Description |
---|---|
string[] |
Json
MIME Types for RDF/JSON.
Declaration
public static readonly string[] Json
Field Value
Type | Description |
---|---|
string[] |
JsonLd
MIME types for JSON-LD.
Declaration
public static readonly string[] JsonLd
Field Value
Type | Description |
---|---|
string[] |
NQuads
MIME Types for NQuads.
Declaration
public static readonly string[] NQuads
Field Value
Type | Description |
---|---|
string[] |
NTriples
MIME Types for NTriples.
Declaration
public static readonly string[] NTriples
Field Value
Type | Description |
---|---|
string[] |
Notation3
MIME Types for Notation 3.
Declaration
public static readonly string[] Notation3
Field Value
Type | Description |
---|---|
string[] |
RdfXml
MIME Types for RDF/XML.
Declaration
public static readonly string[] RdfXml
Field Value
Type | Description |
---|---|
string[] |
SparqlQuery
MIME Type for SPARQL Queries.
Declaration
public const string SparqlQuery = "application/sparql-query"
Field Value
Type | Description |
---|---|
string |
SparqlResults
MIME Types for SPARQL Result Sets.
Declaration
public static readonly string[] SparqlResults
Field Value
Type | Description |
---|---|
string[] |
SparqlResultsBoolean
MIME Types for SPARQL Boolean Result.
Declaration
public static readonly string[] SparqlResultsBoolean
Field Value
Type | Description |
---|---|
string[] |
SparqlResultsJson
MIME Types for SPARQL Results JSON.
Declaration
public static readonly string[] SparqlResultsJson
Field Value
Type | Description |
---|---|
string[] |
SparqlResultsXml
MIME Types for SPARQL Results XML.
Declaration
public static string[] SparqlResultsXml
Field Value
Type | Description |
---|---|
string[] |
SparqlUpdate
MIME Type for SPARQL Updates.
Declaration
public const string SparqlUpdate = "application/sparql-update"
Field Value
Type | Description |
---|---|
string |
TriG
MIME Types for TriG.
Declaration
public static readonly string[] TriG
Field Value
Type | Description |
---|---|
string[] |
TriX
MIME Types for TriX.
Declaration
public static readonly string[] TriX
Field Value
Type | Description |
---|---|
string[] |
Tsv
MIME Types for TSV.
Declaration
public static readonly string[] Tsv
Field Value
Type | Description |
---|---|
string[] |
Turtle
MIME Types for Turtle.
Declaration
public static readonly string[] Turtle
Field Value
Type | Description |
---|---|
string[] |
Utf8WWWFormURLEncoded
MIME Type for URL Enoded WWW Form Content used when POSTing over HTTP in UTF-8 encoding.
Declaration
public const string Utf8WWWFormURLEncoded = "application/x-www-form-urlencoded;charset=utf-8"
Field Value
Type | Description |
---|---|
string |
WWWFormURLEncoded
MIME Type for URL Encoded WWW Form Content used when POSTing over HTTP.
Declaration
public const string WWWFormURLEncoded = "application/x-www-form-urlencoded"
Field Value
Type | Description |
---|---|
string |
Properties
| Edit this page View SourceDefinitions
Gets the available MIME Type Definitions.
Declaration
public static IEnumerable<MimeTypeDefinition> Definitions { get; }
Property Value
Type | Description |
---|---|
IEnumerable<MimeTypeDefinition> |
HttpAcceptHeader
Builds the String for the HTTP Accept Header that should be used when you want to ask for content in RDF formats (except Sparql Results).
Declaration
public static string HttpAcceptHeader { get; }
Property Value
Type | Description |
---|---|
string |
HttpRdfDatasetAcceptHeader
Builds the String for the HTTP Accept Header that should be used for making HTTP Requests where the returned data will be an RDF dataset.
Declaration
public static string HttpRdfDatasetAcceptHeader { get; }
Property Value
Type | Description |
---|---|
string |
HttpRdfOrDatasetAcceptHeader
Builds the String for the HTTP Accept Header that should be used for making HTTP Requests where the returned data may be RDF or an RDF dataset.
Declaration
public static string HttpRdfOrDatasetAcceptHeader { get; }
Property Value
Type | Description |
---|---|
string |
HttpRdfOrSparqlAcceptHeader
Builds the String for the HTTP Accept Header that should be used for making HTTP Requests where the returned data may be RDF or a SPARQL Result Set.
Declaration
public static string HttpRdfOrSparqlAcceptHeader { get; }
Property Value
Type | Description |
---|---|
string |
HttpSparqlAcceptHeader
Builds the String for the HTTP Accept Header that should be used for querying Sparql Endpoints where the response will be a SPARQL Result Set format.
Declaration
public static string HttpSparqlAcceptHeader { get; }
Property Value
Type | Description |
---|---|
string |
SupportedRdfDatasetMimeTypes
Gets the Enumeration of supported MIME Types for RDF Datasets.
Declaration
public static IEnumerable<string> SupportedRdfDatasetMimeTypes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<string> |
SupportedRdfMimeTypes
Gets the Enumeration of supported MIME Types for RDF Graphs.
Declaration
public static IEnumerable<string> SupportedRdfMimeTypes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<string> |
SupportedRdfOrSparqlMimeTypes
Gets the Enumeration of supported MIME Types for RDF Graphs or SPARQL Results.
Declaration
public static IEnumerable<string> SupportedRdfOrSparqlMimeTypes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<string> |
SupportedSparqlMimeTypes
Gets the Enumeration of supported MIME Types for SPARQL Results.
Declaration
public static IEnumerable<string> SupportedSparqlMimeTypes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<string> |
Methods
| Edit this page View SourceAddDefinition(MimeTypeDefinition)
Adds a new MIME Type Definition.
Declaration
public static void AddDefinition(MimeTypeDefinition definition)
Parameters
Type | Name | Description |
---|---|---|
MimeTypeDefinition | definition | MIME Type Definition. |
ApplyParserOptions(object, TokenQueueMode)
Applies global options to a parser.
Declaration
public static void ApplyParserOptions(object parser, TokenQueueMode tokenQueueMode)
Parameters
Type | Name | Description |
---|---|---|
object | parser | Parser. |
TokenQueueMode | tokenQueueMode | The default token queue mode used for tokeniser based parsers. |
CustomHttpAcceptHeader(IEnumerable<string>)
Creates a Custom HTTP Accept Header containing the given selection of MIME Types.
Declaration
public static string CustomHttpAcceptHeader(IEnumerable<string> mimeTypes)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | mimeTypes | Enumeration of MIME Types to use. |
Returns
Type | Description |
---|---|
string |
Remarks
Note: No validation is done on MIME Types so it is possible to generated a malformed header using this function.
CustomHttpAcceptHeader(IEnumerable<string>, IEnumerable<string>)
Creates a Custom HTTP Accept Header containing the given selection of MIME Types where those MIME Types also appear in the list of supported Types.
Declaration
public static string CustomHttpAcceptHeader(IEnumerable<string> mimeTypes, IEnumerable<string> supportedTypes)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | mimeTypes | Enumeration of MIME Types to use. |
IEnumerable<string> | supportedTypes | Enumeration of supported MIME Types. |
Returns
Type | Description |
---|---|
string |
Remarks
Note: No validation is done on MIME Types so it is possible to generated a malformed header using this function.
Use this function when you wish to generate a Custom Accept Header where the URI to which you are making requests supports a set range of URIs (given in the mimeTypes
parameter) where that range of types may exceed the range of types actually supported by the library or your response processing code.
CustomHttpAcceptHeader(IRdfReader)
Creates a Custom HTTP Accept Header containing only the Accept Types supported by a specific parser.
Declaration
public static string CustomHttpAcceptHeader(IRdfReader parser)
Parameters
Type | Name | Description |
---|---|---|
IRdfReader | parser | RDF Parser. |
Returns
Type | Description |
---|---|
string |
CustomHttpAcceptHeader(IStoreReader)
Creates a Custom HTTP Accept Header containing only the Accept Types supported by a specific parser.
Declaration
public static string CustomHttpAcceptHeader(IStoreReader parser)
Parameters
Type | Name | Description |
---|---|---|
IStoreReader | parser | RDF Parser. |
Returns
Type | Description |
---|---|
string |
GetDefinitions(IEnumerable<string>)
Gets all MIME Type definitions which support the given MIME Types.
Declaration
public static IEnumerable<MimeTypeDefinition> GetDefinitions(IEnumerable<string> mimeTypes)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | mimeTypes | MIME Types. |
Returns
Type | Description |
---|---|
IEnumerable<MimeTypeDefinition> |
GetDefinitions(string)
Gets all MIME Type definitions which support the given MIME Type.
Declaration
public static IEnumerable<MimeTypeDefinition> GetDefinitions(string mimeType)
Parameters
Type | Name | Description |
---|---|---|
string | mimeType | MIME Type. |
Returns
Type | Description |
---|---|
IEnumerable<MimeTypeDefinition> |
GetDefinitionsByFileExtension(string)
Gets all MIME Types definitions which are associated with a given file extension.
Declaration
public static IEnumerable<MimeTypeDefinition> GetDefinitionsByFileExtension(string fileExt)
Parameters
Type | Name | Description |
---|---|---|
string | fileExt | File Extension. |
Returns
Type | Description |
---|---|
IEnumerable<MimeTypeDefinition> |
GetFileExtension(string)
Selects the appropriate File Extension for the given MIME Type.
Declaration
public static string GetFileExtension(string mimeType)
Parameters
Type | Name | Description |
---|---|---|
string | mimeType | MIME Type. |
Returns
Type | Description |
---|---|
string |
GetFileExtension(IRdfWriter)
Selects the appropriate File Extension for the given RDF Writer.
Declaration
public static string GetFileExtension(IRdfWriter writer)
Parameters
Type | Name | Description |
---|---|---|
IRdfWriter | writer | RDF Writer. |
Returns
Type | Description |
---|---|
string |
GetFileExtension(IStoreWriter)
Selects the appropriate File Extension for the given Store Writer.
Declaration
public static string GetFileExtension(IStoreWriter writer)
Parameters
Type | Name | Description |
---|---|---|
IStoreWriter | writer | Store Writer. |
Returns
Type | Description |
---|---|
string |
GetFilenameFilter()
Generates a Filename Filter that can be used with any .Net application and includes all formats that dotNetRDF is aware of.
Declaration
public static string GetFilenameFilter()
Returns
Type | Description |
---|---|
string |
GetFilenameFilter(bool, bool, bool, bool, bool, bool)
Generates a Filename Filter that can be used with any .Net application and includes a user dictated subset of the formats that dotNetRDF is aware of.
Declaration
public static string GetFilenameFilter(bool rdf, bool rdfDatasets, bool sparqlResults, bool sparqlQuery, bool sparqlUpdate, bool allFiles)
Parameters
Type | Name | Description |
---|---|---|
bool | rdf | Allow RDF Graph formats (e.g. Turtle). |
bool | rdfDatasets | Allow RDF Dataset formats (e.g. NQuads). |
bool | sparqlResults | Allow SPARQL Results formats (e.g. SPARQL Results XML). |
bool | sparqlQuery | Allow SPARQL Query (i.e. .rq files). |
bool | sparqlUpdate | Allow SPARQL Update (i.e. .ru files). |
bool | allFiles | Allow All Files (i.e. /). |
Returns
Type | Description |
---|---|
string |
GetFilenameFilter(Func<MimeTypeDefinition, bool>, bool)
Generates a Filename Filter that can be used with any .Net application and includes a user dictated subset of the formats that dotNetRDF is aware of.
Declaration
public static string GetFilenameFilter(Func<MimeTypeDefinition, bool> typeSelector, bool allFiles)
Parameters
Type | Name | Description |
---|---|---|
Func<MimeTypeDefinition, bool> | typeSelector | A function that returns true for each known mime-type to be included in the filename filter. |
bool | allFiles | Add an All Files (i.e. .) option to the filename filter. |
Returns
Type | Description |
---|---|
string | A string formatted as a filename filter that can be used in .NET file dialogs. |
GetMimeType(string)
Selects the appropriate MIME Type for the given File Extension if the File Extension is a standard extension for an RDF format.
Declaration
[Obsolete("This method is deprecated, please use GetDefinitionsForExtension() to find relevant definitions and extract the MIME types from there", true)]
public static string GetMimeType(string fileExt)
Parameters
Type | Name | Description |
---|---|---|
string | fileExt | File Extension. |
Returns
Type | Description |
---|---|
string |
GetMimeType(IRdfWriter)
Get the preferred MIME type that is registered for a specific writer.
Declaration
public static string GetMimeType(IRdfWriter writer)
Parameters
Type | Name | Description |
---|---|---|
IRdfWriter | writer | RDF Writer. |
Returns
Type | Description |
---|---|
string | The preferred MIME type associated with the parser. |
Exceptions
Type | Condition |
---|---|
UnregisteredRdfWriterTypeException | Raised if the specific writer is of a type that is not associated with any registered MIME type. |
GetMimeTypes(string)
Gets all the MIME Types associated with a given File Extension.
Declaration
[Obsolete("This method is deprecated, please use GetDefinitionsForExtension() to find relevant definitions and extract the MIME types from there", true)]
public static IEnumerable<string> GetMimeTypes(string fileExt)
Parameters
Type | Name | Description |
---|---|---|
string | fileExt | File Extension. |
Returns
Type | Description |
---|---|
IEnumerable<string> |
GetParser(IEnumerable<string>, TokenQueueMode)
Selects an appropriate IRdfReader based on the given MIME Types.
Declaration
public static IRdfReader GetParser(IEnumerable<string> ctypes, TokenQueueMode tokenQueueMode = TokenQueueMode.SynchronousBufferDuringParsing)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | ctypes | MIME TYpes. |
TokenQueueMode | tokenQueueMode | The default token queue mode used for tokeniser based parsers. |
Returns
Type | Description |
---|---|
IRdfReader |
Exceptions
Type | Condition |
---|---|
RdfParserSelectionException | Raised if there is no |
GetParser(string, TokenQueueMode)
Selects an appropriate IRdfReader based on the HTTP Content-Type header from a HTTP Response.
Declaration
public static IRdfReader GetParser(string contentType, TokenQueueMode tokenQueueMode = TokenQueueMode.SynchronousBufferDuringParsing)
Parameters
Type | Name | Description |
---|---|---|
string | contentType | Value of the HTTP Content-Type Header. |
TokenQueueMode | tokenQueueMode | The default token queue mode used for tokeniser based parsers. |
Returns
Type | Description |
---|---|
IRdfReader |
GetParserByFileExtension(string, TokenQueueMode)
Selects a IRdfReader based on the file extension.
Declaration
public static IRdfReader GetParserByFileExtension(string fileExt, TokenQueueMode tokenQueueMode = TokenQueueMode.SynchronousBufferDuringParsing)
Parameters
Type | Name | Description |
---|---|---|
string | fileExt | File Extension. |
TokenQueueMode | tokenQueueMode | The default token queue mode used for tokeniser based parsers. |
Returns
Type | Description |
---|---|
IRdfReader |
GetSparqlParser(IEnumerable<string>, bool)
Selects a SPARQL Parser based on the MIME types.
Declaration
public static ISparqlResultsReader GetSparqlParser(IEnumerable<string> ctypes, bool allowPlainTextResults)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | ctypes | MIME Types. |
bool | allowPlainTextResults | Whether to allow for plain text results. |
Returns
Type | Description |
---|---|
ISparqlResultsReader |
GetSparqlParser(string)
Selects an appropriate ISparqlResultsReader based on the HTTP Content-Type header from a HTTP Response.
Declaration
public static ISparqlResultsReader GetSparqlParser(string contentType)
Parameters
Type | Name | Description |
---|---|---|
string | contentType | Value of the HTTP Content-Type Header. |
Returns
Type | Description |
---|---|
ISparqlResultsReader |
GetSparqlParser(string, bool)
Selects an appropriate ISparqlResultsReader based on the HTTP Content-Type header from a HTTP Response.
Declaration
public static ISparqlResultsReader GetSparqlParser(string contentType, bool allowPlainTextResults)
Parameters
Type | Name | Description |
---|---|---|
string | contentType | Value of the HTTP Content-Type Header. |
bool | allowPlainTextResults | Whether you allow Sparql Boolean results in text/plain format (Boolean results in text/boolean are handled properly but text/plain results can be conflated with CONSTRUCT/DESCRIBE results in NTriples format). |
Returns
Type | Description |
---|---|
ISparqlResultsReader |
GetSparqlParserByFileExtension(string)
Selects a ISparqlResultsReader based on the file extension.
Declaration
public static ISparqlResultsReader GetSparqlParserByFileExtension(string fileExt)
Parameters
Type | Name | Description |
---|---|---|
string | fileExt | File Extension. |
Returns
Type | Description |
---|---|
ISparqlResultsReader |
GetSparqlWriter(IEnumerable<string>)
Selects an appropriate ISparqlResultsWriter based on the given MIME Types.
Declaration
public static ISparqlResultsWriter GetSparqlWriter(IEnumerable<string> ctypes)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | ctypes | MIME Types. |
Returns
Type | Description |
---|---|
ISparqlResultsWriter | A Writer for a Content Type the client accepts. |
Remarks
This method does not take account of any quality/charset preference parameters included in the Accept Header.
Global options pertaining to writers will be applied to the selected writer.
GetSparqlWriter(IEnumerable<string>, out string)
Selects an appropriate ISparqlResultsWriter based on the HTTP Accept header form a HTTP Request.
Declaration
public static ISparqlResultsWriter GetSparqlWriter(IEnumerable<string> ctypes, out string contentType)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | ctypes | String array of accepted Content Types. |
string | contentType | The Content Type header that should be sent in the Response to the Request. |
Returns
Type | Description |
---|---|
ISparqlResultsWriter | A Writer for a Content Type the client accepts and the Content Type that should be sent to the client. |
Remarks
This method does not take account of any quality/charset preference parameters included in the Accept Header.
GetSparqlWriter(string)
Selects an appropriate ISparqlResultsWriter based on the HTTP Accept header form a HTTP Request.
Declaration
public static ISparqlResultsWriter GetSparqlWriter(string acceptHeader)
Parameters
Type | Name | Description |
---|---|---|
string | acceptHeader | Value of the HTTP Accept Header. |
Returns
Type | Description |
---|---|
ISparqlResultsWriter | A Writer for a Content Type the client accepts. |
Remarks
This method does not take account of any quality/charset preference parameters included in the Accept Header.
Global options pertaining to writers will be applied to the selected writer.
GetSparqlWriter(string, out string)
Selects an appropriate ISparqlResultsWriter based on the HTTP Accept header form a HTTP Request.
Declaration
public static ISparqlResultsWriter GetSparqlWriter(string acceptHeader, out string contentType)
Parameters
Type | Name | Description |
---|---|---|
string | acceptHeader | Value of the HTTP Accept Header. |
string | contentType | The Content Type header that should be sent in the Response to the Request. |
Returns
Type | Description |
---|---|
ISparqlResultsWriter | A Writer for a Content Type the client accepts and the Content Type that should be sent to the client. |
Remarks
This method does not take account of any quality/charset preference parameters included in the Accept Header.
Global options pertaining to writers will be applied to the selected writer.
GetSparqlWriterByFileExtension(string)
Selects a ISparqlResultsWriter based on a file extension.
Declaration
public static ISparqlResultsWriter GetSparqlWriterByFileExtension(string fileExt)
Parameters
Type | Name | Description |
---|---|---|
string | fileExt | File Extension. |
Returns
Type | Description |
---|---|
ISparqlResultsWriter |
GetSparqlWriterByFileExtension(string, out string)
Selects a ISparqlResultsWriter based on a file extension.
Declaration
public static ISparqlResultsWriter GetSparqlWriterByFileExtension(string fileExt, out string contentType)
Parameters
Type | Name | Description |
---|---|---|
string | fileExt | File Extension. |
string | contentType | Content Type of the selected writer. |
Returns
Type | Description |
---|---|
ISparqlResultsWriter |
GetStoreParser(IEnumerable<string>, TokenQueueMode)
Selects a Store parser based on the MIME types.
Declaration
public static IStoreReader GetStoreParser(IEnumerable<string> ctypes, TokenQueueMode tokenQueueMode = TokenQueueMode.SynchronousBufferDuringParsing)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | ctypes | MIME Types. |
TokenQueueMode | tokenQueueMode | The default token queue mode used for tokeniser based parsers. |
Returns
Type | Description |
---|---|
IStoreReader |
GetStoreParser(string, TokenQueueMode)
Selects an appropriate IStoreReader based on the HTTP Content-Type header from a HTTP Response.
Declaration
public static IStoreReader GetStoreParser(string contentType, TokenQueueMode tokenQueueMode = TokenQueueMode.SynchronousBufferDuringParsing)
Parameters
Type | Name | Description |
---|---|---|
string | contentType | Value of the HTTP Content-Type Header. |
TokenQueueMode | tokenQueueMode | The default token queue mode used for tokeniser based parsers. |
Returns
Type | Description |
---|---|
IStoreReader |
GetStoreParserByFileExtension(string, TokenQueueMode)
Selects a Store parser based on the file extension.
Declaration
public static IStoreReader GetStoreParserByFileExtension(string fileExt, TokenQueueMode tokenQueueMode = TokenQueueMode.SynchronousBufferDuringParsing)
Parameters
Type | Name | Description |
---|---|---|
string | fileExt | File Extension. |
TokenQueueMode | tokenQueueMode | The default token queue mode used for tokeniser based parsers. |
Returns
Type | Description |
---|---|
IStoreReader |
GetStoreWriter(IEnumerable<string>, int, bool)
Selects an appropriate IStoreWriter based on the given MIME Types.
Declaration
public static IStoreWriter GetStoreWriter(IEnumerable<string> ctypes, int compressionLevel = 5, bool useDtd = true)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | ctypes | MIME Types. |
int | compressionLevel | The compression level to apply to the writer if it implements the ICompressingWriter interface. |
bool | useDtd | Whether or not the writer should use the DTD to compress output if it implements the IDtdWriter interface. |
Returns
Type | Description |
---|---|
IStoreWriter |
Remarks
This method does not take account of any quality/charset preference parameters included in the Accept Header.
GetStoreWriter(IEnumerable<string>, out string, int, bool, bool)
Selects an appropriate IStoreWriter based on the given MIME Types.
Declaration
public static IStoreWriter GetStoreWriter(IEnumerable<string> ctypes, out string contentType, int compressionLevel = 5, bool useDtd = true, bool useMultipleThreads = false)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | ctypes | MIME Types. |
string | contentType | The Content Type header that should be sent in the Response to the Request. |
int | compressionLevel | The compression level to apply to the writer if it implements the ICompressingWriter interface. |
bool | useDtd | Whether or not the writer should use the DTD to compress output if it implements the IDtdWriter interface. |
bool | useMultipleThreads | Whether or not the writer should use multiple threads to create the output. Applies only to writers that implement the IMultiThreadedWriter interface. |
Returns
Type | Description |
---|---|
IStoreWriter |
Remarks
This method does not take account of any quality/charset preference parameters included in the Accept Header.
GetStoreWriter(string, int, bool)
Selects an appropriate IStoreWriter based on the HTTP Accept header form a HTTP Request.
Declaration
public static IStoreWriter GetStoreWriter(string acceptHeader, int compressionLevel = 5, bool useDtd = true)
Parameters
Type | Name | Description |
---|---|---|
string | acceptHeader | Value of the HTTP Accept Header. |
int | compressionLevel | The compression level to apply to the writer if it implements the ICompressingWriter interface. |
bool | useDtd | Whether or not the writer should use the DTD to compress output if it implements the IDtdWriter interface. |
Returns
Type | Description |
---|---|
IStoreWriter | A Writer for a Content Type the client accepts. |
Remarks
This method does not take account of any quality/charset preference parameters included in the Accept Header.
GetStoreWriter(string, out string, int, bool)
Selects an appropriate IStoreWriter based on the HTTP Accept header form a HTTP Request.
Declaration
public static IStoreWriter GetStoreWriter(string acceptHeader, out string contentType, int compressionLevel = 5, bool useDtd = true)
Parameters
Type | Name | Description |
---|---|---|
string | acceptHeader | Value of the HTTP Accept Header. |
string | contentType | The Content Type header that should be sent in the Response to the Request. |
int | compressionLevel | The compression level to apply to the writer if it implements the ICompressingWriter interface. |
bool | useDtd | Whether or not the writer should use the DTD to compress output if it implements the IDtdWriter interface. |
Returns
Type | Description |
---|---|
IStoreWriter | A Writer for a Content Type the client accepts and the Content Type that should be sent to the client. |
Remarks
This method does not take account of any quality/charset preference parameters included in the Accept Header.
GetStoreWriterByFileExtension(string, int, bool, bool)
Selects a IStoreWriter by file extension.
Declaration
public static IStoreWriter GetStoreWriterByFileExtension(string fileExt, int compressionLevel = 5, bool useDtd = true, bool useMultipleThreads = false)
Parameters
Type | Name | Description |
---|---|---|
string | fileExt | File Extension. |
int | compressionLevel | The compression level to apply to the writer if it implements the ICompressingWriter interface. |
bool | useDtd | Whether or not the writer should use the DTD to compress output if it implements the IDtdWriter interface. |
bool | useMultipleThreads | Whether or not the writer should use multiple threads when writing output if it implements the IMultiThreadedWriter interface. |
Returns
Type | Description |
---|---|
IStoreWriter |
GetStoreWriterByFileExtension(string, out string, int, bool, bool)
Selects a IStoreWriter by file extension.
Declaration
public static IStoreWriter GetStoreWriterByFileExtension(string fileExt, out string contentType, int compressionLevel = 5, bool useDtd = true, bool useMultipleThreads = false)
Parameters
Type | Name | Description |
---|---|---|
string | fileExt | File Extension. |
string | contentType | Content Type of the selected writer. |
int | compressionLevel | The compression level to apply to the writer if it implements the ICompressingWriter interface. |
bool | useDtd | Whether or not the writer should use the DTD to compress output if it implements the IDtdWriter interface. |
bool | useMultipleThreads | Whether or not the writer should use multiple threads to create the output. Applies only to writers that implement the IMultiThreadedWriter interface. |
Returns
Type | Description |
---|---|
IStoreWriter |
GetTrueFileExtension(string)
Gets the true file extension for a filename.
Declaration
public static string GetTrueFileExtension(string filename)
Parameters
Type | Name | Description |
---|---|---|
string | filename |
Returns
Type | Description |
---|---|
string |
Remarks
This is an alternative to using GetExtension(string) which is designed to take into account known extensions which are used in conjunction with other extensions and mask the true extension, for example. .gz
Consider the filename example.ttl.gz, obtaining the extension the standard way gives only .gz which is unhelpful since it doesn't actually tell us the underlying format of the data only that it is GZipped and if it is GZipped we almost certainly want to stream the data rather than read all into memory and heuristically detect the actual format. Instead we'd like to get .ttl.gz as the file extension which is much more useful and this is what this function does.
Important: This method does not blindly return double extensions whenever they are present (since they may simply by period characters in the filename and not double extensions at all) rather it returns double extensions only when the standard extension is an extension is known to be used with double extensions e.g. .gz that is relevan to the library.
GetTrueResourceExtension(string)
Gets the true extension for a resource.
Declaration
public static string GetTrueResourceExtension(string resource)
Parameters
Type | Name | Description |
---|---|---|
string | resource | Resource. |
Returns
Type | Description |
---|---|
string |
GetWriter(IEnumerable<string>)
Selects an appropriate IRdfWriter based on the given MIME Types.
Declaration
public static IRdfWriter GetWriter(IEnumerable<string> ctypes)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | ctypes | MIME Types. |
Returns
Type | Description |
---|---|
IRdfWriter |
Remarks
This method does not take account of any quality/charset preference parameters included in the Accept Header.
Global options pertaining to writers will be applied to the selected writer.
GetWriter(IEnumerable<string>, out string, int, bool, bool)
Selects an appropriate IRdfWriter based on the given MIME Types.
Declaration
public static IRdfWriter GetWriter(IEnumerable<string> ctypes, out string contentType, int compressionLevel = 5, bool useDtd = true, bool useMultipleThreads = false)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | ctypes | MIME Types. |
string | contentType | The Content Type header that should be sent in the Response to the Request. |
int | compressionLevel | The compression level to apply to the writer if it implements the ICompressingWriter interface. |
bool | useDtd | Whether or not the writer should use the DTD to compress output if it implements the IDtdWriter interface. |
bool | useMultipleThreads | Whether or not the writer should use multiple threads to create the output. Applies only to writers that implement the IMultiThreadedWriter interface. |
Returns
Type | Description |
---|---|
IRdfWriter |
Remarks
This method does not take account of any quality/charset preference parameters included in the Accept Header.
GetWriter(string, int, bool, bool)
Selects an appropriate IRdfWriter based on the HTTP Accept header form a HTTP Request.
Declaration
public static IRdfWriter GetWriter(string acceptHeader, int compressionLevel = 5, bool useDtd = true, bool useMultipleThreads = false)
Parameters
Type | Name | Description |
---|---|---|
string | acceptHeader | Value of the HTTP Accept Header. |
int | compressionLevel | The compression level to apply to the writer if it implements the ICompressingWriter interface. |
bool | useDtd | Whether or not the writer should use the DTD to compress output if it implements the IDtdWriter interface. |
bool | useMultipleThreads | Whether or not the writer should use multiple threads to create the output. Applies only to writers that implement the IMultiThreadedWriter interface. |
Returns
Type | Description |
---|---|
IRdfWriter | A Writer for a Content Type the client accepts. |
Remarks
This method does not take account of any quality/charset preference parameters included in the Accept Header.
GetWriter(string, out string, int, bool, bool)
Selects an appropriate IRdfWriter based on the HTTP Accept header form a HTTP Request.
Declaration
public static IRdfWriter GetWriter(string acceptHeader, out string contentType, int compressionLevel = 5, bool useDtd = true, bool useMultipleThreads = false)
Parameters
Type | Name | Description |
---|---|---|
string | acceptHeader | Value of the HTTP Accept Header. |
string | contentType | The Content Type header that should be sent in the Response to the Request. |
int | compressionLevel | The compression level to apply to the writer if it implements the ICompressingWriter interface. |
bool | useDtd | Whether or not the writer should use the DTD to compress output if it implements the IDtdWriter interface. |
bool | useMultipleThreads | Whether or not the writer should use multiple threads to create the output. Applies only to writers that implement the IMultiThreadedWriter interface. |
Returns
Type | Description |
---|---|
IRdfWriter | A Writer for a Content Type the client accepts and the Content Type that should be sent to the client. |
Remarks
This method does not take account of any quality/charset preference parameters included in the Accept Header.
GetWriterByFileExtension(string, int, bool, bool)
Selects a IRdfWriter based on the file extension.
Declaration
public static IRdfWriter GetWriterByFileExtension(string fileExt, int compressionLevel = 5, bool useDtd = true, bool useMultipleThreads = false)
Parameters
Type | Name | Description |
---|---|---|
string | fileExt | File Extension. |
int | compressionLevel | The compression level to apply to the writer if it implements the ICompressingWriter interface. |
bool | useDtd | Whether or not the writer should use the DTD to compress output if it implements the IDtdWriter interface. |
bool | useMultipleThreads | Whether or not the writer should use multiple threads to create the output. Applies only to writers that implement the IMultiThreadedWriter interface. |
Returns
Type | Description |
---|---|
IRdfWriter |
Exceptions
Type | Condition |
---|---|
RdfWriterSelectionException | Thrown if no writers are associated with the given file extension. |
GetWriterByFileExtension(string, out string, int, bool, bool)
Selects a IRdfWriter based on the file extension.
Declaration
public static IRdfWriter GetWriterByFileExtension(string fileExt, out string contentType, int compressionLevel = 5, bool useDtd = true, bool useMultipleThreads = false)
Parameters
Type | Name | Description |
---|---|---|
string | fileExt | File Extension. |
string | contentType | Content Type of the chosen writer. |
int | compressionLevel | The compression level to apply to the writer if it implements the ICompressingWriter interface. |
bool | useDtd | Whether or not the writer should use the DTD to compress output if it implements the IDtdWriter interface. |
bool | useMultipleThreads | Whether or not the writer should use multiple threads to create the output. Applies only to writers that implement the IMultiThreadedWriter interface. |
Returns
Type | Description |
---|---|
IRdfWriter |
Remarks
Global options pertaining to writers will be applied to the selected writer.
Exceptions
Type | Condition |
---|---|
RdfWriterSelectionException | Thrown if no writers are associated with the given file extension. |
Register(IEnumerable<MimeTypeDefinition>)
Register a collection of MimeTypeDefinition with the helper.
Declaration
public static void Register(IEnumerable<MimeTypeDefinition> mimeTypes)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<MimeTypeDefinition> | mimeTypes |
RegisterParser(IRdfReader, IEnumerable<string>, IEnumerable<string>)
Registers a parser as the default RDF Parser for all the given MIME types and updates relevant definitions to include the MIME types and file extensions.
Declaration
public static void RegisterParser(IRdfReader parser, IEnumerable<string> mimeTypes, IEnumerable<string> fileExtensions)
Parameters
Type | Name | Description |
---|---|---|
IRdfReader | parser | RDF Parser. |
IEnumerable<string> | mimeTypes | MIME Types. |
IEnumerable<string> | fileExtensions | File Extensions. |
RegisterParser(ISparqlResultsReader, IEnumerable<string>, IEnumerable<string>)
Registers a parser as the default SPARQL Rsults Parser for all the given MIME types and updates relevant definitions to include the MIME types and file extensions.
Declaration
public static void RegisterParser(ISparqlResultsReader parser, IEnumerable<string> mimeTypes, IEnumerable<string> fileExtensions)
Parameters
Type | Name | Description |
---|---|---|
ISparqlResultsReader | parser | SPARQL Results Parser. |
IEnumerable<string> | mimeTypes | MIME Types. |
IEnumerable<string> | fileExtensions | File Extensions. |
RegisterParser(IStoreReader, IEnumerable<string>, IEnumerable<string>)
Registers a parser as the default RDF Dataset Parser for all the given MIME types and updates relevant definitions to include the MIME types and file extensions.
Declaration
public static void RegisterParser(IStoreReader parser, IEnumerable<string> mimeTypes, IEnumerable<string> fileExtensions)
Parameters
Type | Name | Description |
---|---|---|
IStoreReader | parser | RDF Dataset Parser. |
IEnumerable<string> | mimeTypes | MIME Types. |
IEnumerable<string> | fileExtensions | File Extensions. |
RegisterWriter(IRdfWriter, IEnumerable<string>, IEnumerable<string>)
Registers a writer as the default RDF Writer for all the given MIME types and updates relevant definitions to include the MIME types and file extensions.
Declaration
public static void RegisterWriter(IRdfWriter writer, IEnumerable<string> mimeTypes, IEnumerable<string> fileExtensions)
Parameters
Type | Name | Description |
---|---|---|
IRdfWriter | writer | RDF Writer. |
IEnumerable<string> | mimeTypes | MIME Types. |
IEnumerable<string> | fileExtensions | File Extensions. |
RegisterWriter(ISparqlResultsWriter, IEnumerable<string>, IEnumerable<string>)
Registers a writer as the default SPARQL Results Writer for all the given MIME types and updates relevant definitions to include the MIME types and file extensions.
Declaration
public static void RegisterWriter(ISparqlResultsWriter writer, IEnumerable<string> mimeTypes, IEnumerable<string> fileExtensions)
Parameters
Type | Name | Description |
---|---|---|
ISparqlResultsWriter | writer | SPARQL Results Writer. |
IEnumerable<string> | mimeTypes | MIME Types. |
IEnumerable<string> | fileExtensions | File Extensions. |
RegisterWriter(IStoreWriter, IEnumerable<string>, IEnumerable<string>)
Registers a writer as the default RDF Dataset Writer for all the given MIME types and updates relevant definitions to include the MIME types and file extensions.
Declaration
public static void RegisterWriter(IStoreWriter writer, IEnumerable<string> mimeTypes, IEnumerable<string> fileExtensions)
Parameters
Type | Name | Description |
---|---|---|
IStoreWriter | writer | RDF Dataset Writer. |
IEnumerable<string> | mimeTypes | MIME Types. |
IEnumerable<string> | fileExtensions | File Extensions. |
ResetDefinitions()
Resets the MIME Type Definitions (the associations between file extensions, MIME types and their respective parsers and writers) to the library defaults.
Declaration
public static void ResetDefinitions()
Remarks
May be useful if you've altered the definitions and caused something to stop working as a result.