From 2f3e320cac68e3424fc112d9cd979f7601918224 Mon Sep 17 00:00:00 2001 From: Chris Mungall Date: Wed, 29 May 2024 13:45:03 -0700 Subject: [PATCH 1/2] fixes #46 --- docs/tutorial/pizza01-toppings-model.yaml | 1 + linkml_owl/dumpers/owl_dumper.py | 18 +- poetry.lock | 340 ++++++++-------------- pyproject.toml | 2 +- tests/inputs/enum_model.yaml | 42 +++ tests/output/chromo.schema.owl.ttl | 230 +++++++-------- tests/test_examples/test_enums.py | 57 ++++ 7 files changed, 344 insertions(+), 346 deletions(-) create mode 100644 tests/inputs/enum_model.yaml create mode 100644 tests/test_examples/test_enums.py diff --git a/docs/tutorial/pizza01-toppings-model.yaml b/docs/tutorial/pizza01-toppings-model.yaml index f52f4de..0dbb4da 100644 --- a/docs/tutorial/pizza01-toppings-model.yaml +++ b/docs/tutorial/pizza01-toppings-model.yaml @@ -27,6 +27,7 @@ classes: slot_uri: rdfs:label conforms_to: name: conforms_to + range: string annotations: owl.fstring: AnnotationAssertion( dcterms:conformsTo {id} pizza:{V} ) slot_uri: dcterms:conformsTo diff --git a/linkml_owl/dumpers/owl_dumper.py b/linkml_owl/dumpers/owl_dumper.py index 84a2233..3191985 100644 --- a/linkml_owl/dumpers/owl_dumper.py +++ b/linkml_owl/dumpers/owl_dumper.py @@ -33,7 +33,7 @@ SubObjectPropertyOf, TransitiveObjectProperty, SymmetricObjectProperty, AsymmetricObjectProperty, \ ReflexiveObjectProperty, IrreflexiveObjectProperty, Annotation, ObjectMinCardinality, ObjectHasValue, \ NamedIndividual, DataSomeValuesFrom, DataHasValue, DataAllValuesFrom, AnnotationProperty, DataProperty, Datatype, \ - DisjointClasses, DisjointUnion + DisjointClasses, DisjointUnion, DataPropertyAssertion from linkml_runtime.dumpers.dumper_root import Dumper from linkml_runtime.utils.yamlutils import YAMLRoot @@ -210,9 +210,15 @@ def transform(self, element: YAMLRoot, schema: SchemaDefinition, is_element_an_o if element is None: return None try: - # translate Enum meaning = element.meaning - return self._get_IRI_str(meaning) + # translate Enum + if is_element_an_object or True: + if not meaning: + enum_uri = schema.default_prefix + ":" + type(element).__name__ + meaning = enum_uri + "#" + str(element).replace(" ", "+") + return self._get_IRI_str(meaning) + else: + return str(element) except AttributeError: pass if not self._instance_of_linkml_class(element): @@ -324,6 +330,8 @@ def transform(self, element: YAMLRoot, schema: SchemaDefinition, is_element_an_o slot_interps = self._get_slot_interpretations(slot, linkml_class_name) logging.debug(f'OWL interpretations for {k}={slot_interps}') is_object_ref = slot.range in self.schema.classes + #if "ObjectPropertyAssertion" in slot_interps or "ObjectProperty" in slot_interps: + # is_object_ref = True # normalize input_vals to a list, then recursively transform if isinstance(v, list): input_vals = v @@ -390,7 +398,7 @@ def transform(self, element: YAMLRoot, schema: SchemaDefinition, is_element_an_o # eai.add_operands((0, SubClassOf.__name__, ObjectUnionOf.__name__), parents, axiom_annotations) axiom_type = None # TODO: make this more generic / less repetitive - axiom_types = [SubClassOf, SubObjectPropertyOf, ClassAssertion, ObjectPropertyAssertion, EquivalentClasses, InverseObjectProperties,ObjectPropertyDomain, ObjectPropertyRange, AnnotationAssertion] + axiom_types = [SubClassOf, SubObjectPropertyOf, ClassAssertion, ObjectPropertyAssertion, DataPropertyAssertion, EquivalentClasses, InverseObjectProperties,ObjectPropertyDomain, ObjectPropertyRange, AnnotationAssertion] for candidate_axiom_type in axiom_types: if candidate_axiom_type.__name__ in slot_interps: axiom_type = candidate_axiom_type @@ -445,6 +453,8 @@ def transform(self, element: YAMLRoot, schema: SchemaDefinition, is_element_an_o axiom = ClassAssertion(parent, subj) elif axiom_type == ObjectPropertyAssertion: axiom = ObjectPropertyAssertion(slot_uri, subj, parent) + elif axiom_type == DataPropertyAssertion: + axiom = DataPropertyAssertion(slot_uri, subj, parent) elif axiom_type == InverseObjectProperties: axiom = InverseObjectProperties(subj, parent) elif axiom_type == ObjectPropertyDomain: diff --git a/poetry.lock b/poetry.lock index c820ed3..4fe6bf5 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,10 +1,9 @@ -# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "annotated-types" version = "0.6.0" description = "Reusable constraint types to use with typing.Annotated" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -19,7 +18,6 @@ typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} name = "antlr4-python3-runtime" version = "4.9.3" description = "ANTLR 4.9.3 runtime for Python 3.7" -category = "main" optional = false python-versions = "*" files = [ @@ -30,7 +28,6 @@ files = [ name = "arrow" version = "1.3.0" description = "Better dates & times for Python" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -44,13 +41,12 @@ types-python-dateutil = ">=2.8.10" [package.extras] doc = ["doc8", "sphinx (>=7.0.0)", "sphinx-autobuild", "sphinx-autodoc-typehints", "sphinx_rtd_theme (>=1.3.0)"] -test = ["dateparser (>=1.0.0,<2.0.0)", "pre-commit", "pytest", "pytest-cov", "pytest-mock", "pytz (==2021.1)", "simplejson (>=3.0.0,<4.0.0)"] +test = ["dateparser (==1.*)", "pre-commit", "pytest", "pytest-cov", "pytest-mock", "pytz (==2021.1)", "simplejson (==3.*)"] [[package]] name = "attrs" version = "23.2.0" description = "Classes Without Boilerplate" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -70,7 +66,6 @@ tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "p name = "bcp47" version = "0.0.4" description = "Language tags made easy" -category = "main" optional = false python-versions = "*" files = [ @@ -82,7 +77,6 @@ files = [ name = "black" version = "24.2.0" description = "The uncompromising code formatter." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -125,23 +119,10 @@ d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] -[[package]] -name = "cachetools" -version = "5.3.3" -description = "Extensible memoizing collections and decorators" -category = "dev" -optional = false -python-versions = ">=3.7" -files = [ - {file = "cachetools-5.3.3-py3-none-any.whl", hash = "sha256:0abad1021d3f8325b2fc1d2e9c8b9c9d57b04c3932657a72465447332c24d945"}, - {file = "cachetools-5.3.3.tar.gz", hash = "sha256:ba29e2dfa0b8b556606f097407ed1aa62080ee108ab0dc5ec9d6a723a007d105"}, -] - [[package]] name = "certifi" version = "2024.2.2" description = "Python package for providing Mozilla's CA Bundle." -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -153,7 +134,6 @@ files = [ name = "cfgraph" version = "0.2.1" description = "rdflib collections flattening graph" -category = "main" optional = false python-versions = "*" files = [ @@ -167,7 +147,6 @@ rdflib = ">=0.4.2" name = "chardet" version = "5.2.0" description = "Universal encoding detector for Python 3" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -179,7 +158,6 @@ files = [ name = "charset-normalizer" version = "3.3.2" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." -category = "main" optional = false python-versions = ">=3.7.0" files = [ @@ -279,7 +257,6 @@ files = [ name = "click" version = "8.1.7" description = "Composable command line interface toolkit" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -294,7 +271,6 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""} name = "colorama" version = "0.4.6" description = "Cross-platform colored terminal text." -category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" files = [ @@ -306,7 +282,6 @@ files = [ name = "coverage" version = "7.4.3" description = "Code coverage measurement for Python" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -374,7 +349,6 @@ toml = ["tomli"] name = "curies" version = "0.7.7" description = "Idiomatic conversion between URIs and compact URIs (CURIEs)." -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -399,7 +373,6 @@ tests = ["coverage", "pytest"] name = "deprecated" version = "1.2.14" description = "Python @deprecated decorator to deprecate old python classes, functions or methods." -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" files = [ @@ -417,7 +390,6 @@ dev = ["PyTest", "PyTest-Cov", "bump2version (<1)", "sphinx (<2)", "tox"] name = "distlib" version = "0.3.8" description = "Distribution utilities" -category = "dev" optional = false python-versions = "*" files = [ @@ -429,7 +401,6 @@ files = [ name = "et-xmlfile" version = "1.1.0" description = "An implementation of lxml.xmlfile for the standard library" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -441,7 +412,6 @@ files = [ name = "exceptiongroup" version = "1.2.0" description = "Backport of PEP 654 (exception groups)" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -456,7 +426,6 @@ test = ["pytest (>=6)"] name = "filelock" version = "3.13.1" description = "A platform independent file lock." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -473,7 +442,6 @@ typing = ["typing-extensions (>=4.8)"] name = "fqdn" version = "1.5.1" description = "Validates fully-qualified domain names against RFC 1123, so that they are acceptable to modern bowsers" -category = "main" optional = false python-versions = ">=2.7, !=3.0, !=3.1, !=3.2, !=3.3, !=3.4, <4" files = [ @@ -485,7 +453,6 @@ files = [ name = "funowl" version = "0.2.3" description = "Python rendering of the OWL Functional syntax" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -505,7 +472,6 @@ rfc3987 = "*" name = "ghp-import" version = "2.1.0" description = "Copy your docs directly to the gh-pages branch." -category = "dev" optional = false python-versions = "*" files = [ @@ -523,7 +489,6 @@ dev = ["flake8", "markdown", "twine", "wheel"] name = "graphviz" version = "0.20.1" description = "Simple Python interface for Graphviz" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -538,81 +503,81 @@ test = ["coverage", "mock (>=4)", "pytest (>=7)", "pytest-cov", "pytest-mock (>= [[package]] name = "greenlet" -version = "3.0.3" +version = "2.0.1" description = "Lightweight in-process concurrent programming" -category = "main" optional = false -python-versions = ">=3.7" -files = [ - {file = "greenlet-3.0.3-cp310-cp310-macosx_11_0_universal2.whl", hash = "sha256:9da2bd29ed9e4f15955dd1595ad7bc9320308a3b766ef7f837e23ad4b4aac31a"}, - {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d353cadd6083fdb056bb46ed07e4340b0869c305c8ca54ef9da3421acbdf6881"}, - {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:dca1e2f3ca00b84a396bc1bce13dd21f680f035314d2379c4160c98153b2059b"}, - {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3ed7fb269f15dc662787f4119ec300ad0702fa1b19d2135a37c2c4de6fadfd4a"}, - {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd4f49ae60e10adbc94b45c0b5e6a179acc1736cf7a90160b404076ee283cf83"}, - {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:73a411ef564e0e097dbe7e866bb2dda0f027e072b04da387282b02c308807405"}, - {file = "greenlet-3.0.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:7f362975f2d179f9e26928c5b517524e89dd48530a0202570d55ad6ca5d8a56f"}, - {file = "greenlet-3.0.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:649dde7de1a5eceb258f9cb00bdf50e978c9db1b996964cd80703614c86495eb"}, - {file = "greenlet-3.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:68834da854554926fbedd38c76e60c4a2e3198c6fbed520b106a8986445caaf9"}, - {file = "greenlet-3.0.3-cp311-cp311-macosx_11_0_universal2.whl", hash = "sha256:b1b5667cced97081bf57b8fa1d6bfca67814b0afd38208d52538316e9422fc61"}, - {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:52f59dd9c96ad2fc0d5724107444f76eb20aaccb675bf825df6435acb7703559"}, - {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:afaff6cf5200befd5cec055b07d1c0a5a06c040fe5ad148abcd11ba6ab9b114e"}, - {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:fe754d231288e1e64323cfad462fcee8f0288654c10bdf4f603a39ed923bef33"}, - {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2797aa5aedac23af156bbb5a6aa2cd3427ada2972c828244eb7d1b9255846379"}, - {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b7f009caad047246ed379e1c4dbcb8b020f0a390667ea74d2387be2998f58a22"}, - {file = "greenlet-3.0.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:c5e1536de2aad7bf62e27baf79225d0d64360d4168cf2e6becb91baf1ed074f3"}, - {file = "greenlet-3.0.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:894393ce10ceac937e56ec00bb71c4c2f8209ad516e96033e4b3b1de270e200d"}, - {file = "greenlet-3.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:1ea188d4f49089fc6fb283845ab18a2518d279c7cd9da1065d7a84e991748728"}, - {file = "greenlet-3.0.3-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:70fb482fdf2c707765ab5f0b6655e9cfcf3780d8d87355a063547b41177599be"}, - {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d4d1ac74f5c0c0524e4a24335350edad7e5f03b9532da7ea4d3c54d527784f2e"}, - {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:149e94a2dd82d19838fe4b2259f1b6b9957d5ba1b25640d2380bea9c5df37676"}, - {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:15d79dd26056573940fcb8c7413d84118086f2ec1a8acdfa854631084393efcc"}, - {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:881b7db1ebff4ba09aaaeae6aa491daeb226c8150fc20e836ad00041bcb11230"}, - {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fcd2469d6a2cf298f198f0487e0a5b1a47a42ca0fa4dfd1b6862c999f018ebbf"}, - {file = "greenlet-3.0.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:1f672519db1796ca0d8753f9e78ec02355e862d0998193038c7073045899f305"}, - {file = "greenlet-3.0.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:2516a9957eed41dd8f1ec0c604f1cdc86758b587d964668b5b196a9db5bfcde6"}, - {file = "greenlet-3.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:bba5387a6975598857d86de9eac14210a49d554a77eb8261cc68b7d082f78ce2"}, - {file = "greenlet-3.0.3-cp37-cp37m-macosx_11_0_universal2.whl", hash = "sha256:5b51e85cb5ceda94e79d019ed36b35386e8c37d22f07d6a751cb659b180d5274"}, - {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:daf3cb43b7cf2ba96d614252ce1684c1bccee6b2183a01328c98d36fcd7d5cb0"}, - {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:99bf650dc5d69546e076f413a87481ee1d2d09aaaaaca058c9251b6d8c14783f"}, - {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2dd6e660effd852586b6a8478a1d244b8dc90ab5b1321751d2ea15deb49ed414"}, - {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e3391d1e16e2a5a1507d83e4a8b100f4ee626e8eca43cf2cadb543de69827c4c"}, - {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e1f145462f1fa6e4a4ae3c0f782e580ce44d57c8f2c7aae1b6fa88c0b2efdb41"}, - {file = "greenlet-3.0.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:1a7191e42732df52cb5f39d3527217e7ab73cae2cb3694d241e18f53d84ea9a7"}, - {file = "greenlet-3.0.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:0448abc479fab28b00cb472d278828b3ccca164531daab4e970a0458786055d6"}, - {file = "greenlet-3.0.3-cp37-cp37m-win32.whl", hash = "sha256:b542be2440edc2d48547b5923c408cbe0fc94afb9f18741faa6ae970dbcb9b6d"}, - {file = "greenlet-3.0.3-cp37-cp37m-win_amd64.whl", hash = "sha256:01bc7ea167cf943b4c802068e178bbf70ae2e8c080467070d01bfa02f337ee67"}, - {file = "greenlet-3.0.3-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:1996cb9306c8595335bb157d133daf5cf9f693ef413e7673cb07e3e5871379ca"}, - {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3ddc0f794e6ad661e321caa8d2f0a55ce01213c74722587256fb6566049a8b04"}, - {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c9db1c18f0eaad2f804728c67d6c610778456e3e1cc4ab4bbd5eeb8e6053c6fc"}, - {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7170375bcc99f1a2fbd9c306f5be8764eaf3ac6b5cb968862cad4c7057756506"}, - {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6b66c9c1e7ccabad3a7d037b2bcb740122a7b17a53734b7d72a344ce39882a1b"}, - {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:098d86f528c855ead3479afe84b49242e174ed262456c342d70fc7f972bc13c4"}, - {file = "greenlet-3.0.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:81bb9c6d52e8321f09c3d165b2a78c680506d9af285bfccbad9fb7ad5a5da3e5"}, - {file = "greenlet-3.0.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:fd096eb7ffef17c456cfa587523c5f92321ae02427ff955bebe9e3c63bc9f0da"}, - {file = "greenlet-3.0.3-cp38-cp38-win32.whl", hash = "sha256:d46677c85c5ba00a9cb6f7a00b2bfa6f812192d2c9f7d9c4f6a55b60216712f3"}, - {file = "greenlet-3.0.3-cp38-cp38-win_amd64.whl", hash = "sha256:419b386f84949bf0e7c73e6032e3457b82a787c1ab4a0e43732898a761cc9dbf"}, - {file = "greenlet-3.0.3-cp39-cp39-macosx_11_0_universal2.whl", hash = "sha256:da70d4d51c8b306bb7a031d5cff6cc25ad253affe89b70352af5f1cb68e74b53"}, - {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:086152f8fbc5955df88382e8a75984e2bb1c892ad2e3c80a2508954e52295257"}, - {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d73a9fe764d77f87f8ec26a0c85144d6a951a6c438dfe50487df5595c6373eac"}, - {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b7dcbe92cc99f08c8dd11f930de4d99ef756c3591a5377d1d9cd7dd5e896da71"}, - {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1551a8195c0d4a68fac7a4325efac0d541b48def35feb49d803674ac32582f61"}, - {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:64d7675ad83578e3fc149b617a444fab8efdafc9385471f868eb5ff83e446b8b"}, - {file = "greenlet-3.0.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:b37eef18ea55f2ffd8f00ff8fe7c8d3818abd3e25fb73fae2ca3b672e333a7a6"}, - {file = "greenlet-3.0.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:77457465d89b8263bca14759d7c1684df840b6811b2499838cc5b040a8b5b113"}, - {file = "greenlet-3.0.3-cp39-cp39-win32.whl", hash = "sha256:57e8974f23e47dac22b83436bdcf23080ade568ce77df33159e019d161ce1d1e"}, - {file = "greenlet-3.0.3-cp39-cp39-win_amd64.whl", hash = "sha256:c5ee858cfe08f34712f548c3c363e807e7186f03ad7a5039ebadb29e8c6be067"}, - {file = "greenlet-3.0.3.tar.gz", hash = "sha256:43374442353259554ce33599da8b692d5aa96f8976d567d4badf263371fbe491"}, +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" +files = [ + {file = "greenlet-2.0.1-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:9ed358312e63bf683b9ef22c8e442ef6c5c02973f0c2a939ec1d7b50c974015c"}, + {file = "greenlet-2.0.1-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:4f09b0010e55bec3239278f642a8a506b91034f03a4fb28289a7d448a67f1515"}, + {file = "greenlet-2.0.1-cp27-cp27m-win32.whl", hash = "sha256:1407fe45246632d0ffb7a3f4a520ba4e6051fc2cbd61ba1f806900c27f47706a"}, + {file = "greenlet-2.0.1-cp27-cp27m-win_amd64.whl", hash = "sha256:3001d00eba6bbf084ae60ec7f4bb8ed375748f53aeaefaf2a37d9f0370558524"}, + {file = "greenlet-2.0.1-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:d566b82e92ff2e09dd6342df7e0eb4ff6275a3f08db284888dcd98134dbd4243"}, + {file = "greenlet-2.0.1-cp310-cp310-macosx_10_15_x86_64.whl", hash = "sha256:0722c9be0797f544a3ed212569ca3fe3d9d1a1b13942d10dd6f0e8601e484d26"}, + {file = "greenlet-2.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4d37990425b4687ade27810e3b1a1c37825d242ebc275066cfee8cb6b8829ccd"}, + {file = "greenlet-2.0.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:be35822f35f99dcc48152c9839d0171a06186f2d71ef76dc57fa556cc9bf6b45"}, + {file = "greenlet-2.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c140e7eb5ce47249668056edf3b7e9900c6a2e22fb0eaf0513f18a1b2c14e1da"}, + {file = "greenlet-2.0.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d21681f09e297a5adaa73060737e3aa1279a13ecdcfcc6ef66c292cb25125b2d"}, + {file = "greenlet-2.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fb412b7db83fe56847df9c47b6fe3f13911b06339c2aa02dcc09dce8bbf582cd"}, + {file = "greenlet-2.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:c6a08799e9e88052221adca55741bf106ec7ea0710bca635c208b751f0d5b617"}, + {file = "greenlet-2.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9e112e03d37987d7b90c1e98ba5e1b59e1645226d78d73282f45b326f7bddcb9"}, + {file = "greenlet-2.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:56961cfca7da2fdd178f95ca407fa330c64f33289e1804b592a77d5593d9bd94"}, + {file = "greenlet-2.0.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:13ba6e8e326e2116c954074c994da14954982ba2795aebb881c07ac5d093a58a"}, + {file = "greenlet-2.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1bf633a50cc93ed17e494015897361010fc08700d92676c87931d3ea464123ce"}, + {file = "greenlet-2.0.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:9f2c221eecb7ead00b8e3ddb913c67f75cba078fd1d326053225a3f59d850d72"}, + {file = "greenlet-2.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:13ebf93c343dd8bd010cd98e617cb4c1c1f352a0cf2524c82d3814154116aa82"}, + {file = "greenlet-2.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:6f61d71bbc9b4a3de768371b210d906726535d6ca43506737682caa754b956cd"}, + {file = "greenlet-2.0.1-cp35-cp35m-macosx_10_14_x86_64.whl", hash = "sha256:2d0bac0385d2b43a7bd1d651621a4e0f1380abc63d6fb1012213a401cbd5bf8f"}, + {file = "greenlet-2.0.1-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:f6327b6907b4cb72f650a5b7b1be23a2aab395017aa6f1adb13069d66360eb3f"}, + {file = "greenlet-2.0.1-cp35-cp35m-win32.whl", hash = "sha256:81b0ea3715bf6a848d6f7149d25bf018fd24554a4be01fcbbe3fdc78e890b955"}, + {file = "greenlet-2.0.1-cp35-cp35m-win_amd64.whl", hash = "sha256:38255a3f1e8942573b067510f9611fc9e38196077b0c8eb7a8c795e105f9ce77"}, + {file = "greenlet-2.0.1-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:04957dc96669be041e0c260964cfef4c77287f07c40452e61abe19d647505581"}, + {file = "greenlet-2.0.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:4aeaebcd91d9fee9aa768c1b39cb12214b30bf36d2b7370505a9f2165fedd8d9"}, + {file = "greenlet-2.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:974a39bdb8c90a85982cdb78a103a32e0b1be986d411303064b28a80611f6e51"}, + {file = "greenlet-2.0.1-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8dca09dedf1bd8684767bc736cc20c97c29bc0c04c413e3276e0962cd7aeb148"}, + {file = "greenlet-2.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a4c0757db9bd08470ff8277791795e70d0bf035a011a528ee9a5ce9454b6cba2"}, + {file = "greenlet-2.0.1-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:5067920de254f1a2dee8d3d9d7e4e03718e8fd2d2d9db962c8c9fa781ae82a39"}, + {file = "greenlet-2.0.1-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:5a8e05057fab2a365c81abc696cb753da7549d20266e8511eb6c9d9f72fe3e92"}, + {file = "greenlet-2.0.1-cp36-cp36m-win32.whl", hash = "sha256:3d75b8d013086b08e801fbbb896f7d5c9e6ccd44f13a9241d2bf7c0df9eda928"}, + {file = "greenlet-2.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:097e3dae69321e9100202fc62977f687454cd0ea147d0fd5a766e57450c569fd"}, + {file = "greenlet-2.0.1-cp37-cp37m-macosx_10_15_x86_64.whl", hash = "sha256:cb242fc2cda5a307a7698c93173d3627a2a90d00507bccf5bc228851e8304963"}, + {file = "greenlet-2.0.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:72b00a8e7c25dcea5946692a2485b1a0c0661ed93ecfedfa9b6687bd89a24ef5"}, + {file = "greenlet-2.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d5b0ff9878333823226d270417f24f4d06f235cb3e54d1103b71ea537a6a86ce"}, + {file = "greenlet-2.0.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:be9e0fb2ada7e5124f5282d6381903183ecc73ea019568d6d63d33f25b2a9000"}, + {file = "greenlet-2.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0b493db84d124805865adc587532ebad30efa68f79ad68f11b336e0a51ec86c2"}, + {file = "greenlet-2.0.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:0459d94f73265744fee4c2d5ec44c6f34aa8a31017e6e9de770f7bcf29710be9"}, + {file = "greenlet-2.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:a20d33124935d27b80e6fdacbd34205732660e0a1d35d8b10b3328179a2b51a1"}, + {file = "greenlet-2.0.1-cp37-cp37m-win32.whl", hash = "sha256:ea688d11707d30e212e0110a1aac7f7f3f542a259235d396f88be68b649e47d1"}, + {file = "greenlet-2.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:afe07421c969e259e9403c3bb658968702bc3b78ec0b6fde3ae1e73440529c23"}, + {file = "greenlet-2.0.1-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:cd4ccc364cf75d1422e66e247e52a93da6a9b73cefa8cad696f3cbbb75af179d"}, + {file = "greenlet-2.0.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:4c8b1c43e75c42a6cafcc71defa9e01ead39ae80bd733a2608b297412beede68"}, + {file = "greenlet-2.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:659f167f419a4609bc0516fb18ea69ed39dbb25594934bd2dd4d0401660e8a1e"}, + {file = "greenlet-2.0.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:356e4519d4dfa766d50ecc498544b44c0249b6de66426041d7f8b751de4d6b48"}, + {file = "greenlet-2.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:811e1d37d60b47cb8126e0a929b58c046251f28117cb16fcd371eed61f66b764"}, + {file = "greenlet-2.0.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:d38ffd0e81ba8ef347d2be0772e899c289b59ff150ebbbbe05dc61b1246eb4e0"}, + {file = "greenlet-2.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:0109af1138afbfb8ae647e31a2b1ab030f58b21dd8528c27beaeb0093b7938a9"}, + {file = "greenlet-2.0.1-cp38-cp38-win32.whl", hash = "sha256:88c8d517e78acdf7df8a2134a3c4b964415b575d2840a2746ddb1cc6175f8608"}, + {file = "greenlet-2.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:d6ee1aa7ab36475035eb48c01efae87d37936a8173fc4d7b10bb02c2d75dd8f6"}, + {file = "greenlet-2.0.1-cp39-cp39-macosx_10_15_x86_64.whl", hash = "sha256:b1992ba9d4780d9af9726bbcef6a1db12d9ab1ccc35e5773685a24b7fb2758eb"}, + {file = "greenlet-2.0.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:b5e83e4de81dcc9425598d9469a624826a0b1211380ac444c7c791d4a2137c19"}, + {file = "greenlet-2.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:505138d4fa69462447a562a7c2ef723c6025ba12ac04478bc1ce2fcc279a2db5"}, + {file = "greenlet-2.0.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cce1e90dd302f45716a7715517c6aa0468af0bf38e814ad4eab58e88fc09f7f7"}, + {file = "greenlet-2.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9e9744c657d896c7b580455e739899e492a4a452e2dd4d2b3e459f6b244a638d"}, + {file = "greenlet-2.0.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:662e8f7cad915ba75d8017b3e601afc01ef20deeeabf281bd00369de196d7726"}, + {file = "greenlet-2.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:41b825d65f31e394b523c84db84f9383a2f7eefc13d987f308f4663794d2687e"}, + {file = "greenlet-2.0.1-cp39-cp39-win32.whl", hash = "sha256:db38f80540083ea33bdab614a9d28bcec4b54daa5aff1668d7827a9fc769ae0a"}, + {file = "greenlet-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:b23d2a46d53210b498e5b701a1913697671988f4bf8e10f935433f6e7c332fb6"}, + {file = "greenlet-2.0.1.tar.gz", hash = "sha256:42e602564460da0e8ee67cb6d7236363ee5e131aa15943b6670e44e5c2ed0f67"}, ] [package.extras] -docs = ["Sphinx", "furo"] -test = ["objgraph", "psutil"] +docs = ["Sphinx", "docutils (<0.18)"] +test = ["faulthandler", "objgraph", "psutil"] [[package]] name = "hbreader" version = "0.9.1" description = "Honey Badger reader - a generic file/url/string open and read tool" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -624,7 +589,6 @@ files = [ name = "idna" version = "3.6" description = "Internationalized Domain Names in Applications (IDNA)" -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -636,7 +600,6 @@ files = [ name = "importlib-metadata" version = "7.0.1" description = "Read metadata from Python packages" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -656,7 +619,6 @@ testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs name = "importlib-resources" version = "6.1.2" description = "Read resources from Python packages" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -675,7 +637,6 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-ena name = "iniconfig" version = "2.0.0" description = "brain-dead simple config-ini parsing" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -687,7 +648,6 @@ files = [ name = "isodate" version = "0.6.1" description = "An ISO 8601 date/time/duration parser and formatter" -category = "main" optional = false python-versions = "*" files = [ @@ -702,7 +662,6 @@ six = "*" name = "isoduration" version = "20.11.0" description = "Operations with ISO 8601 durations" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -717,7 +676,6 @@ arrow = ">=0.15.0" name = "jinja2" version = "3.1.3" description = "A very fast and expressive template engine." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -735,7 +693,6 @@ i18n = ["Babel (>=2.7)"] name = "json-flattener" version = "0.1.9" description = "Python library for denormalizing nested dicts or json objects to tables and back" -category = "main" optional = false python-versions = ">=3.7.0" files = [ @@ -751,7 +708,6 @@ pyyaml = "*" name = "jsonasobj" version = "1.3.1" description = "JSON as python objects" -category = "main" optional = false python-versions = "*" files = [ @@ -763,7 +719,6 @@ files = [ name = "jsonasobj2" version = "1.0.4" description = "JSON as python objects - version 2" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -778,7 +733,6 @@ hbreader = "*" name = "jsonpatch" version = "1.33" description = "Apply JSON-Patches (RFC 6902)" -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*" files = [ @@ -793,7 +747,6 @@ jsonpointer = ">=1.9" name = "jsonpath-ng" version = "1.6.1" description = "A final implementation of JSONPath for Python that aims to be standard compliant, including arithmetic and binary comparison operators and providing clear AST for metaprogramming." -category = "main" optional = false python-versions = "*" files = [ @@ -808,7 +761,6 @@ ply = "*" name = "jsonpointer" version = "2.4" description = "Identify specific nodes in a JSON document (RFC 6901)" -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*" files = [ @@ -820,7 +772,6 @@ files = [ name = "jsonschema" version = "4.21.1" description = "An implementation of JSON Schema validation for Python" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -852,7 +803,6 @@ format-nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339- name = "jsonschema-specifications" version = "2023.12.1" description = "The JSON Schema meta-schemas and vocabularies, exposed as a Registry" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -866,14 +816,13 @@ referencing = ">=0.31.0" [[package]] name = "linkml" -version = "1.7.4" +version = "1.7.10" description = "Linked Open Data Modeling Language" -category = "main" optional = false -python-versions = ">=3.8.1,<4.0.0" +python-versions = "<4.0.0,>=3.8.1" files = [ - {file = "linkml-1.7.4-py3-none-any.whl", hash = "sha256:087bdeaf0be62163c7af888ca6e5f23eb93bc2e0757054a8fc83a8b7463de8f1"}, - {file = "linkml-1.7.4.tar.gz", hash = "sha256:65236dac7e5a4a41600261adf8be1d4073baba9664460f334bc958f8bb538f94"}, + {file = "linkml-1.7.10-py3-none-any.whl", hash = "sha256:bf21cce814e9d1509489f1e6e15a7e86e4f11d949490d9a7a5c3f6b5b412ec62"}, + {file = "linkml-1.7.10.tar.gz", hash = "sha256:1c38601c3cd495e34490b8cf7277fd3674ec68dcbe9f5efcec2658093801ce91"}, ] [package.dependencies] @@ -886,11 +835,11 @@ jinja2 = ">=3.1.0" jsonasobj2 = ">=1.0.3,<2.0.0" jsonschema = {version = ">=4.0.0", extras = ["format"]} linkml-dataops = "*" -linkml-runtime = ">=1.7.0" +linkml-runtime = ">=1.7.4" openpyxl = "*" parse = "*" prefixcommons = ">=0.1.7" -prefixmaps = ">=0.1.3" +prefixmaps = ">=0.2.2" pydantic = ">=1.0.0,<3.0.0" pyjsg = ">=0.11.6" pyshex = ">=0.7.20" @@ -900,13 +849,18 @@ pyyaml = "*" rdflib = ">=6.0.0" requests = ">=2.22" sqlalchemy = ">=1.4.31" +typing-extensions = {version = ">=4.4.0", markers = "python_version < \"3.9\""} watchdog = ">=0.9.0" +[package.extras] +black = ["black (>=24.0.0)"] +shacl = ["pyshacl (>=0.25.0,<0.26.0)"] +tests = ["black (>=24.0.0)", "pyshacl (>=0.25.0,<0.26.0)"] + [[package]] name = "linkml-dataops" version = "0.1.0" description = "LinkML Data Operations API" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -923,14 +877,13 @@ linkml-runtime = ">=1.1.6" [[package]] name = "linkml-runtime" -version = "1.7.2" +version = "1.7.5" description = "Runtime environment for LinkML, the Linked open data modeling language" -category = "main" optional = false -python-versions = ">=3.8,<4.0" +python-versions = "<4.0,>=3.8" files = [ - {file = "linkml_runtime-1.7.2-py3-none-any.whl", hash = "sha256:45087530e6c89ec426be0e07a2b936f1b8f72f95caa9e8be347aeb934bf96e57"}, - {file = "linkml_runtime-1.7.2.tar.gz", hash = "sha256:216f5b6511ae1b11a5ba1a69f19fb729c06bc5bdbf7232ffd3149b2e03e1604c"}, + {file = "linkml_runtime-1.7.5-py3-none-any.whl", hash = "sha256:c58000c7c68fa97b7d76c50421a85a64e25f07eec5bcac464bc00c4cd79007a6"}, + {file = "linkml_runtime-1.7.5.tar.gz", hash = "sha256:b31197a5398359441ae1ed43470c54377a1d08db961366dda670300dddcd71d7"}, ] [package.dependencies] @@ -952,7 +905,6 @@ requests = "*" name = "markdown" version = "3.5.2" description = "Python implementation of John Gruber's Markdown." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -971,7 +923,6 @@ testing = ["coverage", "pyyaml"] name = "markupsafe" version = "2.1.5" description = "Safely add untrusted strings to HTML/XML markup." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1041,7 +992,6 @@ files = [ name = "mergedeep" version = "1.3.4" description = "A deep merge function for 🐍." -category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -1053,7 +1003,6 @@ files = [ name = "mkdocs" version = "1.5.3" description = "Project documentation with Markdown." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1085,7 +1034,6 @@ min-versions = ["babel (==2.9.0)", "click (==7.0)", "colorama (==0.4)", "ghp-imp name = "mypy-extensions" version = "1.0.0" description = "Type system extensions for programs checked with the mypy type checker." -category = "dev" optional = false python-versions = ">=3.5" files = [ @@ -1097,7 +1045,6 @@ files = [ name = "openpyxl" version = "3.1.2" description = "A Python library to read/write Excel 2010 xlsx/xlsm files" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -1112,7 +1059,6 @@ et-xmlfile = "*" name = "packaging" version = "23.2" description = "Core utilities for Python packages" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1124,7 +1070,6 @@ files = [ name = "parse" version = "1.20.1" description = "parse() is the opposite of format()" -category = "main" optional = false python-versions = "*" files = [ @@ -1136,7 +1081,6 @@ files = [ name = "pathspec" version = "0.12.1" description = "Utility library for gitignore style pattern matching of file paths." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -1148,7 +1092,6 @@ files = [ name = "pkgutil-resolve-name" version = "1.3.10" description = "Resolve a name to an object." -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -1160,7 +1103,6 @@ files = [ name = "platformdirs" version = "4.2.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -1176,7 +1118,6 @@ test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest- name = "pluggy" version = "1.4.0" description = "plugin and hook calling mechanisms for python" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -1192,7 +1133,6 @@ testing = ["pytest", "pytest-benchmark"] name = "ply" version = "3.11" description = "Python Lex & Yacc" -category = "main" optional = false python-versions = "*" files = [ @@ -1204,7 +1144,6 @@ files = [ name = "prefixcommons" version = "0.1.12" description = "A python API for working with ID prefixes" -category = "main" optional = false python-versions = ">=3.7,<4.0" files = [ @@ -1220,25 +1159,34 @@ requests = ">=2.28.1,<3.0.0" [[package]] name = "prefixmaps" -version = "0.2.2" +version = "0.2.4" description = "A python library for retrieving semantic prefix maps" -category = "main" optional = false -python-versions = ">=3.8,<4.0" +python-versions = "<4.0,>=3.8" files = [ - {file = "prefixmaps-0.2.2-py3-none-any.whl", hash = "sha256:4ac2bf3ddb9b27c40c978cf937e9bedb160050d24e8c679b94c9c885e1d73c72"}, - {file = "prefixmaps-0.2.2.tar.gz", hash = "sha256:a36b1554154ef465271bde82dc91cd671e2d31dc1f50c2fd08ccb0d7d5791c33"}, + {file = "prefixmaps-0.2.4-py3-none-any.whl", hash = "sha256:89bf0e6fb08c276f754f9624c42adf2e87c64ee92a3dde1f7eff01f22d85b512"}, + {file = "prefixmaps-0.2.4.tar.gz", hash = "sha256:ae86a1b31189d0516d199756d5808f75f44b39e86546c356cc78c0fe8d2078af"}, ] [package.dependencies] curies = ">=0.5.3" pyyaml = ">=5.3.1" +[[package]] +name = "py" +version = "1.11.0" +description = "library with cross-python path, ini-parsing, io, code, log facilities" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +files = [ + {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, + {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, +] + [[package]] name = "pydantic" version = "2.6.2" description = "Data validation using Python type hints" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -1258,7 +1206,6 @@ email = ["email-validator (>=2.0.0)"] name = "pydantic-core" version = "2.16.3" description = "" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -1350,7 +1297,6 @@ typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" name = "pyjsg" version = "0.11.10" description = "Python JSON Schema Grammar interpreter" -category = "main" optional = false python-versions = "*" files = [ @@ -1366,7 +1312,6 @@ jsonasobj = ">=1.2.1" name = "pyparsing" version = "3.1.1" description = "pyparsing module - Classes and methods to define and execute parsing grammars" -category = "main" optional = false python-versions = ">=3.6.8" files = [ @@ -1377,31 +1322,10 @@ files = [ [package.extras] diagrams = ["jinja2", "railroad-diagrams"] -[[package]] -name = "pyproject-api" -version = "1.6.1" -description = "API to interact with the python pyproject.toml based projects" -category = "dev" -optional = false -python-versions = ">=3.8" -files = [ - {file = "pyproject_api-1.6.1-py3-none-any.whl", hash = "sha256:4c0116d60476b0786c88692cf4e325a9814965e2469c5998b830bba16b183675"}, - {file = "pyproject_api-1.6.1.tar.gz", hash = "sha256:1817dc018adc0d1ff9ca1ed8c60e1623d5aaca40814b953af14a9cf9a5cae538"}, -] - -[package.dependencies] -packaging = ">=23.1" -tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""} - -[package.extras] -docs = ["furo (>=2023.8.19)", "sphinx (<7.2)", "sphinx-autodoc-typehints (>=1.24)"] -testing = ["covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)", "setuptools (>=68.1.2)", "wheel (>=0.41.2)"] - [[package]] name = "pyshex" version = "0.8.1" description = "Python ShEx Implementation" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -1424,7 +1348,6 @@ urllib3 = "*" name = "pyshexc" version = "0.9.1" description = "PyShExC - Python ShEx compiler" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1444,7 +1367,6 @@ shexjsg = ">=0.8.1" name = "pytest" version = "8.0.2" description = "pytest: simple powerful testing with Python" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -1467,7 +1389,6 @@ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "no name = "pytest-cov" version = "4.1.0" description = "Pytest plugin for measuring coverage." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1486,7 +1407,6 @@ testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtuale name = "pytest-logging" version = "2015.11.4" description = "Configures logging and allows tweaking the log level with a py.test flag" -category = "main" optional = false python-versions = "*" files = [ @@ -1500,7 +1420,6 @@ pytest = ">=2.8.1" name = "python-dateutil" version = "2.8.2" description = "Extensions to the standard Python datetime module" -category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" files = [ @@ -1515,10 +1434,10 @@ six = ">=1.5" name = "pytrie" version = "0.4.0" description = "A pure Python implementation of the trie data structure." -category = "main" optional = false python-versions = "*" files = [ + {file = "PyTrie-0.4.0-py3-none-any.whl", hash = "sha256:f687c224ee8c66cda8e8628a903011b692635ffbb08d4b39c5f92b18eb78c950"}, {file = "PyTrie-0.4.0.tar.gz", hash = "sha256:8f4488f402d3465993fb6b6efa09866849ed8cda7903b50647b7d0342b805379"}, ] @@ -1529,7 +1448,6 @@ sortedcontainers = "*" name = "pyyaml" version = "6.0.1" description = "YAML parser and emitter for Python" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -1590,7 +1508,6 @@ files = [ name = "pyyaml-env-tag" version = "0.1" description = "A custom YAML tag for referencing environment variables in YAML files. " -category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -1605,7 +1522,6 @@ pyyaml = "*" name = "rdflib" version = "7.0.0" description = "RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information." -category = "main" optional = false python-versions = ">=3.8.1,<4.0.0" files = [ @@ -1627,7 +1543,6 @@ networkx = ["networkx (>=2.0.0,<3.0.0)"] name = "rdflib-jsonld" version = "0.6.1" description = "rdflib extension adding JSON-LD parser and serializer" -category = "main" optional = false python-versions = "*" files = [ @@ -1642,7 +1557,6 @@ rdflib = ">=5.0.0" name = "rdflib-shim" version = "1.0.3" description = "Shim for rdflib 5 and 6 incompatibilities" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1658,7 +1572,6 @@ rdflib-jsonld = "0.6.1" name = "referencing" version = "0.33.0" description = "JSON Referencing + Python" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -1674,7 +1587,6 @@ rpds-py = ">=0.7.0" name = "requests" version = "2.31.0" description = "Python HTTP for Humans." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1696,7 +1608,6 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] name = "rfc3339-validator" version = "0.1.4" description = "A pure python RFC3339 validator" -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" files = [ @@ -1711,7 +1622,6 @@ six = "*" name = "rfc3987" version = "1.3.8" description = "Parsing and validation of URIs (RFC 3986) and IRIs (RFC 3987)" -category = "main" optional = false python-versions = "*" files = [ @@ -1723,7 +1633,6 @@ files = [ name = "rpds-py" version = "0.18.0" description = "Python bindings to Rust's persistent data structures (rpds)" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -1832,7 +1741,6 @@ files = [ name = "ruamel-yaml" version = "0.18.6" description = "ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1851,7 +1759,6 @@ jinja2 = ["ruamel.yaml.jinja2 (>=0.2)"] name = "ruamel-yaml-clib" version = "0.2.8" description = "C version of reader, parser and emitter for ruamel.yaml derived from libyaml" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -1911,7 +1818,6 @@ files = [ name = "shexjsg" version = "0.8.2" description = "ShExJSG - Astract Syntax Tree for the ShEx 2.0 language" -category = "main" optional = false python-versions = "*" files = [ @@ -1926,7 +1832,6 @@ pyjsg = ">=0.11.10" name = "six" version = "1.16.0" description = "Python 2 and 3 compatibility utilities" -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" files = [ @@ -1938,7 +1843,6 @@ files = [ name = "sortedcontainers" version = "2.4.0" description = "Sorted Containers -- Sorted List, Sorted Dict, Sorted Set" -category = "main" optional = false python-versions = "*" files = [ @@ -1950,7 +1854,6 @@ files = [ name = "sparqlslurper" version = "0.5.1" description = "SPARQL Slurper for rdflib" -category = "main" optional = false python-versions = ">=3.7.4" files = [ @@ -1967,7 +1870,6 @@ sparqlwrapper = ">=1.8.2" name = "sparqlwrapper" version = "2.0.0" description = "SPARQL Endpoint interface to Python" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1988,7 +1890,6 @@ pandas = ["pandas (>=1.3.5)"] name = "sqlalchemy" version = "2.0.27" description = "Database Abstraction Library" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2076,7 +1977,6 @@ sqlcipher = ["sqlcipher3_binary"] name = "tomli" version = "2.0.1" description = "A lil' TOML parser" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2086,37 +1986,33 @@ files = [ [[package]] name = "tox" -version = "4.13.0" +version = "3.28.0" description = "tox is a generic virtualenv management and test command line tool" -category = "dev" optional = false -python-versions = ">=3.8" +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" files = [ - {file = "tox-4.13.0-py3-none-any.whl", hash = "sha256:1143c7e2489c68026a55d3d4ae84c02c449f073b28e62f80e3e440a3b72a4afa"}, - {file = "tox-4.13.0.tar.gz", hash = "sha256:dd789a554c16c4b532924ba393c92fc8991323c4b3d466712bfecc8c9b9f24f7"}, + {file = "tox-3.28.0-py2.py3-none-any.whl", hash = "sha256:57b5ab7e8bb3074edc3c0c0b4b192a4f3799d3723b2c5b76f1fa9f2d40316eea"}, + {file = "tox-3.28.0.tar.gz", hash = "sha256:d0d28f3fe6d6d7195c27f8b054c3e99d5451952b54abdae673b71609a581f640"}, ] [package.dependencies] -cachetools = ">=5.3.2" -chardet = ">=5.2" -colorama = ">=0.4.6" -filelock = ">=3.13.1" -packaging = ">=23.2" -platformdirs = ">=4.1" -pluggy = ">=1.3" -pyproject-api = ">=1.6.1" -tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""} -virtualenv = ">=20.25" +colorama = {version = ">=0.4.1", markers = "platform_system == \"Windows\""} +filelock = ">=3.0.0" +packaging = ">=14" +pluggy = ">=0.12.0" +py = ">=1.4.17" +six = ">=1.14.0" +tomli = {version = ">=2.0.1", markers = "python_version >= \"3.7\" and python_version < \"3.11\""} +virtualenv = ">=16.0.0,<20.0.0 || >20.0.0,<20.0.1 || >20.0.1,<20.0.2 || >20.0.2,<20.0.3 || >20.0.3,<20.0.4 || >20.0.4,<20.0.5 || >20.0.5,<20.0.6 || >20.0.6,<20.0.7 || >20.0.7" [package.extras] -docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-argparse-cli (>=1.11.1)", "sphinx-autodoc-typehints (>=1.25.2)", "sphinx-copybutton (>=0.5.2)", "sphinx-inline-tabs (>=2023.4.21)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.11)"] -testing = ["build[virtualenv] (>=1.0.3)", "covdefaults (>=2.3)", "detect-test-pollution (>=1.2)", "devpi-process (>=1)", "diff-cover (>=8.0.2)", "distlib (>=0.3.8)", "flaky (>=3.7)", "hatch-vcs (>=0.4)", "hatchling (>=1.21)", "psutil (>=5.9.7)", "pytest (>=7.4.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-xdist (>=3.5)", "re-assert (>=1.1)", "time-machine (>=2.13)", "wheel (>=0.42)"] +docs = ["pygments-github-lexers (>=0.0.5)", "sphinx (>=2.0.0)", "sphinxcontrib-autoprogram (>=0.1.5)", "towncrier (>=18.5.0)"] +testing = ["flaky (>=3.4.0)", "freezegun (>=0.3.11)", "pathlib2 (>=2.3.3)", "psutil (>=5.6.1)", "pytest (>=4.0.0)", "pytest-cov (>=2.5.1)", "pytest-mock (>=1.10.0)", "pytest-randomly (>=1.0.0)"] [[package]] name = "types-python-dateutil" version = "2.8.19.20240106" description = "Typing stubs for python-dateutil" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -2128,7 +2024,6 @@ files = [ name = "typing-extensions" version = "4.10.0" description = "Backported and Experimental Type Hints for Python 3.8+" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -2140,7 +2035,6 @@ files = [ name = "uri-template" version = "1.3.0" description = "RFC 6570 URI Template Processor" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2155,7 +2049,6 @@ dev = ["flake8", "flake8-annotations", "flake8-bandit", "flake8-bugbear", "flake name = "urllib3" version = "2.2.1" description = "HTTP library with thread-safe connection pooling, file post, and more." -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -2173,7 +2066,6 @@ zstd = ["zstandard (>=0.18.0)"] name = "virtualenv" version = "20.25.1" description = "Virtual Python Environment builder" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -2194,7 +2086,6 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess name = "watchdog" version = "4.0.0" description = "Filesystem events monitoring" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -2236,7 +2127,6 @@ watchmedo = ["PyYAML (>=3.10)"] name = "webcolors" version = "1.13" description = "A library for working with the color formats defined by HTML and CSS." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2252,7 +2142,6 @@ tests = ["pytest", "pytest-cov"] name = "wrapt" version = "1.16.0" description = "Module for decorators, wrappers and monkey patching." -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -2332,7 +2221,6 @@ files = [ name = "zipp" version = "3.17.0" description = "Backport of pathlib-compatible object wrapper for zip files" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -2347,4 +2235,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.8.1" -content-hash = "07fe08e5a7b8fe24940ed67c0e4f3854c60de1de55030424f01537bd857b5dbe" +content-hash = "1f10d5fdb96f63d98c70cfd2e39f6ce137bd1e00790c82aae36d1b57a6205d79" diff --git a/pyproject.toml b/pyproject.toml index bb4ceb4..9a7d9d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ python = "^3.8.1" click = "*" funowl = ">=0.2.3" Jinja2 = ">=3.0.3" -linkml = ">=1.7.4" +linkml = "^1.7.10" linkml-runtime = ">=1.7.0" [tool.poetry.dev-dependencies] diff --git a/tests/inputs/enum_model.yaml b/tests/inputs/enum_model.yaml new file mode 100644 index 0000000..6577ab8 --- /dev/null +++ b/tests/inputs/enum_model.yaml @@ -0,0 +1,42 @@ +id: http://example.org/enum-test +name: enum-test +imports: + - linkml:types +prefixes: + linkml: https://w3id.org/linkml/ + ex: http://example.org/enum-test/ + BFO: http://purl.obolibrary.org/obo/BFO_ + +default_prefix: ex +default_curi_maps: + - semweb_context + +slots: + id: + identifier: true + range: uriorcurie + job: + range: JobEnum + annotations: + owl: ObjectPropertyAssertion + + job_str: + range: JobEnum + annotations: + owl: DataPropertyAssertion + +classes: + + Person: + slots: + - id + - job + - job_str + +enums: + JobEnum: + permissible_values: + Bricklayer: + Chimney Sweep: + Welder: + meaning: ex:Welder \ No newline at end of file diff --git a/tests/output/chromo.schema.owl.ttl b/tests/output/chromo.schema.owl.ttl index e0aa6df..321afd6 100644 --- a/tests/output/chromo.schema.owl.ttl +++ b/tests/output/chromo.schema.owl.ttl @@ -14,32 +14,32 @@ chromoschema:ChromosomePartCollection a owl:Class, linkml:ClassDefinition ; rdfs:label "ChromosomePartCollection" ; rdfs:subClassOf [ a owl:Restriction ; - owl:allValuesFrom chromoschema:Genome ; - owl:onProperty chromoschema:genomes ], + owl:maxCardinality 1 ; + owl:onProperty chromoschema:name ], [ a owl:Restriction ; owl:minCardinality 0 ; owl:onProperty chromoschema:taxons ], [ a owl:Restriction ; - owl:maxCardinality 1 ; + owl:allValuesFrom owl:Thing ; owl:onProperty chromoschema:name ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:genomes ], + owl:onProperty chromoschema:has ], + [ a owl:Restriction ; + owl:allValuesFrom chromoschema:ChromosomePart ; + owl:onProperty chromoschema:has ], [ a owl:Restriction ; owl:allValuesFrom chromoschema:OrganismTaxon ; owl:onProperty chromoschema:taxons ], - [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty chromoschema:has ], [ a owl:Restriction ; owl:minCardinality 0 ; owl:onProperty chromoschema:name ], [ a owl:Restriction ; - owl:allValuesFrom owl:Thing ; - owl:onProperty chromoschema:name ], + owl:minCardinality 0 ; + owl:onProperty chromoschema:genomes ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:ChromosomePart ; - owl:onProperty chromoschema:has ] ; + owl:allValuesFrom chromoschema:Genome ; + owl:onProperty chromoschema:genomes ] ; skos:inScheme . chromoschema:download_url a owl:ObjectProperty, @@ -59,6 +59,15 @@ chromoschema:Genome a owl:Class, linkml:ClassDefinition ; rdfs:label "Genome" ; rdfs:subClassOf [ a owl:Restriction ; + owl:minCardinality 1 ; + owl:onProperty chromoschema:name ], + [ a owl:Restriction ; + owl:minCardinality 1 ; + owl:onProperty chromoschema:id ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; + owl:onProperty chromoschema:build ], + [ a owl:Restriction ; owl:allValuesFrom chromoschema:GenomeBuild ; owl:onProperty chromoschema:previous_builds ], [ a owl:Restriction ; @@ -70,38 +79,29 @@ chromoschema:Genome a owl:Class, owl:withRestrictions ( [ xsd:pattern "^\\\\w+$" ] ) ] ; owl:onProperty chromoschema:id ], [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty chromoschema:taxon ], + owl:allValuesFrom chromoschema:LabelType ; + owl:onProperty chromoschema:name ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; + owl:onProperty chromoschema:name ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:build ], + owl:onProperty chromoschema:taxon ], [ a owl:Restriction ; owl:allValuesFrom chromoschema:GenomeBuild ; owl:onProperty chromoschema:build ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:TaxonIdentifier ; + owl:maxCardinality 1 ; owl:onProperty chromoschema:taxon ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:name ], - [ a owl:Restriction ; - owl:minCardinality 1 ; owl:onProperty chromoschema:id ], [ a owl:Restriction ; - owl:minCardinality 1 ; - owl:onProperty chromoschema:name ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty chromoschema:build ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; + owl:allValuesFrom chromoschema:TaxonIdentifier ; owl:onProperty chromoschema:taxon ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:LabelType ; - owl:onProperty chromoschema:name ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty chromoschema:id ] ; + owl:minCardinality 0 ; + owl:onProperty chromoschema:build ] ; skos:definition """Represents a sequenced genome, one per species. Each genome can be associated with one or more builds""" ; skos:inScheme . @@ -114,12 +114,18 @@ chromoschema:OrganismTaxon a owl:Class, owl:onDatatype xsd:string ; owl:withRestrictions ( [ xsd:pattern "^CHR:\\\\S+$" ] ) ] ; owl:onProperty chromoschema:id ], + [ a owl:Restriction ; + owl:minCardinality 0 ; + owl:onProperty chromoschema:name ], + [ a owl:Restriction ; + owl:minCardinality 1 ; + owl:onProperty chromoschema:id ], [ a owl:Restriction ; owl:maxCardinality 1 ; owl:onProperty chromoschema:id ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:name ], + owl:onProperty chromoschema:common_name ], [ a owl:Restriction ; owl:allValuesFrom chromoschema:LabelType ; owl:onProperty chromoschema:name ], @@ -131,13 +137,7 @@ chromoschema:OrganismTaxon a owl:Class, owl:onProperty chromoschema:common_name ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:name ], - [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty chromoschema:common_name ], - [ a owl:Restriction ; - owl:minCardinality 1 ; - owl:onProperty chromoschema:id ] ; + owl:onProperty chromoschema:name ] ; skos:definition "Represents a species, e.g. Homo sapiens" ; skos:exactMatch biolink:OrganismTaxon ; skos:inScheme . @@ -349,148 +349,148 @@ chromoschema:ChromosomePart a owl:Class, linkml:ClassDefinition ; rdfs:label "ChromosomePart" ; rdfs:subClassOf [ a owl:Restriction ; + owl:allValuesFrom chromoschema:LocationType ; + owl:onProperty chromoschema:cell_location ], + [ a owl:Restriction ; + owl:allValuesFrom chromoschema:BandDescriptor ; + owl:onProperty chromoschema:band_descriptor ], + [ a owl:Restriction ; + owl:allValuesFrom owl:Thing ; + owl:onProperty chromoschema:exact_synonyms ], + [ a owl:Restriction ; + owl:allValuesFrom owl:Thing ; + owl:onProperty chromoschema:broad_synonyms ], + [ a owl:Restriction ; owl:allValuesFrom chromoschema:ChromosomeNameType ; owl:onProperty chromoschema:chromosome_name ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:EntityType ; - owl:onProperty chromoschema:type ], + owl:allValuesFrom linkml:Uriorcurie ; + owl:onProperty chromoschema:exact_mappings ], + [ a owl:Restriction ; + owl:allValuesFrom linkml:Integer ; + owl:onProperty chromoschema:end ], + [ a owl:Restriction ; + owl:minCardinality 0 ; + owl:onProperty chromoschema:chromosome_name ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:cell_location ], + owl:onProperty chromoschema:build ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; + owl:onProperty chromoschema:end ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:type ], + owl:onProperty chromoschema:sex_chromosome_type ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:BandDescriptor ; - owl:onProperty chromoschema:band_descriptor ], + owl:minCardinality 0 ; + owl:onProperty chromoschema:broad_synonyms ], + [ a owl:Restriction ; + owl:allValuesFrom chromoschema:TaxonIdentifier ; + owl:onProperty chromoschema:taxon ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:name ], + owl:onProperty chromoschema:cell_location ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:name ], + owl:onProperty chromoschema:start ], [ a owl:Restriction ; - owl:allValuesFrom linkml:Integer ; - owl:onProperty chromoschema:end ], + owl:maxCardinality 1 ; + owl:onProperty chromoschema:parent ], [ a owl:Restriction ; - owl:allValuesFrom [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; - owl:withRestrictions ( [ xsd:pattern "^CHR:\\\\S+$" ] ) ] ; - owl:onProperty chromoschema:id ], + owl:maxCardinality 1 ; + owl:onProperty chromoschema:somal_type ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:start ], + owl:onProperty chromoschema:id ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:cell_location ], + owl:onProperty chromoschema:exact_mappings ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:SexChromosomeType ; - owl:onProperty chromoschema:sex_chromosome_type ], + owl:minCardinality 1 ; + owl:onProperty chromoschema:id ], + [ a owl:Restriction ; + owl:allValuesFrom chromoschema:EntityType ; + owl:onProperty chromoschema:type ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:parent ], + owl:onProperty chromoschema:cell_location ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:broad_synonyms ], + owl:onProperty chromoschema:somal_type ], + [ a owl:Restriction ; + owl:minCardinality 0 ; + owl:onProperty chromoschema:end ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; + owl:onProperty chromoschema:taxon ], [ a owl:Restriction ; owl:allValuesFrom chromoschema:AutosomeVsSexChromosome ; owl:onProperty chromoschema:somal_type ], [ a owl:Restriction ; owl:allValuesFrom linkml:Integer ; owl:onProperty chromoschema:start ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty chromoschema:taxon ], [ a owl:Restriction ; owl:allValuesFrom chromoschema:LabelType ; owl:onProperty chromoschema:name ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:chromosome_name ], + owl:onProperty chromoschema:type ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:exact_mappings ], + owl:onProperty chromoschema:name ], [ a owl:Restriction ; - owl:maxCardinality 1 ; + owl:minCardinality 0 ; owl:onProperty chromoschema:build ], - [ a owl:Restriction ; - owl:allValuesFrom chromoschema:TaxonIdentifier ; - owl:onProperty chromoschema:taxon ], - [ a owl:Restriction ; - owl:allValuesFrom owl:Thing ; - owl:onProperty chromoschema:broad_synonyms ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:somal_type ], - [ a owl:Restriction ; - owl:allValuesFrom chromoschema:LocationType ; - owl:onProperty chromoschema:cell_location ], - [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty chromoschema:exact_synonyms ], + owl:onProperty chromoschema:band_descriptor ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:end ], + owl:onProperty chromoschema:name ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:sex_chromosome_type ], + owl:onProperty chromoschema:chromosome_name ], [ a owl:Restriction ; - owl:minCardinality 0 ; + owl:allValuesFrom chromoschema:ChromosomePart ; owl:onProperty chromoschema:parent ], [ a owl:Restriction ; - owl:minCardinality 0 ; + owl:allValuesFrom chromoschema:ChromosomePart ; owl:onProperty chromoschema:children ], [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty chromoschema:build ], + owl:maxCardinality 1 ; + owl:onProperty chromoschema:sex_chromosome_type ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:band_descriptor ], - [ a owl:Restriction ; - owl:allValuesFrom linkml:Uriorcurie ; - owl:onProperty chromoschema:exact_mappings ], + owl:onProperty chromoschema:children ], [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty chromoschema:type ], + owl:allValuesFrom chromoschema:GenomeBuild ; + owl:onProperty chromoschema:build ], [ a owl:Restriction ; owl:minCardinality 0 ; owl:onProperty chromoschema:start ], [ a owl:Restriction ; - owl:minCardinality 1 ; - owl:onProperty chromoschema:id ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; + owl:allValuesFrom [ a rdfs:Datatype ; + owl:onDatatype xsd:string ; + owl:withRestrictions ( [ xsd:pattern "^CHR:\\\\S+$" ] ) ] ; owl:onProperty chromoschema:id ], [ a owl:Restriction ; - owl:allValuesFrom owl:Thing ; + owl:minCardinality 0 ; owl:onProperty chromoschema:exact_synonyms ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:somal_type ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty chromoschema:band_descriptor ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty chromoschema:chromosome_name ], + owl:onProperty chromoschema:parent ], [ a owl:Restriction ; owl:minCardinality 0 ; owl:onProperty chromoschema:taxon ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:end ], - [ a owl:Restriction ; - owl:allValuesFrom chromoschema:ChromosomePart ; - owl:onProperty chromoschema:parent ], + owl:onProperty chromoschema:band_descriptor ], [ a owl:Restriction ; - owl:minCardinality 0 ; + owl:allValuesFrom chromoschema:SexChromosomeType ; owl:onProperty chromoschema:sex_chromosome_type ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:ChromosomePart ; - owl:onProperty chromoschema:children ], - [ a owl:Restriction ; - owl:allValuesFrom chromoschema:GenomeBuild ; - owl:onProperty chromoschema:build ] ; + owl:maxCardinality 1 ; + owl:onProperty chromoschema:type ] ; skos:definition "A Chromosome or a part of a chromosome (includes whole chromosomes, arms, and bands)" ; skos:inScheme ; skos:note """OWL Notes: when translated to OWL, instances of this class will be treated as @@ -504,13 +504,13 @@ chromoschema:GenomeBuild a owl:Class, owl:allValuesFrom chromoschema:LabelType ; owl:onProperty chromoschema:name ], [ a owl:Restriction ; - owl:minCardinality 0 ; + owl:maxCardinality 1 ; owl:onProperty chromoschema:name ], [ a owl:Restriction ; - owl:maxCardinality 1 ; + owl:minCardinality 1 ; owl:onProperty chromoschema:id ], [ a owl:Restriction ; - owl:minCardinality 1 ; + owl:maxCardinality 1 ; owl:onProperty chromoschema:id ], [ a owl:Restriction ; owl:allValuesFrom [ a rdfs:Datatype ; @@ -518,7 +518,7 @@ chromoschema:GenomeBuild a owl:Class, owl:withRestrictions ( [ xsd:pattern "^CHR:\\\\S+$" ] ) ] ; owl:onProperty chromoschema:id ], [ a owl:Restriction ; - owl:maxCardinality 1 ; + owl:minCardinality 0 ; owl:onProperty chromoschema:name ] ; skos:closeMatch edam:operation_0525 ; skos:definition "Represents a specific build of a sequenced genome" ; diff --git a/tests/test_examples/test_enums.py b/tests/test_examples/test_enums.py new file mode 100644 index 0000000..390b26a --- /dev/null +++ b/tests/test_examples/test_enums.py @@ -0,0 +1,57 @@ +"""Test the module can be imported.""" +import logging +import os +import unittest + +import pytest +import rdflib +from linkml.generators.pythongen import PythonGenerator +from linkml_runtime import SchemaView +from rdflib import Graph, URIRef, Literal + +from linkml_owl.util.loader_wrapper import load_structured_file +from linkml_owl.dumpers.owl_dumper import OWLDumper +from funowl.converters.functional_converter import to_python + +from tests import INPUT_DIR, OUTPUT_DIR + +EX = rdflib.Namespace('http://example.org/enum-test/') + + +SCHEMA_IN = os.path.join(INPUT_DIR, 'enum_model.yaml') + + +@pytest.mark.parametrize("data_name,data,expected",[ + ("1", {"id": "ex:1", "job": "Welder"}, {"job": EX["Welder"]}), + ("2", {"id": "ex:2", "job": "Bricklayer"}, {"job": EX["JobEnum#Bricklayer"]}), + ("3", {"id": "ex:3", "job": "Chimney Sweep"}, {"job": EX["JobEnum#Chimney+Sweep"]}), + ("4", {"id": "ex:4", "job_str": "Welder"}, {"job_str": Literal("Welder")}), +]) +def test_enums(data_name, data, expected): + """ + Test varieties of enums + """ + sv = SchemaView(SCHEMA_IN) + python_module = PythonGenerator(SCHEMA_IN).compile_module() + dumper = OWLDumper() + dumper.schemaview = sv + obj = python_module.Person(**data) + doc = dumper.to_ontology_document(obj, schema=sv.schema) + out_path = os.path.join(OUTPUT_DIR, f'enum-{data_name}.ofn') + with open(out_path, 'w') as stream: + stream.write(str(doc)) + doc_rt = to_python(str(doc)) + axioms = doc_rt.ontology.axioms + logging.info(f'AXIOMS={len(axioms)}') + g = Graph() + doc.to_rdf(g) + for p, v in expected.items(): + vals = [] + print(EX[p]) + print(f"CHECKING FOR {type(v)} == {v}") + for _s, __p, o in g.triples((None, EX[p], None)): + vals.append(o) + print(f" FOUND {o} {type(o)}") + assert len(vals) == 1 + assert vals[0] == v + From a6a67d14d5ed6053c167ab446deaef74c1689203 Mon Sep 17 00:00:00 2001 From: Chris Mungall Date: Thu, 30 May 2024 00:31:41 -0700 Subject: [PATCH 2/2] use literals for data properties --- linkml_owl/dumpers/owl_dumper.py | 15 +- tests/inputs/monsters_and_magic.expected.ofn | 57 +++++ tests/output/chromo.schema.owl.ttl | 246 +++++++++---------- tests/test_examples/test_enums.py | 10 +- 4 files changed, 200 insertions(+), 128 deletions(-) diff --git a/linkml_owl/dumpers/owl_dumper.py b/linkml_owl/dumpers/owl_dumper.py index 3191985..d0e9fb2 100644 --- a/linkml_owl/dumpers/owl_dumper.py +++ b/linkml_owl/dumpers/owl_dumper.py @@ -210,16 +210,23 @@ def transform(self, element: YAMLRoot, schema: SchemaDefinition, is_element_an_o if element is None: return None try: + # naive method to test if an object is an enum: + # try accessing the `meaning` field. If this fails, + # an exception is thrown, and we carry on. + # (when owl_duper is refactored to not be dependent on + # python dataclasses this will no longer be necessary) meaning = element.meaning - # translate Enum - if is_element_an_object or True: + if is_element_an_object: + # enum is used in an object context: translate to URI if not meaning: enum_uri = schema.default_prefix + ":" + type(element).__name__ meaning = enum_uri + "#" + str(element).replace(" ", "+") return self._get_IRI_str(meaning) else: + # enum is used in a data context - stringify return str(element) except AttributeError: + # not an enum - carry on pass if not self._instance_of_linkml_class(element): # TODO: better way of detecting atoms @@ -330,8 +337,8 @@ def transform(self, element: YAMLRoot, schema: SchemaDefinition, is_element_an_o slot_interps = self._get_slot_interpretations(slot, linkml_class_name) logging.debug(f'OWL interpretations for {k}={slot_interps}') is_object_ref = slot.range in self.schema.classes - #if "ObjectPropertyAssertion" in slot_interps or "ObjectProperty" in slot_interps: - # is_object_ref = True + if "ObjectPropertyAssertion" in slot_interps or "ObjectProperty" in slot_interps: + is_object_ref = True # normalize input_vals to a list, then recursively transform if isinstance(v, list): input_vals = v diff --git a/tests/inputs/monsters_and_magic.expected.ofn b/tests/inputs/monsters_and_magic.expected.ofn index 194b75d..c6372eb 100644 --- a/tests/inputs/monsters_and_magic.expected.ofn +++ b/tests/inputs/monsters_and_magic.expected.ofn @@ -19,9 +19,23 @@ Ontology( SubClassOf( mnm:Humanoid mnm:Creature ) Declaration( Class( mnm:Orc ) ) AnnotationAssertion( schema:description mnm:Orc "An orc is a humanoid creature from Middle-earth." ) + DataPropertyAssertion( mnm:armor_class mnm:Orc "13"^^xsd:integer ) + DataPropertyAssertion( mnm:strength mnm:Orc "16"^^xsd:integer ) + DataPropertyAssertion( mnm:dexterity mnm:Orc "11"^^xsd:integer ) + DataPropertyAssertion( mnm:constitution mnm:Orc "12"^^xsd:integer ) + DataPropertyAssertion( mnm:intelligence mnm:Orc "10"^^xsd:integer ) + DataPropertyAssertion( mnm:wisdom mnm:Orc "8"^^xsd:integer ) + DataPropertyAssertion( mnm:charisma mnm:Orc "8"^^xsd:integer ) SubClassOf( mnm:Orc mnm:Humanoid ) Declaration( Class( mnm:Goblin ) ) AnnotationAssertion( schema:description mnm:Goblin "A goblin is a humanoid creature from Middle-earth." ) + DataPropertyAssertion( mnm:armor_class mnm:Goblin "15"^^xsd:integer ) + DataPropertyAssertion( mnm:strength mnm:Goblin "8"^^xsd:integer ) + DataPropertyAssertion( mnm:dexterity mnm:Goblin "14"^^xsd:integer ) + DataPropertyAssertion( mnm:constitution mnm:Goblin "10"^^xsd:integer ) + DataPropertyAssertion( mnm:intelligence mnm:Goblin "10"^^xsd:integer ) + DataPropertyAssertion( mnm:wisdom mnm:Goblin "8"^^xsd:integer ) + DataPropertyAssertion( mnm:charisma mnm:Goblin "8"^^xsd:integer ) SubClassOf( mnm:Goblin mnm:Humanoid ) Declaration( Class( mnm:SerpentineCreature ) ) AnnotationAssertion( schema:description mnm:SerpentineCreature "A serpentine creature is a creature that has a snake-like body." ) @@ -67,24 +81,66 @@ Ontology( SubClassOf( mnm:MagicallyCreatedCreature mnm:Creature ) Declaration( Class( mnm:RugOfSmothering ) ) AnnotationAssertion( schema:description mnm:RugOfSmothering "A rug of smothering is a rug that can be used to suffocate a creature." ) + DataPropertyAssertion( mnm:armor_class mnm:RugOfSmothering "13"^^xsd:integer ) + DataPropertyAssertion( mnm:strength mnm:RugOfSmothering "16"^^xsd:integer ) + DataPropertyAssertion( mnm:dexterity mnm:RugOfSmothering "11"^^xsd:integer ) + DataPropertyAssertion( mnm:constitution mnm:RugOfSmothering "12"^^xsd:integer ) + DataPropertyAssertion( mnm:intelligence mnm:RugOfSmothering "10"^^xsd:integer ) + DataPropertyAssertion( mnm:wisdom mnm:RugOfSmothering "8"^^xsd:integer ) + DataPropertyAssertion( mnm:charisma mnm:RugOfSmothering "8"^^xsd:integer ) SubClassOf( mnm:RugOfSmothering mnm:MagicallyCreatedCreature ) Declaration( Class( mnm:Basilisk ) ) AnnotationAssertion( schema:description mnm:Basilisk "A basilisk is a legendary serpent-like creature with the body of a snake and the head of a king cobra." ) + DataPropertyAssertion( mnm:armor_class mnm:Basilisk "13"^^xsd:integer ) + DataPropertyAssertion( mnm:strength mnm:Basilisk "16"^^xsd:integer ) + DataPropertyAssertion( mnm:dexterity mnm:Basilisk "11"^^xsd:integer ) + DataPropertyAssertion( mnm:constitution mnm:Basilisk "12"^^xsd:integer ) + DataPropertyAssertion( mnm:intelligence mnm:Basilisk "10"^^xsd:integer ) + DataPropertyAssertion( mnm:wisdom mnm:Basilisk "8"^^xsd:integer ) + DataPropertyAssertion( mnm:charisma mnm:Basilisk "8"^^xsd:integer ) SubClassOf( mnm:Basilisk mnm:SerpentineCreature ) Declaration( Class( mnm:UndeadCreature ) ) AnnotationAssertion( schema:description mnm:UndeadCreature "An undead creature is a creature that is dead, but has been brought back to life by magic." ) SubClassOf( mnm:UndeadCreature mnm:Humanoid ) Declaration( Class( mnm:WhiteWalker ) ) AnnotationAssertion( schema:description mnm:WhiteWalker "A white walker is an undead creature from the Game of Thrones universe." ) + DataPropertyAssertion( mnm:armor_class mnm:WhiteWalker "13"^^xsd:integer ) + DataPropertyAssertion( mnm:strength mnm:WhiteWalker "16"^^xsd:integer ) + DataPropertyAssertion( mnm:dexterity mnm:WhiteWalker "11"^^xsd:integer ) + DataPropertyAssertion( mnm:constitution mnm:WhiteWalker "12"^^xsd:integer ) + DataPropertyAssertion( mnm:intelligence mnm:WhiteWalker "10"^^xsd:integer ) + DataPropertyAssertion( mnm:wisdom mnm:WhiteWalker "8"^^xsd:integer ) + DataPropertyAssertion( mnm:charisma mnm:WhiteWalker "8"^^xsd:integer ) SubClassOf( mnm:WhiteWalker mnm:UndeadCreature ) Declaration( Class( mnm:Lich ) ) AnnotationAssertion( schema:description mnm:Lich "A lich is a fictional undead creature in the Dungeons & Dragons fantasy role-playing game." ) + DataPropertyAssertion( mnm:armor_class mnm:Lich "13"^^xsd:integer ) + DataPropertyAssertion( mnm:strength mnm:Lich "16"^^xsd:integer ) + DataPropertyAssertion( mnm:dexterity mnm:Lich "11"^^xsd:integer ) + DataPropertyAssertion( mnm:constitution mnm:Lich "12"^^xsd:integer ) + DataPropertyAssertion( mnm:intelligence mnm:Lich "10"^^xsd:integer ) + DataPropertyAssertion( mnm:wisdom mnm:Lich "8"^^xsd:integer ) + DataPropertyAssertion( mnm:charisma mnm:Lich "8"^^xsd:integer ) SubClassOf( mnm:Lich mnm:UndeadCreature ) Declaration( Class( mnm:Vampire ) ) AnnotationAssertion( schema:description mnm:Vampire "A vampire is a fictional undead creature in the Dungeons & Dragons fantasy role-playing game." ) + DataPropertyAssertion( mnm:armor_class mnm:Vampire "13"^^xsd:integer ) + DataPropertyAssertion( mnm:strength mnm:Vampire "16"^^xsd:integer ) + DataPropertyAssertion( mnm:dexterity mnm:Vampire "11"^^xsd:integer ) + DataPropertyAssertion( mnm:constitution mnm:Vampire "12"^^xsd:integer ) + DataPropertyAssertion( mnm:intelligence mnm:Vampire "10"^^xsd:integer ) + DataPropertyAssertion( mnm:wisdom mnm:Vampire "8"^^xsd:integer ) + DataPropertyAssertion( mnm:charisma mnm:Vampire "8"^^xsd:integer ) SubClassOf( mnm:Vampire mnm:UndeadCreature ) Declaration( Class( mnm:Zombie ) ) AnnotationAssertion( schema:description mnm:Zombie "A zombie is a fictional undead creature in the Dungeons & Dragons fantasy role-playing game." ) + DataPropertyAssertion( mnm:armor_class mnm:Zombie "13"^^xsd:integer ) + DataPropertyAssertion( mnm:strength mnm:Zombie "16"^^xsd:integer ) + DataPropertyAssertion( mnm:dexterity mnm:Zombie "11"^^xsd:integer ) + DataPropertyAssertion( mnm:constitution mnm:Zombie "12"^^xsd:integer ) + DataPropertyAssertion( mnm:intelligence mnm:Zombie "10"^^xsd:integer ) + DataPropertyAssertion( mnm:wisdom mnm:Zombie "8"^^xsd:integer ) + DataPropertyAssertion( mnm:charisma mnm:Zombie "8"^^xsd:integer ) SubClassOf( mnm:Zombie mnm:UndeadCreature ) Declaration( NamedIndividual( mnm:Smaug ) ) Declaration( Class( mnm:Smaug ) ) @@ -98,6 +154,7 @@ Ontology( ClassAssertion( mnm:WhiteWalker mnm:TheNightKing ) Declaration( Class( mnm:Paladin ) ) AnnotationAssertion( schema:description mnm:Paladin "A paladin is a holy warrior who fights evil using divine magic." ) + DataPropertyAssertion( mnm:hit_dice mnm:Paladin "D10" ) Declaration( Class( mnm:Wizard ) ) AnnotationAssertion( schema:description mnm:Wizard "A wizard is a person who practices magic." ) Declaration( Class( mnm:Rogue ) ) diff --git a/tests/output/chromo.schema.owl.ttl b/tests/output/chromo.schema.owl.ttl index 321afd6..77ebcf4 100644 --- a/tests/output/chromo.schema.owl.ttl +++ b/tests/output/chromo.schema.owl.ttl @@ -14,17 +14,11 @@ chromoschema:ChromosomePartCollection a owl:Class, linkml:ClassDefinition ; rdfs:label "ChromosomePartCollection" ; rdfs:subClassOf [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty chromoschema:name ], + owl:allValuesFrom chromoschema:Genome ; + owl:onProperty chromoschema:genomes ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:taxons ], - [ a owl:Restriction ; - owl:allValuesFrom owl:Thing ; owl:onProperty chromoschema:name ], - [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty chromoschema:has ], [ a owl:Restriction ; owl:allValuesFrom chromoschema:ChromosomePart ; owl:onProperty chromoschema:has ], @@ -33,13 +27,19 @@ chromoschema:ChromosomePartCollection a owl:Class, owl:onProperty chromoschema:taxons ], [ a owl:Restriction ; owl:minCardinality 0 ; + owl:onProperty chromoschema:genomes ], + [ a owl:Restriction ; + owl:allValuesFrom owl:Thing ; + owl:onProperty chromoschema:name ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; owl:onProperty chromoschema:name ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:genomes ], + owl:onProperty chromoschema:taxons ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:Genome ; - owl:onProperty chromoschema:genomes ] ; + owl:minCardinality 0 ; + owl:onProperty chromoschema:has ] ; skos:inScheme . chromoschema:download_url a owl:ObjectProperty, @@ -59,14 +59,14 @@ chromoschema:Genome a owl:Class, linkml:ClassDefinition ; rdfs:label "Genome" ; rdfs:subClassOf [ a owl:Restriction ; - owl:minCardinality 1 ; + owl:allValuesFrom chromoschema:LabelType ; owl:onProperty chromoschema:name ], [ a owl:Restriction ; - owl:minCardinality 1 ; - owl:onProperty chromoschema:id ], + owl:minCardinality 0 ; + owl:onProperty chromoschema:taxon ], [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty chromoschema:build ], + owl:minCardinality 1 ; + owl:onProperty chromoschema:name ], [ a owl:Restriction ; owl:allValuesFrom chromoschema:GenomeBuild ; owl:onProperty chromoschema:previous_builds ], @@ -74,30 +74,30 @@ chromoschema:Genome a owl:Class, owl:minCardinality 0 ; owl:onProperty chromoschema:previous_builds ], [ a owl:Restriction ; - owl:allValuesFrom [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; - owl:withRestrictions ( [ xsd:pattern "^\\\\w+$" ] ) ] ; - owl:onProperty chromoschema:id ], + owl:maxCardinality 1 ; + owl:onProperty chromoschema:build ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:LabelType ; - owl:onProperty chromoschema:name ], + owl:allValuesFrom chromoschema:GenomeBuild ; + owl:onProperty chromoschema:build ], [ a owl:Restriction ; owl:maxCardinality 1 ; owl:onProperty chromoschema:name ], [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty chromoschema:taxon ], + owl:minCardinality 1 ; + owl:onProperty chromoschema:id ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:GenomeBuild ; - owl:onProperty chromoschema:build ], + owl:allValuesFrom [ a rdfs:Datatype ; + owl:onDatatype xsd:string ; + owl:withRestrictions ( [ xsd:pattern "^\\\\w+$" ] ) ] ; + owl:onProperty chromoschema:id ], [ a owl:Restriction ; - owl:maxCardinality 1 ; + owl:allValuesFrom chromoschema:TaxonIdentifier ; owl:onProperty chromoschema:taxon ], [ a owl:Restriction ; owl:maxCardinality 1 ; owl:onProperty chromoschema:id ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:TaxonIdentifier ; + owl:maxCardinality 1 ; owl:onProperty chromoschema:taxon ], [ a owl:Restriction ; owl:minCardinality 0 ; @@ -110,34 +110,34 @@ chromoschema:OrganismTaxon a owl:Class, linkml:ClassDefinition ; rdfs:label "OrganismTaxon" ; rdfs:subClassOf [ a owl:Restriction ; - owl:allValuesFrom [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; - owl:withRestrictions ( [ xsd:pattern "^CHR:\\\\S+$" ] ) ] ; - owl:onProperty chromoschema:id ], - [ a owl:Restriction ; owl:minCardinality 0 ; + owl:onProperty chromoschema:common_name ], + [ a owl:Restriction ; + owl:allValuesFrom chromoschema:LabelType ; owl:onProperty chromoschema:name ], [ a owl:Restriction ; - owl:minCardinality 1 ; + owl:maxCardinality 1 ; owl:onProperty chromoschema:id ], [ a owl:Restriction ; owl:maxCardinality 1 ; + owl:onProperty chromoschema:common_name ], + [ a owl:Restriction ; + owl:allValuesFrom [ a rdfs:Datatype ; + owl:onDatatype xsd:string ; + owl:withRestrictions ( [ xsd:pattern "^CHR:\\\\S+$" ] ) ] ; owl:onProperty chromoschema:id ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:common_name ], - [ a owl:Restriction ; - owl:allValuesFrom chromoschema:LabelType ; owl:onProperty chromoschema:name ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty chromoschema:common_name ], [ a owl:Restriction ; owl:allValuesFrom chromoschema:LabelType ; owl:onProperty chromoschema:common_name ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:name ] ; + owl:onProperty chromoschema:name ], + [ a owl:Restriction ; + owl:minCardinality 1 ; + owl:onProperty chromoschema:id ] ; skos:definition "Represents a species, e.g. Homo sapiens" ; skos:exactMatch biolink:OrganismTaxon ; skos:inScheme . @@ -349,148 +349,148 @@ chromoschema:ChromosomePart a owl:Class, linkml:ClassDefinition ; rdfs:label "ChromosomePart" ; rdfs:subClassOf [ a owl:Restriction ; - owl:allValuesFrom chromoschema:LocationType ; - owl:onProperty chromoschema:cell_location ], - [ a owl:Restriction ; - owl:allValuesFrom chromoschema:BandDescriptor ; - owl:onProperty chromoschema:band_descriptor ], - [ a owl:Restriction ; - owl:allValuesFrom owl:Thing ; - owl:onProperty chromoschema:exact_synonyms ], + owl:allValuesFrom chromoschema:TaxonIdentifier ; + owl:onProperty chromoschema:taxon ], [ a owl:Restriction ; - owl:allValuesFrom owl:Thing ; - owl:onProperty chromoschema:broad_synonyms ], + owl:allValuesFrom linkml:Integer ; + owl:onProperty chromoschema:start ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:ChromosomeNameType ; - owl:onProperty chromoschema:chromosome_name ], + owl:maxCardinality 1 ; + owl:onProperty chromoschema:taxon ], [ a owl:Restriction ; - owl:allValuesFrom linkml:Uriorcurie ; - owl:onProperty chromoschema:exact_mappings ], + owl:allValuesFrom chromoschema:LabelType ; + owl:onProperty chromoschema:name ], [ a owl:Restriction ; - owl:allValuesFrom linkml:Integer ; - owl:onProperty chromoschema:end ], + owl:allValuesFrom chromoschema:EntityType ; + owl:onProperty chromoschema:type ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:chromosome_name ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty chromoschema:build ], + owl:onProperty chromoschema:start ], [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty chromoschema:end ], + owl:allValuesFrom [ a rdfs:Datatype ; + owl:onDatatype xsd:string ; + owl:withRestrictions ( [ xsd:pattern "^CHR:\\\\S+$" ] ) ] ; + owl:onProperty chromoschema:id ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:sex_chromosome_type ], + owl:onProperty chromoschema:end ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:broad_synonyms ], + owl:onProperty chromoschema:children ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:TaxonIdentifier ; - owl:onProperty chromoschema:taxon ], + owl:maxCardinality 1 ; + owl:onProperty chromoschema:name ], [ a owl:Restriction ; - owl:minCardinality 0 ; + owl:allValuesFrom chromoschema:LocationType ; owl:onProperty chromoschema:cell_location ], [ a owl:Restriction ; owl:maxCardinality 1 ; owl:onProperty chromoschema:start ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:parent ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty chromoschema:somal_type ], + owl:onProperty chromoschema:cell_location ], [ a owl:Restriction ; - owl:maxCardinality 1 ; + owl:minCardinality 1 ; owl:onProperty chromoschema:id ], + [ a owl:Restriction ; + owl:allValuesFrom chromoschema:ChromosomeNameType ; + owl:onProperty chromoschema:chromosome_name ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:exact_mappings ], + owl:onProperty chromoschema:band_descriptor ], [ a owl:Restriction ; - owl:minCardinality 1 ; - owl:onProperty chromoschema:id ], + owl:allValuesFrom chromoschema:ChromosomePart ; + owl:onProperty chromoschema:parent ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:EntityType ; - owl:onProperty chromoschema:type ], + owl:allValuesFrom chromoschema:ChromosomePart ; + owl:onProperty chromoschema:children ], [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty chromoschema:cell_location ], + owl:allValuesFrom chromoschema:GenomeBuild ; + owl:onProperty chromoschema:build ], [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty chromoschema:somal_type ], + owl:allValuesFrom owl:Thing ; + owl:onProperty chromoschema:broad_synonyms ], [ a owl:Restriction ; - owl:minCardinality 0 ; + owl:maxCardinality 1 ; owl:onProperty chromoschema:end ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:taxon ], - [ a owl:Restriction ; - owl:allValuesFrom chromoschema:AutosomeVsSexChromosome ; - owl:onProperty chromoschema:somal_type ], - [ a owl:Restriction ; - owl:allValuesFrom linkml:Integer ; - owl:onProperty chromoschema:start ], - [ a owl:Restriction ; - owl:allValuesFrom chromoschema:LabelType ; - owl:onProperty chromoschema:name ], + owl:onProperty chromoschema:chromosome_name ], [ a owl:Restriction ; owl:minCardinality 0 ; owl:onProperty chromoschema:type ], [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty chromoschema:name ], + owl:allValuesFrom chromoschema:AutosomeVsSexChromosome ; + owl:onProperty chromoschema:somal_type ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:build ], + owl:onProperty chromoschema:exact_mappings ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:band_descriptor ], + owl:onProperty chromoschema:somal_type ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:name ], + owl:onProperty chromoschema:sex_chromosome_type ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:chromosome_name ], + owl:onProperty chromoschema:build ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:ChromosomePart ; - owl:onProperty chromoschema:parent ], + owl:allValuesFrom owl:Thing ; + owl:onProperty chromoschema:exact_synonyms ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:ChromosomePart ; - owl:onProperty chromoschema:children ], + owl:minCardinality 0 ; + owl:onProperty chromoschema:chromosome_name ], [ a owl:Restriction ; - owl:maxCardinality 1 ; + owl:minCardinality 0 ; owl:onProperty chromoschema:sex_chromosome_type ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:children ], + owl:onProperty chromoschema:taxon ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:GenomeBuild ; + owl:minCardinality 0 ; owl:onProperty chromoschema:build ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; + owl:onProperty chromoschema:id ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:start ], + owl:onProperty chromoschema:name ], [ a owl:Restriction ; - owl:allValuesFrom [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; - owl:withRestrictions ( [ xsd:pattern "^CHR:\\\\S+$" ] ) ] ; - owl:onProperty chromoschema:id ], + owl:minCardinality 0 ; + owl:onProperty chromoschema:somal_type ], + [ a owl:Restriction ; + owl:allValuesFrom linkml:Integer ; + owl:onProperty chromoschema:end ], + [ a owl:Restriction ; + owl:allValuesFrom chromoschema:SexChromosomeType ; + owl:onProperty chromoschema:sex_chromosome_type ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty chromoschema:exact_synonyms ], + owl:onProperty chromoschema:cell_location ], [ a owl:Restriction ; owl:minCardinality 0 ; owl:onProperty chromoschema:parent ], [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty chromoschema:taxon ], + owl:maxCardinality 1 ; + owl:onProperty chromoschema:type ], + [ a owl:Restriction ; + owl:allValuesFrom linkml:Uriorcurie ; + owl:onProperty chromoschema:exact_mappings ], [ a owl:Restriction ; owl:minCardinality 0 ; + owl:onProperty chromoschema:exact_synonyms ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; owl:onProperty chromoschema:band_descriptor ], [ a owl:Restriction ; - owl:allValuesFrom chromoschema:SexChromosomeType ; - owl:onProperty chromoschema:sex_chromosome_type ], + owl:allValuesFrom chromoschema:BandDescriptor ; + owl:onProperty chromoschema:band_descriptor ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty chromoschema:type ] ; + owl:onProperty chromoschema:parent ], + [ a owl:Restriction ; + owl:minCardinality 0 ; + owl:onProperty chromoschema:broad_synonyms ] ; skos:definition "A Chromosome or a part of a chromosome (includes whole chromosomes, arms, and bands)" ; skos:inScheme ; skos:note """OWL Notes: when translated to OWL, instances of this class will be treated as @@ -501,24 +501,24 @@ chromoschema:GenomeBuild a owl:Class, linkml:ClassDefinition ; rdfs:label "GenomeBuild" ; rdfs:subClassOf [ a owl:Restriction ; - owl:allValuesFrom chromoschema:LabelType ; - owl:onProperty chromoschema:name ], - [ a owl:Restriction ; owl:maxCardinality 1 ; owl:onProperty chromoschema:name ], [ a owl:Restriction ; owl:minCardinality 1 ; owl:onProperty chromoschema:id ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty chromoschema:id ], [ a owl:Restriction ; owl:allValuesFrom [ a rdfs:Datatype ; owl:onDatatype xsd:string ; owl:withRestrictions ( [ xsd:pattern "^CHR:\\\\S+$" ] ) ] ; owl:onProperty chromoschema:id ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; + owl:onProperty chromoschema:id ], [ a owl:Restriction ; owl:minCardinality 0 ; + owl:onProperty chromoschema:name ], + [ a owl:Restriction ; + owl:allValuesFrom chromoschema:LabelType ; owl:onProperty chromoschema:name ] ; skos:closeMatch edam:operation_0525 ; skos:definition "Represents a specific build of a sequenced genome" ; diff --git a/tests/test_examples/test_enums.py b/tests/test_examples/test_enums.py index 390b26a..6754a4f 100644 --- a/tests/test_examples/test_enums.py +++ b/tests/test_examples/test_enums.py @@ -26,10 +26,18 @@ ("2", {"id": "ex:2", "job": "Bricklayer"}, {"job": EX["JobEnum#Bricklayer"]}), ("3", {"id": "ex:3", "job": "Chimney Sweep"}, {"job": EX["JobEnum#Chimney+Sweep"]}), ("4", {"id": "ex:4", "job_str": "Welder"}, {"job_str": Literal("Welder")}), + ("5", {"id": "ex:5", "job_str": "Bricklayer"}, {"job_str": Literal("Bricklayer")}), + ("6", {"id": "ex:6", "job_str": "Chimney Sweep"}, {"job_str": Literal("Chimney Sweep")}), ]) def test_enums(data_name, data, expected): """ - Test varieties of enums + Test mapping of permissible values in enums. + + If the enum slot is an object slot, then a URI is generated + (using ``meaning`` if present, otherwise construct a URI by appending a hash url encoding + of the PV to the enum) + + If the enum slot is a data slot, then a literal is created from the PV string """ sv = SchemaView(SCHEMA_IN) python_module = PythonGenerator(SCHEMA_IN).compile_module()