public class QueryResultIO extends Object
Constructor and Description |
---|
QueryResultIO() |
Modifier and Type | Method and Description |
---|---|
static BooleanQueryResultParser |
createParser(BooleanQueryResultFormat format)
Convenience methods for creating BooleanQueryResultParser objects.
|
static TupleQueryResultParser |
createParser(TupleQueryResultFormat format)
Convenience methods for creating TupleQueryResultParser objects.
|
static TupleQueryResultParser |
createParser(TupleQueryResultFormat format,
ValueFactory valueFactory)
Convenience methods for creating TupleQueryResultParser objects that use
the specified ValueFactory to create RDF model objects.
|
static BooleanQueryResultWriter |
createWriter(BooleanQueryResultFormat format,
OutputStream out)
Convenience methods for creating BooleanQueryResultWriter objects.
|
static QueryResultWriter |
createWriter(QueryResultFormat format,
OutputStream out)
Convenience methods for creating QueryResultWriter objects.
|
static TupleQueryResultWriter |
createWriter(TupleQueryResultFormat format,
OutputStream out)
Convenience methods for creating TupleQueryResultWriter objects.
|
static BooleanQueryResultFormat |
getBooleanParserFormatForFileName(String fileName)
Tries to match the extension of a file name against the list of RDF
formats that can be parsed.
|
static BooleanQueryResultFormat |
getBooleanParserFormatForFileName(String fileName,
BooleanQueryResultFormat fallback)
Tries to match the extension of a file name against the list of RDF
formats that can be parsed.
|
static BooleanQueryResultFormat |
getBooleanParserFormatForMIMEType(String mimeType)
Tries to match a MIME type against the list of boolean query result
formats that can be parsed.
|
static BooleanQueryResultFormat |
getBooleanParserFormatForMIMEType(String mimeType,
BooleanQueryResultFormat fallback)
Tries to match a MIME type against the list of boolean query result
formats that can be parsed.
|
static BooleanQueryResultFormat |
getBooleanWriterFormatForFileName(String fileName)
Tries to match the extension of a file name against the list of RDF
formats that can be written.
|
static BooleanQueryResultFormat |
getBooleanWriterFormatForFileName(String fileName,
BooleanQueryResultFormat fallback)
Tries to match the extension of a file name against the list of RDF
formats that can be written.
|
static BooleanQueryResultFormat |
getBooleanWriterFormatForMIMEType(String mimeType)
Tries to match a MIME type against the list of boolean query result
formats that can be written.
|
static BooleanQueryResultFormat |
getBooleanWriterFormatForMIMEType(String mimeType,
BooleanQueryResultFormat fallback)
Tries to match a MIME type against the list of boolean query result
formats that can be written.
|
static TupleQueryResultFormat |
getParserFormatForFileName(String fileName)
Tries to match the extension of a file name against the list of RDF
formats that can be parsed.
|
static TupleQueryResultFormat |
getParserFormatForFileName(String fileName,
TupleQueryResultFormat fallback)
Tries to match the extension of a file name against the list of RDF
formats that can be parsed.
|
static TupleQueryResultFormat |
getParserFormatForMIMEType(String mimeType)
Tries to match a MIME type against the list of tuple query result formats
that can be parsed.
|
static TupleQueryResultFormat |
getParserFormatForMIMEType(String mimeType,
TupleQueryResultFormat fallback)
Tries to match a MIME type against the list of tuple query result formats
that can be parsed.
|
static TupleQueryResultFormat |
getWriterFormatForFileName(String fileName)
Tries to match the extension of a file name against the list of RDF
formats that can be written.
|
static TupleQueryResultFormat |
getWriterFormatForFileName(String fileName,
TupleQueryResultFormat fallback)
Tries to match the extension of a file name against the list of RDF
formats that can be written.
|
static TupleQueryResultFormat |
getWriterFormatForMIMEType(String mimeType)
Tries to match a MIME type against the list of tuple query result formats
that can be written.
|
static TupleQueryResultFormat |
getWriterFormatForMIMEType(String mimeType,
TupleQueryResultFormat fallback)
Tries to match a MIME type against the list of tuple query result formats
that can be written.
|
static boolean |
parse(InputStream in,
BooleanQueryResultFormat format)
Parses a boolean query result document and returns the parsed value.
|
static TupleQueryResult |
parse(InputStream in,
TupleQueryResultFormat format)
Parses a query result document and returns it as a TupleQueryResult
object.
|
static void |
parse(InputStream in,
TupleQueryResultFormat format,
TupleQueryResultHandler handler,
ValueFactory valueFactory)
Parses a query result document, reporting the parsed solutions to the
supplied TupleQueryResultHandler.
|
static void |
write(boolean value,
BooleanQueryResultFormat format,
OutputStream out)
Deprecated.
|
static void |
write(GraphQueryResult gqr,
RDFFormat format,
OutputStream out)
Writes a graph query result document in a specific RDF format to an output
stream.
|
static void |
write(TupleQueryResult tqr,
TupleQueryResultFormat format,
OutputStream out)
Writes a query result document in a specific query result format to an
output stream.
|
static void |
writeBoolean(boolean value,
BooleanQueryResultFormat format,
OutputStream out)
Writes a boolean query result document in a specific boolean query result
format to an output stream.
|
public static TupleQueryResultFormat getParserFormatForMIMEType(String mimeType)
mimeType
- A MIME type, e.g. "application/sparql-results+xml".getParserFormatForMIMEType(String, TupleQueryResultFormat)
public static TupleQueryResultFormat getParserFormatForMIMEType(String mimeType, TupleQueryResultFormat fallback)
FileFormat.matchMIMEType(String, Iterable)
with the
specified MIME type, the keys of
TupleQueryResultParserRegistry.getInstance()
and the fallback
format as parameters.mimeType
- A MIME type, e.g. "application/sparql-results+xml".fallback
- The format that will be returned if no match was found.public static TupleQueryResultFormat getParserFormatForFileName(String fileName)
fileName
- A file name.getParserFormatForFileName(String, TupleQueryResultFormat)
public static TupleQueryResultFormat getParserFormatForFileName(String fileName, TupleQueryResultFormat fallback)
FileFormat.matchFileName(String, Iterable, info.aduna.lang.FileFormat)
with the specified MIME type, the keys of
TupleQueryResultParserRegistry.getInstance()
and the fallback
format as parameters.fileName
- A file name.fallback
- The format that will be returned if no match was found.public static TupleQueryResultFormat getWriterFormatForMIMEType(String mimeType)
mimeType
- A MIME type, e.g. "application/sparql-results+xml".getWriterFormatForMIMEType(String, TupleQueryResultFormat)
public static TupleQueryResultFormat getWriterFormatForMIMEType(String mimeType, TupleQueryResultFormat fallback)
FileFormat.matchMIMEType(String, Iterable, info.aduna.lang.FileFormat)
with the specified MIME type, the keys of
TupleQueryResultWriterRegistry.getInstance()
and the fallback
format as parameters.mimeType
- A MIME type, e.g. "application/sparql-results+xml".fallback
- The format that will be returned if no match was found.public static TupleQueryResultFormat getWriterFormatForFileName(String fileName)
fileName
- A file name.getWriterFormatForFileName(String, TupleQueryResultFormat)
public static TupleQueryResultFormat getWriterFormatForFileName(String fileName, TupleQueryResultFormat fallback)
FileFormat.matchFileName(String, Iterable, info.aduna.lang.FileFormat)
with the specified MIME type, the keys of
TupleQueryResultWriterRegistry.getInstance()
and the fallback
format as parameters.fileName
- A file name.fallback
- The format that will be returned if no match was found.public static BooleanQueryResultFormat getBooleanParserFormatForMIMEType(String mimeType)
mimeType
- A MIME type, e.g. "application/sparql-results+xml".getBooleanParserFormatForMIMEType(String, BooleanQueryResultFormat)
public static BooleanQueryResultFormat getBooleanParserFormatForMIMEType(String mimeType, BooleanQueryResultFormat fallback)
FileFormat.matchMIMEType(String, Iterable)
with the
specified MIME type, the keys of
BooleanQueryResultParserRegistry.getInstance()
and the fallback
format as parameters.mimeType
- A MIME type, e.g. "application/sparql-results+xml".fallback
- The format that will be returned if no match was found.public static BooleanQueryResultFormat getBooleanParserFormatForFileName(String fileName)
fileName
- A file name.getBooleanParserFormatForFileName(String, BooleanQueryResultFormat)
public static BooleanQueryResultFormat getBooleanParserFormatForFileName(String fileName, BooleanQueryResultFormat fallback)
FileFormat.matchFileName(String, Iterable, info.aduna.lang.FileFormat)
with the specified MIME type, the keys of
BooleanQueryResultParserRegistry.getInstance()
and the fallback
format as parameters.fileName
- A file name.fallback
- The format that will be returned if no match was found.public static BooleanQueryResultFormat getBooleanWriterFormatForMIMEType(String mimeType)
mimeType
- A MIME type, e.g. "application/sparql-results+xml".getBooleanWriterFormatForMIMEType(String, BooleanQueryResultFormat)
public static BooleanQueryResultFormat getBooleanWriterFormatForMIMEType(String mimeType, BooleanQueryResultFormat fallback)
FileFormat.matchMIMEType(String, Iterable, info.aduna.lang.FileFormat)
with the specified MIME type, the keys of
BooleanQueryResultWriterRegistry.getInstance()
and the fallback
format as parameters.mimeType
- A MIME type, e.g. "application/sparql-results+xml".fallback
- The format that will be returned if no match was found.public static BooleanQueryResultFormat getBooleanWriterFormatForFileName(String fileName)
fileName
- A file name.getBooleanWriterFormatForFileName(String, BooleanQueryResultFormat)
public static BooleanQueryResultFormat getBooleanWriterFormatForFileName(String fileName, BooleanQueryResultFormat fallback)
FileFormat.matchFileName(String, Iterable, info.aduna.lang.FileFormat)
with the specified MIME type, the keys of
BooleanQueryResultWriterRegistry.getInstance()
and the fallback
format as parameters.fileName
- A file name.fallback
- The format that will be returned if no match was found.public static TupleQueryResultParser createParser(TupleQueryResultFormat format) throws UnsupportedQueryResultFormatException
TupleQueryResultParserRegistry.getInstance()
to get a factory for
the specified format and uses this factory to create the appropriate
parser.UnsupportedQueryResultFormatException
- If no parser is available for the specified tuple query result
format.public static TupleQueryResultParser createParser(TupleQueryResultFormat format, ValueFactory valueFactory) throws UnsupportedQueryResultFormatException
UnsupportedQueryResultFormatException
- If no parser is available for the specified tuple query result
format.createParser(TupleQueryResultFormat)
,
QueryResultParser.setValueFactory(ValueFactory)
public static TupleQueryResultWriter createWriter(TupleQueryResultFormat format, OutputStream out) throws UnsupportedQueryResultFormatException
TupleQueryResultWriterRegistry.getInstance()
to get a factory for
the specified format and uses this factory to create the appropriate
writer.UnsupportedQueryResultFormatException
- If no writer is available for the specified tuple query result
format.public static BooleanQueryResultParser createParser(BooleanQueryResultFormat format) throws UnsupportedQueryResultFormatException
BooleanQueryResultParserRegistry.getInstance()
to get a factory
for the specified format and uses this factory to create the appropriate
parser.UnsupportedQueryResultFormatException
- If no parser is available for the specified boolean query result
format.public static BooleanQueryResultWriter createWriter(BooleanQueryResultFormat format, OutputStream out) throws UnsupportedQueryResultFormatException
BooleanQueryResultWriterRegistry.getInstance()
to get a factory
for the specified format and uses this factory to create the appropriate
writer.UnsupportedQueryResultFormatException
- If no writer is available for the specified boolean query result
format.public static QueryResultWriter createWriter(QueryResultFormat format, OutputStream out) throws UnsupportedQueryResultFormatException
TupleQueryResultWriterRegistry.getInstance()
to get a factory for
the specified format and uses this factory to create the appropriate
writer.UnsupportedQueryResultFormatException
- If no writer is available for the specified tuple query result
format.public static void parse(InputStream in, TupleQueryResultFormat format, TupleQueryResultHandler handler, ValueFactory valueFactory) throws IOException, QueryResultParseException, TupleQueryResultHandlerException, UnsupportedQueryResultFormatException
in
- An InputStream to read the query result document from.format
- The query result format of the document to parse. Supported formats
are TupleQueryResultFormat.SPARQL
and
TupleQueryResultFormat.BINARY
.handler
- The TupleQueryResultHandler to report the parse results to.IOException
- If an I/O error occured while reading the query result document
from the stream.TupleQueryResultHandlerException
- If such an exception is thrown by the supplied
TupleQueryResultHandler.UnsupportedQueryResultFormatException
IllegalArgumentException
- If an unsupported query result file format was specified.QueryResultParseException
public static TupleQueryResult parse(InputStream in, TupleQueryResultFormat format) throws IOException, QueryResultParseException, TupleQueryResultHandlerException, UnsupportedQueryResultFormatException
in
- An InputStream to read the query result document from.format
- The query result format of the document to parse. Supported formats
are TupleQueryResultFormat.SPARQL
and
TupleQueryResultFormat.BINARY
.IOException
- If an I/O error occured while reading the query result document
from the stream.TupleQueryResultHandlerException
- If such an exception is thrown by the used query result parser.UnsupportedQueryResultFormatException
IllegalArgumentException
- If an unsupported query result file format was specified.QueryResultParseException
public static boolean parse(InputStream in, BooleanQueryResultFormat format) throws IOException, QueryResultParseException, UnsupportedQueryResultFormatException
in
- An InputStream to read the query result document from.format
- The file format of the document to parse.IOException
- If an I/O error occured while reading the query result document
from the stream.UnsupportedQueryResultFormatException
- If an unsupported query result file format was specified.QueryResultParseException
public static void write(TupleQueryResult tqr, TupleQueryResultFormat format, OutputStream out) throws IOException, TupleQueryResultHandlerException, UnsupportedQueryResultFormatException, QueryEvaluationException
tqr
- The query result to write.format
- The file format of the document to write.out
- An OutputStream to write the document to.IOException
- If an I/O error occured while writing the query result document to
the stream.TupleQueryResultHandlerException
- If such an exception is thrown by the used query result writer.UnsupportedQueryResultFormatException
QueryEvaluationException
- If an unsupported query result file format was specified.@Deprecated public static void write(boolean value, BooleanQueryResultFormat format, OutputStream out) throws IOException, UnsupportedQueryResultFormatException
writeBoolean(boolean, BooleanQueryResultFormat, OutputStream)
instead.value
- The value to write.format
- The file format of the document to write.out
- An OutputStream to write the document to.IOException
- If an I/O error occured while writing the query result document to
the stream.UnsupportedQueryResultFormatException
- If an unsupported query result file format was specified.public static void writeBoolean(boolean value, BooleanQueryResultFormat format, OutputStream out) throws QueryResultHandlerException, UnsupportedQueryResultFormatException
value
- The value to write.format
- The file format of the document to write.out
- An OutputStream to write the document to.IOException
- If an I/O error occured while writing the query result document to
the stream.UnsupportedQueryResultFormatException
- If an unsupported query result file format was specified.QueryResultHandlerException
public static void write(GraphQueryResult gqr, RDFFormat format, OutputStream out) throws IOException, RDFHandlerException, UnsupportedRDFormatException, QueryEvaluationException
gqr
- The query result to write.format
- The file format of the document to write.out
- An OutputStream to write the document to.IOException
- If an I/O error occured while writing the query result document to
the stream.RDFHandlerException
- If such an exception is thrown by the used RDF writer.QueryEvaluationException
UnsupportedRDFormatException
- If an unsupported query result file format was specified.Copyright © 2001-2016 Aduna. All Rights Reserved.