node_evaluation_helper.rb revision 120a4f90c07b4fdcdb5a856982a64a604ea98094
98N/A # generate IRI for child-ontology 213N/A # find or create child-ontology by IRI 332N/A version = ontology.versions.build 210N/A version.basepath = ontology.basepath 128N/A version.parent = parent_version 326N/A version.commit_oid = parent_version.try(:commit_oid) 335N/A version.commit = parent_version.try(:commit) 70N/A version.file_extension = ontology.file_extension 294N/A # This version will not exist if the parsing fails 98N/A version.do_not_parse! 356N/A importer.versions << version 295N/A importer.version if parent_ontology 262N/A def alias_iris_for_mappings!(current_element) 277N/A aliases = importer.ontology_aliases 332N/A current_element['source_iri'] = aliases[current_element['source']] 332N/A current_element['target_iri'] = aliases[current_element['target']] 319N/A def generate_ontology_iri(internal_iri, current_element) 280N/A if current_element['reference'] == 'true' 319N/A ontology = Ontology.find_with_iri(internal_iri) 359N/A ontohub_iri = ExternalRepository.determine_iri(internal_iri) 98N/A ontohub_iri = ontology.iri 98N/A if parent_ontology.distributed? 156N/A ontohub_iri = parent_ontology.locid_for_child(internal_iri) 98N/A # we use 0 here, because the first time around, we 70N/A # have ontologies_count 0 which is increased by one 70N/A # after obtaining the lock. We need to preempt 70N/A # this message, because otherwise we would 70N/A # fail here with a lock issue instead of the 70N/A # 'more than one ontology' issue. 70N/A if importer.ontologies_count > 0 70N/A raise "more than one #{Settings.OMS} found" 70N/A ontohub_iri = parent_ontology.iri 70N/A def procure_ontology(element, iri) 70N/A if element['reference'] == 'true' 70N/A ontology = Ontology.find_with_iri(iri) 253N/A ontology = ExternalRepository.create_ontology(iri) 70N/A importer.ontology_aliases[element['name']] = ontology.iri importer.ontologies_count += 1 if parent_ontology.distributed? assign_distributed_ontology_logic(parent_ontology) ontology = procure_child_ontology(iri) ontology = parent_ontology def code_reference_from_range(range) reference = CodeReference.new(begin_line: match[:begin_line].to_i, begin_column: match[:begin_column].to_i, end_line: match[:end_line].to_i, end_column: match[:end_column].to_i) # if it is possible for ontologies to be a relation we should optimize the # call by using #select instead of #map. def update_ontologies_per_logic_count!(ontologies) Logic.where(id: ontologies.map(&:logic_id)).pluck(:id).each do |logic_id| Logic.reset_counters(logic_id, :ontologies)