From 926fe1e7f928c300aa32d2cd61a4655fb073fdb9 Mon Sep 17 00:00:00 2001 From: Syphax Bouazzouni Date: Fri, 11 Feb 2022 09:34:42 +0100 Subject: [PATCH 1/2] Auto stash before merge of "upstream" and "upstream/master" --- .gitignore | 2 ++ Gemfile.lock | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 68d9c3f8e..4045ab4b2 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,5 @@ test/test_run.log test/data/ontology_files/catalog-v001.xml create_permissions.log + +ontologies_api.iml diff --git a/Gemfile.lock b/Gemfile.lock index cb883e4f4..991897524 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/ncbo/goo.git - revision: d26b364dc5e8a22753cf9f8495a77c398112683f + revision: 89a8f665f70644989adf70cd132bf0f38ef3414d branch: master specs: goo (0.0.2) @@ -16,7 +16,7 @@ GIT GIT remote: https://github.com/ncbo/ncbo_annotator.git - revision: 94a77bb64f3a5af72d909c597869e9923bac3831 + revision: e224f46dafc254b7d4a1685eb6c5c26d97ab33b7 branch: master specs: ncbo_annotator (0.0.1) @@ -27,7 +27,7 @@ GIT GIT remote: https://github.com/ncbo/ncbo_cron.git - revision: 2861124483e60071266f48b2ed6d72e4394de975 + revision: 3d585ec682d84054668f939b613388186020faa0 branch: master specs: ncbo_cron (0.0.1) From 8770b020b3584fa43a9712854121269915dd94f6 Mon Sep 17 00:00:00 2001 From: Syphax Bouazzouni Date: Thu, 6 Oct 2022 17:17:24 +0200 Subject: [PATCH 2/2] add mapping process update --- controllers/mappings_controller.rb | 27 +++++++++++++++++---------- helpers/mappings_helper.rb | 12 ++++++++++++ 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/controllers/mappings_controller.rb b/controllers/mappings_controller.rb index 29e26483a..ed071e2b7 100644 --- a/controllers/mappings_controller.rb +++ b/controllers/mappings_controller.rb @@ -35,6 +35,8 @@ class MappingsController < ApplicationController reply mappings end + + namespace "/mappings" do # Display all mappings get do @@ -76,16 +78,7 @@ class MappingsController < ApplicationController # Display a single mapping - only rest get '/:mapping' do - mapping_id = nil - if params[:mapping] and params[:mapping].start_with?("http") - mapping_id = params[:mapping] - mapping_id = mapping_id.gsub("/mappings/","/rest_backup_mappings/") - mapping_id = RDF::URI.new(params[:mapping]) - else - mapping_id = - "http://data.bioontology.org/rest_backup_mappings/#{mapping_id}" - mapping_id = RDF::URI.new(mapping_id) - end + mapping_id = request_mapping_id mapping = LinkedData::Mappings.get_rest_mapping(mapping_id) if mapping reply populate_mapping_classes([mapping].first) @@ -147,6 +140,20 @@ class MappingsController < ApplicationController reply(201, mapping) end + + patch '/:mapping' do + mapping = LinkedData::Mappings.get_rest_mapping(request_mapping_id) + process = mapping.process + populate_from_params(process, params) + if process.valid? + process.save + else + error 422, process.errors + end + halt 204 + end + + # Delete a mapping delete '/:mapping' do mapping_id = RDF::URI.new(replace_url_prefix(params[:mapping])) diff --git a/helpers/mappings_helper.rb b/helpers/mappings_helper.rb index e65a98d38..246fbcdba 100644 --- a/helpers/mappings_helper.rb +++ b/helpers/mappings_helper.rb @@ -33,6 +33,18 @@ def populate_mapping_classes(mappings) mappings end + + def request_mapping_id + mapping_id = nil + if params[:mapping] and params[:mapping].start_with?("http") + mapping_id = RDF::URI.new(params[:mapping]) + else + mapping_id = + "http://data.bioontology.org/rest_backup_mappings/#{params[:mapping]}" + mapping_id = RDF::URI.new(mapping_id) + end + mapping_id + end end end end