Interface RDFSyntax
- All Known Implementing Classes:
W3CRDFSyntax
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
.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RDFSyntax
JSON-LD 1.0static final RDFSyntax
RDF 1.1 N-Quadsstatic final RDFSyntax
RDF 1.1 N-Triplesstatic final RDFSyntax
HTML+RDFa 1.1 and XHTML+RDFa 1.1static final RDFSyntax
RDF 1.1 XML Syntaxstatic final RDFSyntax
RDF 1.1 TriGstatic final RDFSyntax
RDF 1.1 Turtle -
Method Summary
Modifier and TypeMethodDescriptionbyFileExtension
(String fileExtension) Return the RDFSyntax with the specified file extension.byMediaType
(String mediaType) Return the RDFSyntax with the specified media type.Return the RDFSyntax with the specifiedname()
.boolean
Compare this RDFSyntax with another object.The IANA-registered file extension.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 themediaType()
in lower case according toString.toLowerCase(Locale)
with the localeLocale.ROOT
.iri()
Return theIRI
that identifies the RDF syntax.The IANA media type for the RDF syntax.Set of IANA media types that covers this RDF syntax, including any non-official media types.name()
A short name of the RDF Syntax e.g.boolean
Indicate if this RDF syntax supports RDF Datasets.title()
The title of the RDF Syntax.Return the RDF 1.1 serialization syntaxes.
-
Field Details
-
JSONLD
JSON-LD 1.0- See Also:
-
TURTLE
RDF 1.1 Turtle- See Also:
-
NQUADS
RDF 1.1 N-Quads- See Also:
-
NTRIPLES
RDF 1.1 N-Triples- See Also:
-
RDFA
HTML+RDFa 1.1 and XHTML+RDFa 1.1- See Also:
-
RDFXML
RDF 1.1 XML Syntax- See Also:
-
TRIG
RDF 1.1 TriG- See Also:
-
-
Method Details
-
name
String name()A short name of the RDF Syntax e.g.JSONLD
.The name is specific to Commons RDF and carries no particular meaning.
- Returns:
- Short name for RDF syntax
-
title
String title()The title of the RDF Syntax.This is generally the title of the corresponding standard, e.g. RDF 1.1 Turtle.
- Returns:
- Title of RDF Syntax
-
mediaType
String mediaType()The IANA media type for the RDF syntax.The media type can be used as part of
Content-Type
andAccept
for content negotiation in the HTTP protocol.- Returns:
- The registered media type of the RDF Syntax
-
mediaTypes
Set of IANA media types that covers this RDF syntax, including any non-official media types.The media type can be used as part of
Content-Type
andAccept
for content negotiation in the HTTP protocol.The returned Set MUST include the value
mediaType()
; this is the behaviour of the default implementation.- Returns:
- The media types corresponding to the RDF Syntax
-
fileExtension
String fileExtension()The IANA-registered file extension.The file extension includes the leading period, e.g.
.jsonld
- Returns:
- The registered file extension of the RDF Syntax
-
fileExtensions
Set of file extensions for this RDF syntax, including any non-official extensions.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.- Returns:
- The file extensions corresponding to the RDF Syntax
-
supportsDataset
boolean supportsDataset()Indicate if this RDF syntax supports RDF Datasets.- Returns:
- true if this RDF Syntax supports datasets; false otherwise
-
iri
IRI iri()Return theIRI
that identifies the RDF syntax.Note that the identifying IRI is generally distinct from the IRI of the document that specifies the RDF syntax.
- Returns:
- Identifying IRI, e.g.
http://www.w3.org/ns/formats/JSON-LD
-
equals
Compare this RDFSyntax with another object.Two
RDFSyntax
es are considered equal if theirmediaType()
s are equal when compared as lower case strings according toString.toLowerCase(Locale)
with the localeLocale.ROOT
. -
hashCode
int hashCode()The hash code of an RDFSyntax is equivalent to the hash code of themediaType()
in lower case according toString.toLowerCase(Locale)
with the localeLocale.ROOT
. -
w3cSyntaxes
Return the RDF 1.1 serialization syntaxes.This lists the W3C standardized RDF 1.1 syntaxes like
TURTLE
andJSONLD
. Note the existence of other RDF syntaxes that are not included here, e.g. N3 and TriX.The syntaxes returned only support the
mediaType()
andfileExtension()
as defined in the corresponding W3C specification.- Returns:
- A set of the official RDF 1.1
RDFSyntax
es. - See Also:
-
byMediaType
Return the RDFSyntax with the specified media type.The
mediaType
is compared in lower case to all media types supported, therefore it might not be equal to themediaType()
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()
.- Parameters:
mediaType
- The media type to match- Returns:
- If
Optional.isPresent()
, theRDFSyntax
which has a matchingmediaType()
, otherwiseOptional.empty()
indicating that no matching syntax was found.
-
byFileExtension
Return the RDFSyntax with the specified file extension.The
fileExtension
is compared in lower case to all extensions supported, therefore it might not be equal to thefileExtension()
of the returned RDFSyntax.This method support all syntaxes returned by
w3cSyntaxes()
.- Parameters:
fileExtension
- The fileExtension to match, starting with.
- Returns:
- If
Optional.isPresent()
, theRDFSyntax
which has a matchingfileExtension()
, otherwiseOptional.empty()
indicating that no matching file extension was found.
-
byName
Return the RDFSyntax with the specifiedname()
.This method support all syntaxes returned by
w3cSyntaxes()
.- Parameters:
name
- The name to match, , e.g."JSONLD"
- Returns:
- If
Optional.isPresent()
, theRDFSyntax
which has a matchingname()
, otherwiseOptional.empty()
indicating that no matching name was found.
-