;; ABSTRACT ALGORITHM

1- Create mapping name. 
    source-name_target-name_mapping1

2- Create maps of identical types, including aggregates and sets,
   ignoring the components of aggregates and the members of sets.
   If there is a conflict, break up into pieces and see which ones have
   similar components. Use the looks-like relation that is the most 
   abstract, as there might be several for a given element. Output the
   map as well as a connector between the map and the mapping name. 

3- if there are no more shapes to map, recursively run this mapper on 
   the members of sets and the components of aggregates, if any, then
   exit. 

4- abstract the highest numbered visual primitive. Groups and aggregates 
   done only after everything else is mapped. Posit a new looks-like
   assertion for the abstraction. 
   Go to 2.



;; FACE EXAMPLE
;; ------------

1- create mapping:
	 (s-face-simage_t-face-simage_mapping1)

2- create maps of identical objects:
	 (s-head maps-to t-head)
	in conflict with 
	 (s-head maps-to t-eye)  ;; both ellipses.
	resolved with size similarities.

3- abstract highest numbered until exact match
	 (t-nose looks-like triangle) ;; to 5
	 (t-nose looks-like polygon)  ;; to 4

4- create maps of identical objects:
         (s-nose maps-to t-nose)      ;; both polygons.

5- abstract highest numbered until exact match.
         (t-eye looks-like ellipse)   ;; to 4

6- create maps of identical objects
         (s-eye maps-to t-eye)        ;; both ellipses.

7- abstract highest numbered until exact match.
         (t-mouth looks-like segmented-line) ;; to 4

8- create maps of identical objects
         (s-mouth maps-to t-mouth)

9- done. 

output:

(s-face-simage_t-face-simage_mapping1)

(s-face-simage_t-face-simage_mapping1 has-map s-head_maps-to_t-head)
(s-face-simage_t-face-simage_mapping1 has-map s-nose_maps-to_t-nose)
(s-face-simage_t-face-simage_mapping1 has-map s-eye_maps-to_t-eye)
(s-face-simage_t-face-simage_mapping1 has-map s-mouth_maps-to_t-mouth)

(s-head  maps-to t-head)
(s-nose  maps-to t-nose)
(s-eye   maps-to t-eye)
(s-mouth maps-to t-mouth)

;; LOT EXAMPLE
;; -----------

1- create mapping.
       (s-lot-simage_t-lot-simage_mapping1)

2- map identical things.
       (s-puddle          maps-to t-puddle)
       (s-dumpster        maps-to t-dumpster)
       (s-truck-aggregate maps-to t-truck-aggregate)
       (s-cans            maps-to t-cans)

3- map within up sets.
       (s-can1 maps-to t-can1) ;; circles
       (s-can2 maps-to t-can2)
       (s-can3 maps-to t-can3)
  note that t-can4 and t-can5 do not map to anything. 

4- map within aggregates.
       (s-rig     maps-to t-rig)     ;; squares
       (s-trailer maps-to t-trailer) ;; rectangles

5- done.

output:
(s-lot-simage_t-lot-simage_mapping1)

(s-lot-simage_t-lot-simage_mapping1 
 has-map s-puddle_maps-to_t-puddle)
(s-lot-simage_t-lot-simage_mapping1 
 has-map s-dumpster_maps-to_t-dumpster)
(s-lot-simage_t-lot-simage_mapping1 
 has-map s-truck-aggregate_maps-to_t-truck-aggregate)
(s-lot-simage_t-lot-simage_mapping1 
 has-map s-cans_maps-to_t-cans)
(s-lot-simage_t-lot-simage_mapping1 
 has-map s-can1_maps-to_t-can1)
(s-lot-simage_t-lot-simage_mapping1 
 has-map s-can2_maps-to_t-can2)
(s-lot-simage_t-lot-simage_mapping1 
 has-map s-can3_maps-to_t-can3)
(s-lot-simage_t-lot-simage_mapping1 
 has-map s-rig_maps-to_t-rig)
(s-lot-simage_t-lot-simage_mapping1 
 has-map s-trailer_maps-to_t-trailer)

(s-puddle          maps-to t-puddle)
(s-dumpster        maps-to t-dumpster)
(s-truck-aggregate maps-to t-truck-aggregate)
(s-cans            maps-to t-cans)
(s-can1            maps-to t-can1) 
(s-can2            maps-to t-can2)
(s-can3            maps-to t-can3)
(s-rig             maps-to t-rig)     
(s-trailer         maps-to t-trailer) 


;; TABLE EXAMPLE
;; -------------

1- create-mapping
      (s-table-simage_maps-to_t-table-simage)

2- map identical not in groups or aggregates.
      (s-glass      maps-to t-glass)      ;; circles
      (s-knife      maps-to t-knife)      ;; lines
      (s-butterdish maps-to t-butterdish) ;; rectangles

3- abstract highest of what's left til match.
      (s-napkin     looks-like isoceles-triangle) ;; to 6
      (t-napkin     looks-like paralellogram)     ;; to 6
      (s-napkin     looks-like triangle)          ;; to 5
      (t-napkin     looks-like quadrilateral)     ;; to 5
      (t-plate      looks-like ellipse)           ;; to 4

4- create maps
      (s-plate      maps-to    t-plate)           ;; ellipses.

5- abstract highest of what's left til match.
      (s-napkin     looks-like polygon)           ;; to 4
      (t-napkin     looks-like polygon)           ;; to 4

6- create-maps
      (s-napkin     maps-to    t-napkin)          ;; polygons.

7- break up aggregates. Use conflict resolution to find which 
   goes with which based on similarity of component shapes.
      (s-fork-aggregate maps-to t-fork-aggregate)   ;; aggregates
      (s-spoon-aggregate maps-to t-spoon-aggregate) ;; aggregates

8- map within aggregages.
      (s-tines       maps-to    t-tines)
      (s-fork-shaft  maps-to    t-fork-shaft)

      (s-spoon-bowl  maps-to    t-spoon-bowl)
      (s-spoon-shaft maps-to    t-spoon-shaft)

9- done.

output:

      (s-table-simage_t-table-simage_mapping1)

      (s-table-simage_t-table-simage_mapping1 
       has-map s-glass_maps-to_t-glass)
      (s-table-simage_t-table-simage_mapping1 
       has-map s-knife_maps-to_t-knife)
      (s-table-simage_t-table-simage_mapping1 
       has-map s-butterdish_maps-to_t-butterdish)
      (s-table-simage_t-table-simage_mapping1 
       has-map s-plate_maps-to_t-plate)
      (s-table-simage_t-table-simage_mapping1 
       has-map s-tines_maps-to_t-tines)
      (s-table-simage_t-table-simage_mapping1 
       has-map s-fork-shaft_maps-to_t-fork-shaft)
      (s-table-simage_t-table-simage_mapping1 
       has-map s-spoon-bowl_maps-to_t-spoon-bowl)
      (s-table-simage_t-table-simage_mapping1 
       has-map s-spoon-shaft_maps-to_t-spoon-shaft)
      (s-table-simage_t-table-simage_mapping1 
       has-map s-spoon-aggregate_maps-to_t-spoon-aggregate)
      (s-table-simage_t-table-simage_mapping1 
       has-map s-fork-aggregate_maps-to_t-fork-aggregate)

      (s-glass           maps-to t-glass)              
      (s-knife           maps-to t-knife)              
      (s-butterdish      maps-to t-butterdish)         
      (s-fork-aggregate  maps-to t-fork-aggregate)   
      (s-spoon-aggregate maps-to t-spoon-aggregate)
      (s-plate           maps-to t-plate)           
      (s-napkin          maps-to t-napkin)          
      (s-tines           maps-to t-tines)
      (s-fork-shaft      maps-to t-fork-shaft)
      (s-spoon-bowl      maps-to t-spoon-bowl)
      (s-spoon-shaft     maps-to t-spoon-shaft)
