Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nanobot #251

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b5ac673
add nanobot
anitacaron Jan 23, 2024
b17e953
add empty columns to schema/table.tsv
anitacaron Jan 23, 2024
cbf7f18
update nanobot version
anitacaron Jan 23, 2024
51ebced
clean nanobot
anitacaron Jan 23, 2024
3b074f1
specify clean_nanobot rule
anitacaron Jan 24, 2024
94cb427
add all patterns data tables
anitacaron Jan 24, 2024
8ecee17
test table name without underscore
anitacaron Jan 24, 2024
98203cd
fix path to exposure_to_organism
anitacaron Jan 24, 2024
dbea312
update clean_nanobot rule
anitacaron Jan 24, 2024
a9f296e
test phony goal
anitacaron Jan 24, 2024
9e0d0db
update phony goal
anitacaron Jan 24, 2024
b003a91
remove whitespace in expo_chemical and normalize tables to nanobot
Jan 24, 2024
262a786
remove whitespace in exposure_to_construction
Feb 2, 2024
e76a4de
remove whitespace in exposure_to_medical_action
Feb 2, 2024
f2d61f7
add `prepare_release_fast` to workflow
anitacaron Feb 2, 2024
7a70b5e
update nanobot
anitacaron Feb 21, 2024
f5b9340
update workflow
anitacaron Feb 21, 2024
42985d8
update link to download nanobot
anitacaron Feb 21, 2024
5ab647f
fix unequal lengths in datatype table
anitacaron Feb 21, 2024
46d643c
fix unequal length in datatype in line 17
anitacaron Feb 21, 2024
ff8d18b
update SQL type in columns table
anitacaron Feb 21, 2024
4cfddd1
autocomplete draft test
anitacaron Feb 21, 2024
f36b716
fix typo in column name
anitacaron Feb 21, 2024
9e4a389
add assets and templates to nanobot toml
anitacaron Feb 21, 2024
644622d
add ols_form view to table table
anitacaron Feb 21, 2024
fa463ca
fix typo in table's column name
anitacaron Feb 28, 2024
c502d8a
fix typo in table's column name
anitacaron Feb 28, 2024
a9f5cb3
update ols_form
anitacaron Feb 28, 2024
d2244df
add relative path to ols-autocomplete js
anitacaron Feb 29, 2024
a0ab84d
test path
anitacaron Feb 29, 2024
91fc29b
fix path
anitacaron Feb 29, 2024
c883383
try path for js
anitacaron Feb 29, 2024
84fe050
add html type as search to ontology_label for autocomplete
anitacaron Mar 6, 2024
7291c39
fix tabs in datatype table
anitacaron Mar 6, 2024
d8735f1
autofill ontology id when using autocomplete in label
anitacaron Mar 11, 2024
b8f668c
change link to custom form when adding row
anitacaron Mar 11, 2024
4375643
add ols_form to a few more tables
anitacaron Mar 11, 2024
ca3ecda
fix typo on table name
anitacaron Mar 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/ontology/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ candidate*
modules/*.omn
modules/*.pro
status/

# Generated by Nanobot
.nanobot.db*
/nanobot
18 changes: 15 additions & 3 deletions src/ontology/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,21 @@
# ----------------------------------------
# IMPORTANT: DO NOT EDIT THIS FILE. To override default make goals, use ecto.Makefile instead


# ----------------------------------------
# More information: https://github.com/INCATools/ontology-development-kit/
### Workflow
#
# Tasks to update templates.
#
# #### Template
#
# 1. View and edit templates in `./_nanobot` and save in the tab Actions
# 2. Check the `git diff`
# 3. [Rebuild ecto.owl](prepare_release_fast)
# 4. Check the `git diff` again
# 5. `git commit` then `git push` your changes
#
##### Maintenance
#
# [Clean nanobot](clean_nanobot) when necessary


# ----------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions src/ontology/_nanobot
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
NANOBOT_URL="https://github.com/ontodev/nanobot.rs/releases/download/v2024-02-16/nanobot-v20240216-x86_64-linux"
if [ ! -f nanobot ]; then
curl -L -o nanobot $NANOBOT_URL
chmod +x nanobot
fi
if [ ! -f .nanobot.db ] || [ ! -s .nanobot.db ]; then
GATEWAY_INTERFACE=NONE ./nanobot init > /tmp/null 2>&1
fi

./nanobot $@
16 changes: 16 additions & 0 deletions src/ontology/ecto-odk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,19 @@ robot_report:
use_labels : False
report_on :
- ecto-base.owl
custom_makefile_header: |
### Workflow
#
# Tasks to update templates.
#
# #### Template
#
# 1. View and edit templates in `./_nanobot` and save in the tab Actions
# 2. Check the `git diff`
# 3. [Rebuild ecto.owl](prepare_release_fast)
# 4. Check the `git diff` again
# 5. `git commit` then `git push` your changes
#
##### Maintenance
#
# [Clean nanobot](clean_nanobot) when necessary
20 changes: 19 additions & 1 deletion src/ontology/ecto.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,22 @@ tmp/mre_seed.txt:


mre: tmp/mre_seed.txt
$(ROBOT) filter -i $(SRC) -T tmp/mre_seed.txt -o $@
$(ROBOT) filter -i $(SRC) -T tmp/mre_seed.txt -o $@


# ----------------------------------------
# NANOBOT
# ----------------------------------------

.PHONY: executable_nanobot
executable_nanobot:
chmod +x _nanobot

NANOBOT := ./nanobot

### Databases

.PHONY: clean
clean_nanobot:
rm -f .nanobot.db nanobot
make executable_nanobot
14 changes: 14 additions & 0 deletions src/ontology/nanobot.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[nanobot]
config_version = 1

[logging]
level = "DEBUG"

[valve]
path = "src/schema/table.tsv"

[assets]
path = "src/assets/"

[templates]
path = "src/resources/"
36 changes: 36 additions & 0 deletions src/ontology/src/assets/ols-autocomplete.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.ontology-source{
background-color: #5FBDCE;
padding:2px;
padding-right:4px;
color: white;
/*font-size: larger;*/
border-radius: 3px;
display: inline-block;
margin-right: 4px;
vertical-align: middle;
}

a .ontology-source {
background-color: #5FBDCE;
padding:2px;
padding-right:4px;
color: white;
/*font-size: larger;*/
border-radius: 3px;
display: inline-block;
margin-right: 4px;
vertical-align: middle;
border-bottom: none;
}

.term-source{
background-color: #ffac1b;
padding:2px;
padding-right:4px;
color: white;
/*font-size: larger;*/
border-radius: 3px;
display: inline-block;
margin-right: 4px;
vertical-align: middle;
}
175 changes: 175 additions & 0 deletions src/ontology/src/assets/ols-autocomplete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
require = function t(e, o, i) {
function a(r, s) {
if (!o[r]) {
if (!e[r]) {
var l = "function" == typeof require && require;
if (!s && l) return l(r, !0);
if (n) return n(r, !0);
var u = new Error("Cannot find module '" + r + "'");
throw u.code = "MODULE_NOT_FOUND", u
}
var d = o[r] = {
exports: {}
};
e[r][0].call(d.exports, function(t) {
var o = e[r][1][t];
return a(o ? o : t)
}, d, d.exports, t, e, o, i)
}
return o[r].exports
}
for (var n = "function" == typeof require && require, r = 0; r < i.length; r++) a(i[r]);
return a
}({
"ols-autocomplete": [function(t, e, o) {
e.exports = autocomplete = function() {
function t(t) {
var e = "terms";
return "property" == t ? e = "properties" : "individual" == t ? e = "individuals" : "ontology" == t && (e = "ontology"), e
}

function e(t, e, o, i, a) {
if (void 0 != o && void 0 != i) {
var n = encodeURIComponent(i);
window.location.href = t + "ontologies/" + e + "/" + o + "?iri=" + n
} else window.location.href = t + "ontologies/" + suggestion_ontoloy
}

function o(e, o, i, a) {
e.bind("typeahead:select", function(e, i) {
if (void 0 != i.data) {
var a = t(i.data.type);
"ontology" == a ? options.action.call(this, o, i.data.ontology, a, i.data.iri, i.data, i.value) : options.action.call(this, o, i.data.ontology, a, i.data.iri, i.data, i.value)
// autocomplete selection done
// now automatically fill ID field based on the selection
autocomplete_input_name = e.currentTarget.name;
// get the matching 'id' input field's name
// classifying_ontology_term_label -> classifying_ontology_term
target_input_name = autocomplete_input_name.replace("_label", "");
if ($('input[name="' + target_input_name + '"]').length > 0) {
$('input[name="' + target_input_name + '"]')[0].value = i.data.shortForm;
}
} else e.target.form.submit()
}).typeahead({
hint: !1,
highlight: !0,
minLength: 2,
limit: 4,
async: !0
}, i)
}

function i(e) {
return {
header: '<hr/><h5 style="text-align: center">' + e + "</h5>",
suggestion: function(e) {
var o = e.data.label,
i = "";
"" != e.data.synonym && (o = e.data.synonym, i = "<div class='sub-text'>synonym for " + e.value + "</div>");
var a = "<div class='ontology-source'>" + e.data.prefix + "</div>",
n = t(e.data.type);
return "ontology" != n && (a += "&nbsp;<div class='term-source'>" + e.data.shortForm + "</div>"), "<div style='width: 100%; display: table;'> <div style='display: table-row'><div style='display: table-cell;' class='ontology-suggest'><div class='suggestion-value'>" + o + "</div>" + i + "</div><div style='vertical-align:middle; text-align: right; width:60px; display: table-cell;'>" + a + "</div></div></div>"
},
footer: Handlebars.compile('<hr/><div onclick="jQuery(this).closest(\'form\').submit()" style="text-align: right;" class="tt-suggestion tt-selectable">Search EBI APIs</div>')
}
}

function a(t, e, o) {
var i = "";
return e && (i = "&ontology=" + e), o && (i += "&type=" + o), new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
identify: function(t) {
return t.id
},
remote: {
url: t + "api/select?q=%QUERY" + i,
wildcard: "%QUERY",
transform: function(t) {
return r(t)
}
}
})
}

function n(t, e) {
var o = "";
return e && (o = "&ontology=" + e), new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: t + "api/suggest?q=%QUERY" + o,
wildcard: "%QUERY",
transform: function(t) {
return jQuery.map(t.response.docs, function(t) {
return {
value: t.autosuggest
}
})
}
}
})
}

function r(t) {
var e = t.responseHeader.params.q;
return jQuery.map(t.response.docs, function(o) {
var i = o.id,
a = o.label,
n = "",
r = !0;
void 0 != t.highlighting[i].label_autosuggest ? (a = t.highlighting[i].label_autosuggest[0], r = !1) : void 0 != t.highlighting[i].label && (a = t.highlighting[i].label[0], r = !1), r && (void 0 != t.highlighting[i].synonym_autosuggest ? n = t.highlighting[i].synonym_autosuggest[0] : void 0 != t.highlighting[i].synonym && (n = t.highlighting[i].synonym[0]));
var s = o.obo_id;
return void 0 == s && (s = o.short_form), {
id: i,
// display label of the selected element
value: o.label,
data: {
ontology: o.ontology_name,
prefix: o.ontology_prefix,
iri: o.iri,
label: a,
synonym: n,
shortForm: s,
type: o.type
},
query: e
}
})
}
options = {
action: e
}, autocomplete.prototype.start = function(t) {
options = jQuery.extend(!0, {}, options, t), jQuery("input[data-olswidget='multisearch']").each(function() {
var t = jQuery(this).data("selectpath") ? jQuery(this).data("selectpath") : "",
e = jQuery(this).data("olsontology") ? jQuery(this).data("olsontology") : "",
r = jQuery(this).data("olstype") ? jQuery(this).data("olstype") : "",
s = jQuery(this).data("suggest-header") ? jQuery(this).data("suggest-header") : "",
l = [{
name: "suggestion",
source: n(t, e),
display: "value"
}, {
name: "selection",
source: a(t, e, r),
display: "value",
templates: i(s)
}];
o(jQuery(this), t, l)
}), jQuery("input[data-olswidget='select']").each(function() {
var t = jQuery(this).data("selectpath") ? jQuery(this).data("selectpath") : "",
e = jQuery(this).data("olsontology") ? jQuery(this).data("olsontology") : "",
n = jQuery(this).data("olstype") ? jQuery(this).data("olstype") : "",
r = jQuery(this).data("suggest-header") ? jQuery(this).data("suggest-header") : "",
s = [{
name: "selection",
source: a(t, e, n),
display: "value",
templates: i(r)
}];
o(jQuery(this), t, s)
})
}
}
}, {}]
}, {}, []);
Loading
Loading