Package com.stardog.stark.io
Class RDFFormats
- java.lang.Object
-
- com.stardog.stark.io.RDFFormats
-
public final class RDFFormats extends java.lang.Object
Utilities for
RDFFormat
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Michael Grove
- See Also:
SupportedFileFormats
-
-
Field Summary
Fields Modifier and Type Field Description static RDFFormat
BINARY
Binary RDFstatic RDFFormat
JSONLD
[JSON-LD](ttp://www.w3.org/TR/json-ld/)static RDFFormat
N3
[Notation 3](http://www.w3.org/TeamSubmission/n3/)static RDFFormat
NQUADS
[NQuads](http://www.w3.org/TR/n-quads/)static RDFFormat
NTRIPLES
[N-triples](http://www.w3.org/TR/n-triples/)static RDFFormat
PRETTY_TURTLE
static RDFFormat
RDFJSON
[RDF/JSON](http://www.w3.org/TR/rdf-json/)static RDFFormat
RDFXML
[RDF/XML](http://www.w3.org/TR/rdf-syntax-grammar/)static RDFFormat
TRIG
[TriG](http://www.w3.org/TR/trig)static RDFFormat
TURTLE
Format denoting [Turtle](https://www.w3.org/TR/turtle/)static RDFFormat
UNKNOWN_BASE_FORMAT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RDFFormat
baseFormat(RDFFormat theFormat)
Returns thebase format
of the given format if it is acompressed format
or the given format otherwise.static RDFFormat
compressedFormat(RDFFormat theFormat, FileFormat.Compression theCompression)
static RDFFormat
compressedForName(RDFFormat theFormat, java.lang.String theName)
Return thecompressed RDFFormat
for the given name, with the provided base format.static FileFormat.Compression
compressionOf(RDFFormat theFormat)
Returns thecompression
of given format if it is acompressed format
orFileFormat.Compression.NONE
otherwise.static RDFFormat
forFile(java.io.File theFile, RDFFormat theBaseFormat)
static java.util.Optional<RDFFormat>
forFile(java.lang.String theFileName)
static RDFFormat
forFile(java.lang.String theFileName, RDFFormat theBaseFormat)
static java.util.Optional<RDFFormat>
forFile(java.nio.file.Path thePath)
Return theformat
for the file denoted by the givenPath
.static java.util.Optional<RDFFormat>
forMime(java.lang.String theMime)
Return theformat
which supports the given mimetypestatic java.util.Optional<RDFFormat>
forName(java.lang.String theName)
Return theformat
with the provided namestatic RDFFormat
register(java.lang.String theName, IRI theId, java.util.List<java.lang.String> theMimetypes, java.util.List<java.lang.String> theFileExtensions)
Create a newRDFFormats.RDFFormatImpl
static RDFFormat.BinaryRDFFormat
registerBinary(java.lang.String theName, IRI theId, java.util.List<java.lang.String> theMimetypes, java.util.List<java.lang.String> theFileExtensions)
Create a newRDFFormat.BinaryRDFFormat
static boolean
supportsContexts(RDFFormat theFormat)
Return whether or not the format is capable of serializing the context information for aStatement
.
-
-
-
Field Detail
-
UNKNOWN_BASE_FORMAT
public static RDFFormat UNKNOWN_BASE_FORMAT
-
TURTLE
public static final RDFFormat TURTLE
Format denoting [Turtle](https://www.w3.org/TR/turtle/)
-
PRETTY_TURTLE
public static final RDFFormat PRETTY_TURTLE
-
NTRIPLES
public static final RDFFormat NTRIPLES
[N-triples](http://www.w3.org/TR/n-triples/)
-
NQUADS
public static final RDFFormat NQUADS
[NQuads](http://www.w3.org/TR/n-quads/)
-
RDFXML
public static final RDFFormat RDFXML
[RDF/XML](http://www.w3.org/TR/rdf-syntax-grammar/)
-
N3
public static final RDFFormat N3
[Notation 3](http://www.w3.org/TeamSubmission/n3/)
-
TRIG
public static final RDFFormat TRIG
[TriG](http://www.w3.org/TR/trig)
-
RDFJSON
public static final RDFFormat RDFJSON
[RDF/JSON](http://www.w3.org/TR/rdf-json/)
-
BINARY
public static final RDFFormat BINARY
Binary RDF
-
JSONLD
public static final RDFFormat JSONLD
[JSON-LD](ttp://www.w3.org/TR/json-ld/)
-
-
Method Detail
-
forFile
@Nonnull public static java.util.Optional<RDFFormat> forFile(@Nonnull java.nio.file.Path thePath)
Return theformat
for the file denoted by the givenPath
. If none can be determined- Parameters:
thePath
- the file to be parsed- Returns:
- the RDF format
-
forName
@Nonnull public static java.util.Optional<RDFFormat> forName(@Nonnull java.lang.String theName)
Return theformat
with the provided name- Parameters:
theName
- the name of the format- Returns:
- the
format
-
forMime
@Nonnull public static java.util.Optional<RDFFormat> forMime(@Nonnull java.lang.String theMime)
Return theformat
which supports the given mimetype- Parameters:
theMime
- the mimetype- Returns:
- the
format
that supports the mimetype - Implementation Notes:
- The default mimetypes are checked for _all_ formats before the full set of mimetypes for each format are considered.
-
compressedForName
@Nonnull public static RDFFormat compressedForName(RDFFormat theFormat, java.lang.String theName)
Return thecompressed RDFFormat
for the given name, with the provided base format.- Parameters:
theFormat
-theName
-- Returns:
-
compressedFormat
@Nonnull public static RDFFormat compressedFormat(RDFFormat theFormat, FileFormat.Compression theCompression)
-
forFile
public static java.util.Optional<RDFFormat> forFile(java.lang.String theFileName)
-
baseFormat
public static RDFFormat baseFormat(RDFFormat theFormat)
Returns thebase format
of the given format if it is acompressed format
or the given format otherwise.- Parameters:
theFormat
- input format- Returns:
- the
base format
of the given format if it is acompressed format
or the given format otherwise.
-
compressionOf
public static FileFormat.Compression compressionOf(RDFFormat theFormat)
Returns thecompression
of given format if it is acompressed format
orFileFormat.Compression.NONE
otherwise.- Parameters:
theFormat
- input format- Returns:
- the
compression
of given format if it is acompressed format
orFileFormat.Compression.NONE
otherwise.
-
supportsContexts
public static boolean supportsContexts(@Nonnull RDFFormat theFormat)
Return whether or not the format is capable of serializing the context information for aStatement
.- Parameters:
theFormat
- the format- Returns:
- `true` if the format can serialize quads, `false` otherwise
-
register
public static RDFFormat 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)
Create a newRDFFormats.RDFFormatImpl
- 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
-
registerBinary
public static RDFFormat.BinaryRDFFormat registerBinary(@Nonnull java.lang.String theName, @Nonnull IRI theId, @Nonnull java.util.List<java.lang.String> theMimetypes, @Nonnull java.util.List<java.lang.String> theFileExtensions)
Create a newRDFFormat.BinaryRDFFormat
- 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
-
-