<commit_before>class CreateLocIdsForExistingOntologies < ActiveRecord::Migration
  def up
    Ontology.all.each do |ontology|
      ontology.locid = "/#{ontology.repository.path}/"
      if ontology.parent
        ontology.locid << "#{ontology.parent.basepath}//#{ontology.name}"
      else
        ontology.locid << "#{ontology.basepath}"
      end
      ontology.update_column(:locid, ontology.locid)
    end
  end

  def down
    Ontology.find_each do |ontology|
      ontology.locid = nil
      ontology.save!
    end
  end
end<commit_msg>update ontology-members for loc/id as well.<commit_after>class CreateLocIdsForExistingOntologies < ActiveRecord::Migration
  def up
    Ontology.all.each do |ontology|
      ontology.locid = "/#{ontology.repository.path}/"
      if ontology.parent
        ontology.locid << "#{ontology.parent.basepath}//#{ontology.name}"
      else
        ontology.locid << "#{ontology.basepath}"
      end
      ontology.update_column(:locid, ontology.locid)

      ontology.symbols.find_each do |symbol|
        symbol.update_column(:locid, "#{ontology.locid}//#{symbol.name}")
      end

      ontology.mappings.find_each do |mapping|
        mapping.update_column(:locid, "#{ontology.locid}//#{mapping.name}")
      end

      ontology.sentences.find_each do |sentence|
        sentence.update_column(:locid, "#{ontology.locid}//#{sentence.name}")
      end
    end
  end

  def down
    Ontology.find_each do |ontology|
      ontology.locid = nil
      ontology.save!
    end
  end
end
{'fraction_non_alphanumeric': 0.1225296442687747, 'fraction_numerical': 0.0, 'mean_word_length': 2.8651399491094147, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2015349', 'n_tokens_mistral': 501, 'n_tokens_neox': 504, 'n_words': 88}