Skip to content

Adding components to an ODK repo

For details on what components are, please see component section of repository file structure document.

To add custom components to an ODK repo, please follow the following steps:

1) Locate your odk yaml file and open it with your favourite text editor (src/ontology/zp-odk.yaml) 2) Search if there is already a component section to the yaml file, if not add it accordingly, adding the name of your component:

components:
  products:
    - filename: your-component-name.owl

3) Refresh your repo by running sh run update_repo. This will automatically (1) create a new file in src/ontology/components/, (2) update the -edit file so that it imports http://purl.obolibrary.org/obo/zp/components/your-component-name.owl (the IRI of your new component), and (3) update the XML catalog file (src/ontology/catalog-v001.xml) to redirect that IRI to the file in the src/ontology/components directory, so that the new component can be found by tools such as Protégé or ROBOT, when they load the -edit file.

If your component is to be generated by some automated process, add a goal in your custom Makefile (src/ontology/zp.Makefile) and make it perform any task needed to generate the component:

$(COMPONENTSDIR)/your-component-name.owl: $(SRC)
    <Insert here the code to produce the component>

If the component is to be generated from a ROBOT template, the ODK can generate the appropriate code for you. For that, when adding the component fo the ODK configuration file (step 2 above), explicitly indicate that the component should be derived from template(s) and list the source templates:

components:
  products:
    - filename: your-component-name.owl
      use_template: true
      templates:
        - template1.tsv
        - template2.tsv

In this example, the component will be derived from the templates found in src/templates/template1.tsv and src/templates/template2.tsv. Initial empty templates will automatically be generated when the repository is refreshed (step 3).

Likewise, the ODK can generate the required code for the case where the component is to be derived from SSSOM mappings:

components:
  products:
    - filename: your-component-name.owl
      use_mappings: true
      mappings:
        - my-mappings.sssom.tsv

and for the case where the component is to be fetched from a remote resource:

components:
  products:
    - filename: your-component-name.owl
      source: https://example.org/component-source.owl