linkml / linkml-runtime

Runtime support for linkml generated models
https://linkml.io/linkml/
Creative Commons Zero v1.0 Universal
24 stars 23 forks source link

Imports to metamodel resolved locally rather than over network, #1102. #248

Closed cmungall closed 1 year ago

cmungall commented 1 year ago

This solves the problem introduced in https://github.com/linkml/linkml/issues/502 but only for the metamodel.

See also https://github.com/linkml/linkml/issues/1102

codecov-commenter commented 1 year ago

Codecov Report

Merging #248 (e6e1aa8) into main (b992fe0) will increase coverage by 0.35%. The diff coverage is 60.86%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #248      +/-   ##
==========================================
+ Coverage   63.54%   63.90%   +0.35%     
==========================================
  Files          53       53              
  Lines        6117     6233     +116     
  Branches     1650     1690      +40     
==========================================
+ Hits         3887     3983      +96     
+ Misses       1774     1769       -5     
- Partials      456      481      +25     
Impacted Files Coverage Δ
linkml_runtime/index/object_index.py 88.28% <12.50%> (-3.53%) :arrow_down:
linkml_runtime/dumpers/rdflib_dumper.py 94.94% <40.00%> (-2.97%) :arrow_down:
linkml_runtime/utils/context_utils.py 68.33% <50.00%> (-1.85%) :arrow_down:
linkml_runtime/utils/schemaview.py 83.23% <52.27%> (-3.17%) :arrow_down:
linkml_runtime/__init__.py 100.00% <100.00%> (ø)
linkml_runtime/utils/namespaces.py 73.37% <100.00%> (+2.48%) :arrow_up:
linkml_runtime/utils/yamlutils.py 79.44% <100.00%> (+1.29%) :arrow_up:
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

cmungall commented 1 year ago

@dalito any ideas on how to handle this? I think what is happening here is that when we obtain absolute paths on windows, it will make a path that looks like a CURIE, e.g. D:\foo\bar.

dalito commented 1 year ago

I can have a look tomorrow. I think we had a very similar problem before.

@cmungall - Here is a fix "Windows: do not take drive letter for curie" that makes all tests pass.

diff --git a/linkml_runtime/utils/namespaces.py b/linkml_runtime/utils/namespaces.py
index a90661f..92aceb5 100644
--- a/linkml_runtime/utils/namespaces.py
+++ b/linkml_runtime/utils/namespaces.py
@@ -197,6 +197,8 @@ class Namespaces(CaseInsensitiveDict):
         uri_or_curie_str = str(uri_or_curie)
         if '://' in uri_or_curie_str:
             return URIRef(uri_or_curie_str)
+        if ':\\' in uri_or_curie_str:  # Windows drive letters
+            return URIRef(uri_or_curie_str)
         if ':' in uri_or_curie_str:
             prefix, local = str(uri_or_curie_str).split(':', 1)
             if not prefix: