-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added format_utilities.py -- see #687
- Loading branch information
Showing
4 changed files
with
82 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
""" | ||
Utilities for working with formats | ||
See https://github.com/INCATools/ontology-access-kit/issues/687 | ||
""" | ||
from enum import Enum | ||
|
||
|
||
class OntologyModel(str, Enum): | ||
""" | ||
Enumerated types for ontology models. | ||
A model is an abstract representation of an ontology that is potentially | ||
serializable in multiple syntaxes. | ||
""" | ||
|
||
OWL = "owl" | ||
"""W3C OWL2 Ontology Model""" | ||
|
||
SKOS = "skos" | ||
"""W3C SKOS Ontology Model""" | ||
|
||
SDO_RDFS = "sdo_rdfs" | ||
"""Schema.org RDFS Ontology Model""" | ||
|
||
OBOFORMAT = "oboformat" | ||
"""OBO Format Ontology Model. Always serialized as obo format""" | ||
|
||
OBOGRAPHS = "obographs" | ||
"""OBO Graphs Ontology Model""" | ||
|
||
|
||
MODEL_ALLOWED_SYNTAXES = { | ||
OntologyModel.OWL: [ | ||
"ttl", | ||
"rdfxml", | ||
"n3", | ||
"nt", | ||
"pretty-xml", | ||
"trix", | ||
"trig", | ||
"ofn", | ||
"owx", | ||
"omn", | ||
"obo", | ||
], | ||
OntologyModel.SKOS: ["ttl", "rdfxml", "n3", "nt", "pretty-xml", "trix", "trig"], | ||
OntologyModel.OBOFORMAT: ["obo"], | ||
OntologyModel.OBOGRAPHS: ["json", "yaml"], | ||
} | ||
|
||
|
||
OBOGRAPHS_SYNTAX_ALIAS_MAP = { | ||
"json": "json", | ||
"obojson": "json", | ||
"yaml": "yaml", | ||
"obograph": "json", | ||
"obographjson": "json", | ||
"obographyaml": "yaml", | ||
} | ||
|
||
|
||
RDFLIB_SYNTAX_ALIAS_MAP = { | ||
"owl": "turtle", | ||
"ttl": "turtle", | ||
"rdfxml": "xml", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters