Enum Class OntFormat

java.lang.Object
java.lang.Enum<OntFormat>
com.github.owlcs.ontapi.OntFormat
All Implemented Interfaces:
Serializable, Comparable<OntFormat>, Constable

public enum OntFormat extends Enum<OntFormat>
The map between jena languages (Lang) and OWL-API syntax formats (OWLLangRegistry.OWLLang). There are 22 ONT formats (22(19 actual, i.e. without intersection) OWL document formats + 15(11 actual) jena languages), but only 12 of them can be used without any hesitation (see isSupported() for more details). For working with the OWL-API interfaces the createOwlFormat() method can be used. OWL-API formats are located inside owlapi-api, owlapi-rio, owlapi-parsers and owlapi-obiformat modules, which may absent in dependencies. Jena's formats are located inside jena-arq and jena-csv. Note: on loading Apache Jena has more priority than OWL-API, in other cases the enum order are used.

Created by @ssz on 27.09.2016.

  • Enum Constant Details

    • TURTLE

      public static final OntFormat TURTLE
    • RDF_XML

      public static final OntFormat RDF_XML
    • RDF_JSON

      public static final OntFormat RDF_JSON
    • JSON_LD

      public static final OntFormat JSON_LD
    • NTRIPLES

      public static final OntFormat NTRIPLES
    • NQUADS

      public static final OntFormat NQUADS
    • TRIG

      public static final OntFormat TRIG
    • TRIX

      public static final OntFormat TRIX
    • RDF_THRIFT

      public static final OntFormat RDF_THRIFT
    • CSV

      public static final OntFormat CSV
    • TSV

      public static final OntFormat TSV
    • OWL_XML

      public static final OntFormat OWL_XML
    • MANCHESTER_SYNTAX

      public static final OntFormat MANCHESTER_SYNTAX
    • FUNCTIONAL_SYNTAX

      public static final OntFormat FUNCTIONAL_SYNTAX
    • BINARY_RDF

      public static final OntFormat BINARY_RDF
    • RDFA

      public static final OntFormat RDFA
    • OBO

      public static final OntFormat OBO
    • KRSS

      public static final OntFormat KRSS
    • KRSS2

      public static final OntFormat KRSS2
    • DL

      public static final OntFormat DL
    • DL_HTML

      public static final OntFormat DL_HTML
    • LATEX

      public static final OntFormat LATEX
  • Method Details

    • values

      public static OntFormat[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static OntFormat valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getID

      public String getID()
      Returns the format identifier, which can be considered as syntax short name. Could be used in Jena model as language tip to read and write (see e.g. Model.read(String, String), Model.write(Writer, String))
      Returns:
      String
    • getExt

      public String getExt()
      The primary file extension. There is no direct usage in the API, it's just for convenience only.
      Returns:
      String
    • getLang

      @Nullable public org.apache.jena.riot.Lang getLang()
      Returns the primary jena language (first alias from the list).
      Returns:
      Jena Lang or null
      See Also:
    • jenaLangs

      public Stream<org.apache.jena.riot.Lang> jenaLangs()
      Lists all jena languages associated with this type in the form of Stream. Technically it is the stream of aliases, i.e. it does no matter what to use.
      Returns:
      Stream of Lang, can be empty
    • getOWLLang

      public OWLLangRegistry.OWLLang getOWLLang()
      Chooses the most suitable owl language details container: it should have associated storer and parser factories or at least one of them.
      Returns:
      OWLLangRegistry.OWLLang or null
      See Also:
    • owlKeys

      public Stream<OWLLangRegistry.LangKey> owlKeys()
      Gets all OWL-API language keys associated with this enum-type instance in the form of Stream.
      Returns:
      Stream of OWLLangRegistry.LangKeys, could be empty.
    • owlLangs

      public Stream<OWLLangRegistry.OWLLang> owlLangs()
      Lists all registered OWL-langs in form of Lang-Details Stream.
      Returns:
      Stream of Lang Details
    • createOwlFormat

      public org.semanticweb.owlapi.model.OWLDocumentFormat createOwlFormat()
      Creates a new instance of OWLDocumentFormat by this type setting, if possible, with default prefixes. If there is no a ready-to-use owl-document-format factory in the system, then a OntFormat.SimpleDocumentFormat 'fake' format backed by this type is returned. Note: default prefixes include owl, rdf, rdfs and xsd, the prefix xml is not included as illegal and useless.
      Returns:
      OWLDocumentFormat, no null
      Throws:
      OntApiException - if something wrong
    • isSupported

      public boolean isSupported()
      Returns true if format is good for using by ONT-API without any restrictions both to read and write. Note: this method has an advisory character and reflects the current state of ONT-API. Even if the format is considered 'no good', and it is supported by OWL-API, usually it is still possible use it by the native mechanisms. The list of reasons why these formats require special attention:
      • CSV (Jena lang: Lang.CSV) is not a valid Jena RDF serialization format, it is only for SPARQL results. But it is possible to use it for reading csv files. Need to add jena-csv to class-path. For more details see jena-csv documentation. Be warned: it is very tolerant format: almost any text file could be treated as csv.
      • TSV (Jena lang:Lang.TSV) is used by Jena for result sets, not RDF syntax. It was added here for completeness only.
      • RDFA (OWL-API lang: OWLLangRegistry.LangKey.RDFA) is available only for reading (it has no storer factory in OWL-API 5.1.4 supply).
      • LATEX (OWL-API lang: OWLLangRegistry.LangKey.LATEX) is available only for writing (it has no parser factory in OWL-API 5.1.4 supply).
      • DL_HTML (OWL-API lang: OWLLangRegistry.LangKey.DLSYNTAXHTML) is available only for writing (it has no parser factory in OWL-API 5.1.4 supply).
      • KRSS (OWL-API lang: OWLLangRegistry.LangKey.KRSS) is excluded in standard OWL-API (5.1.4) supply
      • KRSS2 (OWL-API lang: OWLLangRegistry.LangKey.KRSS2) does not pass reload test, i.e. the list of significant axioms do not match after sequential saving and loading.
      • DL (OWL-API lang: OWLLangRegistry.LangKey.DLSYNTAX) does not pass reload test.
      • OBO (OWL-API lang: OWLLangRegistry.LangKey.OBO) does not pass reload test.
      The test ontology for last three formats:
       @prefix test:  <http://test.org/> .
       @prefix owl:   <http://www.w3.org/2002/07/owl#> .
       @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
       test:simple  a  owl:Ontology .
       test:class1  a  owl:Class .
       test:class2  a           owl:Class ;
               rdfs:subClassOf  test:class1 .
       test:individual  a  test:class1 , owl:NamedIndividual .
       
      Returns:
      false if format is considered dangerous and requires special attention.
      See Also:
    • isReadSupported

      public boolean isReadSupported()
      Answers true if this format-type is supported for read operation.
      Returns:
      true if reading is possible through OWL-API or Jena
      See Also:
    • isWriteSupported

      public boolean isWriteSupported()
      Answers true if this format-type is supported for write operation.
      Returns:
      true if writing is possible through OWL-API or Jena
      See Also:
    • isJena

      public boolean isJena()
      Answers true if this format-type is provided by Apache Jena.
      Returns:
      boolean
    • isOWL

      public boolean isOWL()
      Answers true if this format-type is provided by OWL-API.
      Returns:
      boolean
    • isJenaOnly

      public boolean isJenaOnly()
      Answers true if this format-type is provided by Apache Jena only, i.e. there is no OWL-API support.
      Returns:
      boolean
    • isOWLOnly

      public boolean isOWLOnly()
      Answers true if this format-type is provided by OWL-API only, i.e. there is no Jena support.
      Returns:
      boolean
    • isXML

      public boolean isXML()
      Answers true if it is an XML format. Currently, there are only two such formats: RDF/XML and OWL/XML.
      Returns:
      true if one of xml formats
    • isJSON

      public boolean isJSON()
      Answers true if it is a JSON format. Currently, there are only two such formats: RDF/JSON and JSONLD.
      Returns:
      true if one of json formats
    • formats

      public static Stream<OntFormat> formats()
      Returns all format-types as stream.
      Returns:
      Stream of formats
    • get

      public static OntFormat get(org.semanticweb.owlapi.model.OWLDocumentFormat format)
      Finds an ONT Format Type by the instance of OWL Docuemnt Format.
      Parameters:
      format - OWLDocumentFormat instance, not null
      Returns:
      OntFormat or null if the format is not described in this integrator
      Throws:
      NullPointerException - in case of null format key identifier
    • get

      public static OntFormat get(Class<? extends org.semanticweb.owlapi.model.OWLDocumentFormat> type)
      Gets OntFormat by the class of OWLDocumentFormat.
      Parameters:
      type - OWL-API Document Format class type, not null
      Returns:
      OntFormat or null
      Throws:
      NullPointerException - in case of wrong argument
    • get

      public static OntFormat get(org.apache.jena.riot.Lang lang)
      Gets OntFormat by the Jena syntax.
      Parameters:
      lang - Jena Lang, not null
      Returns:
      OntFormat or null
    • get

      public static OntFormat get(String id)
      Gets OntFormat by the string identifier.
      Parameters:
      id - String, the id of format, not null
      Returns:
      OntFormat or null
      Throws:
      NullPointerException - in case of wrong argument
      See Also: