oeplatform
oeplatform copied to clipboard
Automated ontological annotation in metadata
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:
- read unique column-values in csv-file (that are
strings
) and paste into the metadata json - drop-down menu in MetaEditor to search and make annotation suggestions in MetaEditor
- automatic insertion in json in field
isAbout
andvalueReference
- 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 - OEO concept information should be shown in an information panel to allow users to make an informed annotation choice
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 )
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.
For documentation purposes, a screenshot of the first implementation of 2. drop-down menu in MetaEditor.
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));
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: