helpers/mappings_helper.rb
##
# Take an array of mappings and replace 'empty' classes with populated ones
# Does a lookup in a provided hash that uses ontology uri + class id as a key
Take an array of mappings and replace 'empty' classes with populated ones
Does a lookup in a provided hash that uses ontology uri + class id as a key
Take an array of mappings and replace ' empty ' classes with populated ones Does a lookup in a provided hash that uses ontology uri + class id as a key
def validate_interportal_mapping(class_id, ontology_acronym, interportal_prefix)
        query = "#{LinkedData.settings.interportal_hash[interportal_prefix]["api"]}/ontologies/#{ontology_acronym}/classes/#{CGI.escape(class_id.to_s)}?apikey=#{LinkedData.settings.interportal_hash[interportal_prefix]["apikey"]}"
        begin
          json = ::JSON.parse(Net::HTTP.get(URI.parse(query)))
          if json["@id"] == class_id
            return true
          else
            return false
          end
        rescue => e
          error(400, "Interportal combination of class and ontology don't point to a valid class : #{e}")
        end
      end
def validate_interportal_mapping ( class_id , ontology_acronym , interportal_prefix ) query = "#{LinkedData.settings.interportal_hash[interportal_prefix]["api"]}/ontologies/#{ontology_acronym}/classes/#{CGI.escape(class_id.to_s)}?apikey=#{LinkedData.settings.interportal_hash[interportal_prefix]["apikey"]}" begin json = :: JSON . parse ( Net :: HTTP . get ( URI . parse ( query ) ) ) if json [ "@id" ] == class_id return true else return false end rescue => e error ( 400 , "Interportal combination of class and ontology don't point to a valid class : #{e}" ) end end
Take an array of mappings and replace 'empty' classes with populated ones
Does a lookup in a provided hash that uses ontology uri + class id as a key
Take an array of mappings and replace ' empty ' classes with populated ones Does a lookup in a provided hash that uses ontology uri + class id as a key
# A method to check if the interportal mapping submitted is valid
class_id
<not_specific>
ontology_acronym
<not_specific>
interportal_prefix
<not_specific>