Package com.stardog.stark.query.io
Class QueryResultFormats
- java.lang.Object
-
- com.stardog.stark.query.io.QueryResultFormats
-
public final class QueryResultFormats extends java.lang.Object
Utilities for
QueryResultFormat
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Michael Grove
- See Also:
QueryResultFormat
,SupportedFileFormats
-
-
Field Summary
Fields Modifier and Type Field Description static QueryResultFormat
BINARY
Binary query result format for select query resultsstatic QueryResultFormat
CSV
Query result format for csv encoded query resultsstatic QueryResultFormat
JSON
Query result format for JSON encoded query resultsstatic QueryResultFormat
JSON_BOOLEAN
Query result format for JSON encoded query resultsstatic QueryResultFormat
TEXT
Text-based query result format for boolean query resultsstatic QueryResultFormat
TEXT_TABLE
Text-based table format for select query results.static QueryResultFormat
TSV
Query result format for tsv encoded query resultsstatic QueryResultFormat
XML
Query result format for SPARQL/XML encoded query resultsstatic QueryResultFormat
XML_BOOLEAN
Query result format for SPARQL/XML boolean encoded query results
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SupportedFileFormats<QueryResultFormat>
booleanFormats()
Return only the supported boolean query formatsstatic java.util.Optional<QueryResultFormat>
forFile(java.nio.file.Path thePath)
Return theformat
for the file denoted by the givenPath
.static java.util.Optional<QueryResultFormat>
forFileName(java.lang.String thePath)
static java.util.Optional<QueryResultFormat>
forMime(java.lang.String theMime)
Return theformat
for the given mime-type.static java.util.Optional<QueryResultFormat>
forMimeBoolean(java.lang.String theMime)
Return theformat
for the given mime-type.static java.util.Optional<QueryResultFormat>
forMimeSelect(java.lang.String theMime)
Return theformat
for the given mime-type.static void
register(QueryResultFormat theFormat)
Add a newQueryResultFormat
static QueryResultFormat
register(java.lang.String theName, IRI theId, java.util.List<java.lang.String> theMimetypes, java.util.List<java.lang.String> theFileExtensions)
Add a newQueryResultFormat
static SupportedFileFormats<QueryResultFormat>
selectFormats()
Return only the supported select query formats
-
-
-
Field Detail
-
XML
public static final QueryResultFormat XML
Query result format for SPARQL/XML encoded query results
-
XML_BOOLEAN
public static final QueryResultFormat XML_BOOLEAN
Query result format for SPARQL/XML boolean encoded query results
-
JSON
public static final QueryResultFormat JSON
Query result format for JSON encoded query results
-
JSON_BOOLEAN
public static final QueryResultFormat JSON_BOOLEAN
Query result format for JSON encoded query results
-
TSV
public static final QueryResultFormat TSV
Query result format for tsv encoded query results
-
CSV
public static final QueryResultFormat CSV
Query result format for csv encoded query results
-
TEXT
public static final QueryResultFormat TEXT
Text-based query result format for boolean query results
-
TEXT_TABLE
public static final QueryResultFormat TEXT_TABLE
Text-based table format for select query results.
-
BINARY
public static final QueryResultFormat BINARY
Binary query result format for select query results
-
-
Method Detail
-
forFile
@Nonnull public static java.util.Optional<QueryResultFormat> forFile(@Nonnull java.nio.file.Path thePath)
Return theformat
for the file denoted by the givenPath
.- Parameters:
thePath
- the file to be parsed- Returns:
- the `QueryResultFormat`
- See Also:
SupportedFileFormats.forFile(Path)
-
forFileName
@Nonnull public static java.util.Optional<QueryResultFormat> forFileName(@Nonnull java.lang.String thePath)
-
forMime
@Nonnull public static java.util.Optional<QueryResultFormat> forMime(@Nonnull java.lang.String theMime)
Return theformat
for the given mime-type.- Parameters:
theMime
- the mime-type- Returns:
- the `QueryResultFormat`
- See Also:
SupportedFileFormats.forMime(String)
-
forMimeSelect
@Nonnull public static java.util.Optional<QueryResultFormat> forMimeSelect(@Nonnull java.lang.String theMime)
Return theformat
for the given mime-type.- Parameters:
theMime
- the mime-type- Returns:
- the `QueryResultFormat`
- See Also:
SupportedFileFormats.forMime(String)
-
selectFormats
@Nonnull public static SupportedFileFormats<QueryResultFormat> selectFormats()
Return only the supported select query formats- Returns:
- the formats for select queries
-
booleanFormats
@Nonnull public static SupportedFileFormats<QueryResultFormat> booleanFormats()
Return only the supported boolean query formats- Returns:
- the formats for boolean queries
-
forMimeBoolean
@Nonnull public static java.util.Optional<QueryResultFormat> forMimeBoolean(@Nonnull java.lang.String theMime)
Return theformat
for the given mime-type.- Parameters:
theMime
- the mime-type- Returns:
- the `QueryResultFormat`
- See Also:
SupportedFileFormats.forMime(String)
-
register
public static void register(QueryResultFormat theFormat)
Add a newQueryResultFormat
- Parameters:
theFormat
- the format
-
register
public static QueryResultFormat register(@Nonnull java.lang.String theName, @Nonnull IRI theId, @Nonnull java.util.List<java.lang.String> theMimetypes, @Nonnull java.util.List<java.lang.String> theFileExtensions)
Add a newQueryResultFormat
- Parameters:
theName
- the human-friendly name of the formattheId
- the IRI of the formattheMimetypes
- the list of supported mimetypes. There must be *at least* `1`, and the first element in the list is taken to be the default mimetypetheFileExtensions
- the list of supported extensions. There must be *at least* `1`, and the first element in the list is taken to be the default extension
-
-