oeplatform icon indicating copy to clipboard operation
oeplatform copied to clipboard

Automated ontological annotation in metadata

Open jh-RLI opened this issue 2 years ago • 7 comments

A new feature that extends the MetaEdit. It should be possible to enter the OEO values into the metadata fields is_about and value_refenece in a user-friendly way. Often the same information has to be re-entered in different tables or columns. So it should be possible to search the OEO terms in the metaeditor and then enter the result into a field. In addition, recurring terms should be entered automatically in all fields.

This includes functions such as:

  1. read unique column-values in csv-file (that are strings) and paste into the metadata json
  2. drop-down menu in MetaEditor to search and make annotation suggestions in MetaEditor
  3. automatic insertion in json in field isAbout and valueReference
  4. update project-related database with ontological "project-dialect". The database will be updated with already annotated terms and will be used to automatically annotate (already known) project-specific terms in other tables
  5. OEO concept information should be shown in an information panel to allow users to make an informed annotation choice

jh-RLI avatar Jul 18 '22 14:07 jh-RLI

The dbpedia has already published a tool that is able to query the OEO and provide results. It is based on Java and fully containerized with Docker: see the architecture for more details.

  • [x] I will test this and try to integrate this with the OEP backend. (Edit: could be a bit overkill, try other solution first )

jh-RLI avatar Aug 03 '22 13:08 jh-RLI

So it should be possible to search the OEO terms in the metaeditor and then enter the result into a field.

In OEP, we use the json-editor to generate a form for the metaeditor. Indeed, the json-editor has built-in functionality for the ‘autocomplete’ inputs.

To have an ‘autocomplete’, we should change the config in the ’oep-website/dataedit/static/metaedit/schema.json’. The example below is about making an autocomplete textbox for the 'name' in the value_reference:

"name": {
    "description": "Full name of the value",  
    "type": "autocomplete",  
    "title": "Name",  
    "format": "autocomplete",  
    "options": {
      "autocomplete": {
          "search": "search_name",
          "getResultValue": "getResultValue_name",
          "renderResult": "renderResult_name",
          "autoSelect": true
      }
  }
}

and also we need to write some code in the ‘oep-website/dataedit/static/metaedit/metaedit.js/meta edit.json’. The code below is the callback function (inside the init() method) that I wrote for the autocomplete.

window.JSONEditor.defaults.callbacks = {
  "autocomplete": {
    // Setup API calls
    "search_name": function search(jseditor_editor, input) {
        return ([
                  { ... the JSON object is returned here ...}
                ]);
    },
    "renderResult_name": function(jseditor_editor, result, props) {
        return ['<li ' + props + '>',
            '<div class="eiao-object-snippet">' + result.name.substring(0,50) + ' <small>' + result.class.substring(0,10) + 
            '<small></div>',
            '</li>'].join('');
    },
    "getResultValue_name": function getResultValue(jseditor_editor, result) {
        return result.key;
    }
  }
  };

The ‘autocomplete’ functionality is provided by an external library. Therefore we have to import it manually. The best place to import is the ’templates/dataedit/meta_edit.html’. The library itself should be downloaded inside the 'oep-website/dataedit/static' since we decided not to use CDN links anymore.

I pushed the code into a new branch called meta_edit_autocomplete.

adelmemariani avatar Sep 02 '22 10:09 adelmemariani

For documentation purposes, a screenshot of the first implementation of 2. drop-down menu in MetaEditor.

grafik

chrwm avatar Sep 08 '22 06:09 chrwm

The dbpedia-lookup service is now working with our MetaEdit tool.

metaedit

adelmemariani avatar Sep 22 '22 16:09 adelmemariani

Autocomplete with autofill the 'path' below it:

let path = String(jseditor_editor.path).replace("name", "path");
let path_uri = config.editor.getEditor(path);
path_uri.setValue(String(result.resource));

Metaedit_autocomplement_with_path

adelmemariani avatar Sep 26 '22 15:09 adelmemariani

I have started to document the architecture of the tool and what is currently missing. Also included the environment and relations. I post the current status here:

jh-RLI avatar Sep 29 '22 11:09 jh-RLI

Architektur_quick

jh-RLI avatar Sep 29 '22 11:09 jh-RLI