Class RDFFormat
name
and can have one or more associated MIME types, zero or more associated file extensions and can specify a (default)
character encoding. Some formats are able to encode context information while other are not; this is indicated by the
value of supportsContexts.- Author:
- Arjohn Kampman
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RDFFormatA binary RDF format.static final RDFFormatThe HDT file format, an RDF serialization format.static final RDFFormatThe JSON-LD file format, an RDF serialization format that supports recording of named graphs.static final RDFFormatThe N3/Notation3 file format.static final RDFFormatThe NDJSON-LD is a Newline Delimited JSON-LD format.static final booleanIndicates that theStatement.getContext()URI will NOT be serialized for this format.static final booleanIndicates that all calls toRDFHandler.handleNamespace(String, String)will be ignored when serializing to this format.static final booleanIndicates that RDF-star triples will NOT be serialized natively for this format.static final RDFFormatThe N-Quads file format, an RDF serialization format that supports recording of named graphs.static final RDFFormatThe N-Triples file format.static final RDFFormatThe RDFa file format, an RDF serialization format.static final RDFFormatThe RDF/JSON file format, an RDF serialization format that supports recording of named graphs.static final RDFFormatThe RDF/XML file format.static final booleanIndicates that theStatement.getContext()URI may be serialized for this format.static final booleanIndicates that calls toRDFHandler.handleNamespace(String, String)may be serialised when serializing to this format.static final booleanIndicates that RDF-star triples can be serialized natively for this format.static final RDFFormatThe TriG file format, a Turtle-based RDF serialization format that supports recording of named graphs.static final RDFFormatThe TriG-star file format, a TriG-based RDF serialization format that supports RDF-star triples.static final RDFFormatThe TriX file format, an XML-based RDF serialization format that supports recording of named graphs.static final RDFFormatThe Turtle file format.static final RDFFormatThe Turtle-star file format, a Turtle-based RDF serialization format that supports RDF-star triples. -
Constructor Summary
ConstructorsConstructorDescriptionRDFFormat(String name, String mimeType, Charset charset, String fileExtension, boolean supportsNamespaces, boolean supportsContexts) Deprecated.since 3.2.0RDFFormat(String name, String mimeType, Charset charset, String fileExtension, boolean supportsNamespaces, boolean supportsContexts, boolean supportsRDFStar) Creates a new RDFFormat object.RDFFormat(String name, String mimeType, Charset charset, Collection<String> fileExtensions, boolean supportsNamespaces, boolean supportsContexts) Deprecated.since 3.2.0RDFFormat(String name, String mimeType, Charset charset, Collection<String> fileExtensions, boolean supportsNamespaces, boolean supportsContexts, boolean supportsRDFStar) Creates a new RDFFormat object.RDFFormat(String name, Collection<String> mimeTypes, Charset charset, Collection<String> fileExtensions, boolean supportsNamespaces, boolean supportsContexts) Deprecated.since 3.2.0RDFFormat(String name, Collection<String> mimeTypes, Charset charset, Collection<String> fileExtensions, boolean supportsNamespaces, boolean supportsContexts, boolean supportsRDFStar) Creates a new RDFFormat object.RDFFormat(String name, Collection<String> mimeTypes, Charset charset, Collection<String> fileExtensions, IRI standardURI, boolean supportsNamespaces, boolean supportsContexts) Deprecated.since 3.2.0RDFFormat(String name, Collection<String> mimeTypes, Charset charset, Collection<String> fileExtensions, IRI standardURI, boolean supportsNamespaces, boolean supportsContexts, boolean supportsRDFStar) Creates a new RDFFormat object. -
Method Summary
Modifier and TypeMethodDescriptiongetAcceptParams(Iterable<RDFFormat> rdfFormats, boolean requireContext, RDFFormat preferredFormat) Processes the supplied collection ofRDFFormats and assigns quality values to each based on whether context must be supported and whether the format is preferred.booleanbooleanReturn true if the RDFFormat supports the encoding of contexts/named graphs.booleanReturn true if the RDFFormat supports the encoding of namespace/prefix information.booleanReturn true if the RDFFormat supports the encoding of RDF-star triples natively.Methods inherited from class org.eclipse.rdf4j.common.lang.FileFormat
equals, getCharset, getDefaultFileExtension, getDefaultMIMEType, getFileExtensions, getMIMETypes, getName, hasCharset, hasDefaultFileExtension, hasDefaultMIMEType, hasFileExtension, hashCode, hasMIMEType, matchFileName, matchMIMEType, toString
-
Field Details
-
SUPPORTS_NAMESPACES
public static final boolean SUPPORTS_NAMESPACESIndicates that calls toRDFHandler.handleNamespace(String, String)may be serialised when serializing to this format.- See Also:
-
NO_NAMESPACES
public static final boolean NO_NAMESPACESIndicates that all calls toRDFHandler.handleNamespace(String, String)will be ignored when serializing to this format.- See Also:
-
SUPPORTS_CONTEXTS
public static final boolean SUPPORTS_CONTEXTSIndicates that theStatement.getContext()URI may be serialized for this format.- See Also:
-
NO_CONTEXTS
public static final boolean NO_CONTEXTSIndicates that theStatement.getContext()URI will NOT be serialized for this format.- See Also:
-
SUPPORTS_RDF_STAR
public static final boolean SUPPORTS_RDF_STARIndicates that RDF-star triples can be serialized natively for this format.- See Also:
-
NO_RDF_STAR
public static final boolean NO_RDF_STARIndicates that RDF-star triples will NOT be serialized natively for this format.- See Also:
-
RDFXML
The RDF/XML file format.Several file extensions are accepted for RDF/XML documents, including
.rdf,.rdfs(for RDF Schema files),.owl(for OWL ontologies), and.xml. The media type isapplication/rdf+xml, butapplication/xmlandtext/xmlare also accepted. The character encoding is UTF-8.- See Also:
-
NTRIPLES
The N-Triples file format.The file extension
.ntis recommend for N-Triples documents. The media type isapplication/n-triplesand encoding is in UTF-8.- See Also:
-
TURTLE
The Turtle file format.The file extension
.ttlis recommend for Turtle documents. The media type istext/turtle, butapplication/x-turtleis also accepted. Character encoding is UTF-8.- See Also:
-
TURTLESTAR
The Turtle-star file format, a Turtle-based RDF serialization format that supports RDF-star triples.The file extension
.ttlsis recommended for Turtle-star documents. The media type isapplication/x-turtlestarand the encoding is UTF-8. -
N3
The N3/Notation3 file format.The file extension
.n3is recommended for N3 documents. The media type istext/n3, buttext/rdf+n3is also accepted. Character encoding is UTF-8.- See Also:
-
TRIX
The TriX file format, an XML-based RDF serialization format that supports recording of named graphs.The file extension
.xmlis recommended for TriX documents,.trixis also accepted. The media type isapplication/trixand the encoding is UTF-8.- See Also:
-
TRIG
The TriG file format, a Turtle-based RDF serialization format that supports recording of named graphs.The file extension
.trigis recommend for TriG documents. The media type isapplication/trigand the encoding is UTF-8.- See Also:
-
TRIGSTAR
The TriG-star file format, a TriG-based RDF serialization format that supports RDF-star triples. This builds upon the idea for the Turtle-star format but adds support for named graphs.The file extension
.trigsis recommended for TriG-star documents. The media type isapplication/x-trigstarand the encoding is UTF-8. -
BINARY
A binary RDF format.The file extension
.brfis recommend for binary RDF documents. The media type isapplication/x-binary-rdf.- See Also:
-
NQUADS
The N-Quads file format, an RDF serialization format that supports recording of named graphs.The file extension
.nqis recommended for N-Quads documents. The media type isapplication/n-quadsand the encoding is UTF-8. -
JSONLD
The JSON-LD file format, an RDF serialization format that supports recording of named graphs.The file extension
.jsonldis recommended for JSON-LD documents. The media type isapplication/ld+jsonand the encoding is UTF-8.- See Also:
-
NDJSONLD
The NDJSON-LD is a Newline Delimited JSON-LD format.The file extension
.ndjsonldis recommended for NDJSON-LD documents. The media type isapplication/x-ld+ndjsonand the encoding is UTF-8. -
RDFJSON
The RDF/JSON file format, an RDF serialization format that supports recording of named graphs.The file extension
.rjis recommended for RDF/JSON documents. The media type isapplication/rdf+jsonand the encoding is UTF-8. -
RDFA
The RDFa file format, an RDF serialization format.The file extension
.xhtmlis recommended for RDFa documents. The preferred media type isapplication/xhtml+xmland the encoding is UTF-8.- See Also:
-
HDT
The HDT file format, an RDF serialization format.The file extension
.hdtis recommended for HDT documents.- See Also:
-
-
Constructor Details
-
RDFFormat
@Deprecated(since="3.2.0") public RDFFormat(String name, String mimeType, Charset charset, String fileExtension, boolean supportsNamespaces, boolean supportsContexts) Deprecated.since 3.2.0Creates a new RDFFormat object.- Parameters:
name- The name of the RDF file format, e.g. "RDF/XML".mimeType- The MIME type of the RDF file format, e.g. application/rdf+xml for the RDF/XML file format.charset- The default character encoding of the RDF file format. Specify null if not applicable.fileExtension- The (default) file extension for the RDF file format, e.g. rdf for RDF/XML files.supportsNamespaces- True if the RDFFormat supports the encoding of namespace/prefix information and false otherwise.supportsContexts- True if the RDFFormat supports the encoding of contexts/named graphs and false otherwise.
-
RDFFormat
public RDFFormat(String name, String mimeType, Charset charset, String fileExtension, boolean supportsNamespaces, boolean supportsContexts, boolean supportsRDFStar) Creates a new RDFFormat object.- Parameters:
name- The name of the RDF file format, e.g. "RDF/XML".mimeType- The MIME type of the RDF file format, e.g. application/rdf+xml for the RDF/XML file format.charset- The default character encoding of the RDF file format. Specify null if not applicable.fileExtension- The (default) file extension for the RDF file format, e.g. rdf for RDF/XML files.supportsNamespaces- True if the RDFFormat supports the encoding of namespace/prefix information and false otherwise.supportsContexts- True if the RDFFormat supports the encoding of contexts/named graphs and false otherwise.supportsRDFStar- True if the RDFFormat supports the encoding of RDF-star triples natively and false otherwise.
-
RDFFormat
@Deprecated(since="3.2.0") public RDFFormat(String name, String mimeType, Charset charset, Collection<String> fileExtensions, boolean supportsNamespaces, boolean supportsContexts) Deprecated.since 3.2.0Creates a new RDFFormat object.- Parameters:
name- The name of the RDF file format, e.g. "RDF/XML".mimeType- The MIME type of the RDF file format, e.g. application/rdf+xml for the RDF/XML file format.charset- The default character encoding of the RDF file format. Specify null if not applicable.fileExtensions- The RDF format's file extensions, e.g. rdf for RDF/XML files. The first item in the list is interpreted as the default file extension for the format.supportsNamespaces- True if the RDFFormat supports the encoding of namespace/prefix information and false otherwise.supportsContexts- True if the RDFFormat supports the encoding of contexts/named graphs and false otherwise.
-
RDFFormat
public RDFFormat(String name, String mimeType, Charset charset, Collection<String> fileExtensions, boolean supportsNamespaces, boolean supportsContexts, boolean supportsRDFStar) Creates a new RDFFormat object.- Parameters:
name- The name of the RDF file format, e.g. "RDF/XML".mimeType- The MIME type of the RDF file format, e.g. application/rdf+xml for the RDF/XML file format.charset- The default character encoding of the RDF file format. Specify null if not applicable.fileExtensions- The RDF format's file extensions, e.g. rdf for RDF/XML files. The first item in the list is interpreted as the default file extension for the format.supportsNamespaces- True if the RDFFormat supports the encoding of namespace/prefix information and false otherwise.supportsContexts- True if the RDFFormat supports the encoding of contexts/named graphs and false otherwise.supportsRDFStar- True if the RDFFormat supports the encoding of RDF-star triples natively and false otherwise.
-
RDFFormat
@Deprecated(since="3.2.0") public RDFFormat(String name, Collection<String> mimeTypes, Charset charset, Collection<String> fileExtensions, boolean supportsNamespaces, boolean supportsContexts) Deprecated.since 3.2.0Creates a new RDFFormat object.- Parameters:
name- The name of the RDF file format, e.g. "RDF/XML".mimeTypes- The MIME types of the RDF file format, e.g. application/rdf+xml for the RDF/XML file format. The first item in the list is interpreted as the default MIME type for the format.charset- The default character encoding of the RDF file format. Specify null if not applicable.fileExtensions- The RDF format's file extensions, e.g. rdf for RDF/XML files. The first item in the list is interpreted as the default file extension for the format.supportsNamespaces- True if the RDFFormat supports the encoding of namespace/prefix information and false otherwise.supportsContexts- True if the RDFFormat supports the encoding of contexts/named graphs and false otherwise.
-
RDFFormat
public RDFFormat(String name, Collection<String> mimeTypes, Charset charset, Collection<String> fileExtensions, boolean supportsNamespaces, boolean supportsContexts, boolean supportsRDFStar) Creates a new RDFFormat object.- Parameters:
name- The name of the RDF file format, e.g. "RDF/XML".mimeTypes- The MIME types of the RDF file format, e.g. application/rdf+xml for the RDF/XML file format. The first item in the list is interpreted as the default MIME type for the format.charset- The default character encoding of the RDF file format. Specify null if not applicable.fileExtensions- The RDF format's file extensions, e.g. rdf for RDF/XML files. The first item in the list is interpreted as the default file extension for the format.supportsNamespaces- True if the RDFFormat supports the encoding of namespace/prefix information and false otherwise.supportsContexts- True if the RDFFormat supports the encoding of contexts/named graphs and false otherwise.supportsRDFStar- True if the RDFFormat supports the encoding of RDF-star triples natively and false otherwise.
-
RDFFormat
@Deprecated(since="3.2.0") public RDFFormat(String name, Collection<String> mimeTypes, Charset charset, Collection<String> fileExtensions, IRI standardURI, boolean supportsNamespaces, boolean supportsContexts) Deprecated.since 3.2.0Creates a new RDFFormat object.- Parameters:
name- The name of the RDF file format, e.g. "RDF/XML".mimeTypes- The MIME types of the RDF file format, e.g. application/rdf+xml for the RDF/XML file format. The first item in the list is interpreted as the default MIME type for the format.charset- The default character encoding of the RDF file format. Specify null if not applicable.fileExtensions- The RDF format's file extensions, e.g. rdf for RDF/XML files. The first item in the list is interpreted as the default file extension for the format.standardURI- The standard URI that has been assigned to this format by a standards organisation or null if it does not currently have a standard URI.supportsNamespaces- True if the RDFFormat supports the encoding of namespace/prefix information and false otherwise.supportsContexts- True if the RDFFormat supports the encoding of contexts/named graphs and false otherwise.
-
RDFFormat
public RDFFormat(String name, Collection<String> mimeTypes, Charset charset, Collection<String> fileExtensions, IRI standardURI, boolean supportsNamespaces, boolean supportsContexts, boolean supportsRDFStar) Creates a new RDFFormat object.- Parameters:
name- The name of the RDF file format, e.g. "RDF/XML".mimeTypes- The MIME types of the RDF file format, e.g. application/rdf+xml for the RDF/XML file format. The first item in the list is interpreted as the default MIME type for the format.charset- The default character encoding of the RDF file format. Specify null if not applicable.fileExtensions- The RDF format's file extensions, e.g. rdf for RDF/XML files. The first item in the list is interpreted as the default file extension for the format.standardURI- The standard URI that has been assigned to this format by a standards organisation or null if it does not currently have a standard URI.supportsNamespaces- True if the RDFFormat supports the encoding of namespace/prefix information and false otherwise.supportsContexts- True if the RDFFormat supports the encoding of contexts/named graphs and false otherwise.supportsRDFStar- True if the RDFFormat supports the encoding of RDF-star triples natively and false otherwise.
-
-
Method Details
-
getAcceptParams
public static List<String> getAcceptParams(Iterable<RDFFormat> rdfFormats, boolean requireContext, RDFFormat preferredFormat) Processes the supplied collection ofRDFFormats and assigns quality values to each based on whether context must be supported and whether the format is preferred.- Parameters:
rdfFormats- TheRDFFormats to process.requireContext- True to decrease the quality value for formats wheresupportsContexts()returns false.preferredFormat- The preferred RDFFormat. If it is not in the list then the quality of all formats will be processed as if they are not preferred.- Returns:
- A list of strings containing the content types and an attached q-value specifying the quality for the format for each type.
-
supportsNamespaces
public boolean supportsNamespaces()Return true if the RDFFormat supports the encoding of namespace/prefix information. -
supportsContexts
public boolean supportsContexts()Return true if the RDFFormat supports the encoding of contexts/named graphs. -
supportsRDFStar
public boolean supportsRDFStar()Return true if the RDFFormat supports the encoding of RDF-star triples natively. -
hasStandardURI
public boolean hasStandardURI()- Returns:
- True if a standard URI has been assigned to this format by a standards organisation.
-
getStandardURI
- Returns:
- The standard URI that has been assigned to this format by a standards organisation or null if it does not currently have a standard URI.
-