Class W3CRDFSyntax

java.lang.Object
org.apache.commons.rdf.api.W3CRDFSyntax
All Implemented Interfaces:
RDFSyntax

class W3CRDFSyntax extends Object implements RDFSyntax
W3C RDF 1.1 serialization syntax.

This defines 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.

This class is package-protected, its static constants are exposed through RDFSyntax.

See Also:
  • Field Details

    • JSONLD

      static final RDFSyntax JSONLD
    • TURTLE

      static final RDFSyntax TURTLE
    • NQUADS

      static final RDFSyntax NQUADS
    • NTRIPLES

      static final RDFSyntax NTRIPLES
    • RDFA

      static final RDFSyntax RDFA
    • RDFXML

      static final RDFSyntax RDFXML
    • TRIG

      static final RDFSyntax TRIG
    • syntaxes

      static final Set<RDFSyntax> syntaxes
    • title

      private final String title
    • mediaType

      private final String mediaType
    • fileExtension

      private final String fileExtension
    • supportsDataset

      private final boolean supportsDataset
    • name

      private final String name
    • iri

      private final IRI iri
  • Constructor Details

    • W3CRDFSyntax

      private W3CRDFSyntax(String name, String title, String mediaType, String fileExtension, boolean supportsDataset)
  • Method Details

    • mediaType

      public String mediaType()
      The IANA media type for the RDF syntax.

      The media type can be used as part of Content-Type and Accept for content negotiation in the HTTP protocol.

      W3CRDFSyntax always defines media type in lower case, so String.toLowerCase(Locale) need not be called.

      Specified by:
      mediaType in interface RDFSyntax
      Returns:
      The registered media type of the RDF Syntax
    • fileExtension

      public String fileExtension()
      The IANA-registered file extension.

      The file extension includes the leading period, e.g. .jsonld

      W3CRDFSyntax always defines file extensions in lower case, so String.toLowerCase(Locale) need not be called.

      Specified by:
      fileExtension in interface RDFSyntax
      Returns:
      The registered file extension of the RDF Syntax
    • supportsDataset

      public boolean supportsDataset()
      Description copied from interface: RDFSyntax
      Indicate if this RDF syntax supports RDF Datasets.
      Specified by:
      supportsDataset in interface RDFSyntax
      Returns:
      true if this RDF Syntax supports datasets; false otherwise
    • title

      public String title()
      Description copied from interface: RDFSyntax
      The title of the RDF Syntax.

      This is generally the title of the corresponding standard, e.g. RDF 1.1 Turtle.

      Specified by:
      title in interface RDFSyntax
      Returns:
      Title of RDF Syntax
    • name

      public String name()
      Description copied from interface: RDFSyntax
      A short name of the RDF Syntax e.g. JSONLD.

      The name is specific to Commons RDF and carries no particular meaning.

      Specified by:
      name in interface RDFSyntax
      Returns:
      Short name for RDF syntax
    • iri

      public IRI iri()
      Description copied from interface: RDFSyntax
      Return the 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.

      Specified by:
      iri in interface RDFSyntax
      Returns:
      Identifying IRI, e.g. http://www.w3.org/ns/formats/JSON-LD
    • equals

      public boolean equals(Object obj)
      Description copied from interface: RDFSyntax
      Compare this RDFSyntax with another object.

      Two RDFSyntaxes are considered equal if their RDFSyntax.mediaType()s are equal when compared as lower case strings according to String.toLowerCase(Locale) with the locale Locale.ROOT.

      Specified by:
      equals in interface RDFSyntax
      Overrides:
      equals in class Object
      Parameters:
      obj - the object with which to compare
      Returns:
      true if this object is the same as the obj argument; false otherwise
    • hashCode

      public int hashCode()
      Description copied from interface: RDFSyntax
      The hash code of an RDFSyntax is equivalent to the hash code of the RDFSyntax.mediaType() in lower case according to String.toLowerCase(Locale) with the locale Locale.ROOT.
      Specified by:
      hashCode in interface RDFSyntax
      Overrides:
      hashCode in class Object
      Returns:
      Hash code of RDFSyntax
    • toString

      public String toString()
      Overrides:
      toString in class Object