org.openrdf.query.resultio
Class BooleanQueryResultFormat

java.lang.Object
  extended by info.aduna.lang.FileFormat
      extended by org.openrdf.query.resultio.BooleanQueryResultFormat

public class BooleanQueryResultFormat
extends FileFormat

Represents the concept of a boolean query result serialization format. Boolean query result formats are identified by a name and can have one or more associated MIME types, zero or more associated file extensions and can specify a (default) character encoding.

Author:
Arjohn Kampman

Field Summary
static BooleanQueryResultFormat SPARQL
          SPARQL Query Results XML Format.
static BooleanQueryResultFormat TEXT
          Plain text encoding using values "true" and "false" (case-insensitive).
 
Constructor Summary
BooleanQueryResultFormat(String name, Collection<String> mimeTypes, Charset charset, Collection<String> fileExtensions)
          Creates a new TupleQueryResultFormat object.
BooleanQueryResultFormat(String name, String mimeType, Charset charset, String fileExt)
          Creates a new TupleQueryResultFormat object.
BooleanQueryResultFormat(String name, String mimeType, String fileExt)
          Creates a new TupleQueryResultFormat object.
 
Method Summary
static BooleanQueryResultFormat forFileName(String fileName)
          Tries to determine the appropriate boolean file format for a file, based on the extension specified in a file name.
static BooleanQueryResultFormat forFileName(String fileName, BooleanQueryResultFormat fallback)
          Tries to determine the appropriate boolean file format for a file, based on the extension specified in a file name.
static BooleanQueryResultFormat forMIMEType(String mimeType)
          Tries to determine the appropriate boolean file format based on the a MIME type that describes the content type.
static BooleanQueryResultFormat forMIMEType(String mimeType, BooleanQueryResultFormat fallback)
          Tries to determine the appropriate boolean file format based on the a MIME type that describes the content type.
static void register(BooleanQueryResultFormat format)
          Registers the specified boolean query result format.
static BooleanQueryResultFormat register(String name, String mimeType, String fileExt)
          Registers the specified boolean query result format.
static Collection<BooleanQueryResultFormat> values()
          Returns all known/registered boolean query result formats.
 
Methods inherited from class info.aduna.lang.FileFormat
equals, getCharset, getDefaultFileExtension, getDefaultMIMEType, getFileExtensions, getMIMETypes, getName, hasCharset, hasDefaultFileExtension, hasDefaultMIMEType, hasFileExtension, hashCode, hasMIMEType, matchFileName, matchFileName, matchMIMEType, matchMIMEType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SPARQL

public static final BooleanQueryResultFormat SPARQL
SPARQL Query Results XML Format.


TEXT

public static final BooleanQueryResultFormat TEXT
Plain text encoding using values "true" and "false" (case-insensitive).

Constructor Detail

BooleanQueryResultFormat

public BooleanQueryResultFormat(String name,
                                String mimeType,
                                String fileExt)
Creates a new TupleQueryResultFormat object.

Parameters:
name - The name of the format, e.g. "SPARQL/XML".
mimeType - The MIME type of the format, e.g. application/sparql-results+xml for the SPARQL/XML format.
fileExt - The (default) file extension for the format, e.g. srx for SPARQL/XML.

BooleanQueryResultFormat

public BooleanQueryResultFormat(String name,
                                String mimeType,
                                Charset charset,
                                String fileExt)
Creates a new TupleQueryResultFormat object.

Parameters:
name - The name of the format, e.g. "SPARQL/XML".
mimeType - The MIME type of the format, e.g. application/sparql-results+xml for the SPARQL/XML format.
charset - The default character encoding of the format. Specify null if not applicable.
fileExt - The (default) file extension for the format, e.g. srx for SPARQL/XML.

BooleanQueryResultFormat

public BooleanQueryResultFormat(String name,
                                Collection<String> mimeTypes,
                                Charset charset,
                                Collection<String> fileExtensions)
Creates a new TupleQueryResultFormat object.

Parameters:
name - The name of the format, e.g. "SPARQL/XML".
mimeTypes - The MIME types of the format, e.g. application/sparql-results+xml for the SPARQL/XML format. The first item in the list is interpreted as the default MIME type for the format.
charset - The default character encoding of the format. Specify null if not applicable.
fileExtensions - The format's file extensions, e.g. srx for SPARQL/XML files. The first item in the list is interpreted as the default file extension for the format.
Method Detail

values

public static Collection<BooleanQueryResultFormat> values()
Returns all known/registered boolean query result formats.


register

public static BooleanQueryResultFormat register(String name,
                                                String mimeType,
                                                String fileExt)
Registers the specified boolean query result format.

Parameters:
name - The name of the format, e.g. "SPARQL/XML".
mimeType - The MIME type of the format, e.g. application/sparql-results+xml for the SPARQL/XML file format.
fileExt - The (default) file extension for the format, e.g. srx for SPARQL/XML files.

register

public static void register(BooleanQueryResultFormat format)
Registers the specified boolean query result format.


forMIMEType

public static BooleanQueryResultFormat forMIMEType(String mimeType)
Tries to determine the appropriate boolean file format based on the a MIME type that describes the content type.

Parameters:
mimeType - A MIME type, e.g. "application/sparql-results+xml".
Returns:
A TupleQueryResultFormat object if the MIME type was recognized, or null otherwise.
See Also:
forMIMEType(String,BooleanQueryResultFormat), #getMIMEType

forMIMEType

public static BooleanQueryResultFormat forMIMEType(String mimeType,
                                                   BooleanQueryResultFormat fallback)
Tries to determine the appropriate boolean file format based on the a MIME type that describes the content type. The supplied fallback format will be returned when the MIME type was not recognized.

Parameters:
mimeType - a MIME type, e.g. "application/sparql-results+xml"
fallback - a fallback TupleQueryResultFormat that will be returned by the method if no match for the supplied MIME type can be found.
Returns:
A TupleQueryResultFormat that matches the MIME type, or the fallback format if the extension was not recognized.
See Also:
forMIMEType(String), #getMIMEType

forFileName

public static BooleanQueryResultFormat forFileName(String fileName)
Tries to determine the appropriate boolean file format for a file, based on the extension specified in a file name.

Parameters:
fileName - A file name.
Returns:
A TupleQueryResultFormat object if the file extension was recognized, or null otherwise.
See Also:
forFileName(String,BooleanQueryResultFormat), #getFileExtension

forFileName

public static BooleanQueryResultFormat forFileName(String fileName,
                                                   BooleanQueryResultFormat fallback)
Tries to determine the appropriate boolean file format for a file, based on the extension specified in a file name. The supplied fallback format will be returned when the file name extension was not recognized.

Parameters:
fileName - A file name.
Returns:
A TupleQueryResultFormat that matches the file name extension, or the fallback format if the extension was not recognized.
See Also:
forFileName(String), #getFileExtension


Copyright © 2001-2008 Aduna. All Rights Reserved.