def test_basics(self): BFO = CurieNamespace('bfo', "http://purl.obolibrary.org/obo/BFO_") self.assertEqual(URIRef("http://purl.obolibrary.org/obo/BFO_test"), BFO.test) self.assertEqual("http://purl.obolibrary.org/obo/BFO_", BFO) self.assertEqual("bfo:test", BFO.curie('test')) self.assertEqual("bfo:", BFO.curie())
def parse_identifier(cls, identifier: str) -> Tuple[CurieNamespace, str]: # trivial case of a null identifier? if not identifier: return CurieNamespace("", ""), "" # check if this is a candidate URI... if identifier.lower().startswith("http"): # guess that perhaps it is, so try to parse it return cls.parse_uri(identifier) else: # attempt to parse as a CURIE return cls.parse_curie(identifier)
def parse_curie(cls, curie: str) -> Tuple[CurieNamespace, str]: """ Parse a candidate CURIE :param curie: candidate curie string :return: CURIE namespace and object_id """ found = CurieNamespace( "", ""), curie # default value if not a CURIE or unknown XMLNS prefix if ':' in curie: part = curie.split(":") # Normalize retrieval with upper case of prefix for lookup prefix = part[0].upper() if prefix in cls._get_prefix_map(): found = cls._prefix_map[prefix], part[1] return found
def parse_uri(cls, uri: str) -> Tuple[CurieNamespace, str]: """ Parse a candidate URI :param uri: candidate URI string :return: namespace and object_id """ found = CurieNamespace( "", ""), uri # default value returned if unknown URI namespace # TODO: is there a more efficient lookup scheme here than a linear search of namespaces? for ns in cls._namespaces: base_uri = str(ns) if uri.startswith(base_uri): # simple minded deletion of base_uri to give the object_id object_id = uri.replace(base_uri, "") found = ns, object_id break return found
from linkml.utils.slot import Slot from linkml.utils.metamodelcore import empty_list, empty_dict, bnode from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces EX = CurieNamespace('ex', 'https://example.org/linkml/hello-world/') FOAF = CurieNamespace('foaf', 'http://xmlns.com/foaf/0.1/') LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') SDO = CurieNamespace('sdo', 'https://schema.org/') XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') DEFAULT_ = EX # Types class String(str): type_class_uri = XSD.string type_class_curie = "xsd:string" type_name = "string" type_model_uri = EX.String
from linkml.utils.slot import Slot from linkml.utils.metamodelcore import empty_list, empty_dict, bnode from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces EX = CurieNamespace('ex', 'https://example.org/importee/') XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') DEFAULT_ = EX # Types class String(str): """ A character string """ type_class_uri = XSD.string type_class_curie = "xsd:string" type_name = "string" type_model_uri = EX.String # Class references class BaseId(extended_str):
if sys.version_info < (3, 7, 6): from linkml.utils.dataclass_extensions_375 import dataclasses_init_fn_with_kwargs else: from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from includes.types import String metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces CLUE = CurieNamespace('CLUE', 'http://ontologies-r.us/clue/') CS = CurieNamespace('CS', 'http://ontologies-r.us/codesystems/') BIOLINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') EVIDENCE = CurieNamespace('evidence', 'http://example.org/test/evidence/') DEFAULT_ = EVIDENCE # Types # Class references class AllEnumsEntryName(extended_str): pass @dataclass class AllEnums(YAMLRoot):
from linkml.utils.metamodelcore import empty_list, empty_dict, bnode from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from linkml.utils.metamodelcore import URI metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') DEFAULT_ = LINKML # Types class String(str): type_class_uri = XSD.string type_class_curie = "xsd:string" type_name = "string" type_model_uri = LINKML.String class Uri(URI): """ a complete URI """ type_class_uri = XSD.anyURI
from dataclasses import dataclass from linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions from linkml.utils.slot import Slot from linkml.utils.metamodelcore import empty_list, empty_dict, bnode from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces DEFAULT_ = CurieNamespace('', 'https://hotecosystem.org/tccm/prefixes/') # Types # Class references # Enumerations # Slots class slots: pass
from linkml.utils.metamodelcore import empty_list, empty_dict, bnode from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from linkml.utils.metamodelcore import Bool metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces FOAF = CurieNamespace('foaf', 'http://xmlns.com/foaf/0.1/') LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') PERS = CurieNamespace('pers', 'http://example.org/sample/person/') XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') DEFAULT_ = PERS # Types class String(str): type_class_uri = XSD.string type_class_curie = "xsd:string" type_name = "string" type_model_uri = PERS.String class Int(int):
from linkml.utils.metamodelcore import empty_list, empty_dict, bnode from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces DEFAULT_ = CurieNamespace('', 'https://microbiomedata/schema/mixs/') # Types # Class references class ParentClass(YAMLRoot): _inherited_slots: ClassVar[List[str]] = [] class_class_uri: ClassVar[URIRef] = URIRef("https://microbiomedata/schema/mixs/ParentClass") class_class_curie: ClassVar[str] = None class_name: ClassVar[str] = "parent_class" class_model_uri: ClassVar[URIRef] = URIRef("https://microbiomedata/schema/mixs/ParentClass")
from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from linkml.utils.metamodelcore import ElementIdentifier from linkml_model.types import Double, Float, String metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces UO = CurieNamespace('UO', 'http://purl.obolibrary.org/obo/UO_') DCTERMS = CurieNamespace('dcterms', 'http://example.org/UNKNOWN/dcterms/') LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') NMDC = CurieNamespace('nmdc', 'https://microbiomedata/meta/') QUD = CurieNamespace('qud', 'http://qudt.org/1.1/schema/qudt#') RDF = CurieNamespace('rdf', 'http://example.org/UNKNOWN/rdf/') RDFS = CurieNamespace('rdfs', 'http://example.org/UNKNOWN/rdfs/') SKOS = CurieNamespace('skos', 'http://example.org/UNKNOWN/skos/') WGS = CurieNamespace('wgs', 'http://www.w3.org/2003/01/geo/wgs84_pos') XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') DEFAULT_ = NMDC # Types class IdentifierType(ElementIdentifier): """ A string that is intended to uniquely identify a thing May be URI in full or compact (CURIE) form """
class BiolinkNameSpace: """ Map of BioLink Model registered URI Namespaces """ _namespaces = [ CurieNamespace('APO', 'http://purl.obolibrary.org/obo/APO_'), CurieNamespace('Aeolus', 'http://translator.ncats.nih.gov/Aeolus_'), CurieNamespace('BIOGRID', 'http://identifiers.org/biogrid/'), CurieNamespace('BIOSAMPLE', 'http://identifiers.org/biosample/'), CurieNamespace('BSPO', 'http://purl.obolibrary.org/obo/BSPO_'), CurieNamespace( 'CAID', 'http://reg.clinicalgenome.org/redmine/projects/registry/genboree_registry/by_caid?caid=' ), CurieNamespace('CAS', 'http://identifiers.org/cas/'), CurieNamespace('CATH', 'http://identifiers.org/cath/'), CurieNamespace('CATH_SUPERFAMILY', 'http://identifiers.org/cath.superfamily/'), CurieNamespace('CDD', 'http://identifiers.org/cdd/'), CurieNamespace('CHADO', 'http://gmod.org/wiki/Chado/'), CurieNamespace('CHEBI', 'http://purl.obolibrary.org/obo/CHEBI_'), CurieNamespace('CHEMBL_COMPOUND', 'http://identifiers.org/chembl.compound/'), CurieNamespace('CHEMBL_MECHANISM', 'https://www.ebi.ac.uk/chembl/mechanism/inspect/'), CurieNamespace('CHEMBL_TARGET', 'http://identifiers.org/chembl.target/'), CurieNamespace('CID', 'http://pubchem.ncbi.nlm.nih.gov/compound/'), CurieNamespace('CL', 'http://purl.obolibrary.org/obo/CL_'), CurieNamespace('CLINVAR', 'http://identifiers.org/clinvar/'), CurieNamespace('CLO', 'http://purl.obolibrary.org/obo/CLO_'), CurieNamespace('COAR_RESOURCE', 'http://purl.org/coar/resource_type/'), CurieNamespace('CPT', 'https://www.ama-assn.org/practice-management/cpt/'), CurieNamespace('CTD', 'http://translator.ncats.nih.gov/CTD_'), CurieNamespace( 'ChemBank', 'http://chembank.broadinstitute.org/chemistry/viewMolecule.htm?cbid=' ), CurieNamespace('ClinVarVariant', 'http://www.ncbi.nlm.nih.gov/clinvar/variation/'), CurieNamespace('DBSNP', 'http://identifiers.org/dbsnp/'), CurieNamespace('DGIdb', 'https://www.dgidb.org/interaction_types'), CurieNamespace('DOID', 'http://purl.obolibrary.org/obo/DOID_'), CurieNamespace('DRUGBANK', 'http://identifiers.org/drugbank/'), CurieNamespace('DrugCentral', 'http://translator.ncats.nih.gov/DrugCentral_'), CurieNamespace('EC', 'http://www.enzyme-database.org/query.php?ec='), CurieNamespace('ECTO', 'http://purl.obolibrary.org/obo/ECTO_'), CurieNamespace('EDAM-DATA', 'http://edamontology.org/data_'), CurieNamespace('EDAM-FORMAT', 'http://edamontology.org/format_'), CurieNamespace('EDAM-OPERATION', 'http://edamontology.org/operation_'), CurieNamespace('EDAM-TOPIC', 'http://edamontology.org/topic_'), CurieNamespace('EFO', 'http://www.ebi.ac.uk/efo/EFO_'), CurieNamespace('EGGNOG', 'http://identifiers.org/eggnog/'), CurieNamespace('ENSEMBL', 'http://identifiers.org/ensembl/'), CurieNamespace('ExO', 'http://purl.obolibrary.org/obo/ExO_'), CurieNamespace('FAO', 'http://purl.obolibrary.org/obo/FAO_'), CurieNamespace('FB', 'http://identifiers.org/fb/'), CurieNamespace('FBcv', 'http://purl.obolibrary.org/obo/FBcv_'), CurieNamespace('GAMMA', 'http://translator.renci.org/GAMMA_'), CurieNamespace('GO', 'http://purl.obolibrary.org/obo/GO_'), CurieNamespace('GOLD_META', 'http://identifiers.org/gold.meta/'), CurieNamespace('GOP', 'http://purl.obolibrary.org/obo/go#'), CurieNamespace('GOREL', 'http://purl.obolibrary.org/obo/GOREL_'), CurieNamespace('GSID', 'https://scholar.google.com/citations?user='******'GTEx', 'https://www.gtexportal.org/home/gene/'), CurieNamespace( 'GTOPDB', 'https://www.guidetopharmacology.org/GRAC/LigandDisplayForward?ligandId=' ), CurieNamespace('HAMAP', 'http://identifiers.org/hamap/'), CurieNamespace('HANCESTRO', 'http://www.ebi.ac.uk/ancestro/ancestro_'), CurieNamespace('HCPCS', 'http://purl.bioontology.org/ontology/HCPCS/'), CurieNamespace('HGNC', 'http://identifiers.org/hgnc/'), CurieNamespace('HGNC_FAMILY', 'http://identifiers.org/hgnc.family/'), CurieNamespace('HMDB', 'http://identifiers.org/hmdb/'), CurieNamespace('HP', 'http://purl.obolibrary.org/obo/HP_'), CurieNamespace('HsapDv', 'http://purl.obolibrary.org/obo/HsapDv_'), CurieNamespace('ICD0', 'http://translator.ncats.nih.gov/ICD0_'), CurieNamespace('ICD10', 'http://translator.ncats.nih.gov/ICD10_'), CurieNamespace('ICD9', 'http://translator.ncats.nih.gov/ICD9_'), CurieNamespace('INCHI', 'http://identifiers.org/inchi/'), CurieNamespace('INCHIKEY', 'http://identifiers.org/inchikey/'), CurieNamespace('INO', 'http://purl.obolibrary.org/obo/INO_'), CurieNamespace('INTACT', 'http://identifiers.org/intact/'), CurieNamespace('IUPHAR_FAMILY', 'http://identifiers.org/iuphar.family/'), CurieNamespace('KEGG', 'http://identifiers.org/kegg/'), CurieNamespace('KEGG_BRITE', 'http://www.kegg.jp/entry/'), CurieNamespace('KEGG_COMPOUND', 'http://identifiers.org/kegg.compound/'), CurieNamespace('KEGG_DGROUP', 'http://www.kegg.jp/entry/'), CurieNamespace('KEGG_DISEASE', 'http://identifiers.org/kegg.disease/'), CurieNamespace('KEGG_DRUG', 'http://identifiers.org/kegg.drug/'), CurieNamespace('KEGG_ENVIRON', 'http://identifiers.org/kegg.environ/'), CurieNamespace('KEGG_ENZYME', 'http://www.kegg.jp/entry/'), CurieNamespace('KEGG_GENE', 'http://www.kegg.jp/entry/'), CurieNamespace('KEGG_GLYCAN', 'http://identifiers.org/kegg.glycan/'), CurieNamespace('KEGG_MODULE', 'http://identifiers.org/kegg.module/'), CurieNamespace('KEGG_ORTHOLOGY', 'http://identifiers.org/kegg.orthology/'), CurieNamespace('KEGG_RCLASS', 'http://www.kegg.jp/entry/'), CurieNamespace('KEGG_REACTION', 'http://identifiers.org/kegg.reaction/'), CurieNamespace('LOINC', 'http://loinc.org/rdf/'), CurieNamespace('MEDDRA', 'http://identifiers.org/meddra/'), CurieNamespace('MESH', 'http://identifiers.org/mesh/'), CurieNamespace('MGI', 'http://identifiers.org/mgi/'), CurieNamespace('MI', 'http://purl.obolibrary.org/obo/MI_'), CurieNamespace('MIR', 'http://identifiers.org/mir/'), CurieNamespace('MONDO', 'http://purl.obolibrary.org/obo/MONDO_'), CurieNamespace('MP', 'http://purl.obolibrary.org/obo/MP_'), CurieNamespace('MSigDB', 'https://www.gsea-msigdb.org/gsea/msigdb/'), CurieNamespace('MetaCyc', 'http://translator.ncats.nih.gov/MetaCyc_'), CurieNamespace('NCBIGENE', 'http://identifiers.org/ncbigene/'), CurieNamespace('NCBITaxon', 'http://purl.obolibrary.org/obo/NCBITaxon_'), CurieNamespace('NCIT', 'http://purl.obolibrary.org/obo/NCIT_'), CurieNamespace('NDC', 'http://identifiers.org/ndc/'), CurieNamespace('NDDF', 'http://purl.bioontology.org/ontology/NDDF/'), CurieNamespace('NLMID', 'https://www.ncbi.nlm.nih.gov/nlmcatalog/?term='), CurieNamespace('OBAN', 'http://purl.org/oban/'), CurieNamespace('OBOREL', 'http://purl.obolibrary.org/obo/RO_'), CurieNamespace('OIO', 'http://www.geneontology.org/formats/oboInOwl#'), CurieNamespace('OMIM', 'http://purl.obolibrary.org/obo/OMIM_'), CurieNamespace('ORCID', 'https://orcid.org/'), CurieNamespace('ORPHA', 'http://www.orpha.net/ORDO/Orphanet_'), CurieNamespace('ORPHANET', 'http://identifiers.org/orphanet/'), CurieNamespace('PANTHER_FAMILY', 'http://identifiers.org/panther.family/'), CurieNamespace('PANTHER_PATHWAY', 'http://identifiers.org/panther.pathway/'), CurieNamespace('PATO', 'http://purl.obolibrary.org/obo/PATO_'), CurieNamespace('PATO-PROPERTY', 'http://purl.obolibrary.org/obo/pato#'), CurieNamespace('PDQ', 'https://www.cancer.gov/publications/pdq#'), CurieNamespace('PFAM', 'http://identifiers.org/pfam/'), CurieNamespace('PHARMGKB_DRUG', 'http://identifiers.org/pharmgkb.drug/'), CurieNamespace('PHARMGKB_PATHWAYS', 'http://identifiers.org/pharmgkb.pathways/'), CurieNamespace('PHAROS', 'http://pharos.nih.gov'), CurieNamespace('PIRSF', 'http://identifiers.org/pirsf/'), CurieNamespace('PMID', 'http://www.ncbi.nlm.nih.gov/pubmed/'), CurieNamespace('PO', 'http://purl.obolibrary.org/obo/PO_'), CurieNamespace('POMBASE', 'http://identifiers.org/pombase/'), CurieNamespace('PR', 'http://purl.obolibrary.org/obo/PR_'), CurieNamespace('PRINTS', 'http://identifiers.org/prints/'), CurieNamespace('PRODOM', 'http://identifiers.org/prodom/'), CurieNamespace('PROSITE', 'http://identifiers.org/prosite/'), CurieNamespace('PUBCHEM_COMPOUND', 'http://identifiers.org/pubchem.compound/'), CurieNamespace('PUBCHEM_SUBSTANCE', 'http://identifiers.org/pubchem.substance/'), CurieNamespace('PathWhiz', 'http://smpdb.ca/pathways/#'), CurieNamespace('REACT', 'http://www.reactome.org/PathwayBrowser/#/'), CurieNamespace('REPODB', 'http://apps.chiragjpgroup.org/repoDB/'), CurieNamespace('RFAM', 'http://identifiers.org/rfam/'), CurieNamespace('RGD', 'http://identifiers.org/rgd/'), CurieNamespace('RHEA', 'http://identifiers.org/rhea/'), CurieNamespace('RNACENTRAL', 'http://identifiers.org/rnacentral/'), CurieNamespace('RO', 'http://purl.obolibrary.org/obo/RO_'), CurieNamespace('RTXKG1', 'http://kg1endpoint.rtx.ai/'), CurieNamespace( 'RXCUI', 'https://mor.nlm.nih.gov/RxNav/search?searchBy=RXCUI&searchTerm='), CurieNamespace('RXNORM', 'http://purl.bioontology.org/ontology/RXNORM/'), CurieNamespace('ResearchID', 'https://publons.com/researcher/'), CurieNamespace('SEMMEDDB', 'https://skr3.nlm.nih.gov/SemMedDB'), CurieNamespace('SGD', 'http://identifiers.org/sgd/'), CurieNamespace('SIDER_DRUG', 'http://identifiers.org/sider.drug/'), CurieNamespace('SIO', 'http://semanticscience.org/resource/SIO_'), CurieNamespace('SMART', 'http://identifiers.org/smart/'), CurieNamespace('SMPDB', 'http://identifiers.org/smpdb/'), CurieNamespace('SNOMEDCT', 'http://identifiers.org/snomedct/'), CurieNamespace('SNPEFF', 'http://translator.ncats.nih.gov/SNPEFF_'), CurieNamespace('SUPFAM', 'http://identifiers.org/supfam/'), CurieNamespace('ScopusID', 'https://www.scopus.com/authid/detail.uri?authorId='), CurieNamespace('TAXRANK', 'http://purl.obolibrary.org/obo/TAXRANK_'), CurieNamespace('TCDB', 'http://identifiers.org/tcdb/'), CurieNamespace('TIGRFAM', 'http://identifiers.org/tigrfam/'), CurieNamespace('UBERGRAPH', 'http://translator.renci.org/ubergraph-axioms.ofn#'), CurieNamespace('UBERON', 'http://purl.obolibrary.org/obo/UBERON_'), CurieNamespace('UBERON_CORE', 'http://purl.obolibrary.org/obo/uberon/core#'), CurieNamespace('UMLS', 'http://identifiers.org/umls/'), CurieNamespace( 'UMLSSC', 'https://metamap.nlm.nih.gov/Docs/SemanticTypes_2018AB.txt/code#'), CurieNamespace( 'UMLSSG', 'https://metamap.nlm.nih.gov/Docs/SemGroups_2018.txt/group#'), CurieNamespace( 'UMLSST', 'https://metamap.nlm.nih.gov/Docs/SemanticTypes_2018AB.txt/type#'), CurieNamespace('UNII', 'http://identifiers.org/unii/'), CurieNamespace('UNIPROT_ISOFORM', 'http://identifiers.org/uniprot.isoform/'), CurieNamespace('UO', 'http://purl.obolibrary.org/obo/UO_'), CurieNamespace('UPHENO', 'http://purl.obolibrary.org/obo/UPHENO_'), CurieNamespace('UniProtKB', 'http://identifiers.org/uniprot/'), CurieNamespace( 'VANDF', 'https://www.nlm.nih.gov/research/umls/sourcereleasedocs/current/VANDF/' ), CurieNamespace('VMC', 'https://github.com/ga4gh/vr-spec/'), CurieNamespace('WB', 'http://identifiers.org/wb/'), CurieNamespace('WBPhenotype', 'http://purl.obolibrary.org/obo/WBPhenotype_'), CurieNamespace('WBVocab', 'http://bio2rdf.org/wormbase_vocabulary'), CurieNamespace('WIKIDATA', 'https://www.wikidata.org/wiki/'), CurieNamespace('WIKIDATA_PROPERTY', 'https://www.wikidata.org/wiki/Property:'), CurieNamespace('WIKIPATHWAYS', 'http://identifiers.org/wikipathways/'), CurieNamespace('WormBase', 'https://www.wormbase.org/get?name='), CurieNamespace('ZFIN', 'http://identifiers.org/zfin/'), CurieNamespace('ZP', 'http://purl.obolibrary.org/obo/ZP_'), CurieNamespace('alliancegenome', 'https://www.alliancegenome.org/'), CurieNamespace('biolink', 'https://w3id.org/biolink/vocab/'), CurieNamespace('chembio', 'http://translator.ncats.nih.gov/chembio_'), CurieNamespace('dcat', 'http://www.w3.org/ns/dcat#'), CurieNamespace('dct', 'http://purl.org/dc/terms/'), CurieNamespace('dictyBase', 'http://dictybase.org/gene/'), CurieNamespace('doi', 'https://doi.org/'), CurieNamespace('fabio', 'http://purl.org/spar/fabio/'), CurieNamespace('foaf', 'http://xmlns.com/foaf/0.1/'), CurieNamespace('foodb_compound', 'http://foodb.ca/compounds/'), CurieNamespace( 'gff3', 'https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md#' ), CurieNamespace( 'gpi', 'https://github.com/geneontology/go-annotation/blob/master/specs/gpad-gpi-2-0.md#' ), CurieNamespace('gtpo', 'https://rdf.guidetopharmacology.org/ns/gtpo#'), CurieNamespace('hetio', 'http://translator.ncats.nih.gov/hetio_'), CurieNamespace('interpro', 'https://www.ebi.ac.uk/interpro/entry/'), CurieNamespace('isbn', 'https://www.isbn-international.org/identifier/'), CurieNamespace('isni', 'https://isni.org/isni/'), CurieNamespace('issn', 'https://portal.issn.org/resource/ISSN/'), CurieNamespace('linkml', 'https://w3id.org/linkml/'), CurieNamespace('medgen', 'https://www.ncbi.nlm.nih.gov/medgen/'), CurieNamespace('oboformat', 'http://www.geneontology.org/formats/oboInOWL#'), CurieNamespace('pav', 'http://purl.org/pav/'), CurieNamespace('prov', 'http://www.w3.org/ns/prov#'), CurieNamespace('qud', 'http://qudt.org/1.1/schema/qudt#'), CurieNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'), CurieNamespace('rdfs', 'http://www.w3.org/2000/01/rdf-schema#'), CurieNamespace('schema', 'http://schema.org/'), CurieNamespace('skos', 'https://www.w3.org/TR/skos-reference/#'), CurieNamespace('wgs', 'http://www.w3.org/2003/01/geo/wgs84_pos'), CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#'), ] # class level dictionaries _prefix_map: Dict[str, CurieNamespace] = {} @classmethod def _get_prefix_map(cls): if not cls._prefix_map: for ns in cls._namespaces: # index by upper case for uniformity of search cls._prefix_map[ns.prefix.upper()] = ns return cls._prefix_map @classmethod def parse_curie(cls, curie: str) -> Tuple[CurieNamespace, str]: """ Parse a candidate CURIE :param curie: candidate curie string :return: CURIE namespace and object_id """ found = CurieNamespace( "", ""), curie # default value if not a CURIE or unknown XMLNS prefix if ':' in curie: part = curie.split(":") # Normalize retrieval with upper case of prefix for lookup prefix = part[0].upper() if prefix in cls._get_prefix_map(): found = cls._prefix_map[prefix], part[1] return found @classmethod def parse_uri(cls, uri: str) -> Tuple[CurieNamespace, str]: """ Parse a candidate URI :param uri: candidate URI string :return: namespace and object_id """ found = CurieNamespace( "", ""), uri # default value returned if unknown URI namespace # TODO: is there a more efficient lookup scheme here than a linear search of namespaces? for ns in cls._namespaces: base_uri = str(ns) if uri.startswith(base_uri): # simple minded deletion of base_uri to give the object_id object_id = uri.replace(base_uri, "") found = ns, object_id break return found @classmethod def parse_identifier(cls, identifier: str) -> Tuple[CurieNamespace, str]: # trivial case of a null identifier? if not identifier: return CurieNamespace("", ""), "" # check if this is a candidate URI... if identifier.lower().startswith("http"): # guess that perhaps it is, so try to parse it return cls.parse_uri(identifier) else: # attempt to parse as a CURIE return cls.parse_curie(identifier)
if sys.version_info < (3, 7, 6): from linkml.utils.dataclass_extensions_375 import dataclasses_init_fn_with_kwargs else: from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from includes.types import String metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces BIOLINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') DEFAULT_ = CurieNamespace('', 'http://example.org/') # Types # Enumerations # Class references @dataclass class C(YAMLRoot): _inherited_slots: ClassVar[List[str]] = [] class_class_uri: ClassVar[URIRef] = URIRef("http://example.org/C") class_class_curie: ClassVar[str] = None
from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from linkml.utils.metamodelcore import URIorCURIE from linkml_model.types import Uriorcurie metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces IAO = CurieNamespace('IAO', 'http://purl.obolibrary.org/obo/IAO_') OIO = CurieNamespace('OIO', 'http://www.geneontology.org/formats/oboInOwl#') LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') RDF = CurieNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#') RDFS = CurieNamespace('rdfs', 'http://www.w3.org/2000/01/rdf-schema#') SKOS = CurieNamespace('skos', 'http://www.w3.org/2004/02/skos/core#') XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') DEFAULT_ = LINKML # Types # Class references
from linkml.utils.metamodelcore import empty_list, empty_dict, bnode from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from linkml_model.types import String metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') DEFAULT_ = CurieNamespace('', 'https://microbiomedata/schema/') # Types # Class references @dataclass class Biosample(YAMLRoot): _inherited_slots: ClassVar[List[str]] = [] class_class_uri: ClassVar[URIRef] = URIRef( "https://microbiomedata/schema/Biosample") class_class_curie: ClassVar[str] = None class_name: ClassVar[str] = "biosample"
from linkml.utils.slot import Slot from linkml.utils.metamodelcore import empty_list, empty_dict, bnode from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') TCCM = CurieNamespace('tccm', 'https://hotecosystem.org/tccm/') DEFAULT_ = TCCM # Types # Class references @dataclass class IterableResolvedValueSet(YAMLRoot): _inherited_slots: ClassVar[List[str]] = [] class_class_uri: ClassVar[URIRef] = TCCM.IterableResolvedValueSet class_class_curie: ClassVar[str] = "tccm:IterableResolvedValueSet" class_name: ClassVar[str] = "IterableResolvedValueSet"
from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from linkml.utils.metamodelcore import URIorCURIE from linkml_model.types import String, Uriorcurie metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') SCT = CurieNamespace('sct', 'http://snomed.info/id/') DEFAULT_ = SCT # Types # Class references class ContaineeId(URIorCURIE): pass @dataclass class Container(YAMLRoot): _inherited_slots: ClassVar[List[str]] = []
from linkml.utils.metamodelcore import empty_list, empty_dict, bnode from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from linkml_model.types import String metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') DEFAULT_ = CurieNamespace('', 'https://microbiomedata/schema/') # Types # Class references class NamedThing(YAMLRoot): _inherited_slots: ClassVar[List[str]] = [] class_class_uri: ClassVar[URIRef] = URIRef( "https://microbiomedata/schema/NamedThing") class_class_curie: ClassVar[str] = None class_name: ClassVar[str] = "named thing" class_model_uri: ClassVar[URIRef] = URIRef(
from linkml.utils.slot import Slot from linkml.utils.metamodelcore import empty_list, empty_dict, bnode from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces XSD = CurieNamespace('xsd', 'http://example.org/UNKNOWN/xsd/') DEFAULT_ = CurieNamespace('', 'http://example.org/tests/issue_260a/') # Types class String(str): """ A character string """ type_class_uri = XSD.string type_class_curie = "xsd:string" type_name = "string" type_model_uri = URIRef("http://example.org/tests/issue_260a/String") # Class references
if self._defn.permissible_values[self.text] != self: raise TypeError(f"Permissible value for code: {self.text} is already assigned") if self not in self._defn.permissible_values: if not self._defn.code_set: # Fixed set of values -- no terminology reference raise TypeError("{self}: Permissible value not in definition set") # code_set: Optional[Union[str, URIorCURIE]] = None # code_set_tag: Optional[str] = None # code_set_version: Optional[str] = None # pv_formula: Optional[Union[str, "PvFormulaOptions"]] = None # This will be imported from the TCCM module when we get everything glued together RDF = CurieNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#') SKOS = CurieNamespace('skos', 'http://www.w3.org/2004/02/skos/core#') TCCM = CurieNamespace('tccm', 'https://hotecosystem.org/tccm/') class EntityReferenceCode(extended_str): pass @dataclass class EntityReference(YAMLRoot): """ The URI, namespace/name (if known) and a list of code systems that make assertions about the entity. """ _inherited_slots: ClassVar[List[str]] = []
from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int if sys.version_info < (3, 7, 6): from linkml.utils.dataclass_extensions_375 import dataclasses_init_fn_with_kwargs else: from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace metamodel_version = "1.4.3" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces ORGDATA = CurieNamespace('ORGDATA', 'http://example.org/sample/organization/data/') XSD = CurieNamespace('xsd', 'http://example.org/UNKNOWN/xsd/') DEFAULT_ = CurieNamespace('', 'http://example.org/sample/organization/') # Types class YearCount(int): type_class_uri = XSD.int type_class_curie = "xsd:int" type_name = "yearCount" type_model_uri = URIRef("http://example.org/sample/organization/YearCount") class String(str): type_class_uri = XSD.string type_class_curie = "xsd:string"
from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from .issue_260a import C260a, String from ..issue_260.issue_260b import C260b from .issue_260c import C260c metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces DEFAULT_ = CurieNamespace('', 'http://example.org/tests/issue_260/') # Types # Class references class C2601(C260a): _inherited_slots: ClassVar[List[str]] = [] class_class_uri: ClassVar[URIRef] = URIRef( "http://example.org/tests/issue_260/C2601") class_class_curie: ClassVar[str] = None class_name: ClassVar[str] = "c2601" class_model_uri: ClassVar[URIRef] = URIRef( "http://example.org/tests/issue_260/C2601")
from linkml.utils.metamodelcore import empty_list, empty_dict, bnode from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from linkml.utils.metamodelcore import Bool, Decimal, ElementIdentifier, NCName, NodeIdentifier, URI, URIorCURIE, XSDDate, XSDDateTime, XSDTime metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces BIOLINKML = CurieNamespace('biolinkml', 'https://w3id.org/biolink/biolinkml/') SHEX = CurieNamespace('shex', 'http://www.w3.org/ns/shex#') TYPES = CurieNamespace('types', 'https://example.org/ccdh/datatypes/') XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') DEFAULT_ = TYPES # Types class Url(String): type_class_uri = XSD.string type_class_curie = "xsd:string" type_name = "url" type_model_uri = TYPES.Url class String(str):
from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from linkml.utils.metamodelcore import URIorCURIE from linkml_model.extensions import Extension from linkml_model.types import String, Uriorcurie metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') DEFAULT_ = LINKML # Types # Class references @dataclass class Annotatable(YAMLRoot): """ mixin for classes that support annotations """ _inherited_slots: ClassVar[List[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML.Annotatable
if sys.version_info < (3, 7, 6): from linkml.utils.dataclass_extensions_375 import dataclasses_init_fn_with_kwargs else: from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from linkml.utils.metamodelcore import URIorCURIE metamodel_version = "1.5.3" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces TCCM = CurieNamespace('tccm', 'https://hotecosystem.org/tccm/') XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') DEFAULT_ = TCCM # Types class PersistentURI(URIorCURIE): """ A Universal Resource Identifier (URI) that persists across service instances. PersistentURIs have enduring reference and meaning. """ type_class_uri = XSD.anyURI type_class_curie = "xsd:anyURI" type_name = "PersistentURI" type_model_uri = TCCM.PersistentURI class LocalURI(URIorCURIE):
from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from linkml.utils.metamodelcore import URIorCURIE from linkml_model.types import String, Uriorcurie metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') DEFAULT_ = LINKML # Types # Class references @dataclass class Extension(YAMLRoot): """ a tag/value pair used to add non-model information to an entry """ _inherited_slots: ClassVar[List[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML.Extension
from linkml.utils.metamodelcore import empty_list, empty_dict, bnode from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from linkml.utils.metamodelcore import Bool, Decimal, ElementIdentifier, NCName, NodeIdentifier, URI, URIorCURIE, XSDDate, XSDDateTime, XSDTime metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces META = CurieNamespace('meta', 'https://w3id.org/linkml/') SHEX = CurieNamespace('shex', 'http://www.w3.org/ns/shex#') XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') DEFAULT_ = CurieNamespace('', 'https://example.com/test14/') # Types class String(str): """ A character string """ type_class_uri = XSD.string type_class_curie = "xsd:string" type_name = "string" type_model_uri = URIRef("https://example.com/test14/String") class Integer(int):
from linkml.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml.utils.formatutils import camelcase, underscore, sfx from linkml.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml.utils.curienamespace import CurieNamespace from linkml.utils.metamodelcore import ElementIdentifier from linkml_model.types import Integer, Objectidentifier, String metamodel_version = "1.7.0" # Overwrite dataclasses _init_fn to add **kwargs in __init__ dataclasses._init_fn = dataclasses_init_fn_with_kwargs # Namespaces BIOLINK = CurieNamespace('biolink', 'https://w3id.org/biolink/vocab/') EX = CurieNamespace('ex', 'http://example.org/') LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') MODEL = CurieNamespace('model', 'https://w3id.org/biolink/') DEFAULT_ = BIOLINK # Types # Class references class PersonId(ElementIdentifier): pass @dataclass class Person(YAMLRoot):
def test_curie_as_curie(self): """ "curie can't be a local name at the moment" """ BFO = CurieNamespace('bfo', "http://purl.obolibrary.org/obo/BFO_") self.assertEqual("bfo:curie", BFO.curie)