INCATools / dosdp-tools

Utility for working with DOSDP design patterns and OWL ontologies
MIT License
23 stars 5 forks source link

Problem with adding ORCIDs as data_list_vars #418

Closed rays22 closed 2 years ago

rays22 commented 2 years ago

I am trying to add a list of ORCIDs 'data_list_vars' without success.

It seems to me that only the DOS-DP OBO fields work with data_list_vars. Adding a list of contributors using data_list_vars did not work for me.

files to reproduce the problem: issue418-test-files.zip

  1. test_data_list_vars.yaml
    • validation: PASS
      dosdp validate -i test_data_list_vars.yaml
      INFO:root:Checking test_data_list_vars.yaml
      INFO:root:Validation completed without any issues to report.
  2. test_data_list_vars.tsv

When I check definitions.owl after turning the template table into OWL axioms, I do not find any of the dcterms:contributor ORCID data, or the synonyms from the tsv table that I am trying to add under annotations. Please, note that I can add synonyms as data_list_vars in another way ( see syns2 and the comments in 'test_data_list_vars.yaml').

dosumis commented 2 years ago

‘contributor’ is not a key defined in the DOSDP schema https://github.com/INCATools/dead_simple_owl_design_patterns/blob/master/docs/dosdp_schema.md. You need to add this under annotations.

This should work:

On 27 Jun 2022, at 15:02, Ray Stefancsik @.***> wrote:

I am trying to add a list of ORCIDs 'data_list_vars' without success.

It seems to me that only the DOS-DP OBO fields work with data_list_vars. Adding a list of contributors using data_list_vars did not work for me.

files to reproduce problem: test_data.zip https://github.com/INCATools/dosdp-tools/files/8992158/test_data.zip — Reply to this email directly, view it on GitHub https://github.com/INCATools/dosdp-tools/issues/418, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA3RR22GNMYVTVNPMLJYRTVRGQ6PANCNFSM5Z6NVZ2A. You are receiving this because you are subscribed to this thread.

rays22 commented 2 years ago

Test DOS-DP pattern files:

  1. test_data_vars.yaml:

Adding data_list_vars

exact_synonym:
  value: syns

works all right.

dosdp validate -i test_data_vars.yaml        
INFO:root:Checking test_data_vars.yaml
INFO:root:Validation completed without any issues to report.
  1. test_data_list_vars.yaml

Adding another annotation type does not seem to work.

dosdp validate -i test_data_list_vars.yaml
INFO:root:Checking test_data_list_vars.yaml
/Users/ray/py_tools/venv/lib/python3.9/site-packages/dosdp/validator.py:30: UserWarning:deque(['additionalProperties']) => Additional properties are not allowed ('contributor' was unexpected) => []
INFO:root:Validation completed with issues to be fixed.
rays22 commented 2 years ago

I have updated the test files to help reproduce the problem and tried to clarify the issue in the description above.

balhoff commented 2 years ago

@rays22 are you defining the prefix dcterms: when running your command?

rays22 commented 2 years ago

@rays22 are you defining the prefix dcterms: when running your command?

I am not sure if I understand your question @balhoff . No, I am not defining it explicitly dcterms: or other prefixes when I am running my make command:

sh run.sh make ../patterns/definitions.owl -B IMP=false

Here is the relevant part of my yaml:

annotationProperties:
  exact_synonym: oio:hasExactSynonym
  contributor: dcterms:contributor

vars:
  chemical: "'chemical entity'"

data_list_vars:
  syns: xsd:string   # placeholder for synonym list
  syns2: xsd:string   # placeholder for synonym list
  orcid: xsd:string  # ORCID of contributor

name:
  text: "trait in response to %s"
  vars:
    - chemical

annotations:
  - annotationProperty: exact_synonym
    text: "response to %s trait"
    vars:
      - chemical

  - annotationProperty: contributor
    value: orcid

  - annotationProperty: exact_synonym  # this does not work 
    value: syns  # this does not work

exact_synonym:  # this works
  value: syns2   # this works
balhoff commented 2 years ago

If you look for the command line that is executed when dosdp-tools is run by your makefile, you can see if it has some options like dosdp-tools --prefixes=prefixes.yaml or dosdp-tools --obo-prefixes=true. obo-prefixes turns on some standard prefixes, but dcterms is not one of them. If your command is using --obo-prefixes, you could change your pattern to use dct instead; that one is defined. Or pass your prefixes to the command. If this turns out to be the problem, let me know and leave this issue open, and I will try to improve the error reporting.

dosumis commented 2 years ago

Sorry for my quick reply by email earlier. Screenshot fix didn't make it into the comment.

This fail is due to the fact there is not contributor key in the spec:

dosdp validate -i test_data_list_vars.yaml
INFO:root:Checking test_data_list_vars.yaml
/Users/ray/py_tools/venv/lib/python3.9/site-packages/dosdp/validator.py:30: UserWarning:deque(['additionalProperties']) => Additional properties are not allowed ('contributor' was unexpected) => []
INFO:root:Validation completed with issues to be fixed.

Looks like you fixed that subsequently and are now correctly using they value key under annotations.

  - annotationProperty: contributor
    value: orcid

This should work, but as Jim pointed out, you need to define a prefix for dcterms so that this can be read:

annotationProperties:
  exact_synonym: oio:hasExactSynonym
  contributor: dcterms:contributor

IIRC, you don't need one for oio because its defined in the default prefix set for OBO.

rays22 commented 2 years ago

Thanks for the explanation @balhoff . The Makefile has the obo-prefixes=true options. I should note that oio:hasExactSynonym also fails under the annotations. I am also able to add single dcterms:contributor annotations as data_vars without any problem.

balhoff commented 2 years ago

@rays22 thanks, I ran your test file and I now see that this is a bug that was fixed a while back in #405. It seems to work fine in the current release. Put some pressure on @matentzn to make an ODK release including this PR: https://github.com/INCATools/ontology-development-kit/pull/575 😛

balhoff commented 2 years ago

@rays22 oh by the way the prefix issue still stands; if you don't provide it you will get incorrect expansions for contributor as seen here:

AnnotationAssertion(<http://purl.obolibrary.org/obo/dcterms_contributor> <http://purl.obolibrary.org/obo/OBA_9999990> "https://orcid.org/0000-0001-8314-2140"^^xsd:string)

dosdp-tools should keep a list of OBO prefixes instead of defaulting to that when you pass that option.

rays22 commented 2 years ago

Thanks @balhoff and @dosumis . I will change the prefix.

rays22 commented 2 years ago

Fixed by https://github.com/INCATools/ontology-development-kit/pull/575

balhoff commented 2 years ago

@rays22 I forgot, there WAS an ODK release recently: https://github.com/INCATools/ontology-development-kit/releases/tag/v1.3.1

So you just need to update to the latest version (sorry @matentzn)

rays22 commented 2 years ago

I can confirm that my data_list_vars issues are fixed after updating obolibrary/odkfull to the latest version. Thanks @balhoff .