Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made SSSOM Schemaview object generation an method #327

Merged
merged 1 commit into from
Dec 13, 2022

Conversation

hrshdhgd
Copy link
Contributor

@hrshdhgd hrshdhgd commented Dec 13, 2022

In spite of PR #322 , #323 and #324 network calls were still being made. This PR should finally put an end to the problem.

Before fix:

>>> from oaklib.implementations import BioPortalImplementation
INFO:root:Loading schema https://w3id.org/linkml/types from /opt/anaconda3/envs/test/lib/python3.9/site-packages/sssom_schema/schema/sssom_schema.yaml
Traceback (most recent call last):
  File "/opt/anaconda3/envs/test/lib/python3.9/urllib/request.py", line 1346, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/opt/anaconda3/envs/test/lib/python3.9/http/client.py", line 1285, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/opt/anaconda3/envs/test/lib/python3.9/http/client.py", line 1331, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/opt/anaconda3/envs/test/lib/python3.9/http/client.py", line 1280, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/opt/anaconda3/envs/test/lib/python3.9/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/opt/anaconda3/envs/test/lib/python3.9/http/client.py", line 980, in send
    self.connect()
  File "/opt/anaconda3/envs/test/lib/python3.9/http/client.py", line 1447, in connect
    super().connect()
  File "/opt/anaconda3/envs/test/lib/python3.9/http/client.py", line 946, in connect
    self.sock = self._create_connection(
  File "/opt/anaconda3/envs/test/lib/python3.9/socket.py", line 823, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/opt/anaconda3/envs/test/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/oaklib/__init__.py", line 7, in <module>
    from oaklib.interfaces import BasicOntologyInterface  # noqa:F401
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/oaklib/interfaces/__init__.py", line 1, in <module>
    from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/oaklib/interfaces/basic_ontology_interface.py", line 26, in <module>
    from oaklib.mappers.ontology_metadata_mapper import OntologyMetadataMapper
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/oaklib/mappers/ontology_metadata_mapper.py", line 6, in <module>
    from sssom.parsers import parse_sssom_table, to_mapping_set_document
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/sssom/__init__.py", line 18, in <module>
    from .util import (  # noqa:401
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/sssom/util.py", line 40, in <module>
    from .constants import (
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/sssom/constants.py", line 48, in <module>
    c for c in SCHEMA_VIEW.all_slots() if SCHEMA_VIEW.get_slot(c).multivalued
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/linkml_runtime/utils/schemaview.py", line 278, in all_slots
    slots = copy(self._get_dict(SLOTS, imports))
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/linkml_runtime/utils/schemaview.py", line 375, in _get_dict
    schemas = self.all_schema(imports)
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/linkml_runtime/utils/schemaview.py", line 194, in all_schema
    return [m[sn] for sn in self.imports_closure(imports)]
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/linkml_runtime/utils/schemaview.py", line 169, in imports_closure
    imported_schema = self.load_import(sn)
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/linkml_runtime/utils/schemaview.py", line 146, in load_import
    schema = load_schema_wrap(sname + '.yaml',
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/linkml_runtime/utils/schemaview.py", line 68, in load_schema_wrap
    schema = yaml_loader.load(path, target_class=SchemaDefinition, **kwargs)
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/linkml_runtime/loaders/loader_root.py", line 85, in load
    results = self.load_any(*args, **kwargs)
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/linkml_runtime/loaders/yaml_loader.py", line 25, in load_any
    return self.load_source(source, loader, target_class, accept_header="text/yaml, application/yaml;q=0.9",
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/linkml_runtime/loaders/loader_root.py", line 58, in load_source
    data = hbread(source, metadata, metadata.base_path, accept_header)
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/hbreader/__init__.py", line 260, in hbread
    with hbopen(source, open_info, base_path, accept_header, is_actual_data, read_codec) as f:
  File "/opt/anaconda3/envs/test/lib/python3.9/site-packages/hbreader/__init__.py", line 184, in hbopen
    response = urlopen(req, context=ssl._create_unverified_context())
  File "/opt/anaconda3/envs/test/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/opt/anaconda3/envs/test/lib/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)
  File "/opt/anaconda3/envs/test/lib/python3.9/urllib/request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/opt/anaconda3/envs/test/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/opt/anaconda3/envs/test/lib/python3.9/urllib/request.py", line 1389, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/opt/anaconda3/envs/test/lib/python3.9/urllib/request.py", line 1349, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>

After fix

>>> import logging
>>> logger = logging.getLogger()
>>> logger.setLevel(level=logging.DEBUG)
>>> logging.debug('x')
DEBUG:root:x
>>> from oaklib.implementations import BioPortalImplementation
DEBUG:bioregistry.resource_manager:[gramene.growthstage] missing potential synonym: gro
DEBUG:bioregistry.resource_manager:[merops.entry] missing potential synonym: MEROPS
DEBUG:bioregistry.resource_manager:[ncbi.assembly] missing potential synonym: assembly
DEBUG:bioregistry.resource_manager:[ncbiprotein] missing potential synonym: NCBI_NP
DEBUG:bioregistry.resource_manager:[panther.family] missing potential synonym: PANTHER
DEBUG:bioregistry.resource_manager:[pharmgkb.gene] missing potential synonym: PharmGKB
DEBUG:bioregistry.resource_manager:[rapdb.transcript] missing potential synonym: RAP-DB
DEBUG:bioregistry.resource_manager:[sabiork.kineticrecord] missing potential synonym: SABIO-RK
DEBUG:bioregistry.resource_manager:[tair.locus] missing potential synonym: TAIR
DEBUG:bioregistry.resource_manager:[uniprot.tissue] missing potential synonym: tissuelist
>>> 

@hrshdhgd hrshdhgd merged commit c10173e into master Dec 13, 2022
@hrshdhgd hrshdhgd deleted the schema-ntwrk-remove branch December 13, 2022 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants