lib/catissue/database.rb
def resolve_parent(refs, attribute)
      id_ref_hash = refs.to_compact_hash { |ref| ref.identifier }.invert
      refs.each do |ref|
        parent = ref.send(attribute) || next
        resolved = id_ref_hash[parent.identifier] || next
        logger.debug { "Resetting #{ref.qp} #{attribute} from #{parent} to #{resolved} in order to fix a caCORE inconsistency..." }
        ref.set_property_value(attribute, resolved)
      end
    end
def resolve_parent(refs, attribute)
      id_ref_hash = refs.to_compact_hash { |ref| ref.identifier }.invert
      refs.each do |ref|
        parent = ref.send(attribute) || next
        resolved = id_ref_hash[parent.identifier] || next
        logger.debug { "Resetting #{ref.qp} #{attribute} from #{parent} to #{resolved} in order to fix a caCORE inconsistency..." }
        ref.set_property_value(attribute, resolved)
      end
    end
def resolve_parent ( refs , attribute ) id_ref_hash = refs . to_compact_hash { | ref | ref . identifier } . invert refs . each do | ref | parent = ref . send ( attribute ) || next resolved = id_ref_hash [ parent . identifier ] || next logger . debug { "Resetting #{ref.qp} #{attribute} from #{parent} to #{resolved} in order to fix a caCORE inconsistency..." } ref . set_property_value ( attribute , resolved ) end end
This method patches up fetched sources to correct the following anomaly:

 @quirk caCORE fetched references are not reconciled within an existing query result, e.g.
   given a query result with two Specimens s1 and s2, the parent reference is not fetched.
   Subsequently fetching the parent is independent of the query result. Thus if s1 is the parent
   of s2 in the database, the fetched s2 parent s3 is distinct from s1, even though
   s1.identifier == s3.identifier. Thus, enforcing reference consistency requires a post-fetch step
   that matches the fetched objects to the original query result on identifier and resets the
   references.

 Not yet enabled. TODO - plug this into fetch_object.

 @param [<Resource>] refs the fetched domain objects
 @param [Symbol] attribute the owner attribute
This method patches up fetched sources to correct the following anomaly :