public interface RDFSyntax
An RDF syntax is uniquely identified by its mediaType()
, and has a
suggested fileExtension()
.
Some of the RDF syntaxes may supportsDataset()
, meaning they can
represent Quad
s.
An enumeration of the official RDF 1.1 syntaxes is available in
W3CRDFSyntax
- for convenience they are also accessible
as constants here, e.g. RDFSyntax.JSONLD
.
Modifier and Type | Field and Description |
---|---|
static RDFSyntax |
JSONLD
JSON-LD 1.0
|
static RDFSyntax |
NQUADS
RDF 1.1 N-Quads
|
static RDFSyntax |
NTRIPLES
RDF 1.1 N-Triples
|
static RDFSyntax |
RDFA
HTML+RDFa 1.1 and XHTML+RDFa 1.1
|
static RDFSyntax |
RDFXML
RDF 1.1 XML Syntax
|
static RDFSyntax |
TRIG
RDF 1.1 TriG
|
static RDFSyntax |
TURTLE
RDF 1.1 Turtle
|
Modifier and Type | Method and Description |
---|---|
static Optional<RDFSyntax> |
byFileExtension(String fileExtension)
Return the RDFSyntax with the specified file extension.
|
static Optional<RDFSyntax> |
byMediaType(String mediaType)
Return the RDFSyntax with the specified media type.
|
static Optional<RDFSyntax> |
byName(String name)
Return the RDFSyntax with the specified
name() . |
boolean |
equals(Object obj)
Compare this RDFSyntax with another object.
|
String |
fileExtension()
The IANA-registered
file extension.
|
default Set<String> |
fileExtensions()
Set of file extensions for this RDF syntax, including any non-official extensions.
|
int |
hashCode()
The hash code of an RDFSyntax is equivalent to the hash code
of the
mediaType() in lower case according to
String.toLowerCase(Locale) with the locale
Locale.ROOT . |
IRI |
iri()
Return the
IRI that identifies the RDF syntax. |
String |
mediaType()
The IANA media type for
the RDF syntax.
|
default Set<String> |
mediaTypes()
Set of IANA media types that
covers this RDF syntax, including any non-official media types.
|
String |
name()
A short name of the RDF Syntax e.g.
|
boolean |
supportsDataset()
Indicate if this RDF syntax supports
RDF
Datasets.
|
String |
title()
The title of the RDF Syntax.
|
static Set<RDFSyntax> |
w3cSyntaxes()
Return the RDF 1.1 serialization syntaxes.
|
static final RDFSyntax JSONLD
static final RDFSyntax TURTLE
static final RDFSyntax NQUADS
static final RDFSyntax NTRIPLES
static final RDFSyntax TRIG
String name()
JSONLD
.
The name is specific to Commons RDF and carries no particular meaning.
String title()
This is generally the title of the corresponding standard, e.g. RDF 1.1 Turtle.
String mediaType()
The media type can be used as part of Content-Type
and
Accept
for content negotiation in the
HTTP
protocol.
default Set<String> mediaTypes()
The media type can be used as part of Content-Type
and
Accept
for content negotiation in the
HTTP
protocol.
The returned Set MUST include the value mediaType()
; this is the
behaviour of the default implementation.
String fileExtension()
The file extension includes the leading period, e.g. .jsonld
default Set<String> fileExtensions()
The file extension includes the leading period, e.g. .jsonld
The returned Set MUST include the value from fileExtension()
; this is
the behaviour of the default implementation.
boolean supportsDataset()
IRI iri()
IRI
that identifies the RDF syntax.
Note that the identifying IRI is generally distinct from the IRI of the document that specifies the RDF syntax.
http://www.w3.org/ns/formats/JSON-LD
boolean equals(Object obj)
Two RDFSyntax
es are considered equal if their
mediaType()
s are equal when compared as lower case strings
according to String.toLowerCase(Locale)
with the locale
Locale.ROOT
.
int hashCode()
mediaType()
in lower case according to
String.toLowerCase(Locale)
with the locale
Locale.ROOT
.static Set<RDFSyntax> w3cSyntaxes()
This lists the W3C standardized RDF 1.1 syntaxes like TURTLE
and
JSONLD
. Note the existence of other RDF syntaxes that are not
included here, e.g. N3 and
TriX.
The syntaxes returned only support the mediaType()
and fileExtension()
as defined in the corresponding
W3C specification.
RDFSyntax
es.RDFParser
static Optional<RDFSyntax> byMediaType(String mediaType)
The mediaType
is compared in lower case to all media types
supported, therefore it might not be equal to the
mediaType()
of the returned RDFSyntax.
If the media type specifies parameters, e.g.
text/turtle; charset=ascii
, only the part of the string to
before ;
is considered.
This method support all syntaxes returned by w3cSyntaxes()
.
mediaType
- The media type to matchOptional.isPresent()
, the RDFSyntax
which has
a matching mediaType()
, otherwise
Optional.empty()
indicating that no matching syntax was
found.static Optional<RDFSyntax> byFileExtension(String fileExtension)
The fileExtension
is compared in lower case to all
extensions supported, therefore it might not be equal to the
fileExtension()
of the returned RDFSyntax.
This method support all syntaxes returned by w3cSyntaxes()
.
fileExtension
- The fileExtension to match, starting with .
Optional.isPresent()
, the RDFSyntax
which has
a matching fileExtension()
, otherwise
Optional.empty()
indicating that no matching file
extension was found.static Optional<RDFSyntax> byName(String name)
name()
.
This method support all syntaxes returned by w3cSyntaxes()
.
name
- The name to match, , e.g. "JSONLD"
Optional.isPresent()
, the RDFSyntax
which has
a matching name()
, otherwise
Optional.empty()
indicating that no matching name was found.Copyright © 2015–2018 The Apache Software Foundation. All rights reserved.