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

Added support for lists in tripper.convert #129

Merged
merged 6 commits into from
Sep 12, 2023

Conversation

jesper-friis
Copy link
Contributor

Description:

The save_dict() and load_dict() in the tripper.convert module saves and loads dicts as their name indicate. However, we also need support for lists, since OTEAPI represents mappings as a list in the configurations.

This PR generalises the above functions to also support lists. To reflect that, has the names of the functions also been changed to save_container() and load_container(). The old function names still exists, but are deprecated.

We have also removed the bases argument, since the base (superclass) is now used and can therefore not be allowed to be changed by the user.

A bug in parse_literal() has also been fixed.

Type of change:

  • Bug fix.
  • New feature.
  • Documentation update.
  • Testing.

Checklist for the reviewer:

This checklist should be used as a help for the reviewer.

  • Is the change limited to one issue?
  • Does this PR close the issue?
  • Is the code easy to read and understand?
  • Do all new feature have an accompanying new test?
  • Has the documentation been updated as necessary?

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 84.69% and project coverage change: -0.44% ⚠️

Comparison is base (d2ec5cb) 76.11% compared to head (bffcc45) 75.67%.

❗ 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.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #129      +/-   ##
==========================================
- Coverage   76.11%   75.67%   -0.44%     
==========================================
  Files          17       17              
  Lines        1348     1402      +54     
==========================================
+ Hits         1026     1061      +35     
- Misses        322      341      +19     
Files Changed Coverage Δ
tripper/convert/convert.py 86.60% <83.87%> (-13.40%) ⬇️
tripper/convert/__init__.py 100.00% <100.00%> (ø)
tripper/utils.py 86.88% <100.00%> (-0.41%) ⬇️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jesper-friis jesper-friis mentioned this pull request Sep 1, 2023
9 tasks
value = OWL.Nothing

def get_obj_iri(obj, uuid):
"""Return IRI for Python object `obj`. The `uuid` argument is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain why this method returns either an IRI or a list

Copy link
Contributor Author

@jesper-friis jesper-friis Sep 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nested help-function get_obj_iri() will only return an IRI. I updated its docstring to explain that it also populates the list of triples (built up in the outer function from_container()) with a representation of obj .

The reason for introducing a nested function is to support arbitrary nested containers through recursion.

from_container() will always return a list of triples.

@jesper-friis jesper-friis merged commit d23f316 into master Sep 12, 2023
9 checks passed
@jesper-friis jesper-friis deleted the support-list-in-convert branch September 12, 2023 09:22
jesper-friis added a commit to SINTEF/dlite that referenced this pull request Sep 29, 2023
# Description
Example with OTEAPI and OTELib using TEM data.

This example currently depends on a set of other PRs:

* #633 (already merged into this
branch)
* EMMC-ASBL/oteapi-core#318
* EMMC-ASBL/tripper#129
* EMMC-ASBL/oteapi-dlite#163

## Type of change
- [ ] Bug fix & code cleanup
- [ ] New feature
- [x] Documentation update
- [ ] Test update

## Checklist for the reviewer
This checklist should be used as a help for the reviewer.

- [ ] Is the change limited to one issue?
- [ ] Does this PR close the issue?
- [ ] Is the code easy to read and understand?
- [ ] Do all new feature have an accompanying new test?
- [ ] Has the documentation been updated as necessary?
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.

3 participants