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

Implement load-vocab and list-vocab commands #614

Merged
merged 13 commits into from
Sep 2, 2022

Conversation

osma
Copy link
Member

@osma osma commented Aug 25, 2022

This PR adds two new CLI commands, annif load-vocab and annif list-vocabs. It also deprecates the old annif loadvoc command. The main difference between load-vocab and loadvoc is that load-vocab operates directly on the vocabulary and takes a vocabulary ID as argument, while loadvoc takes a project ID as argument. See #602 for more details on these.

Here are examples of running the new commands:

$ annif load-vocab dummy tests/corpora/dummy-subjects.csv 
Loading vocabulary from CSV file tests/corpora/dummy-subjects.csv...
updating existing subject index
saving vocabulary into SKOS file data/vocabs/dummy/subjects.ttl

As is apparent, the load-vocab command is more verbose than loadvoc which produced little or no output.

The new list-vocabs command shows some basic information about the vocabularies:

$ annif list-vocabs
Vocabulary ID       Languages                 Size  Loaded
----------------------------------------------------------
yso                 en,fi,sv                 37869  True  
stw                 de,en                     6243  True  
gnd                 -                            -  False 
yletest             -                            -  False 
arch                fi                         125  True  
ykl                 -                            -  False 
dummy               en,fi                        2  True  

The loadvoc command now shows a deprecation message (in red color when possible) and has also become slightly more verbose:

$ annif loadvoc dummy-fi tests/corpora/dummy-subjects.csv 
DeprecationWarning: The command 'loadvoc' is deprecated.
updating existing subject index
saving vocabulary into SKOS file data/vocabs/dummy/subjects.ttl

There are also changes to the CLI commands documentation that is nowadays published on ReadTheDocs (see #611). The section on loadvoc command has been deleted, since we don't want to encourage its use. I will file a separate issue on removing the loadvoc command in a future release, probably 0.60.

Fixes #602

@codecov
Copy link

codecov bot commented Aug 25, 2022

Codecov Report

Merging #614 (bd21582) into master (f632673) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #614      +/-   ##
==========================================
+ Coverage   99.58%   99.61%   +0.02%     
==========================================
  Files          87       87              
  Lines        5848     6034     +186     
==========================================
+ Hits         5824     6011     +187     
+ Misses         24       23       -1     
Impacted Files Coverage Δ
annif/rest.py 100.00% <ø> (ø)
tests/test_vocab_skos.py 100.00% <ø> (ø)
annif/cli.py 99.69% <100.00%> (+0.05%) ⬆️
annif/corpus/subject.py 100.00% <100.00%> (ø)
annif/project.py 99.41% <100.00%> (+0.02%) ⬆️
annif/registry.py 100.00% <100.00%> (ø)
annif/vocab.py 97.50% <100.00%> (+1.60%) ⬆️
tests/conftest.py 100.00% <100.00%> (ø)
tests/test_cli.py 100.00% <100.00%> (ø)
tests/test_project.py 100.00% <100.00%> (ø)
... and 2 more

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

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 2, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
15.1% 15.1% Duplication

@osma osma marked this pull request as ready for review September 2, 2022 07:18
@osma osma added this to the 0.59 milestone Sep 2, 2022
@osma osma self-assigned this Sep 2, 2022
@osma osma requested a review from juhoinkinen September 2, 2022 07:18
Copy link
Member

@juhoinkinen juhoinkinen left a comment

Choose a reason for hiding this comment

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

LGTM

Wiki pages need update to align to these chages too.

@osma
Copy link
Member Author

osma commented Sep 2, 2022

Wiki pages need update to align to these chages too.

Right, many wiki pages (e.g. all the backend pages) show use of the loadvoc command. Also vocabulary id's in example configurations and commands should be edited to remove the language suffixes that are no longer useful. I think it's best to do all the wiki edits synchronized with the 0.59 release.

@osma osma merged commit 48b23f7 into master Sep 2, 2022
@osma osma deleted the issue602-load-vocab-command branch September 2, 2022 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

loadvoc command should take a vocabulary id, not project id
2 participants