libraries/AssociationManagement.rb
def add_provenance(opts = {})
      if opts[:from] == opts[:to] # special case: provenance between two parts on the same collection
        opts[:from_map] = opts[:to_map] # ensure from map and to map are the same object for this case
      end

      # creating information hashes to represent `from` and `to` relationship data
      from_info = serialize_as_simple_tag(opts[:from], opts[:from_coord], opts[:additional_relation_data])
      to_info = serialize_as_simple_tag(opts[:to], opts[:to_coord], opts[:additional_relation_data])

      # in destination field of `from`, add information tag representing `to`
      append_to_association(opts[:from_map], DESTINATION, to_info, coord: opts[:from_coord]) if opts[:from_map]

      # in source field of `to`, add information tag representing `from`
      append_to_association(opts[:to_map], SOURCE, from_info, coord: opts[:to_coord]) if opts[:to_map]
    end
# Record an entry to the provenance data between two parts, or a part and an item.
# This will populate the destination field of `from`, and the source field
# of the `to` in their respective associations. If from_coord or to_coord is specified, then
# the associations of the part of the from/to collection at that coordinate will
# populated instead.
#
# @param opts [Hash]  Arguments specifying which objects to record relation for
# @option from [Item/Collection]  the item or collection where sample transfer originated
# @option to [Item/Collection]  the item or collection for destination of sample transfer
# @option from_coord [Tuple Array]  optionally, specify the coordinate selecting a part of the collection, if `to` was a collection
# @option to_coord [Tuple Array]  optionally, specify the coordinate selecting a part of the collection, if `from` was a collection
# @option additional_relation_data [Hash]  optionally, add additional key/value pairs to add to both object's routing data
#                         for this relation. For example, you might want to specify the volume of the transfer,
#                         or which colony was picked from a plate
# @option from_map [AssociationMap]  existing AssociationMap for the given from-object, required to successfully associate provenance to
#                           the `from` item
# @option to_map [AssociationMap]  existing AssociationMap for the given to-object, required to successfully associate provenance to
#                           the `to` item
Record an entry to the provenance data between two parts, or a part and an item.
This will populate the destination field of `from`, and the source field
of the `to` in their respective associations. If from_coord or to_coord is specified, then
the associations of the part of the from/to collection at that coordinate will
populated instead.
Record an entry to the provenance data between two parts or a part and an item . This will populate the destination field of ` from ` and the source field of the ` to ` in their respective associations . If from_coord or to_coord is specified then the associations of the part of the from / to collection at that coordinate will populated instead .
def add_provenance(opts = {})
      if opts[:from] == opts[:to] 
        opts[:from_map] = opts[:to_map] 
      end
      from_info = serialize_as_simple_tag(opts[:from], opts[:from_coord], opts[:additional_relation_data])
      to_info = serialize_as_simple_tag(opts[:to], opts[:to_coord], opts[:additional_relation_data])
      append_to_association(opts[:from_map], DESTINATION, to_info, coord: opts[:from_coord]) if opts[:from_map]
      append_to_association(opts[:to_map], SOURCE, from_info, coord: opts[:to_coord]) if opts[:to_map]
    end
def add_provenance ( opts = { } ) if opts [ :from ] == opts [ :to ] opts [ :from_map ] = opts [ :to_map ] end from_info = serialize_as_simple_tag ( opts [ :from ] , opts [ :from_coord ] , opts [ :additional_relation_data ] ) to_info = serialize_as_simple_tag ( opts [ :to ] , opts [ :to_coord ] , opts [ :additional_relation_data ] ) append_to_association ( opts [ :from_map ] , DESTINATION , to_info , coord : opts [ :from_coord ] ) if opts [ :from_map ] append_to_association ( opts [ :to_map ] , SOURCE , from_info , coord : opts [ :to_coord ] ) if opts [ :to_map ] end
Record an entry to the provenance data between two parts, or a part and an item.
Record an entry to the provenance data between two parts or a part and an item .
# special case: provenance between two parts on the same collection # ensure from map and to map are the same object for this case # creating information hashes to represent `from` and `to` relationship data # in destination field of `from`, add information tag representing `to` # in source field of `to`, add information tag representing `from`
opts
Arguments specifying which objects to record relation for
Arguments specifying which objects to record relation for
from
the item or collection where sample transfer originated
the item or collection where sample transfer originated
to
the item or collection for destination of sample transfer
the item or collection for destination of sample transfer
from_coord
optionally, specify the coordinate selecting a part of the collection, if `to` was a collection
optionally specify the coordinate selecting a part of the collection if ` to ` was a collection
to_coord
optionally, specify the coordinate selecting a part of the collection, if `from` was a collection
optionally specify the coordinate selecting a part of the collection if ` from ` was a collection
additional_relation_data
optionally, add additional key/value pairs to add to both object's routing data for this relation. For example, you might want to specify the volume of the transfer, or which colony was picked from a plate
optionally add additional key / value pairs to add to both object ' s routing data for this relation . For example you might want to specify the volume of the transfer or which colony was picked from a plate
from_map
existing AssociationMap for the given from-object, required to successfully associate provenance to the `from` item
existing AssociationMap for the given from - object required to successfully associate provenance to the ` from ` item
to_map
existing AssociationMap for the given to-object, required to successfully associate provenance to the `to` item
existing AssociationMap for the given to - object required to successfully associate provenance to the ` to ` item