Package com.github.owlcs.ontapi
Enum Class OntFormat
- All Implemented Interfaces:
Serializable,Comparable<OntFormat>,Constable
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassImplementation ofOWLDocumentFormatattached to this enum-type.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionorg.semanticweb.owlapi.model.OWLDocumentFormatCreates a new instance ofOWLDocumentFormatby this type setting, if possible, with default prefixes.formats()Returns all format-types as stream.static OntFormatGetsOntFormatby the class ofOWLDocumentFormat.static OntFormatGetsOntFormatby the string identifier.static OntFormatget(org.apache.jena.riot.Lang lang) GetsOntFormatby the Jena syntax.static OntFormatget(org.semanticweb.owlapi.model.OWLDocumentFormat format) Finds anONT Format Typeby the instance ofOWL Docuemnt Format.getExt()The primary file extension.getID()Returns the format identifier, which can be considered as syntax short name.org.apache.jena.riot.LanggetLang()Returns the primary jena language (first alias from the list).Chooses the most suitable owl language details container: it should have associated storer and parser factories or at least one of them.booleanisJena()Answerstrueif this format-type is provided by Apache Jena.booleanAnswerstrueif this format-type is provided by Apache Jena only, i.e. there is no OWL-API support.booleanisJSON()Answerstrueif it is a JSON format.booleanisOWL()Answerstrueif this format-type is provided by OWL-API.booleanAnswerstrueif this format-type is provided by OWL-API only, i.e. there is no Jena support.booleanAnswerstrueif this format-type is supported for read operation.booleanReturnstrueif format is good for using by ONT-API without any restrictions both to read and write.booleanAnswerstrueif this format-type is supported for write operation.booleanisXML()Answerstrueif it is an XML format.Stream<org.apache.jena.riot.Lang> Lists all jena languages associated with this type in the form of Stream.owlKeys()Gets all OWL-API language keys associated with this enum-type instance in the form of Stream.owlLangs()Lists all registered OWL-langs in form of Lang-Details Stream.static OntFormatReturns the enum constant of this class with the specified name.static OntFormat[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TURTLE
-
RDF_XML
-
RDF_JSON
-
JSON_LD
-
NTRIPLES
-
NQUADS
-
TRIG
-
TRIX
-
RDF_THRIFT
-
CSV
-
TSV
-
OWL_XML
-
MANCHESTER_SYNTAX
-
FUNCTIONAL_SYNTAX
-
BINARY_RDF
-
RDFA
-
OBO
-
KRSS
-
KRSS2
-
DL
-
DL_HTML
-
LATEX
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
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
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 Langornull- See Also:
-
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
Chooses the most suitable owl language details container: it should have associated storer and parser factories or at least one of them.- Returns:
OWLLangRegistry.OWLLangornull- See Also:
-
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
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 ofOWLDocumentFormatby this type setting, if possible, with default prefixes. If there is no a ready-to-use owl-document-format factory in the system, then aOntFormat.SimpleDocumentFormat'fake' format backed by this type is returned. Note: default prefixes includeowl,rdf,rdfsandxsd, the prefixxmlis not included as illegal and useless.- Returns:
OWLDocumentFormat, nonull- Throws:
OntApiException- if something wrong
-
isSupported
public boolean isSupported()Returnstrueif 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 nostorer factoryin OWL-API 5.1.4 supply). - LATEX (OWL-API lang:
OWLLangRegistry.LangKey.LATEX) is available only for writing (it has noparser factoryin OWL-API 5.1.4 supply). - DL_HTML (OWL-API lang:
OWLLangRegistry.LangKey.DLSYNTAXHTML) is available only for writing (it has noparser factoryin 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.
@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:
- CSV (Jena lang:
-
isReadSupported
public boolean isReadSupported()Answerstrueif this format-type is supported for read operation.- Returns:
trueif reading is possible through OWL-API or Jena- See Also:
-
isWriteSupported
public boolean isWriteSupported()Answerstrueif this format-type is supported for write operation.- Returns:
trueif writing is possible through OWL-API or Jena- See Also:
-
isJena
public boolean isJena()Answerstrueif this format-type is provided by Apache Jena.- Returns:
- boolean
-
isOWL
public boolean isOWL()Answerstrueif this format-type is provided by OWL-API.- Returns:
- boolean
-
isJenaOnly
public boolean isJenaOnly()Answerstrueif this format-type is provided by Apache Jena only, i.e. there is no OWL-API support.- Returns:
- boolean
-
isOWLOnly
public boolean isOWLOnly()Answerstrueif this format-type is provided by OWL-API only, i.e. there is no Jena support.- Returns:
- boolean
-
isXML
public boolean isXML()Answerstrueif it is an XML format. Currently, there are only two such formats:RDF/XMLandOWL/XML.- Returns:
trueif one of xml formats
-
isJSON
public boolean isJSON()Answerstrueif it is a JSON format. Currently, there are only two such formats:RDF/JSONandJSONLD.- Returns:
trueif one of json formats
-
formats
Returns all format-types as stream.- Returns:
- Stream of formats
-
get
Finds anONT Format Typeby the instance ofOWL Docuemnt Format.- Parameters:
format-OWLDocumentFormatinstance, notnull- Returns:
OntFormatornullif the format is not described in this integrator- Throws:
NullPointerException- in case of null format key identifier
-
get
GetsOntFormatby the class ofOWLDocumentFormat.- Parameters:
type-OWL-API Document Formatclass type, notnull- Returns:
OntFormatornull- Throws:
NullPointerException- in case of wrong argument
-
get
GetsOntFormatby the Jena syntax.- Parameters:
lang-Jena Lang, notnull- Returns:
OntFormatornull
-
get
GetsOntFormatby the string identifier.- Parameters:
id- String, the id of format, notnull- Returns:
OntFormatornull- Throws:
NullPointerException- in case of wrong argument- See Also:
-