Skip to content

Generate keywords file#451

Merged
jesper-friis merged 58 commits intomasterfrom
load-keywords
Nov 7, 2025
Merged

Generate keywords file#451
jesper-friis merged 58 commits intomasterfrom
load-keywords

Conversation

@jesper-friis
Copy link
Contributor

@jesper-friis jesper-friis commented Oct 19, 2025

Description

Added new functionality to load and save keywords in several different representations. The the Keywords class has now the following set of methods:

  • load_yaml() | save_yaml(): The original keywords.yaml representation.
  • load_rdf() | save_rdf(): RDF representation, e.g. turtle format.
  • load_table() | save_table(): Tabular representation, e.g. csv format.
  • save_context(): Save as JSON-LD context.
  • save_markdown(): Save as markdown table (for documentation).

Especially loading from ontologies and tables makes it much easier to define new keywords (rdf properties).

The PR includes many other bug-fixes and improvements making it almost impossible to review.
Things that could be interesting for a reviewer to look at are:

  • The following tests:
    • test_save_yaml()
    • test_load_rdf()
    • test_save_rdf()
    • test_load_table()
    • test_save_table()
  • It may also be interesting to have a look at the first version of the datadoc vocabulary. The intention is to publish it on emmo-repo.

@jesper-friis jesper-friis marked this pull request as draft October 19, 2025 21:49
@codecov
Copy link

codecov bot commented Oct 19, 2025

Codecov Report

❌ Patch coverage is 91.42857% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.84%. Comparing base (1f7fbe3) to head (bcb0bd3).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
tripper/datadoc/keywords.py 90.84% 40 Missing ⚠️
tripper/datadoc/dataset.py 80.00% 1 Missing ⚠️
tripper/datadoc/utils.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #451      +/-   ##
==========================================
+ Coverage   84.04%   84.84%   +0.79%     
==========================================
  Files          30       30              
  Lines        4186     4565     +379     
==========================================
+ Hits         3518     3873     +355     
- Misses        668      692      +24     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +259 to +263
"""Load YAML file with keyword definitions.

Arguments:
yamlfile: Path of URL to a YAML file to load.
timeout: Timeout when accessing remote files.
Copy link
Contributor

Choose a reason for hiding this comment

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

This goes into the documentation. Make a link to an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. Added it to issue #462.

Comment on lines +447 to +451
Arguments:
yamlfile: File to save keyword definitions to.
keywords: Sequence of keywords to include.
classes: Include keywords that have these classes in their domain.
themes: Include keywords for these themes.
Copy link
Contributor

Choose a reason for hiding this comment

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

example?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added it to issue #462.

Comment on lines +484 to +492
"""Load keywords from a csv file.

Arguments:
filename: File to load.
format: File format. Unused. Only csv is currently supported.
prefixes: Dict with additional prefixes used by `dicts`.
theme: Theme defined by `dicts`.
basedOn: Theme(s) that `dicts` are based on.
kwargs: Keyword arguments passed on to TableDoc.parse_csv().
Copy link
Contributor

Choose a reason for hiding this comment

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

Point to an example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added to issue #462

Comment on lines 806 to 807
- list of keywords missing `ts`
- list of keywords existing `ts`
Copy link
Contributor

Choose a reason for hiding this comment

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

Does not make sensee

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see there is a typo. Apart from that, what doesn't make sense?

Copy link
Contributor

@francescalb francescalb left a comment

Choose a reason for hiding this comment

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

Probably fine. Since you write that it is impossible to review I won't do a proper review. Documentation needs to be improved so that people can see examples of inputs.

Tests are failing.

jesper-friis and others added 3 commits November 7, 2025 09:20
Co-authored-by: Francesca L. Bleken <48128015+francescalb@users.noreply.github.com>
Co-authored-by: Francesca L. Bleken <48128015+francescalb@users.noreply.github.com>
Comment on lines 806 to 807
- list of keywords missing `ts`
- list of keywords existing `ts`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see there is a typo. Apart from that, what doesn't make sense?

@jesper-friis jesper-friis merged commit 3f3ba09 into master Nov 7, 2025
22 checks passed
@jesper-friis jesper-friis deleted the load-keywords branch November 7, 2025 09:54
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.

2 participants