Show / Hide Table of Contents

Class MimeTypesHelper

Helper Class containing definitions of MIME Types for the various RDF Concrete Syntaxes and Content Negotation Methods.

Inheritance
object
MimeTypesHelper
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
public static class MimeTypesHelper

Fields

| Edit this page View Source

Any

MIME Type for accept any content Type.

Declaration
public const string Any = "*/*"
Field Value
Type Description
string
| Edit this page View Source

CharsetUtf16

Charset constants.

Declaration
public const string CharsetUtf16 = "utf-16"
Field Value
Type Description
string
| Edit this page View Source

CharsetUtf8

Charset constants.

Declaration
public const string CharsetUtf8 = "utf-8"
Field Value
Type Description
string
| Edit this page View Source

Csv

MIME Types for CSV.

Declaration
public static readonly string[] Csv
Field Value
Type Description
string[]
| Edit this page View Source

DefaultCsvExtension

Default File Extension for CSV.

Declaration
public const string DefaultCsvExtension = "csv"
Field Value
Type Description
string
| Edit this page View Source

DefaultGZipExtension

Default File Extension for GZip.

Declaration
public const string DefaultGZipExtension = "gz"
Field Value
Type Description
string
| Edit this page View Source

DefaultHtmlExtension

Default File Extension for HTML.

Declaration
public const string DefaultHtmlExtension = "html"
Field Value
Type Description
string
| Edit this page View Source

DefaultJsonExtension

Default File Extension for Json formats.

Declaration
public const string DefaultJsonExtension = "json"
Field Value
Type Description
string
| Edit this page View Source

DefaultJsonLdExtension

Default file extension for JSON-LD formats.

Declaration
public const string DefaultJsonLdExtension = "jsonld"
Field Value
Type Description
string
| Edit this page View Source

DefaultNQuadsExtension

Default File Extension for NQuads.

Declaration
public const string DefaultNQuadsExtension = "nq"
Field Value
Type Description
string
| Edit this page View Source

DefaultNTriplesExtension

Default File Extension for NTriples.

Declaration
public const string DefaultNTriplesExtension = "nt"
Field Value
Type Description
string
| Edit this page View Source

DefaultNotation3Extension

Default File Extension for Notation 3.

Declaration
public const string DefaultNotation3Extension = "n3"
Field Value
Type Description
string
| Edit this page View Source

DefaultRdfJsonExtension

Default File Extension for RDF/JSON.

Declaration
public const string DefaultRdfJsonExtension = "rj"
Field Value
Type Description
string
| Edit this page View Source

DefaultRdfXmlExtension

Default File Extension for RDF/XML.

Declaration
public const string DefaultRdfXmlExtension = "rdf"
Field Value
Type Description
string
| Edit this page View Source

DefaultSparqlJsonExtension

Default File Extension for SPARQL JSON Results Format.

Declaration
public const string DefaultSparqlJsonExtension = "srj"
Field Value
Type Description
string
| Edit this page View Source

DefaultSparqlQueryExtension

Default File Extension for SPARQL Queries.

Declaration
public const string DefaultSparqlQueryExtension = "rq"
Field Value
Type Description
string
| Edit this page View Source

DefaultSparqlUpdateExtension

Default File Extension for SPARQL Updates.

Declaration
public const string DefaultSparqlUpdateExtension = "ru"
Field Value
Type Description
string
| Edit this page View Source

DefaultSparqlXmlExtension

Default File Extension for SPARQL XML Results Format.

Declaration
public const string DefaultSparqlXmlExtension = "srx"
Field Value
Type Description
string
| Edit this page View Source

DefaultTriGExtension

Default File Extension for TriG.

Declaration
public const string DefaultTriGExtension = "trig"
Field Value
Type Description
string
| Edit this page View Source

DefaultTriXExtension

Default File Extension for TriX.

Declaration
public const string DefaultTriXExtension = "xml"
Field Value
Type Description
string
| Edit this page View Source

DefaultTsvExtension

Default File Extension for TSV.

Declaration
public const string DefaultTsvExtension = "tsv"
Field Value
Type Description
string
| Edit this page View Source

DefaultTurtleExtension

Default File Extension for Turtle Files.

Declaration
public const string DefaultTurtleExtension = "ttl"
Field Value
Type Description
string
| Edit this page View Source

DefaultXHtmlExtension

Default File Extension for XHTML.

Declaration
public const string DefaultXHtmlExtension = "xhtml"
Field Value
Type Description
string
| Edit this page View Source

FormMultipart

MIME Type for Multipart Form Data.

Declaration
public const string FormMultipart = "multipart/form-data"
Field Value
Type Description
string
| Edit this page View Source

Html

MIME Types for HTML.

Declaration
public static readonly string[] Html
Field Value
Type Description
string[]
| Edit this page View Source

Json

MIME Types for RDF/JSON.

Declaration
public static readonly string[] Json
Field Value
Type Description
string[]
| Edit this page View Source

JsonLd

MIME types for JSON-LD.

Declaration
public static readonly string[] JsonLd
Field Value
Type Description
string[]
| Edit this page View Source

NQuads

MIME Types for NQuads.

Declaration
public static readonly string[] NQuads
Field Value
Type Description
string[]
| Edit this page View Source

NTriples

MIME Types for NTriples.

Declaration
public static readonly string[] NTriples
Field Value
Type Description
string[]
| Edit this page View Source

Notation3

MIME Types for Notation 3.

Declaration
public static readonly string[] Notation3
Field Value
Type Description
string[]
| Edit this page View Source

RdfXml

MIME Types for RDF/XML.

Declaration
public static readonly string[] RdfXml
Field Value
Type Description
string[]
| Edit this page View Source

SparqlQuery

MIME Type for SPARQL Queries.

Declaration
public const string SparqlQuery = "application/sparql-query"
Field Value
Type Description
string
| Edit this page View Source

SparqlResults

MIME Types for SPARQL Result Sets.

Declaration
public static readonly string[] SparqlResults
Field Value
Type Description
string[]
| Edit this page View Source

SparqlResultsBoolean

MIME Types for SPARQL Boolean Result.

Declaration
public static readonly string[] SparqlResultsBoolean
Field Value
Type Description
string[]
| Edit this page View Source

SparqlResultsJson

MIME Types for SPARQL Results JSON.

Declaration
public static readonly string[] SparqlResultsJson
Field Value
Type Description
string[]
| Edit this page View Source

SparqlResultsXml

MIME Types for SPARQL Results XML.

Declaration
public static string[] SparqlResultsXml
Field Value
Type Description
string[]
| Edit this page View Source

SparqlUpdate

MIME Type for SPARQL Updates.

Declaration
public const string SparqlUpdate = "application/sparql-update"
Field Value
Type Description
string
| Edit this page View Source

TriG

MIME Types for TriG.

Declaration
public static readonly string[] TriG
Field Value
Type Description
string[]
| Edit this page View Source

TriX

MIME Types for TriX.

Declaration
public static readonly string[] TriX
Field Value
Type Description
string[]
| Edit this page View Source

Tsv

MIME Types for TSV.

Declaration
public static readonly string[] Tsv
Field Value
Type Description
string[]
| Edit this page View Source

Turtle

MIME Types for Turtle.

Declaration
public static readonly string[] Turtle
Field Value
Type Description
string[]
| Edit this page View Source

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
| Edit this page View Source

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 Source

Definitions

Gets the available MIME Type Definitions.

Declaration
public static IEnumerable<MimeTypeDefinition> Definitions { get; }
Property Value
Type Description
IEnumerable<MimeTypeDefinition>
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

SupportedRdfDatasetMimeTypes

Gets the Enumeration of supported MIME Types for RDF Datasets.

Declaration
public static IEnumerable<string> SupportedRdfDatasetMimeTypes { get; }
Property Value
Type Description
IEnumerable<string>
| Edit this page View Source

SupportedRdfMimeTypes

Gets the Enumeration of supported MIME Types for RDF Graphs.

Declaration
public static IEnumerable<string> SupportedRdfMimeTypes { get; }
Property Value
Type Description
IEnumerable<string>
| Edit this page View Source

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>
| Edit this page View Source

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 Source

AddDefinition(MimeTypeDefinition)

Adds a new MIME Type Definition.

Declaration
public static void AddDefinition(MimeTypeDefinition definition)
Parameters
Type Name Description
MimeTypeDefinition definition

MIME Type Definition.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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>
| Edit this page View Source

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>
| Edit this page View Source

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>
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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.

| Edit this page View Source

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
| Edit this page View Source

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.

| Edit this page View Source

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>
| Edit this page View Source

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

| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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.

| Edit this page View Source

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
| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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
| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

  • Edit this page
  • View Source
In this article
  • Fields
    • Any
    • CharsetUtf16
    • CharsetUtf8
    • Csv
    • DefaultCsvExtension
    • DefaultGZipExtension
    • DefaultHtmlExtension
    • DefaultJsonExtension
    • DefaultJsonLdExtension
    • DefaultNQuadsExtension
    • DefaultNTriplesExtension
    • DefaultNotation3Extension
    • DefaultRdfJsonExtension
    • DefaultRdfXmlExtension
    • DefaultSparqlJsonExtension
    • DefaultSparqlQueryExtension
    • DefaultSparqlUpdateExtension
    • DefaultSparqlXmlExtension
    • DefaultTriGExtension
    • DefaultTriXExtension
    • DefaultTsvExtension
    • DefaultTurtleExtension
    • DefaultXHtmlExtension
    • FormMultipart
    • Html
    • Json
    • JsonLd
    • NQuads
    • NTriples
    • Notation3
    • RdfXml
    • SparqlQuery
    • SparqlResults
    • SparqlResultsBoolean
    • SparqlResultsJson
    • SparqlResultsXml
    • SparqlUpdate
    • TriG
    • TriX
    • Tsv
    • Turtle
    • Utf8WWWFormURLEncoded
    • WWWFormURLEncoded
  • Properties
    • Definitions
    • HttpAcceptHeader
    • HttpRdfDatasetAcceptHeader
    • HttpRdfOrDatasetAcceptHeader
    • HttpRdfOrSparqlAcceptHeader
    • HttpSparqlAcceptHeader
    • SupportedRdfDatasetMimeTypes
    • SupportedRdfMimeTypes
    • SupportedRdfOrSparqlMimeTypes
    • SupportedSparqlMimeTypes
  • Methods
    • AddDefinition(MimeTypeDefinition)
    • ApplyParserOptions(object, TokenQueueMode)
    • CustomHttpAcceptHeader(IEnumerable<string>)
    • CustomHttpAcceptHeader(IEnumerable<string>, IEnumerable<string>)
    • CustomHttpAcceptHeader(IRdfReader)
    • CustomHttpAcceptHeader(IStoreReader)
    • GetDefinitions(IEnumerable<string>)
    • GetDefinitions(string)
    • GetDefinitionsByFileExtension(string)
    • GetFileExtension(string)
    • GetFileExtension(IRdfWriter)
    • GetFileExtension(IStoreWriter)
    • GetFilenameFilter()
    • GetFilenameFilter(bool, bool, bool, bool, bool, bool)
    • GetFilenameFilter(Func<MimeTypeDefinition, bool>, bool)
    • GetMimeType(string)
    • GetMimeType(IRdfWriter)
    • GetMimeTypes(string)
    • GetParser(IEnumerable<string>, TokenQueueMode)
    • GetParser(string, TokenQueueMode)
    • GetParserByFileExtension(string, TokenQueueMode)
    • GetSparqlParser(IEnumerable<string>, bool)
    • GetSparqlParser(string)
    • GetSparqlParser(string, bool)
    • GetSparqlParserByFileExtension(string)
    • GetSparqlWriter(IEnumerable<string>)
    • GetSparqlWriter(IEnumerable<string>, out string)
    • GetSparqlWriter(string)
    • GetSparqlWriter(string, out string)
    • GetSparqlWriterByFileExtension(string)
    • GetSparqlWriterByFileExtension(string, out string)
    • GetStoreParser(IEnumerable<string>, TokenQueueMode)
    • GetStoreParser(string, TokenQueueMode)
    • GetStoreParserByFileExtension(string, TokenQueueMode)
    • GetStoreWriter(IEnumerable<string>, int, bool)
    • GetStoreWriter(IEnumerable<string>, out string, int, bool, bool)
    • GetStoreWriter(string, int, bool)
    • GetStoreWriter(string, out string, int, bool)
    • GetStoreWriterByFileExtension(string, int, bool, bool)
    • GetStoreWriterByFileExtension(string, out string, int, bool, bool)
    • GetTrueFileExtension(string)
    • GetTrueResourceExtension(string)
    • GetWriter(IEnumerable<string>)
    • GetWriter(IEnumerable<string>, out string, int, bool, bool)
    • GetWriter(string, int, bool, bool)
    • GetWriter(string, out string, int, bool, bool)
    • GetWriterByFileExtension(string, int, bool, bool)
    • GetWriterByFileExtension(string, out string, int, bool, bool)
    • Register(IEnumerable<MimeTypeDefinition>)
    • RegisterParser(IRdfReader, IEnumerable<string>, IEnumerable<string>)
    • RegisterParser(ISparqlResultsReader, IEnumerable<string>, IEnumerable<string>)
    • RegisterParser(IStoreReader, IEnumerable<string>, IEnumerable<string>)
    • RegisterWriter(IRdfWriter, IEnumerable<string>, IEnumerable<string>)
    • RegisterWriter(ISparqlResultsWriter, IEnumerable<string>, IEnumerable<string>)
    • RegisterWriter(IStoreWriter, IEnumerable<string>, IEnumerable<string>)
    • ResetDefinitions()
Back to top Generated by DocFX