ontology-development-kit icon indicating copy to clipboard operation
ontology-development-kit copied to clipboard

Robot template processing within ODK

Open luisenriqueramos1977 opened this issue 2 years ago • 16 comments

Dear All,

I am very new to ODK and have used robot for some time. I was able to create a new ontology with ODK, but I wonder if I could create my ontology in ODK using a robot template?.

Some robot parameters are mentioned in the yaml file that was autogenerated, but I wonder if there could be an illustrative example somewhere, where they explain how to generate the ontology with robot and ODK?. I read the documentation (https://ontology-development-kit.readthedocs.io/en/latest/) and did not find anything similar.

Any recommendation is welcomed.

Luis Ramos

luisenriqueramos1977 avatar Jun 15 '22 11:06 luisenriqueramos1977

@luisenriqueramos1977 Thank you so much for your issue. I do not know how it slipped through my inbox.

Native ROBOT template support is being implemented as we speak, but not ready yet for prime time #314

In the meantime, you can build a custom ROBOT template pipeline by:

  1. Adding a component in the config
  2. Defining the component as a robot template process in yourontology.Makefile

I can help you with that if you like, its easy enough to set up (share your Github repo and I can make a PR).

matentzn avatar Aug 05 '22 08:08 matentzn

Hi @matentzn,

thanks so much for your disposition to help.

I created a sample project repository, that you can use to add the component, and then I use it as a seed for my work:

https://github.com/luisenriqueramos1977/testontoodk

I hope we can set it up properly, and thanks in advance.

Best regards

Luis Ramos

luisenriqueramos1977 avatar Aug 08 '22 13:08 luisenriqueramos1977

Hi @matentzn and @luisenriqueramos1977, sorry ot tag along here, but I want to do the same in https://github.com/NFDI4Chem/VibrationSpectroscopyOntology and I don't know how to best set up the component part as mentioned in https://github.com/INCATools/ontology-development-kit/issues/613#issuecomment-1206202300. @matentzn can you point me to an ontology that uses this in theri yaml & makefile already to learn from?

StroemPhi avatar Aug 17 '22 14:08 StroemPhi

Until the new feature is released, you can:

  1. create a component
  2. create a custom goal for that component which involves a robot template pipeline, depending on a template tsv file.
  3. Import component URL to edit.

Here is an example: https://gitlab.c-path.org/c-pathontology/critical-path-ontology/-/blob/main/src/ontology/Makefile#L408

matentzn avatar Aug 17 '22 17:08 matentzn

I've managed to get it working in https://github.com/NFDI4Chem/VibrationSpectroscopyOntology/pull/10 but somehow the QC pipeline fails due to the component owl build from the TSV, which I cannot explain. Running sh run.sh make test runs through locally but doesn't contain the component build part, as does the QC in the GH actions of the PR. Loading the component owl into the edit.owl works also as expected locally. I'm out of ideas where to look for other than trying to merge the component owl into the edit owl. If you have the time to have a look @matentzn that would be great. If not, no worries ;)

StroemPhi avatar Aug 19 '22 13:08 StroemPhi

@luisenriqueramos1977 I got it working, so if you need help with that you can look at the VISPRO repo as an example or can ask me as well.

StroemPhi avatar Aug 19 '22 13:08 StroemPhi

Hi @matentzn , dear, I have not been able to solve the issue. Please, could you tell me how I create a component in the config?, in the config folder there are 3 files.

context.json table-template-config.yaml top_level_classes.txt.

Where should I create the component?, and how?. Where do I find documentation on how to create such a component?.

Luis Ramos

luisenriqueramos1977 avatar Sep 26 '22 12:09 luisenriqueramos1977

Hi @luisenriqueramos1977

  1. you need to have your template in scr/templates like this one: https://github.com/NFDI4Chem/VibrationSpectroscopyOntology/blob/main/src/templates/vispro_terms.tsv
  2. you need to specify your template pipeline by directing to YOUR TSV template like this: https://github.com/NFDI4Chem/VibrationSpectroscopyOntology/blob/main/src/ontology/vispro-odk.yaml#L134-L140
  3. run sh run.sh make update_repo twice! --> this will update your automated Makefile (which should never be edited manually), providing you the commands/recipies you'll need in step 5, e.g. https://github.com/NFDI4Chem/VibrationSpectroscopyOntology/blob/main/src/ontology/Makefile#L349-L370.
  4. In your ontology.Makefile (the place where you can add customized code to deviate from the standard) add code for how you want the OWL module (specified in your congig.yml) to be build using ROBOT, e.g. like this here: https://github.com/NFDI4Chem/VibrationSpectroscopyOntology/blob/main/src/ontology/vispro.Makefile#L6-L19
  5. now, assuming that the OTHER_SRC variable in the Makefile was set correctly to COMPONENTSDIR)/[your_component].owl by step 3, you can call sh run.sh make all_components which should generate your component owl within the component folder.
  6. To load the newly generated component into your edit.owl you need to copy the import statement from the catalog-v001.xml in the target folder, as indicated by the update_repo script shell output of step 3. and also add an import statement to your component in your edit.owl

StroemPhi avatar Sep 26 '22 12:09 StroemPhi

Dear @StroemPhi thanks for your answer.

I followed the indicated steps to 3, as you indicated. I found the command sh run.sh make update_repo, and run it at ontology folder level, which created another target folder. But, no ontology with my robot template terms was created, or updated. The robot template is properly developed because is the one I use to create my ontology, so the problem should not be there.

The step 4, is before or after step 3?.

So, I do not know what I am doing wrong.

luisenriqueramos1977 avatar Sep 27 '22 08:09 luisenriqueramos1977

@luisenriqueramos1977 I updated my previous post in the hope of being more clear now.

StroemPhi avatar Sep 27 '22 08:09 StroemPhi

@luisenriqueramos1977 did you get it to work?

StroemPhi avatar Sep 27 '22 11:09 StroemPhi

Hi @StroemPhi , unfortunalley I have not been able to solve the issue.

When I run the step 3, a new folder is created as indicated here: https://github.com/INCATools/ontology-development-kit/issues/669 After that, I do not know if that is normal, or not, or if I have to do the next indicated steps in the new folder. Anyway, I followed the new steps in the current folder, but at the end, when I run the command: sh run.sh make all_components the system indicates me: sh run.sh make all_components . At the end, nothing is done on the digitrubber_terms.owl file.

Luis

luisenriqueramos1977 avatar Sep 28 '22 07:09 luisenriqueramos1977

Yes the target folder is normal and you can remove it by running sh run.sh make clean which is all documented within the Makefile. I'm sorry but helping you without a link to the repo to see where you are, is really hard. Did step 3 really update your Makefile to have the ´all_components` recipe? Did you add your ROBOT code in you ontology.makefile? If I can't see what you did, I cannot really help. Since we're both TIB and if this is in our TIB GitLab because you are not allowed to have it public send me the link via email.

StroemPhi avatar Sep 28 '22 08:09 StroemPhi

Here is the repository: https://github.com/luisenriqueramos1977/digitrubber

Step 3 did nothing. In the make file it is only what I added as indicated in step 4.

I do not have access to our (tib) gitlab

Luis.

luisenriqueramos1977 avatar Sep 28 '22 08:09 luisenriqueramos1977

@luisenriqueramos1977 see the above PR, which fixes all. Step 3 did, what it should have, which is create the commands in the autogenerate Makefile. Step 5 did't do as expected, because step 3 already created the component.owl as a stub, which I forgot it would do. Thus the proper command should have been sh run.sh make recreate-components or you could just have deleted this stub, like I did in the PR. But the main problem that was there, was the wron prefix in your TSV template, which needs to be obo.

Glad I could help. Next time, please make sure to read/inspect the available docs/comments in the sourcefiles before, as some of the questions could have been answered thereby.

StroemPhi avatar Sep 28 '22 09:09 StroemPhi

Thanks so much my dear @StroemPhi. Job done!. Hope this learning step helps others!.

Luis

luisenriqueramos1977 avatar Sep 28 '22 09:09 luisenriqueramos1977

Hi guys, I am trying to update a version of the ontology using an updated version of my robot template.

Following the commands:

  1. sh run.sh make update_repo (2 times)
  2. sh run.sh make all_components
  3. sh run.sh make recreate-components.

The file digitrubber_terms.owl is updated with the new terms brought from digitrubber_terms.tsv, but the file DIGIT-RUBBER-edit.owl is not updated. Actually this last file has nothing.

What should I do being wrong?

Luis Ramos

luisenriqueramos1977 avatar Oct 24 '22 13:10 luisenriqueramos1977

@luisenriqueramos1977 as far as I know you don't need to run sh run.sh make all_components again, as the component is already created, you only need to run sh run.sh make recreate-components. But this should not be your problem. If digitrubber_terms.owl is updated properly, all seems to be as expected, because this is what the recreate command does. Did you reload DIGIT-RUBBER-edit.owl, which Protégé should have asked for after recreating the component and if the edit owl was still open in Protégé.

StroemPhi avatar Oct 24 '22 13:10 StroemPhi

HI @StroemPhi , very thanked again for your quick answer. My installation does not response to the command: sh run.sh make recreate-components, I reloaded the ontology, closed and open, but did not work.

I do not understand very well this:

To load the newly generated component into your edit.owl you need to copy the import statement from the catalog-v001.xml in the target folder, as indicated by the update_repo script shell output of step 3. and also add an import statement to your component in your edit.owl

You say: you need to copy the import statement from the catalog-v001.xml in the target folder, I do not understand that, how do I copy an import to a folder?, should I create a file in that folder?.

I simply imported the _term ontology mentioned in catalog-v001.xml, into the _edit.owl file, is that the procedure?.

Thanks in advance.

Luis

luisenriqueramos1977 avatar Oct 24 '22 13:10 luisenriqueramos1977

please let's move this discussion to your digit rubber repo, as I think this would otherwise clutter this issue thread, which is resolved afaik.

StroemPhi avatar Oct 24 '22 14:10 StroemPhi

Thank you all for the vibrant discussion here, seems the issue is moved elsewhere. Please confirm and close this one!

matentzn avatar Nov 04 '22 17:11 matentzn

Yes can be closed here, if you don't need it as reference anymore.

StroemPhi avatar Nov 04 '22 17:11 StroemPhi

Thank you all for the vibrant discussion here, seems the issue is moved elsewhere. Please confirm and close this one!

I do not agree to close it, because I have not been able to satisfactory solve the issues following the given steps, so I am not sure if that is the solution.

luisenriqueramos1977 avatar Nov 04 '22 18:11 luisenriqueramos1977

The stepsn outlined here worked as expected in my example and also in yours according to this PR. So from the ODK side this is resolved to me. What we need to do now, is help you getting familiar with this ODK workflow. Hence, I made https://github.com/luisenriqueramos1977/digitrubber/issues/2 to move this issue, which to me would be a better place, to not lose track. Not?

StroemPhi avatar Nov 04 '22 18:11 StroemPhi

@StroemPhi , as you might remember, thanks to your support we run the application, but after that, I have not been able to reproduce it. We tried to follow the procedure from a windows PC, and it was necessary to create a "config" folder and add two files. @matentzn mentioned the folder, but he did not say the folder was not present there, the files were just in digitrubeer, I copied and pasted them in the folder config, that I had to create, but the question is what is the content of such files?, where is that documented?. I will discuss this case a separate issue, and separated of digitrubber. Thanks so much for your support.

luisenriqueramos1977 avatar Nov 07 '22 08:11 luisenriqueramos1977

Hi,

@matentzn @StroemPhi I also tried to link the ROBOT flat template with the ODK, I followed the steps mentioned by @StroemPhi, and everything seems to work fine, components ontology gets updated as expected, myontology.owl updated correctly but myontology-edit.owl did not reflect the updates. Is it a normal behavior or some kind of bug? I am also using Windows environment. Thank you guys, for such an illustrative discussion, there was no proper documentation about this implementation as far as searched. please ping me, if more information is required regarding the issue.

Crispae avatar Sep 03 '23 22:09 Crispae

Hi @Crispae, did you do the edits of step 6? If you provide a link to your repo, it would be easier to help. :)

StroemPhi avatar Sep 04 '23 07:09 StroemPhi

Hi @StroemPhi thank's for quick response. https://github.com/Crispae/pkonto, here is the repo

Crispae avatar Sep 04 '23 08:09 Crispae

I don't really get what you mean. To me it looks all the way it should be. You generate the component from the TSV, which is then being imported into the myontology-edit.owl file. And when creating a release (myontology.owl) the coponent.owl is being merged with the -edit.owl. So all as it should be. What am I missing in your question?

StroemPhi avatar Sep 04 '23 08:09 StroemPhi

Sorry, if it was not clear. myontology-edit.owl doesn't have the classes mentioned in the TSV file, link to the file https://github.com/Crispae/pkonto/blob/main/src/ontology/pko-edit.owl.

Is it normal, to have like this ?

Crispae avatar Sep 04 '23 09:09 Crispae