Package com.stardog.stark.io
Class RDFFormats
- java.lang.Object
-
- com.stardog.stark.io.RDFFormats
-
public final class RDFFormats extends java.lang.ObjectUtilities for
RDFFormat- Since:
- 1.0
- Version:
- 1.0
- Author:
- Michael Grove
- See Also:
SupportedFileFormats
-
-
Field Summary
Fields Modifier and Type Field Description static RDFFormatBINARYBinary RDFstatic RDFFormatJSONLD[JSON-LD](ttp://www.w3.org/TR/json-ld/)static RDFFormatN3[Notation 3](http://www.w3.org/TeamSubmission/n3/)static RDFFormatNQUADS[NQuads](http://www.w3.org/TR/n-quads/)static RDFFormatNTRIPLES[N-triples](http://www.w3.org/TR/n-triples/)static RDFFormatPRETTY_TURTLEstatic RDFFormatRDFJSON[RDF/JSON](http://www.w3.org/TR/rdf-json/)static RDFFormatRDFXML[RDF/XML](http://www.w3.org/TR/rdf-syntax-grammar/)static RDFFormatTRIG[TriG](http://www.w3.org/TR/trig)static RDFFormatTURTLEFormat denoting [Turtle](https://www.w3.org/TR/turtle/)static RDFFormatUNKNOWN_BASE_FORMAT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RDFFormatbaseFormat(RDFFormat theFormat)Returns thebase formatof the given format if it is acompressed formator the given format otherwise.static RDFFormatcompressedFormat(RDFFormat theFormat, FileFormat.Compression theCompression)static RDFFormatcompressedForName(RDFFormat theFormat, java.lang.String theName)Return thecompressed RDFFormatfor the given name, with the provided base format.static FileFormat.CompressioncompressionOf(RDFFormat theFormat)Returns thecompressionof given format if it is acompressed formatorFileFormat.Compression.NONEotherwise.static RDFFormatforFile(java.io.File theFile, RDFFormat theBaseFormat)static java.util.Optional<RDFFormat>forFile(java.lang.String theFileName)static RDFFormatforFile(java.lang.String theFileName, RDFFormat theBaseFormat)static java.util.Optional<RDFFormat>forFile(java.nio.file.Path thePath)Return theformatfor the file denoted by the givenPath.static java.util.Optional<RDFFormat>forMime(java.lang.String theMime)Return theformatwhich supports the given mimetypestatic java.util.Optional<RDFFormat>forName(java.lang.String theName)Return theformatwith the provided namestatic RDFFormatregister(java.lang.String theName, IRI theId, java.util.List<java.lang.String> theMimetypes, java.util.List<java.lang.String> theFileExtensions)Create a newRDFFormats.RDFFormatImplstatic RDFFormat.BinaryRDFFormatregisterBinary(java.lang.String theName, IRI theId, java.util.List<java.lang.String> theMimetypes, java.util.List<java.lang.String> theFileExtensions)Create a newRDFFormat.BinaryRDFFormatstatic booleansupportsContexts(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 theformatfor 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 theformatwith 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 theformatwhich supports the given mimetype- Parameters:
theMime- the mimetype- Returns:
- the
formatthat 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 RDFFormatfor 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 formatof the given format if it is acompressed formator the given format otherwise.- Parameters:
theFormat- input format- Returns:
- the
base formatof the given format if it is acompressed formator the given format otherwise.
-
compressionOf
public static FileFormat.Compression compressionOf(RDFFormat theFormat)
Returns thecompressionof given format if it is acompressed formatorFileFormat.Compression.NONEotherwise.- Parameters:
theFormat- input format- Returns:
- the
compressionof given format if it is acompressed formatorFileFormat.Compression.NONEotherwise.
-
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
-
-