From 0eac277287f3efcf5580bc4fcbbd0f7987755af3 Mon Sep 17 00:00:00 2001 From: Chris Mungall Date: Fri, 5 Jul 2024 16:04:59 -0700 Subject: [PATCH 1/2] additional sources --- ontologies.Makefile | 93 +++- src/semsql/builder/build.Makefile | 1 + src/semsql/builder/builder.py | 26 +- src/semsql/builder/cli.py | 12 + src/semsql/builder/prefixes/prefixes.csv | 5 + .../builder/prefixes/prefixes_local.csv | 5 + src/semsql/builder/registry/ontologies.yaml | 46 +- .../builder/registry/registry_schema.py | 474 +++++------------- .../builder/registry/registry_schema.yaml | 4 + views/bfo.sql | 76 +++ 10 files changed, 390 insertions(+), 352 deletions(-) create mode 100644 views/bfo.sql diff --git a/ontologies.Makefile b/ontologies.Makefile index eb569ad..d187d88 100644 --- a/ontologies.Makefile +++ b/ontologies.Makefile @@ -229,6 +229,28 @@ db/oeo.owl: download/oeo.owl cp $< $@ +download/taxslim.owl: STAMP + curl -L -s http://purl.obolibrary.org/obo/ncbitaxon/subsets/taxslim.obo > $@.tmp + sha256sum -b $@.tmp > $@.sha256 + mv $@.tmp $@ + +.PRECIOUS: download/taxslim.owl + +db/taxslim.owl: download/taxslim.owl + robot convert -i $< -o $@ + + +download/goldterms.owl: STAMP + curl -L -s https://raw.githubusercontent.com/cmungall/gold-ontology/main/gold.owl > $@.tmp + sha256sum -b $@.tmp > $@.sha256 + mv $@.tmp $@ + +.PRECIOUS: download/goldterms.owl + +db/goldterms.owl: download/goldterms.owl + robot relax -i $< reason -o $@ + + download/sdgio.owl: STAMP curl -L -s https://raw.githubusercontent.com/SDG-InterfaceOntology/sdgio/master/sdgio.owl > $@.tmp sha256sum -b $@.tmp > $@.sha256 @@ -240,6 +262,17 @@ db/sdgio.owl: download/sdgio.owl cp $< $@ +download/kin.owl: STAMP + curl -L -s http://purl.org/ga4gh/kin.owl > $@.tmp + sha256sum -b $@.tmp > $@.sha256 + mv $@.tmp $@ + +.PRECIOUS: download/kin.owl + +db/kin.owl: download/kin.owl + robot reason -i $< -o $@ + + download/biovoices.owl: STAMP curl -L -s https://zenodo.org/record/5589773/files/ontology.owl?download=1 > $@.tmp sha256sum -b $@.tmp > $@.sha256 @@ -262,6 +295,17 @@ db/omop.owl: download/omop.owl cp $< $@ +download/comet.owl: STAMP + curl -L -s https://raw.githubusercontent.com/linkml/linkml-common/main/project/owl/linkml_common.owl.ttl > $@.tmp + sha256sum -b $@.tmp > $@.sha256 + mv $@.tmp $@ + +.PRECIOUS: download/comet.owl + +db/comet.owl: download/comet.owl + robot relax -i $< merge -o $@ + + download/cco.owl: STAMP curl -L -s http://www.ontologyrepository.com/CommonCoreOntologies/Mid/AllCoreOntology > $@.tmp sha256sum -b $@.tmp > $@.sha256 @@ -428,7 +472,7 @@ db/mlo.owl: download/mlo.owl download/ito.owl: STAMP - curl -L -s https://github.com/OpenBioLink/ITO/raw/master/ITO.owl.zip > $@.zip.tmp && unzip -p $@.zip.tmp {ont.zip_extract_file} > $@.tmp && rm $@.zip.tmp + curl -L -s https://github.com/OpenBioLink/ITO/raw/master/ITO.owl.zip > $@.zip.tmp && unzip -p $@.zip.tmp ITO.owl > $@.tmp && rm $@.zip.tmp sha256sum -b $@.tmp > $@.sha256 mv $@.tmp $@ @@ -438,14 +482,25 @@ db/ito.owl: download/ito.owl cp $< $@ -download/reactome-Homo-sapiens.owl: STAMP - curl -L -s https://reactome.org/download/current/biopax.zip > $@.zip.tmp && unzip -p $@.zip.tmp {ont.zip_extract_file} > $@.tmp && rm $@.zip.tmp +download/reactome-hs.owl: STAMP + curl -L -s https://reactome.org/download/current/biopax.zip > $@.zip.tmp && unzip -p $@.zip.tmp Homo_sapiens.owl > $@.tmp && rm $@.zip.tmp + sha256sum -b $@.tmp > $@.sha256 + mv $@.tmp $@ + +.PRECIOUS: download/reactome-hs.owl + +db/reactome-hs.owl: download/reactome-hs.owl + cp $< $@ + + +download/reactome-mm.owl: STAMP + curl -L -s https://reactome.org/download/current/biopax.zip > $@.zip.tmp && unzip -p $@.zip.tmp Mus_musculus.owl > $@.tmp && rm $@.zip.tmp sha256sum -b $@.tmp > $@.sha256 mv $@.tmp $@ -.PRECIOUS: download/reactome-Homo-sapiens.owl +.PRECIOUS: download/reactome-mm.owl -db/reactome-Homo-sapiens.owl: download/reactome-Homo-sapiens.owl +db/reactome-mm.owl: download/reactome-mm.owl cp $< $@ @@ -823,6 +878,28 @@ db/nando.owl: download/nando.owl cp $< $@ +download/ecso.owl: STAMP + curl -L -s 'https://data.bioontology.org/ontologies/ECSO/submissions/64/download?apikey=8b5b7825-538d-40e0-9e9e-5ab9274a9aeb' > $@.tmp + sha256sum -b $@.tmp > $@.sha256 + mv $@.tmp $@ + +.PRECIOUS: download/ecso.owl + +db/ecso.owl: download/ecso.owl + cp $< $@ + + +download/enigma_context.owl: STAMP + curl -L -s https://raw.githubusercontent.com/jmchandonia/CORAL/main/example/enigma/ontologies/context_measurement_ontology.obo > $@.tmp + sha256sum -b $@.tmp > $@.sha256 + mv $@.tmp $@ + +.PRECIOUS: download/enigma_context.owl + +db/enigma_context.owl: download/enigma_context.owl + robot merge -i $< -o $@ + + download/ontie.owl: STAMP curl -L -s https://ontology.iedb.org/file/ontie.owl > $@.tmp sha256sum -b $@.tmp > $@.sha256 @@ -857,14 +934,14 @@ db/nmdc_schema.owl: download/nmdc_schema.owl download/mixs.owl: STAMP - curl -L -s https://raw.githubusercontent.com/microbiomedata/mixs-6-2-release-candidate/main/schema-derivatives/mixs_6_2_rc.owl.ttl > $@.tmp + curl -L -s https://raw.githubusercontent.com/GenomicsStandardsConsortium/mixs/main/project/owl/mixs.owl.ttl > $@.tmp sha256sum -b $@.tmp > $@.sha256 mv $@.tmp $@ .PRECIOUS: download/mixs.owl db/mixs.owl: download/mixs.owl - robot merge -i $< reason -o $@.tmp.owl && perl -npe 's@_6_2_rc@@g;s@-6-2-rc@@g' $@.tmp.owl > $@ + robot merge -i $< reason -o $@ download/fibo.owl: STAMP @@ -932,4 +1009,4 @@ download/%.owl: STAMP db/%.owl: download/%.owl robot merge -i $< -o $@ -EXTRA_ONTOLOGIES = upheno chiro ncit fma maxo foodon chebiplus msio modl phenio phenio_test comploinc bero aio reacto bcio icd10who ordo gard mondo-ingest oeo sdgio biovoices omop cco occo iof upa go go-lego go-amigo neo bao orcid cpont biolink biopax enanomapper mlo ito reactome-Homo-sapiens efo hcao hpinternational edam sweetAll lov schema-dot-org prov cellosaurus cosmo fhkb dbpendiaont uberoncm icd10cm co_324 ppeo interpro hgnc.genegroup hgnc sgd dictybase eccode uniprot rhea swisslipid drugbank drugcentral complexportal wikipathways drugmechdb rxnorm vccf ontobiotope nando ontie ecosim nmdc_schema mixs fibo bfo2020 bfo2020_core bfo2020_notime bfo2020_time +EXTRA_ONTOLOGIES = upheno chiro ncit fma maxo foodon chebiplus msio modl phenio phenio_test comploinc bero aio reacto bcio icd10who ordo gard mondo-ingest oeo taxslim goldterms sdgio kin biovoices omop comet cco occo iof upa go go-lego go-amigo neo bao orcid cpont biolink biopax enanomapper mlo ito reactome-hs reactome-mm efo hcao hpinternational edam sweetAll lov schema-dot-org prov cellosaurus cosmo fhkb dbpendiaont uberoncm icd10cm co_324 ppeo interpro hgnc.genegroup hgnc sgd dictybase eccode uniprot rhea swisslipid drugbank drugcentral complexportal wikipathways drugmechdb rxnorm vccf ontobiotope nando ecso enigma_context ontie ecosim nmdc_schema mixs fibo bfo2020 bfo2020_core bfo2020_notime bfo2020_time diff --git a/src/semsql/builder/build.Makefile b/src/semsql/builder/build.Makefile index 8c4cd69..c92e5f2 100644 --- a/src/semsql/builder/build.Makefile +++ b/src/semsql/builder/build.Makefile @@ -61,6 +61,7 @@ PREFIX_YAML_PATH = $(PREFIX_DIR)/prefixes.yaml gzip -f $*-$(RGSUFFIX).tsv && \ cat $(THIS_DIR)/indexes/*.sql | sqlite3 $@.tmp && \ echo "ALTER TABLE statements ADD COLUMN graph TEXT;" | sqlite3 $@.tmp && \ + (test -d views && find views -maxdepth 1 -name '$(notdir $*)*.sql' -type f -print0 | xargs -0 -I{} sh -c 'sqlite3 $@.tmp< "$$1"' sh {} || echo no views ) && \ mv $@.tmp $@ .PRECIOUS: %.db diff --git a/src/semsql/builder/builder.py b/src/semsql/builder/builder.py index 06472e3..8145285 100644 --- a/src/semsql/builder/builder.py +++ b/src/semsql/builder/builder.py @@ -4,14 +4,14 @@ import shutil import subprocess from pathlib import Path -from typing import Optional, TextIO +from typing import Optional, TextIO, List import requests from linkml_runtime.loaders import yaml_loader from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker -from semsql.builder.registry import registry_schema +from semsql.builder.registry import registry_schema, path_to_ontology_registry from semsql.builder.registry.registry_schema import (CompressionEnum, Makefile, MakefileRule, Ontology) from semsql.utils.makefile_utils import makefile_to_string @@ -117,6 +117,23 @@ def connect(owl_file: str): return session +def get_postprocessing_steps(ontology: str, db: str, registry_path: str = None) -> List[str]: + """ + Get postprocessing steps for an ontology + + :param registry_path: + :param ontology: + :return: + """ + if registry_path is None: + registry_path = path_to_ontology_registry() + registry: registry_schema.Registry + registry = yaml_loader.load(str(registry_path), target_class=registry_schema.Registry) + #steps = [step.format(ont=ontology, db=db) for step in registry.ontologies.get(ontology, []).post_processing_steps] + steps = registry.ontologies.get(ontology, []) + return steps + + def compile_registry(registry_path: str, local_prefix_file: TextIO = None) -> str: """ Generate makefile content from registry @@ -139,7 +156,7 @@ def compile_registry(registry_path: str, local_prefix_file: TextIO = None) -> st elif ont.zip_extract_file: command = ( f"curl -L -s {ont.url} > $@.zip.tmp && " - "unzip -p $@.zip.tmp {ont.zip_extract_file} " + f"unzip -p $@.zip.tmp {ont.zip_extract_file} " "> $@.tmp && rm $@.zip.tmp" ) elif ont.compression: @@ -169,8 +186,9 @@ def compile_registry(registry_path: str, local_prefix_file: TextIO = None) -> st command = "robot merge -i $< -o $@" else: command = "cp $< $@" + commands = [command] rule = MakefileRule( - target=target, dependencies=dependencies, commands=[command] + target=target, dependencies=dependencies, commands=commands ) makefile.rules.append(rule) if not ont.suppress: diff --git a/src/semsql/builder/cli.py b/src/semsql/builder/cli.py index 7327f19..69a9799 100644 --- a/src/semsql/builder/cli.py +++ b/src/semsql/builder/cli.py @@ -1,4 +1,5 @@ import logging +import subprocess from itertools import chain, combinations import click @@ -62,6 +63,17 @@ def make(path, docker, **kwargs): else: docker_config = None builder.make(path, docker_config=docker_config, **kwargs) + # check if path is db/{foo}.db using regular expression + import re + matches = re.match(r"db/(\w+).db", path) + if matches: + ontology = matches.group(1) + steps = builder.get_postprocessing_steps(ontology, path) + for step in steps: + print(f"RUNNING: {step}") + subprocess.run(step, shell=True) + + @main.command() diff --git a/src/semsql/builder/prefixes/prefixes.csv b/src/semsql/builder/prefixes/prefixes.csv index 093b53c..691a2a5 100644 --- a/src/semsql/builder/prefixes/prefixes.csv +++ b/src/semsql/builder/prefixes/prefixes.csv @@ -77,9 +77,13 @@ OMIM,https://omim.org/entry/ OMIMPS,https://www.omim.org/phenotypicSeries/PS CHR,http://purl.obolibrary.org/obo/CHR_ OEO,http://openenergy-platform.org/ontology/oeo/OEO_ +GOLDTERMS,https://w3id.org/gold.path/ +GOLDVOCAB,https://w3id.org/gold.vocab/ SDGIO,http://purl.unep.org/sdg/SDGIO_ +KIN,http://purl.org/ga4gh/kin.owl#KIN_ ontorion,http://ontorion.com/namespace# omop,https://athena.ohdsi.org/search-terms/terms/ +comet,https://w3id.org/linkml-common/ CCO,http://www.ontologyrepository.com/CommonCoreOntologies/ OccO,http://purl.obolibrary.org/obo/OccO_ IOFcore,https://spec.industrialontologies.org/ontology/ @@ -115,6 +119,7 @@ MESH,http://id.nlm.nih.gov/mesh/ RXNORM,http://purl.bioontology.org/ontology/RXNORM/ OBT,http://purl.obolibrary.org/obo/OBT_ NANDO,http://nanbyodata.jp/ontology/NANDO_ +ECSO,http://purl.dataone.org/odo/ECSO_ ONTIE,https://ontology.iedb.org/ontology/ONTIE_ ECOSIM,http://purl.obolibrary.org/obo/ECOSIM_ ECOSIMCONCEPT,http://purl.obolibrary.org/obo/ECOSIMCONCEPT_ diff --git a/src/semsql/builder/prefixes/prefixes_local.csv b/src/semsql/builder/prefixes/prefixes_local.csv index cf5ec45..00f0e6a 100644 --- a/src/semsql/builder/prefixes/prefixes_local.csv +++ b/src/semsql/builder/prefixes/prefixes_local.csv @@ -14,9 +14,13 @@ OMIM,https://omim.org/entry/ OMIMPS,https://www.omim.org/phenotypicSeries/PS CHR,http://purl.obolibrary.org/obo/CHR_ OEO,http://openenergy-platform.org/ontology/oeo/OEO_ +GOLDTERMS,https://w3id.org/gold.path/ +GOLDVOCAB,https://w3id.org/gold.vocab/ SDGIO,http://purl.unep.org/sdg/SDGIO_ +KIN,http://purl.org/ga4gh/kin.owl#KIN_ ontorion,http://ontorion.com/namespace# omop,https://athena.ohdsi.org/search-terms/terms/ +comet,https://w3id.org/linkml-common/ CCO,http://www.ontologyrepository.com/CommonCoreOntologies/ OccO,http://purl.obolibrary.org/obo/OccO_ IOFcore,https://spec.industrialontologies.org/ontology/ @@ -52,6 +56,7 @@ MESH,http://id.nlm.nih.gov/mesh/ RXNORM,http://purl.bioontology.org/ontology/RXNORM/ OBT,http://purl.obolibrary.org/obo/OBT_ NANDO,http://nanbyodata.jp/ontology/NANDO_ +ECSO,http://purl.dataone.org/odo/ECSO_ ONTIE,https://ontology.iedb.org/ontology/ONTIE_ ECOSIM,http://purl.obolibrary.org/obo/ECOSIM_ ECOSIMCONCEPT,http://purl.obolibrary.org/obo/ECOSIMCONCEPT_ diff --git a/src/semsql/builder/registry/ontologies.yaml b/src/semsql/builder/registry/ontologies.yaml index 272ddc6..fe16e92 100644 --- a/src/semsql/builder/registry/ontologies.yaml +++ b/src/semsql/builder/registry/ontologies.yaml @@ -98,10 +98,24 @@ ontologies: url: https://openenergyplatform.org/ontology/oeo/releases/oeo-full.owl prefixmap: OEO: http://openenergy-platform.org/ontology/oeo/OEO_ + taxslim: + url: http://purl.obolibrary.org/obo/ncbitaxon/subsets/taxslim.obo + build_command: "robot convert -i $< -o $@" + goldterms: + url: https://raw.githubusercontent.com/cmungall/gold-ontology/main/gold.owl + build_command: "robot relax -i $< reason -o $@" + prefixmap: + GOLDTERMS: https://w3id.org/gold.path/ + GOLDVOCAB: https://w3id.org/gold.vocab/ sdgio: url: https://raw.githubusercontent.com/SDG-InterfaceOntology/sdgio/master/sdgio.owl prefixmap: SDGIO: http://purl.unep.org/sdg/SDGIO_ + kin: + url: http://purl.org/ga4gh/kin.owl + build_command: "robot reason -i $< -o $@" + prefixmap: + KIN: "http://purl.org/ga4gh/kin.owl#KIN_" biovoices: url: https://zenodo.org/record/5589773/files/ontology.owl?download=1 build_command: "robot relax -i $< merge -o $@" @@ -110,6 +124,11 @@ ontologies: omop: prefixmap: omop: https://athena.ohdsi.org/search-terms/terms/ + comet: + url: https://raw.githubusercontent.com/linkml/linkml-common/main/project/owl/linkml_common.owl.ttl + build_command: "robot relax -i $< merge -o $@" + prefixmap: + comet: https://w3id.org/linkml-common/ cco: url: http://www.ontologyrepository.com/CommonCoreOntologies/Mid/AllCoreOntology build_command: "robot merge -i $< relax -o $@" @@ -166,9 +185,16 @@ ontologies: ito: url: https://github.com/OpenBioLink/ITO/raw/master/ITO.owl.zip zip_extract_file: ITO.owl - reactome-Homo-sapiens: + reactome-hs: url: https://reactome.org/download/current/biopax.zip zip_extract_file: Homo_sapiens.owl + #post_processing_steps: + # - "sqlite3 {db} < views/reactome.sql" + reactome-mm: + url: https://reactome.org/download/current/biopax.zip + zip_extract_file: Mus_musculus.owl + post_processing_steps: + - "sqlite3 {db} < views/reactome.sql" efo: url: http://www.ebi.ac.uk/efo/efo.owl has_imports: true @@ -327,6 +353,17 @@ ontologies: url: "'https://data.bioontology.org/ontologies/NANDO/submissions/15/download?apikey=8b5b7825-538d-40e0-9e9e-5ab9274a9aeb'" prefixmap: NANDO: http://nanbyodata.jp/ontology/NANDO_ + ecso: + url: "'https://data.bioontology.org/ontologies/ECSO/submissions/64/download?apikey=8b5b7825-538d-40e0-9e9e-5ab9274a9aeb'" + prefixmap: + ECSO: http://purl.dataone.org/odo/ECSO_ + enigma_context: + url: https://raw.githubusercontent.com/jmchandonia/CORAL/main/example/enigma/ontologies/context_measurement_ontology.obo + build_command: "robot merge -i $< -o $@" + #meo: + # url: "'https://data.bioontology.org/ontologies/MEO/submissions/9/download?apikey=8b5b7825-538d-40e0-9e9e-5ab9274a9aeb'" + # prefixmap: + # MEO: http://purl.jp/bio/11/meo/MEO_ ontie: url: https://ontology.iedb.org/file/ontie.owl prefixmap: @@ -349,8 +386,8 @@ ontologies: linkml: https://w3id.org/linkml/ mixs: https://w3id.org/mixs/ mixs: - url: https://raw.githubusercontent.com/microbiomedata/mixs-6-2-release-candidate/main/schema-derivatives/mixs_6_2_rc.owl.ttl - build_command: "robot merge -i $< reason -o $@.tmp.owl && perl -npe 's@_6_2_rc@@g;s@-6-2-rc@@g' $@.tmp.owl > $@" + url: https://raw.githubusercontent.com/GenomicsStandardsConsortium/mixs/main/project/owl/mixs.owl.ttl + build_command: "robot merge -i $< reason -o $@" prefixmap: mixs: https://w3id.org/mixs/ fibo: @@ -363,6 +400,9 @@ ontologies: # BFO variant products bfo2020: url: http://purl.obolibrary.org/obo/bfo/2020/bfo.owl + #post_processing_steps: + # - "echo hello {db}" + # - "echo goodbye {db}" bfo2020_core: url: http://purl.obolibrary.org/obo/bfo/2020/bfo-core.owl bfo2020_notime: diff --git a/src/semsql/builder/registry/registry_schema.py b/src/semsql/builder/registry/registry_schema.py index bd5ec9b..5e790e5 100644 --- a/src/semsql/builder/registry/registry_schema.py +++ b/src/semsql/builder/registry/registry_schema.py @@ -1,5 +1,5 @@ -# Auto generated from registry_schema.yaml by pythongen.py version: 0.9.0 -# Generation date: 2022-11-13T13:16:23 +# Auto generated from registry_schema.yaml by pythongen.py version: 0.0.1 +# Generation date: 2024-06-04T13:42:40 # Schema: ontology_registry # # id: https://w3id.org/semsql/registry @@ -7,25 +7,23 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses +import re +from jsonasobj2 import JsonObj, as_dict +from typing import Optional, List, Union, Dict, ClassVar, Any from dataclasses import dataclass -from typing import Any, ClassVar, Dict, List, Optional, Union +from datetime import date, datetime +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions -from jsonasobj2 import JsonObj, as_dict -from linkml_runtime.linkml_model.meta import (EnumDefinition, PermissibleValue, - PvFormulaOptions) -from linkml_runtime.linkml_model.types import (Boolean, Integer, String, - Uriorcurie) -from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.utils.dataclass_extensions_376 import \ - dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from linkml_runtime.utils.formatutils import camelcase, sfx, underscore -from linkml_runtime.utils.metamodelcore import (Bool, URIorCURIE, bnode, - empty_dict, empty_list) from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.yamlutils import (YAMLRoot, extended_float, - extended_int, extended_str) +from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs +from linkml_runtime.utils.formatutils import camelcase, underscore, sfx +from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef +from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.linkml_model.types import Boolean, Integer, String, Uriorcurie +from linkml_runtime.utils.metamodelcore import Bool, URIorCURIE metamodel_version = "1.7.0" version = None @@ -34,29 +32,29 @@ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces -LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") -SEMSQL_REGISTRY = CurieNamespace("semsql_registry", "https://w3id.org/semsql/registry") -XSD = CurieNamespace("xsd", "http://www.w3.org/2001/XMLSchema#") +LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') +SEMSQL_REGISTRY = CurieNamespace('semsql_registry', 'https://w3id.org/semsql/registry') +XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') DEFAULT_ = SEMSQL_REGISTRY # Types class Identifier(String): - type_class_uri = XSD.string + type_class_uri = XSD["string"] type_class_curie = "xsd:string" type_name = "identifier" type_model_uri = SEMSQL_REGISTRY.Identifier class HttpsIdentifier(String): - type_class_uri = XSD.string + type_class_uri = XSD["string"] type_class_curie = "xsd:string" type_name = "https identifier" type_model_uri = SEMSQL_REGISTRY.HttpsIdentifier class HttpIdentifier(String): - type_class_uri = XSD.string + type_class_uri = XSD["string"] type_class_curie = "xsd:string" type_name = "http identifier" type_model_uri = SEMSQL_REGISTRY.HttpIdentifier @@ -79,7 +77,7 @@ class RegistryId(extended_str): class Ontology(YAMLRoot): _inherited_slots: ClassVar[List[str]] = [] - class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.Ontology + class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY["Ontology"] class_class_curie: ClassVar[str] = "semsql_registry:Ontology" class_name: ClassVar[str] = "Ontology" class_model_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.Ontology @@ -91,12 +89,7 @@ class Ontology(YAMLRoot): local_path: Optional[str] = None has_imports: Optional[int] = None jsonld_context: Optional[Union[str, HttpsIdentifier]] = None - prefixmap: Optional[ - Union[ - Dict[Union[str, PrefixMapPrefix], Union[dict, "PrefixMap"]], - List[Union[dict, "PrefixMap"]], - ] - ] = empty_dict() + prefixmap: Optional[Union[Dict[Union[str, PrefixMapPrefix], Union[dict, "PrefixMap"]], List[Union[dict, "PrefixMap"]]]] = empty_dict() named_prefixmaps: Optional[Union[str, List[str]]] = empty_list() format: Optional[str] = None compression: Optional[Union[str, "CompressionEnum"]] = None @@ -104,6 +97,7 @@ class Ontology(YAMLRoot): relation_graph_settings: Optional[Union[dict, "RelationGraphConfiguration"]] = None zip_extract_file: Optional[str] = None build_command: Optional[str] = None + post_processing_steps: Optional[Union[str, List[str]]] = empty_list() def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self._is_empty(self.id): @@ -126,49 +120,37 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self.has_imports is not None and not isinstance(self.has_imports, int): self.has_imports = int(self.has_imports) - if self.jsonld_context is not None and not isinstance( - self.jsonld_context, HttpsIdentifier - ): + if self.jsonld_context is not None and not isinstance(self.jsonld_context, HttpsIdentifier): self.jsonld_context = HttpsIdentifier(self.jsonld_context) - self._normalize_inlined_as_dict( - slot_name="prefixmap", slot_type=PrefixMap, key_name="prefix", keyed=True - ) + self._normalize_inlined_as_dict(slot_name="prefixmap", slot_type=PrefixMap, key_name="prefix", keyed=True) if not isinstance(self.named_prefixmaps, list): - self.named_prefixmaps = ( - [self.named_prefixmaps] if self.named_prefixmaps is not None else [] - ) - self.named_prefixmaps = [ - v if isinstance(v, str) else str(v) for v in self.named_prefixmaps - ] + self.named_prefixmaps = [self.named_prefixmaps] if self.named_prefixmaps is not None else [] + self.named_prefixmaps = [v if isinstance(v, str) else str(v) for v in self.named_prefixmaps] if self.format is not None and not isinstance(self.format, str): self.format = str(self.format) - if self.compression is not None and not isinstance( - self.compression, CompressionEnum - ): + if self.compression is not None and not isinstance(self.compression, CompressionEnum): self.compression = CompressionEnum(self.compression) if self.suppress is not None and not isinstance(self.suppress, Bool): self.suppress = Bool(self.suppress) - if self.relation_graph_settings is not None and not isinstance( - self.relation_graph_settings, RelationGraphConfiguration - ): - self.relation_graph_settings = RelationGraphConfiguration( - **as_dict(self.relation_graph_settings) - ) + if self.relation_graph_settings is not None and not isinstance(self.relation_graph_settings, RelationGraphConfiguration): + self.relation_graph_settings = RelationGraphConfiguration(**as_dict(self.relation_graph_settings)) - if self.zip_extract_file is not None and not isinstance( - self.zip_extract_file, str - ): + if self.zip_extract_file is not None and not isinstance(self.zip_extract_file, str): self.zip_extract_file = str(self.zip_extract_file) if self.build_command is not None and not isinstance(self.build_command, str): self.build_command = str(self.build_command) + if not isinstance(self.post_processing_steps, list): + self.post_processing_steps = [self.post_processing_steps] if self.post_processing_steps is not None else [] + self.post_processing_steps = [v if isinstance(v, str) else str(v) for v in self.post_processing_steps] + super().__post_init__(**kwargs) @@ -176,7 +158,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): class PrefixMap(YAMLRoot): _inherited_slots: ClassVar[List[str]] = [] - class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.PrefixMap + class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY["PrefixMap"] class_class_curie: ClassVar[str] = "semsql_registry:PrefixMap" class_name: ClassVar[str] = "PrefixMap" class_model_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.PrefixMap @@ -190,9 +172,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if not isinstance(self.prefix, PrefixMapPrefix): self.prefix = PrefixMapPrefix(self.prefix) - if self.prefix_value is not None and not isinstance( - self.prefix_value, HttpIdentifier - ): + if self.prefix_value is not None and not isinstance(self.prefix_value, HttpIdentifier): self.prefix_value = HttpIdentifier(self.prefix_value) super().__post_init__(**kwargs) @@ -202,7 +182,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): class Registry(YAMLRoot): _inherited_slots: ClassVar[List[str]] = [] - class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.Registry + class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY["Registry"] class_class_curie: ClassVar[str] = "semsql_registry:Registry" class_name: ClassVar[str] = "Registry" class_model_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.Registry @@ -210,12 +190,7 @@ class Registry(YAMLRoot): id: Union[str, RegistryId] = None description: Optional[str] = None license: Optional[str] = None - ontologies: Optional[ - Union[ - Dict[Union[str, OntologyId], Union[dict, Ontology]], - List[Union[dict, Ontology]], - ] - ] = empty_dict() + ontologies: Optional[Union[Dict[Union[str, OntologyId], Union[dict, Ontology]], List[Union[dict, Ontology]]]] = empty_dict() def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self._is_empty(self.id): @@ -229,9 +204,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self.license is not None and not isinstance(self.license, str): self.license = str(self.license) - self._normalize_inlined_as_dict( - slot_name="ontologies", slot_type=Ontology, key_name="id", keyed=True - ) + self._normalize_inlined_as_dict(slot_name="ontologies", slot_type=Ontology, key_name="id", keyed=True) super().__post_init__(**kwargs) @@ -240,21 +213,17 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): class RelationGraphConfiguration(YAMLRoot): _inherited_slots: ClassVar[List[str]] = [] - class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.RelationGraphConfiguration + class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY["RelationGraphConfiguration"] class_class_curie: ClassVar[str] = "semsql_registry:RelationGraphConfiguration" class_name: ClassVar[str] = "RelationGraphConfiguration" class_model_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.RelationGraphConfiguration - properties: Optional[ - Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]] - ] = empty_list() + properties: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if not isinstance(self.properties, list): self.properties = [self.properties] if self.properties is not None else [] - self.properties = [ - v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.properties - ] + self.properties = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.properties] super().__post_init__(**kwargs) @@ -263,7 +232,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): class MakefileRule(YAMLRoot): _inherited_slots: ClassVar[List[str]] = [] - class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.MakefileRule + class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY["MakefileRule"] class_class_curie: ClassVar[str] = "semsql_registry:MakefileRule" class_name: ClassVar[str] = "MakefileRule" class_model_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.MakefileRule @@ -279,12 +248,8 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): self.target = str(self.target) if not isinstance(self.dependencies, list): - self.dependencies = ( - [self.dependencies] if self.dependencies is not None else [] - ) - self.dependencies = [ - v if isinstance(v, str) else str(v) for v in self.dependencies - ] + self.dependencies = [self.dependencies] if self.dependencies is not None else [] + self.dependencies = [v if isinstance(v, str) else str(v) for v in self.dependencies] if not isinstance(self.commands, list): self.commands = [self.commands] if self.commands is not None else [] @@ -304,288 +269,123 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): class Makefile(YAMLRoot): _inherited_slots: ClassVar[List[str]] = [] - class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.Makefile + class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY["Makefile"] class_class_curie: ClassVar[str] = "semsql_registry:Makefile" class_name: ClassVar[str] = "Makefile" class_model_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.Makefile - rules: Optional[ - Union[Union[dict, MakefileRule], List[Union[dict, MakefileRule]]] - ] = empty_list() + rules: Optional[Union[Union[dict, MakefileRule], List[Union[dict, MakefileRule]]]] = empty_list() def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if not isinstance(self.rules, list): self.rules = [self.rules] if self.rules is not None else [] - self.rules = [ - v if isinstance(v, MakefileRule) else MakefileRule(**as_dict(v)) - for v in self.rules - ] + self.rules = [v if isinstance(v, MakefileRule) else MakefileRule(**as_dict(v)) for v in self.rules] super().__post_init__(**kwargs) # Enumerations class FormatEnum(EnumDefinitionImpl): - n3 = PermissibleValue(text="n3", description="n3") + + n3 = PermissibleValue( + text="n3", + description="n3") _defn = EnumDefinition( name="FormatEnum", ) - class CompressionEnum(EnumDefinitionImpl): - gzip = PermissibleValue(text="gzip", description="gzip") + + gzip = PermissibleValue( + text="gzip", + description="gzip") _defn = EnumDefinition( name="CompressionEnum", ) - # Slots class slots: pass +slots.id = Slot(uri=SEMSQL_REGISTRY.id, name="id", curie=SEMSQL_REGISTRY.curie('id'), + model_uri=SEMSQL_REGISTRY.id, domain=None, range=URIRef) + +slots.description = Slot(uri=SEMSQL_REGISTRY.description, name="description", curie=SEMSQL_REGISTRY.curie('description'), + model_uri=SEMSQL_REGISTRY.description, domain=None, range=Optional[str]) + +slots.url = Slot(uri=SEMSQL_REGISTRY.url, name="url", curie=SEMSQL_REGISTRY.curie('url'), + model_uri=SEMSQL_REGISTRY.url, domain=None, range=Optional[Union[str, Identifier]]) + +slots.relation_graph_settings = Slot(uri=SEMSQL_REGISTRY.relation_graph_settings, name="relation_graph_settings", curie=SEMSQL_REGISTRY.curie('relation_graph_settings'), + model_uri=SEMSQL_REGISTRY.relation_graph_settings, domain=None, range=Optional[Union[dict, RelationGraphConfiguration]]) + +slots.has_imports = Slot(uri=SEMSQL_REGISTRY.has_imports, name="has_imports", curie=SEMSQL_REGISTRY.curie('has_imports'), + model_uri=SEMSQL_REGISTRY.has_imports, domain=None, range=Optional[int]) + +slots.jsonld_context = Slot(uri=SEMSQL_REGISTRY.jsonld_context, name="jsonld_context", curie=SEMSQL_REGISTRY.curie('jsonld_context'), + model_uri=SEMSQL_REGISTRY.jsonld_context, domain=None, range=Optional[Union[str, HttpsIdentifier]]) + +slots.prefixmap = Slot(uri=SEMSQL_REGISTRY.prefixmap, name="prefixmap", curie=SEMSQL_REGISTRY.curie('prefixmap'), + model_uri=SEMSQL_REGISTRY.prefixmap, domain=None, range=Optional[Union[Dict[Union[str, PrefixMapPrefix], Union[dict, PrefixMap]], List[Union[dict, PrefixMap]]]]) + +slots.zip_extract_file = Slot(uri=SEMSQL_REGISTRY.zip_extract_file, name="zip_extract_file", curie=SEMSQL_REGISTRY.curie('zip_extract_file'), + model_uri=SEMSQL_REGISTRY.zip_extract_file, domain=None, range=Optional[str]) + +slots.named_prefixmaps = Slot(uri=SEMSQL_REGISTRY.named_prefixmaps, name="named_prefixmaps", curie=SEMSQL_REGISTRY.curie('named_prefixmaps'), + model_uri=SEMSQL_REGISTRY.named_prefixmaps, domain=None, range=Optional[Union[str, List[str]]]) + +slots.format = Slot(uri=SEMSQL_REGISTRY.format, name="format", curie=SEMSQL_REGISTRY.curie('format'), + model_uri=SEMSQL_REGISTRY.format, domain=None, range=Optional[str]) + +slots.build_command = Slot(uri=SEMSQL_REGISTRY.build_command, name="build_command", curie=SEMSQL_REGISTRY.curie('build_command'), + model_uri=SEMSQL_REGISTRY.build_command, domain=None, range=Optional[str]) + +slots.sha256 = Slot(uri=SEMSQL_REGISTRY.sha256, name="sha256", curie=SEMSQL_REGISTRY.curie('sha256'), + model_uri=SEMSQL_REGISTRY.sha256, domain=None, range=Optional[str]) + +slots.local_path = Slot(uri=SEMSQL_REGISTRY.local_path, name="local_path", curie=SEMSQL_REGISTRY.curie('local_path'), + model_uri=SEMSQL_REGISTRY.local_path, domain=None, range=Optional[str]) + +slots.compression = Slot(uri=SEMSQL_REGISTRY.compression, name="compression", curie=SEMSQL_REGISTRY.curie('compression'), + model_uri=SEMSQL_REGISTRY.compression, domain=None, range=Optional[Union[str, "CompressionEnum"]]) + +slots.prefix = Slot(uri=SEMSQL_REGISTRY.prefix, name="prefix", curie=SEMSQL_REGISTRY.curie('prefix'), + model_uri=SEMSQL_REGISTRY.prefix, domain=None, range=URIRef) + +slots.prefix_value = Slot(uri=SEMSQL_REGISTRY.prefix_value, name="prefix_value", curie=SEMSQL_REGISTRY.curie('prefix_value'), + model_uri=SEMSQL_REGISTRY.prefix_value, domain=None, range=Optional[Union[str, HttpIdentifier]]) + +slots.license = Slot(uri=SEMSQL_REGISTRY.license, name="license", curie=SEMSQL_REGISTRY.curie('license'), + model_uri=SEMSQL_REGISTRY.license, domain=None, range=Optional[str]) + +slots.ontologies = Slot(uri=SEMSQL_REGISTRY.ontologies, name="ontologies", curie=SEMSQL_REGISTRY.curie('ontologies'), + model_uri=SEMSQL_REGISTRY.ontologies, domain=None, range=Optional[Union[Dict[Union[str, OntologyId], Union[dict, Ontology]], List[Union[dict, Ontology]]]]) + +slots.suppress = Slot(uri=SEMSQL_REGISTRY.suppress, name="suppress", curie=SEMSQL_REGISTRY.curie('suppress'), + model_uri=SEMSQL_REGISTRY.suppress, domain=None, range=Optional[Union[bool, Bool]]) + +slots.post_processing_steps = Slot(uri=SEMSQL_REGISTRY.post_processing_steps, name="post_processing_steps", curie=SEMSQL_REGISTRY.curie('post_processing_steps'), + model_uri=SEMSQL_REGISTRY.post_processing_steps, domain=None, range=Optional[Union[str, List[str]]]) + +slots.relationGraphConfiguration__properties = Slot(uri=SEMSQL_REGISTRY.properties, name="relationGraphConfiguration__properties", curie=SEMSQL_REGISTRY.curie('properties'), + model_uri=SEMSQL_REGISTRY.relationGraphConfiguration__properties, domain=None, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + +slots.makefileRule__target = Slot(uri=SEMSQL_REGISTRY.target, name="makefileRule__target", curie=SEMSQL_REGISTRY.curie('target'), + model_uri=SEMSQL_REGISTRY.makefileRule__target, domain=None, range=Optional[str]) + +slots.makefileRule__dependencies = Slot(uri=SEMSQL_REGISTRY.dependencies, name="makefileRule__dependencies", curie=SEMSQL_REGISTRY.curie('dependencies'), + model_uri=SEMSQL_REGISTRY.makefileRule__dependencies, domain=None, range=Optional[Union[str, List[str]]]) + +slots.makefileRule__commands = Slot(uri=SEMSQL_REGISTRY.commands, name="makefileRule__commands", curie=SEMSQL_REGISTRY.curie('commands'), + model_uri=SEMSQL_REGISTRY.makefileRule__commands, domain=None, range=Optional[Union[str, List[str]]]) + +slots.makefileRule__comments = Slot(uri=SEMSQL_REGISTRY.comments, name="makefileRule__comments", curie=SEMSQL_REGISTRY.curie('comments'), + model_uri=SEMSQL_REGISTRY.makefileRule__comments, domain=None, range=Optional[Union[str, List[str]]]) + +slots.makefileRule__precious = Slot(uri=SEMSQL_REGISTRY.precious, name="makefileRule__precious", curie=SEMSQL_REGISTRY.curie('precious'), + model_uri=SEMSQL_REGISTRY.makefileRule__precious, domain=None, range=Optional[Union[bool, Bool]]) -slots.id = Slot( - uri=SEMSQL_REGISTRY.id, - name="id", - curie=SEMSQL_REGISTRY.curie("id"), - model_uri=SEMSQL_REGISTRY.id, - domain=None, - range=URIRef, -) - -slots.description = Slot( - uri=SEMSQL_REGISTRY.description, - name="description", - curie=SEMSQL_REGISTRY.curie("description"), - model_uri=SEMSQL_REGISTRY.description, - domain=None, - range=Optional[str], -) - -slots.url = Slot( - uri=SEMSQL_REGISTRY.url, - name="url", - curie=SEMSQL_REGISTRY.curie("url"), - model_uri=SEMSQL_REGISTRY.url, - domain=None, - range=Optional[Union[str, Identifier]], -) - -slots.relation_graph_settings = Slot( - uri=SEMSQL_REGISTRY.relation_graph_settings, - name="relation_graph_settings", - curie=SEMSQL_REGISTRY.curie("relation_graph_settings"), - model_uri=SEMSQL_REGISTRY.relation_graph_settings, - domain=None, - range=Optional[Union[dict, RelationGraphConfiguration]], -) - -slots.has_imports = Slot( - uri=SEMSQL_REGISTRY.has_imports, - name="has_imports", - curie=SEMSQL_REGISTRY.curie("has_imports"), - model_uri=SEMSQL_REGISTRY.has_imports, - domain=None, - range=Optional[int], -) - -slots.jsonld_context = Slot( - uri=SEMSQL_REGISTRY.jsonld_context, - name="jsonld_context", - curie=SEMSQL_REGISTRY.curie("jsonld_context"), - model_uri=SEMSQL_REGISTRY.jsonld_context, - domain=None, - range=Optional[Union[str, HttpsIdentifier]], -) - -slots.prefixmap = Slot( - uri=SEMSQL_REGISTRY.prefixmap, - name="prefixmap", - curie=SEMSQL_REGISTRY.curie("prefixmap"), - model_uri=SEMSQL_REGISTRY.prefixmap, - domain=None, - range=Optional[ - Union[ - Dict[Union[str, PrefixMapPrefix], Union[dict, PrefixMap]], - List[Union[dict, PrefixMap]], - ] - ], -) - -slots.zip_extract_file = Slot( - uri=SEMSQL_REGISTRY.zip_extract_file, - name="zip_extract_file", - curie=SEMSQL_REGISTRY.curie("zip_extract_file"), - model_uri=SEMSQL_REGISTRY.zip_extract_file, - domain=None, - range=Optional[str], -) - -slots.named_prefixmaps = Slot( - uri=SEMSQL_REGISTRY.named_prefixmaps, - name="named_prefixmaps", - curie=SEMSQL_REGISTRY.curie("named_prefixmaps"), - model_uri=SEMSQL_REGISTRY.named_prefixmaps, - domain=None, - range=Optional[Union[str, List[str]]], -) - -slots.format = Slot( - uri=SEMSQL_REGISTRY.format, - name="format", - curie=SEMSQL_REGISTRY.curie("format"), - model_uri=SEMSQL_REGISTRY.format, - domain=None, - range=Optional[str], -) - -slots.build_command = Slot( - uri=SEMSQL_REGISTRY.build_command, - name="build_command", - curie=SEMSQL_REGISTRY.curie("build_command"), - model_uri=SEMSQL_REGISTRY.build_command, - domain=None, - range=Optional[str], -) - -slots.sha256 = Slot( - uri=SEMSQL_REGISTRY.sha256, - name="sha256", - curie=SEMSQL_REGISTRY.curie("sha256"), - model_uri=SEMSQL_REGISTRY.sha256, - domain=None, - range=Optional[str], -) - -slots.local_path = Slot( - uri=SEMSQL_REGISTRY.local_path, - name="local_path", - curie=SEMSQL_REGISTRY.curie("local_path"), - model_uri=SEMSQL_REGISTRY.local_path, - domain=None, - range=Optional[str], -) - -slots.compression = Slot( - uri=SEMSQL_REGISTRY.compression, - name="compression", - curie=SEMSQL_REGISTRY.curie("compression"), - model_uri=SEMSQL_REGISTRY.compression, - domain=None, - range=Optional[Union[str, "CompressionEnum"]], -) - -slots.prefix = Slot( - uri=SEMSQL_REGISTRY.prefix, - name="prefix", - curie=SEMSQL_REGISTRY.curie("prefix"), - model_uri=SEMSQL_REGISTRY.prefix, - domain=None, - range=URIRef, -) - -slots.prefix_value = Slot( - uri=SEMSQL_REGISTRY.prefix_value, - name="prefix_value", - curie=SEMSQL_REGISTRY.curie("prefix_value"), - model_uri=SEMSQL_REGISTRY.prefix_value, - domain=None, - range=Optional[Union[str, HttpIdentifier]], -) - -slots.license = Slot( - uri=SEMSQL_REGISTRY.license, - name="license", - curie=SEMSQL_REGISTRY.curie("license"), - model_uri=SEMSQL_REGISTRY.license, - domain=None, - range=Optional[str], -) - -slots.ontologies = Slot( - uri=SEMSQL_REGISTRY.ontologies, - name="ontologies", - curie=SEMSQL_REGISTRY.curie("ontologies"), - model_uri=SEMSQL_REGISTRY.ontologies, - domain=None, - range=Optional[ - Union[ - Dict[Union[str, OntologyId], Union[dict, Ontology]], - List[Union[dict, Ontology]], - ] - ], -) - -slots.suppress = Slot( - uri=SEMSQL_REGISTRY.suppress, - name="suppress", - curie=SEMSQL_REGISTRY.curie("suppress"), - model_uri=SEMSQL_REGISTRY.suppress, - domain=None, - range=Optional[Union[bool, Bool]], -) - -slots.relationGraphConfiguration__properties = Slot( - uri=SEMSQL_REGISTRY.properties, - name="relationGraphConfiguration__properties", - curie=SEMSQL_REGISTRY.curie("properties"), - model_uri=SEMSQL_REGISTRY.relationGraphConfiguration__properties, - domain=None, - range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]], -) - -slots.makefileRule__target = Slot( - uri=SEMSQL_REGISTRY.target, - name="makefileRule__target", - curie=SEMSQL_REGISTRY.curie("target"), - model_uri=SEMSQL_REGISTRY.makefileRule__target, - domain=None, - range=Optional[str], -) - -slots.makefileRule__dependencies = Slot( - uri=SEMSQL_REGISTRY.dependencies, - name="makefileRule__dependencies", - curie=SEMSQL_REGISTRY.curie("dependencies"), - model_uri=SEMSQL_REGISTRY.makefileRule__dependencies, - domain=None, - range=Optional[Union[str, List[str]]], -) - -slots.makefileRule__commands = Slot( - uri=SEMSQL_REGISTRY.commands, - name="makefileRule__commands", - curie=SEMSQL_REGISTRY.curie("commands"), - model_uri=SEMSQL_REGISTRY.makefileRule__commands, - domain=None, - range=Optional[Union[str, List[str]]], -) - -slots.makefileRule__comments = Slot( - uri=SEMSQL_REGISTRY.comments, - name="makefileRule__comments", - curie=SEMSQL_REGISTRY.curie("comments"), - model_uri=SEMSQL_REGISTRY.makefileRule__comments, - domain=None, - range=Optional[Union[str, List[str]]], -) - -slots.makefileRule__precious = Slot( - uri=SEMSQL_REGISTRY.precious, - name="makefileRule__precious", - curie=SEMSQL_REGISTRY.curie("precious"), - model_uri=SEMSQL_REGISTRY.makefileRule__precious, - domain=None, - range=Optional[Union[bool, Bool]], -) - -slots.makefile__rules = Slot( - uri=SEMSQL_REGISTRY.rules, - name="makefile__rules", - curie=SEMSQL_REGISTRY.curie("rules"), - model_uri=SEMSQL_REGISTRY.makefile__rules, - domain=None, - range=Optional[Union[Union[dict, MakefileRule], List[Union[dict, MakefileRule]]]], -) +slots.makefile__rules = Slot(uri=SEMSQL_REGISTRY.rules, name="makefile__rules", curie=SEMSQL_REGISTRY.curie('rules'), + model_uri=SEMSQL_REGISTRY.makefile__rules, domain=None, range=Optional[Union[Union[dict, MakefileRule], List[Union[dict, MakefileRule]]]]) diff --git a/src/semsql/builder/registry/registry_schema.yaml b/src/semsql/builder/registry/registry_schema.yaml index 07cf978..d204b7e 100644 --- a/src/semsql/builder/registry/registry_schema.yaml +++ b/src/semsql/builder/registry/registry_schema.yaml @@ -96,6 +96,9 @@ slots: range: Ontology suppress: range: boolean + post_processing_steps: + multivalued: true + range: string classes: Ontology: slots: @@ -114,6 +117,7 @@ classes: - relation_graph_settings - zip_extract_file - build_command + - post_processing_steps PrefixMap: slots: - prefix diff --git a/views/bfo.sql b/views/bfo.sql new file mode 100644 index 0000000..618c6f8 --- /dev/null +++ b/views/bfo.sql @@ -0,0 +1,76 @@ +CREATE VIEW formal_class AS + SELECT + 'BFO' AS ont, id + FROM + node + WHERE + id LIKE 'BFO:%' +UNION + SELECT + 'OGMS' AS ont, id + FROM + node + WHERE + id LIKE 'OGMS:%'; + +CREATE VIEW subclass_of_formal_class AS + SELECT + f.ont, s.* + FROM + rdfs_subclass_of_statement s, + formal_class f + WHERE + s.object=f.id AND s.subject NOT IN (select id FROM formal_class); + +CREATE VIEW formal_class_subclass_count_by_prefix AS + SELECT + s.object AS formal_class_id, ni.prefix, count(distinct s.subject) AS subclass_count + FROM + subclass_of_formal_class AS s, + node_identifier AS ni + WHERE + s.subject=ni.id + GROUP BY formal_class_id, ni.prefix; + + +CREATE VIEW formal_class_subclass_count AS + SELECT + object AS formal_class_id, count(distinct subject) AS subclass_count + FROM + subclass_of_formal_class + GROUP BY formal_class_id; + +CREATE VIEW formal_ontology_usage_count AS + SELECT + ont, count(distinct subject) AS subclass_count + FROM + subclass_of_formal_class + GROUP BY ont; + +CREATE VIEW inter_sofc_edge AS + SELECT + e.*, + s.object AS subject_fc, + o.object AS object_fc + FROM + edge AS e, + subclass_of_formal_class AS s, + subclass_of_formal_class AS o + WHERE + e.subject=s.subject AND + e.object=o.subject; + +CREATE VIEW intra_inter_sofc_edge AS + SELECT + e.*, + nis.prefix as subject_prefix, + ois.prefix as object_prefix + FROM + inter_sofc_edge AS e, + node_identifier AS nis, + node_identifier AS nio + WHERE + e.subject=nis.id AND + e.object=nio.id; + + From af957d1060b441066c6ae32c255946d739d7b7bc Mon Sep 17 00:00:00 2001 From: Chris Mungall Date: Fri, 5 Jul 2024 16:22:41 -0700 Subject: [PATCH 2/2] formatting --- src/semsql/builder/builder.py | 18 +- src/semsql/builder/cli.py | 3 +- .../builder/registry/registry_schema.py | 462 +++++++++++++----- src/semsql/ontlib/subgraph.py | 1 + 4 files changed, 355 insertions(+), 129 deletions(-) diff --git a/src/semsql/builder/builder.py b/src/semsql/builder/builder.py index 8145285..1ae09f1 100644 --- a/src/semsql/builder/builder.py +++ b/src/semsql/builder/builder.py @@ -4,14 +4,14 @@ import shutil import subprocess from pathlib import Path -from typing import Optional, TextIO, List +from typing import List, Optional, TextIO import requests from linkml_runtime.loaders import yaml_loader from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker -from semsql.builder.registry import registry_schema, path_to_ontology_registry +from semsql.builder.registry import path_to_ontology_registry, registry_schema from semsql.builder.registry.registry_schema import (CompressionEnum, Makefile, MakefileRule, Ontology) from semsql.utils.makefile_utils import makefile_to_string @@ -117,7 +117,9 @@ def connect(owl_file: str): return session -def get_postprocessing_steps(ontology: str, db: str, registry_path: str = None) -> List[str]: +def get_postprocessing_steps( + ontology: str, db: str, registry_path: str = None +) -> List[str]: """ Get postprocessing steps for an ontology @@ -128,8 +130,10 @@ def get_postprocessing_steps(ontology: str, db: str, registry_path: str = None) if registry_path is None: registry_path = path_to_ontology_registry() registry: registry_schema.Registry - registry = yaml_loader.load(str(registry_path), target_class=registry_schema.Registry) - #steps = [step.format(ont=ontology, db=db) for step in registry.ontologies.get(ontology, []).post_processing_steps] + registry = yaml_loader.load( + str(registry_path), target_class=registry_schema.Registry + ) + # steps = [step.format(ont=ontology, db=db) for step in registry.ontologies.get(ontology, []).post_processing_steps] steps = registry.ontologies.get(ontology, []) return steps @@ -187,9 +191,7 @@ def compile_registry(registry_path: str, local_prefix_file: TextIO = None) -> st else: command = "cp $< $@" commands = [command] - rule = MakefileRule( - target=target, dependencies=dependencies, commands=commands - ) + rule = MakefileRule(target=target, dependencies=dependencies, commands=commands) makefile.rules.append(rule) if not ont.suppress: onts.append(ont.id) diff --git a/src/semsql/builder/cli.py b/src/semsql/builder/cli.py index 69a9799..7838d7b 100644 --- a/src/semsql/builder/cli.py +++ b/src/semsql/builder/cli.py @@ -65,6 +65,7 @@ def make(path, docker, **kwargs): builder.make(path, docker_config=docker_config, **kwargs) # check if path is db/{foo}.db using regular expression import re + matches = re.match(r"db/(\w+).db", path) if matches: ontology = matches.group(1) @@ -74,8 +75,6 @@ def make(path, docker, **kwargs): subprocess.run(step, shell=True) - - @main.command() @click.option( "--local-prefixes", diff --git a/src/semsql/builder/registry/registry_schema.py b/src/semsql/builder/registry/registry_schema.py index 5e790e5..be4b36b 100644 --- a/src/semsql/builder/registry/registry_schema.py +++ b/src/semsql/builder/registry/registry_schema.py @@ -8,22 +8,26 @@ import dataclasses import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any from dataclasses import dataclass from datetime import date, datetime -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions +from typing import Any, ClassVar, Dict, List, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx +from jsonasobj2 import JsonObj, as_dict +from linkml_runtime.linkml_model.meta import (EnumDefinition, PermissibleValue, + PvFormulaOptions) +from linkml_runtime.linkml_model.types import (Boolean, Integer, String, + Uriorcurie) +from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.dataclass_extensions_376 import \ + dataclasses_init_fn_with_kwargs from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from linkml_runtime.utils.formatutils import camelcase, sfx, underscore +from linkml_runtime.utils.metamodelcore import (Bool, URIorCURIE, bnode, + empty_dict, empty_list) +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import (YAMLRoot, extended_float, + extended_int, extended_str) from rdflib import Namespace, URIRef -from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.linkml_model.types import Boolean, Integer, String, Uriorcurie -from linkml_runtime.utils.metamodelcore import Bool, URIorCURIE metamodel_version = "1.7.0" version = None @@ -32,9 +36,9 @@ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -SEMSQL_REGISTRY = CurieNamespace('semsql_registry', 'https://w3id.org/semsql/registry') -XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +SEMSQL_REGISTRY = CurieNamespace("semsql_registry", "https://w3id.org/semsql/registry") +XSD = CurieNamespace("xsd", "http://www.w3.org/2001/XMLSchema#") DEFAULT_ = SEMSQL_REGISTRY @@ -89,7 +93,12 @@ class Ontology(YAMLRoot): local_path: Optional[str] = None has_imports: Optional[int] = None jsonld_context: Optional[Union[str, HttpsIdentifier]] = None - prefixmap: Optional[Union[Dict[Union[str, PrefixMapPrefix], Union[dict, "PrefixMap"]], List[Union[dict, "PrefixMap"]]]] = empty_dict() + prefixmap: Optional[ + Union[ + Dict[Union[str, PrefixMapPrefix], Union[dict, "PrefixMap"]], + List[Union[dict, "PrefixMap"]], + ] + ] = empty_dict() named_prefixmaps: Optional[Union[str, List[str]]] = empty_list() format: Optional[str] = None compression: Optional[Union[str, "CompressionEnum"]] = None @@ -120,36 +129,58 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self.has_imports is not None and not isinstance(self.has_imports, int): self.has_imports = int(self.has_imports) - if self.jsonld_context is not None and not isinstance(self.jsonld_context, HttpsIdentifier): + if self.jsonld_context is not None and not isinstance( + self.jsonld_context, HttpsIdentifier + ): self.jsonld_context = HttpsIdentifier(self.jsonld_context) - self._normalize_inlined_as_dict(slot_name="prefixmap", slot_type=PrefixMap, key_name="prefix", keyed=True) + self._normalize_inlined_as_dict( + slot_name="prefixmap", slot_type=PrefixMap, key_name="prefix", keyed=True + ) if not isinstance(self.named_prefixmaps, list): - self.named_prefixmaps = [self.named_prefixmaps] if self.named_prefixmaps is not None else [] - self.named_prefixmaps = [v if isinstance(v, str) else str(v) for v in self.named_prefixmaps] + self.named_prefixmaps = ( + [self.named_prefixmaps] if self.named_prefixmaps is not None else [] + ) + self.named_prefixmaps = [ + v if isinstance(v, str) else str(v) for v in self.named_prefixmaps + ] if self.format is not None and not isinstance(self.format, str): self.format = str(self.format) - if self.compression is not None and not isinstance(self.compression, CompressionEnum): + if self.compression is not None and not isinstance( + self.compression, CompressionEnum + ): self.compression = CompressionEnum(self.compression) if self.suppress is not None and not isinstance(self.suppress, Bool): self.suppress = Bool(self.suppress) - if self.relation_graph_settings is not None and not isinstance(self.relation_graph_settings, RelationGraphConfiguration): - self.relation_graph_settings = RelationGraphConfiguration(**as_dict(self.relation_graph_settings)) + if self.relation_graph_settings is not None and not isinstance( + self.relation_graph_settings, RelationGraphConfiguration + ): + self.relation_graph_settings = RelationGraphConfiguration( + **as_dict(self.relation_graph_settings) + ) - if self.zip_extract_file is not None and not isinstance(self.zip_extract_file, str): + if self.zip_extract_file is not None and not isinstance( + self.zip_extract_file, str + ): self.zip_extract_file = str(self.zip_extract_file) if self.build_command is not None and not isinstance(self.build_command, str): self.build_command = str(self.build_command) if not isinstance(self.post_processing_steps, list): - self.post_processing_steps = [self.post_processing_steps] if self.post_processing_steps is not None else [] - self.post_processing_steps = [v if isinstance(v, str) else str(v) for v in self.post_processing_steps] + self.post_processing_steps = ( + [self.post_processing_steps] + if self.post_processing_steps is not None + else [] + ) + self.post_processing_steps = [ + v if isinstance(v, str) else str(v) for v in self.post_processing_steps + ] super().__post_init__(**kwargs) @@ -172,7 +203,9 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if not isinstance(self.prefix, PrefixMapPrefix): self.prefix = PrefixMapPrefix(self.prefix) - if self.prefix_value is not None and not isinstance(self.prefix_value, HttpIdentifier): + if self.prefix_value is not None and not isinstance( + self.prefix_value, HttpIdentifier + ): self.prefix_value = HttpIdentifier(self.prefix_value) super().__post_init__(**kwargs) @@ -190,7 +223,12 @@ class Registry(YAMLRoot): id: Union[str, RegistryId] = None description: Optional[str] = None license: Optional[str] = None - ontologies: Optional[Union[Dict[Union[str, OntologyId], Union[dict, Ontology]], List[Union[dict, Ontology]]]] = empty_dict() + ontologies: Optional[ + Union[ + Dict[Union[str, OntologyId], Union[dict, Ontology]], + List[Union[dict, Ontology]], + ] + ] = empty_dict() def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self._is_empty(self.id): @@ -204,7 +242,9 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self.license is not None and not isinstance(self.license, str): self.license = str(self.license) - self._normalize_inlined_as_dict(slot_name="ontologies", slot_type=Ontology, key_name="id", keyed=True) + self._normalize_inlined_as_dict( + slot_name="ontologies", slot_type=Ontology, key_name="id", keyed=True + ) super().__post_init__(**kwargs) @@ -218,12 +258,16 @@ class RelationGraphConfiguration(YAMLRoot): class_name: ClassVar[str] = "RelationGraphConfiguration" class_model_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.RelationGraphConfiguration - properties: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + properties: Optional[ + Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]] + ] = empty_list() def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if not isinstance(self.properties, list): self.properties = [self.properties] if self.properties is not None else [] - self.properties = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.properties] + self.properties = [ + v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.properties + ] super().__post_init__(**kwargs) @@ -248,8 +292,12 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): self.target = str(self.target) if not isinstance(self.dependencies, list): - self.dependencies = [self.dependencies] if self.dependencies is not None else [] - self.dependencies = [v if isinstance(v, str) else str(v) for v in self.dependencies] + self.dependencies = ( + [self.dependencies] if self.dependencies is not None else [] + ) + self.dependencies = [ + v if isinstance(v, str) else str(v) for v in self.dependencies + ] if not isinstance(self.commands, list): self.commands = [self.commands] if self.commands is not None else [] @@ -274,12 +322,17 @@ class Makefile(YAMLRoot): class_name: ClassVar[str] = "Makefile" class_model_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.Makefile - rules: Optional[Union[Union[dict, MakefileRule], List[Union[dict, MakefileRule]]]] = empty_list() + rules: Optional[ + Union[Union[dict, MakefileRule], List[Union[dict, MakefileRule]]] + ] = empty_list() def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if not isinstance(self.rules, list): self.rules = [self.rules] if self.rules is not None else [] - self.rules = [v if isinstance(v, MakefileRule) else MakefileRule(**as_dict(v)) for v in self.rules] + self.rules = [ + v if isinstance(v, MakefileRule) else MakefileRule(**as_dict(v)) + for v in self.rules + ] super().__post_init__(**kwargs) @@ -287,105 +340,276 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): # Enumerations class FormatEnum(EnumDefinitionImpl): - n3 = PermissibleValue( - text="n3", - description="n3") + n3 = PermissibleValue(text="n3", description="n3") _defn = EnumDefinition( name="FormatEnum", ) + class CompressionEnum(EnumDefinitionImpl): - gzip = PermissibleValue( - text="gzip", - description="gzip") + gzip = PermissibleValue(text="gzip", description="gzip") _defn = EnumDefinition( name="CompressionEnum", ) + # Slots class slots: pass -slots.id = Slot(uri=SEMSQL_REGISTRY.id, name="id", curie=SEMSQL_REGISTRY.curie('id'), - model_uri=SEMSQL_REGISTRY.id, domain=None, range=URIRef) - -slots.description = Slot(uri=SEMSQL_REGISTRY.description, name="description", curie=SEMSQL_REGISTRY.curie('description'), - model_uri=SEMSQL_REGISTRY.description, domain=None, range=Optional[str]) - -slots.url = Slot(uri=SEMSQL_REGISTRY.url, name="url", curie=SEMSQL_REGISTRY.curie('url'), - model_uri=SEMSQL_REGISTRY.url, domain=None, range=Optional[Union[str, Identifier]]) - -slots.relation_graph_settings = Slot(uri=SEMSQL_REGISTRY.relation_graph_settings, name="relation_graph_settings", curie=SEMSQL_REGISTRY.curie('relation_graph_settings'), - model_uri=SEMSQL_REGISTRY.relation_graph_settings, domain=None, range=Optional[Union[dict, RelationGraphConfiguration]]) - -slots.has_imports = Slot(uri=SEMSQL_REGISTRY.has_imports, name="has_imports", curie=SEMSQL_REGISTRY.curie('has_imports'), - model_uri=SEMSQL_REGISTRY.has_imports, domain=None, range=Optional[int]) - -slots.jsonld_context = Slot(uri=SEMSQL_REGISTRY.jsonld_context, name="jsonld_context", curie=SEMSQL_REGISTRY.curie('jsonld_context'), - model_uri=SEMSQL_REGISTRY.jsonld_context, domain=None, range=Optional[Union[str, HttpsIdentifier]]) - -slots.prefixmap = Slot(uri=SEMSQL_REGISTRY.prefixmap, name="prefixmap", curie=SEMSQL_REGISTRY.curie('prefixmap'), - model_uri=SEMSQL_REGISTRY.prefixmap, domain=None, range=Optional[Union[Dict[Union[str, PrefixMapPrefix], Union[dict, PrefixMap]], List[Union[dict, PrefixMap]]]]) - -slots.zip_extract_file = Slot(uri=SEMSQL_REGISTRY.zip_extract_file, name="zip_extract_file", curie=SEMSQL_REGISTRY.curie('zip_extract_file'), - model_uri=SEMSQL_REGISTRY.zip_extract_file, domain=None, range=Optional[str]) - -slots.named_prefixmaps = Slot(uri=SEMSQL_REGISTRY.named_prefixmaps, name="named_prefixmaps", curie=SEMSQL_REGISTRY.curie('named_prefixmaps'), - model_uri=SEMSQL_REGISTRY.named_prefixmaps, domain=None, range=Optional[Union[str, List[str]]]) - -slots.format = Slot(uri=SEMSQL_REGISTRY.format, name="format", curie=SEMSQL_REGISTRY.curie('format'), - model_uri=SEMSQL_REGISTRY.format, domain=None, range=Optional[str]) - -slots.build_command = Slot(uri=SEMSQL_REGISTRY.build_command, name="build_command", curie=SEMSQL_REGISTRY.curie('build_command'), - model_uri=SEMSQL_REGISTRY.build_command, domain=None, range=Optional[str]) - -slots.sha256 = Slot(uri=SEMSQL_REGISTRY.sha256, name="sha256", curie=SEMSQL_REGISTRY.curie('sha256'), - model_uri=SEMSQL_REGISTRY.sha256, domain=None, range=Optional[str]) - -slots.local_path = Slot(uri=SEMSQL_REGISTRY.local_path, name="local_path", curie=SEMSQL_REGISTRY.curie('local_path'), - model_uri=SEMSQL_REGISTRY.local_path, domain=None, range=Optional[str]) - -slots.compression = Slot(uri=SEMSQL_REGISTRY.compression, name="compression", curie=SEMSQL_REGISTRY.curie('compression'), - model_uri=SEMSQL_REGISTRY.compression, domain=None, range=Optional[Union[str, "CompressionEnum"]]) - -slots.prefix = Slot(uri=SEMSQL_REGISTRY.prefix, name="prefix", curie=SEMSQL_REGISTRY.curie('prefix'), - model_uri=SEMSQL_REGISTRY.prefix, domain=None, range=URIRef) - -slots.prefix_value = Slot(uri=SEMSQL_REGISTRY.prefix_value, name="prefix_value", curie=SEMSQL_REGISTRY.curie('prefix_value'), - model_uri=SEMSQL_REGISTRY.prefix_value, domain=None, range=Optional[Union[str, HttpIdentifier]]) - -slots.license = Slot(uri=SEMSQL_REGISTRY.license, name="license", curie=SEMSQL_REGISTRY.curie('license'), - model_uri=SEMSQL_REGISTRY.license, domain=None, range=Optional[str]) - -slots.ontologies = Slot(uri=SEMSQL_REGISTRY.ontologies, name="ontologies", curie=SEMSQL_REGISTRY.curie('ontologies'), - model_uri=SEMSQL_REGISTRY.ontologies, domain=None, range=Optional[Union[Dict[Union[str, OntologyId], Union[dict, Ontology]], List[Union[dict, Ontology]]]]) - -slots.suppress = Slot(uri=SEMSQL_REGISTRY.suppress, name="suppress", curie=SEMSQL_REGISTRY.curie('suppress'), - model_uri=SEMSQL_REGISTRY.suppress, domain=None, range=Optional[Union[bool, Bool]]) - -slots.post_processing_steps = Slot(uri=SEMSQL_REGISTRY.post_processing_steps, name="post_processing_steps", curie=SEMSQL_REGISTRY.curie('post_processing_steps'), - model_uri=SEMSQL_REGISTRY.post_processing_steps, domain=None, range=Optional[Union[str, List[str]]]) - -slots.relationGraphConfiguration__properties = Slot(uri=SEMSQL_REGISTRY.properties, name="relationGraphConfiguration__properties", curie=SEMSQL_REGISTRY.curie('properties'), - model_uri=SEMSQL_REGISTRY.relationGraphConfiguration__properties, domain=None, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) - -slots.makefileRule__target = Slot(uri=SEMSQL_REGISTRY.target, name="makefileRule__target", curie=SEMSQL_REGISTRY.curie('target'), - model_uri=SEMSQL_REGISTRY.makefileRule__target, domain=None, range=Optional[str]) - -slots.makefileRule__dependencies = Slot(uri=SEMSQL_REGISTRY.dependencies, name="makefileRule__dependencies", curie=SEMSQL_REGISTRY.curie('dependencies'), - model_uri=SEMSQL_REGISTRY.makefileRule__dependencies, domain=None, range=Optional[Union[str, List[str]]]) - -slots.makefileRule__commands = Slot(uri=SEMSQL_REGISTRY.commands, name="makefileRule__commands", curie=SEMSQL_REGISTRY.curie('commands'), - model_uri=SEMSQL_REGISTRY.makefileRule__commands, domain=None, range=Optional[Union[str, List[str]]]) - -slots.makefileRule__comments = Slot(uri=SEMSQL_REGISTRY.comments, name="makefileRule__comments", curie=SEMSQL_REGISTRY.curie('comments'), - model_uri=SEMSQL_REGISTRY.makefileRule__comments, domain=None, range=Optional[Union[str, List[str]]]) - -slots.makefileRule__precious = Slot(uri=SEMSQL_REGISTRY.precious, name="makefileRule__precious", curie=SEMSQL_REGISTRY.curie('precious'), - model_uri=SEMSQL_REGISTRY.makefileRule__precious, domain=None, range=Optional[Union[bool, Bool]]) -slots.makefile__rules = Slot(uri=SEMSQL_REGISTRY.rules, name="makefile__rules", curie=SEMSQL_REGISTRY.curie('rules'), - model_uri=SEMSQL_REGISTRY.makefile__rules, domain=None, range=Optional[Union[Union[dict, MakefileRule], List[Union[dict, MakefileRule]]]]) +slots.id = Slot( + uri=SEMSQL_REGISTRY.id, + name="id", + curie=SEMSQL_REGISTRY.curie("id"), + model_uri=SEMSQL_REGISTRY.id, + domain=None, + range=URIRef, +) + +slots.description = Slot( + uri=SEMSQL_REGISTRY.description, + name="description", + curie=SEMSQL_REGISTRY.curie("description"), + model_uri=SEMSQL_REGISTRY.description, + domain=None, + range=Optional[str], +) + +slots.url = Slot( + uri=SEMSQL_REGISTRY.url, + name="url", + curie=SEMSQL_REGISTRY.curie("url"), + model_uri=SEMSQL_REGISTRY.url, + domain=None, + range=Optional[Union[str, Identifier]], +) + +slots.relation_graph_settings = Slot( + uri=SEMSQL_REGISTRY.relation_graph_settings, + name="relation_graph_settings", + curie=SEMSQL_REGISTRY.curie("relation_graph_settings"), + model_uri=SEMSQL_REGISTRY.relation_graph_settings, + domain=None, + range=Optional[Union[dict, RelationGraphConfiguration]], +) + +slots.has_imports = Slot( + uri=SEMSQL_REGISTRY.has_imports, + name="has_imports", + curie=SEMSQL_REGISTRY.curie("has_imports"), + model_uri=SEMSQL_REGISTRY.has_imports, + domain=None, + range=Optional[int], +) + +slots.jsonld_context = Slot( + uri=SEMSQL_REGISTRY.jsonld_context, + name="jsonld_context", + curie=SEMSQL_REGISTRY.curie("jsonld_context"), + model_uri=SEMSQL_REGISTRY.jsonld_context, + domain=None, + range=Optional[Union[str, HttpsIdentifier]], +) + +slots.prefixmap = Slot( + uri=SEMSQL_REGISTRY.prefixmap, + name="prefixmap", + curie=SEMSQL_REGISTRY.curie("prefixmap"), + model_uri=SEMSQL_REGISTRY.prefixmap, + domain=None, + range=Optional[ + Union[ + Dict[Union[str, PrefixMapPrefix], Union[dict, PrefixMap]], + List[Union[dict, PrefixMap]], + ] + ], +) + +slots.zip_extract_file = Slot( + uri=SEMSQL_REGISTRY.zip_extract_file, + name="zip_extract_file", + curie=SEMSQL_REGISTRY.curie("zip_extract_file"), + model_uri=SEMSQL_REGISTRY.zip_extract_file, + domain=None, + range=Optional[str], +) + +slots.named_prefixmaps = Slot( + uri=SEMSQL_REGISTRY.named_prefixmaps, + name="named_prefixmaps", + curie=SEMSQL_REGISTRY.curie("named_prefixmaps"), + model_uri=SEMSQL_REGISTRY.named_prefixmaps, + domain=None, + range=Optional[Union[str, List[str]]], +) + +slots.format = Slot( + uri=SEMSQL_REGISTRY.format, + name="format", + curie=SEMSQL_REGISTRY.curie("format"), + model_uri=SEMSQL_REGISTRY.format, + domain=None, + range=Optional[str], +) + +slots.build_command = Slot( + uri=SEMSQL_REGISTRY.build_command, + name="build_command", + curie=SEMSQL_REGISTRY.curie("build_command"), + model_uri=SEMSQL_REGISTRY.build_command, + domain=None, + range=Optional[str], +) + +slots.sha256 = Slot( + uri=SEMSQL_REGISTRY.sha256, + name="sha256", + curie=SEMSQL_REGISTRY.curie("sha256"), + model_uri=SEMSQL_REGISTRY.sha256, + domain=None, + range=Optional[str], +) + +slots.local_path = Slot( + uri=SEMSQL_REGISTRY.local_path, + name="local_path", + curie=SEMSQL_REGISTRY.curie("local_path"), + model_uri=SEMSQL_REGISTRY.local_path, + domain=None, + range=Optional[str], +) + +slots.compression = Slot( + uri=SEMSQL_REGISTRY.compression, + name="compression", + curie=SEMSQL_REGISTRY.curie("compression"), + model_uri=SEMSQL_REGISTRY.compression, + domain=None, + range=Optional[Union[str, "CompressionEnum"]], +) + +slots.prefix = Slot( + uri=SEMSQL_REGISTRY.prefix, + name="prefix", + curie=SEMSQL_REGISTRY.curie("prefix"), + model_uri=SEMSQL_REGISTRY.prefix, + domain=None, + range=URIRef, +) + +slots.prefix_value = Slot( + uri=SEMSQL_REGISTRY.prefix_value, + name="prefix_value", + curie=SEMSQL_REGISTRY.curie("prefix_value"), + model_uri=SEMSQL_REGISTRY.prefix_value, + domain=None, + range=Optional[Union[str, HttpIdentifier]], +) + +slots.license = Slot( + uri=SEMSQL_REGISTRY.license, + name="license", + curie=SEMSQL_REGISTRY.curie("license"), + model_uri=SEMSQL_REGISTRY.license, + domain=None, + range=Optional[str], +) + +slots.ontologies = Slot( + uri=SEMSQL_REGISTRY.ontologies, + name="ontologies", + curie=SEMSQL_REGISTRY.curie("ontologies"), + model_uri=SEMSQL_REGISTRY.ontologies, + domain=None, + range=Optional[ + Union[ + Dict[Union[str, OntologyId], Union[dict, Ontology]], + List[Union[dict, Ontology]], + ] + ], +) + +slots.suppress = Slot( + uri=SEMSQL_REGISTRY.suppress, + name="suppress", + curie=SEMSQL_REGISTRY.curie("suppress"), + model_uri=SEMSQL_REGISTRY.suppress, + domain=None, + range=Optional[Union[bool, Bool]], +) + +slots.post_processing_steps = Slot( + uri=SEMSQL_REGISTRY.post_processing_steps, + name="post_processing_steps", + curie=SEMSQL_REGISTRY.curie("post_processing_steps"), + model_uri=SEMSQL_REGISTRY.post_processing_steps, + domain=None, + range=Optional[Union[str, List[str]]], +) + +slots.relationGraphConfiguration__properties = Slot( + uri=SEMSQL_REGISTRY.properties, + name="relationGraphConfiguration__properties", + curie=SEMSQL_REGISTRY.curie("properties"), + model_uri=SEMSQL_REGISTRY.relationGraphConfiguration__properties, + domain=None, + range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]], +) + +slots.makefileRule__target = Slot( + uri=SEMSQL_REGISTRY.target, + name="makefileRule__target", + curie=SEMSQL_REGISTRY.curie("target"), + model_uri=SEMSQL_REGISTRY.makefileRule__target, + domain=None, + range=Optional[str], +) + +slots.makefileRule__dependencies = Slot( + uri=SEMSQL_REGISTRY.dependencies, + name="makefileRule__dependencies", + curie=SEMSQL_REGISTRY.curie("dependencies"), + model_uri=SEMSQL_REGISTRY.makefileRule__dependencies, + domain=None, + range=Optional[Union[str, List[str]]], +) + +slots.makefileRule__commands = Slot( + uri=SEMSQL_REGISTRY.commands, + name="makefileRule__commands", + curie=SEMSQL_REGISTRY.curie("commands"), + model_uri=SEMSQL_REGISTRY.makefileRule__commands, + domain=None, + range=Optional[Union[str, List[str]]], +) + +slots.makefileRule__comments = Slot( + uri=SEMSQL_REGISTRY.comments, + name="makefileRule__comments", + curie=SEMSQL_REGISTRY.curie("comments"), + model_uri=SEMSQL_REGISTRY.makefileRule__comments, + domain=None, + range=Optional[Union[str, List[str]]], +) + +slots.makefileRule__precious = Slot( + uri=SEMSQL_REGISTRY.precious, + name="makefileRule__precious", + curie=SEMSQL_REGISTRY.curie("precious"), + model_uri=SEMSQL_REGISTRY.makefileRule__precious, + domain=None, + range=Optional[Union[bool, Bool]], +) + +slots.makefile__rules = Slot( + uri=SEMSQL_REGISTRY.rules, + name="makefile__rules", + curie=SEMSQL_REGISTRY.curie("rules"), + model_uri=SEMSQL_REGISTRY.makefile__rules, + domain=None, + range=Optional[Union[Union[dict, MakefileRule], List[Union[dict, MakefileRule]]]], +) diff --git a/src/semsql/ontlib/subgraph.py b/src/semsql/ontlib/subgraph.py index a8aa7fc..329d8a1 100644 --- a/src/semsql/ontlib/subgraph.py +++ b/src/semsql/ontlib/subgraph.py @@ -2,6 +2,7 @@ Deprecated -- use oaklib instead """ + import json import logging import shutil