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 Quads.
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 RDFSyntaxJSON-LD 1.0static final RDFSyntaxRDF 1.1 N-Quadsstatic final RDFSyntaxRDF 1.1 N-Triplesstatic final RDFSyntaxHTML+RDFa 1.1 and XHTML+RDFa 1.1static final RDFSyntaxRDF 1.1 XML Syntaxstatic final RDFSyntaxRDF 1.1 TriGstatic final RDFSyntaxRDF 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().booleanCompare this RDFSyntax with another object.The IANA-registered file extension.Set of file extensions for this RDF syntax, including any non-official extensions.inthashCode()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 theIRIthat 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.booleanIndicate if this RDF syntax supports RDF Datasets.title()The title of the RDF Syntax.Return the RDF 1.1 serialization syntaxes.
-
Field Details
-
JSONLD
-
TURTLE
-
NQUADS
-
NTRIPLES
-
RDFA
-
RDFXML
-
TRIG
-
-
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-TypeandAcceptfor 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-TypeandAcceptfor 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.
.jsonldThe 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
-
equals
Compare this RDFSyntax with another object.Two
RDFSyntaxes 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
TURTLEandJSONLD. 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
RDFSyntaxes. - See Also:
-
byMediaType
Return the RDFSyntax with the specified media type.The
mediaTypeis 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(), theRDFSyntaxwhich has a matchingmediaType(), otherwiseOptional.empty()indicating that no matching syntax was found.
-
byFileExtension
Return the RDFSyntax with the specified file extension.The
fileExtensionis 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(), theRDFSyntaxwhich 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(), theRDFSyntaxwhich has a matchingname(), otherwiseOptional.empty()indicating that no matching name was found.
-