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

Add `load_as_dict` method to Loader class #269

Closed pkalita-lbl closed 1 year ago

pkalita-lbl commented 1 year ago

This is in support of https://github.com/linkml/linkml/issues/1404, https://github.com/linkml/linkml/issues/891, and others. It adds a load_as_dict method to the Loader base class. It's up to subclasses to actually implement it, and these changes include an implementation for JSON, YAML, CSV, and TSV loaders. It wasn't immediately clear how to make it work for RDF formats, but if anyone has thoughts on that I'd be glad to get some help.

codecov-commenter commented 1 year ago

Codecov Report

Merging #269 (62bacfd) into main (74d699c) will increase coverage by 0.23%. The diff coverage is 83.25%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main     #269      +/-   ##
==========================================
+ Coverage   65.86%   66.09%   +0.23%     
==========================================
  Files          56       60       +4     
  Lines        7613     7687      +74     
  Branches     2012     2020       +8     
==========================================
+ Hits         5014     5081      +67     
- Misses       2009     2014       +5     
- Partials      590      592       +2     
Impacted Files Coverage Δ
linkml_runtime/utils/context_utils.py 68.33% <ø> (ø)
linkml_runtime/loaders/loader_root.py 69.84% <54.28%> (+3.17%) :arrow_up:
linkml_runtime/dumpers/rdf_dumper.py 65.90% <55.55%> (-5.89%) :arrow_down:
linkml_runtime/loaders/delimited_file_loader.py 82.85% <82.85%> (ø)
linkml_runtime/dumpers/json_dumper.py 77.77% <84.61%> (-1.54%) :arrow_down:
linkml_runtime/loaders/yaml_loader.py 92.30% <85.71%> (+1.00%) :arrow_up:
linkml_runtime/utils/schemaview.py 87.79% <88.23%> (ø)
linkml_runtime/dumpers/delimited_file_dumper.py 89.65% <89.65%> (ø)
linkml_runtime/dumpers/__init__.py 100.00% <100.00%> (ø)
linkml_runtime/dumpers/csv_dumper.py 100.00% <100.00%> (+8.69%) :arrow_up:
... and 11 more