Operation Formula Explanation Example XML Thoughts about how to map to tauZaman
Grouping-oriented
Operations
Group G' = Groupm(G) The grouping operation generates a new granularity G' by partitioning the granules of G into m-granule groups and making each group a granule of the resulting granularity. week = Group7(day) <group groupBy="INT">
 
basicGranularityArgument*
</group>
construct a RegularMapping with groupSize = m
Altering-tick G' = Alter l,mk(G2, G1) The altering-tick operation generates a new full-integer labeled granularity by periodically expanding or shrinking granules of G1 in terms of G2.  m is the number of granules in a group of G1.  The altering-tick operation modifies the granules of G1 so that the lth granule of each group has |k| additional (or fewer when k < 0) granules of G2. if
  G1 = Group30(day),
then
  Alter
5,121(day, G1)
gives the 5th granule in G
1 31 days (i.e. correcting the month of May to have 31 days)
<alter groupSize="INT" granuleToModify="INT" modifyBy="INT">
 
basicGranularityArgument*
  basicGranularityArgument*

</alter>
create IrregularMapping:
~ for down conversion: use formula in calendar algebra paper to make code for IrregularMapping
~ for up conversion: ?
Shift G' = Shiftm(G) The shifting operation generates a new full-integer labeled granularity G' by shifting the labels of G by m positions. USPacificHour =
     Shift-3(USEastHour)
<shift shiftBy="INT">
 
basicGranularityArgument*
</shift>
should be able to construct a regular congruent mapping (using tauZaman v2 which should have regular congruent mappings)
Combine G' = Combine(G1, G2) The combining operation generates a new granularity G' by combining all the granules of G2 that are included in one granule of G1 into one granule of G'. businessMonth =
    Combine(month, businessDay)
<combine>
  layerThreeGranularityArgument***
  layerThreeGranularityArgument***

</combine>
probably will have to do some kind of lattice analysis…?
Anchored Group G' = AnchoredGroup(G1, G2) The anchored grouping operation generates a new granularity G' by combining all the granules of G1 that are between two granules of G2 into one granule of G'. FiscalYear =
    AnchoredGroup(month, October)
<anchored-group>
  layerThreeGranularityArgument***
  layerThreeGranularityArgument***

</anchored-group>
can probably do some calculations between G2 and G1 to find anchor and groupSize and then make a RegularMapping
Granule-oriented
Operations
Subset G' = Subsetnm(G) The subset operation generates a new granularity G' by taking all the granules of G whose lables are between m and n. For all years after the 20th century,
  FutureYear = SubsetINF2001(year)
<subset lowerbound="INT" upperbound="INT">
  layerTwoGranularityArgument**

</subset>
~ define epochs for these cases
~ add functionality to RegularCongruentMapping to handle this
Select-down G' = Select-downlk(G1, G2) The select-down operation, where
k != 0 and l > 0 are integers, selects granules of G1 by picking up l granules starting from the kth one in each set of granules of G1 contained in one granules of G2.
Sunday =
    Select-down11(day, week)
<select-down startingGranule="INT" numGranules="INT">
  layerTwoGranularityArgument**
  layerTwoGranularityArgument**

</select-down>
make RegularMapping: groupSize = numGranules, periodSize = number of G1 granules in G2, anchor = startingGranule
Select-up G' = Select-up(G1, G2) The select-up operation generates a new granularity G' by selecting the granules of G1 that contain one or more granules of G2. FirstWeekOfMonth =
    Select-up(week, FirstDayOfMonth)
<select-up>
  layerTwoGranularityArgument**
  layerTwoGranularityArgument**

</select-up>
could we just make an indirect call to cast G2 to G1? … it seems like that is all this is
Select-by-intersect G' = Select-by-intersect lk(G1, G2) The select-by-intersect operation, where k != 0 and l > 0 are integers, selects granules of G1 by selecting l granules starting from the kth one in such sets, generating a new granularity G'. LastWeekOfSemester =
    Select-by-intersect1-1(week, Semester)
<select-by-intersect startingGranule="INT" numGranules="INT">
  layerTwoGranularityArgument**
  layerTwoGranularityArgument**

</select-by-intersect>
how would we do this one in tauZaman?
Union G' = Union(G1, G2) The union operation generates a new granularity G' by collection all granules from both G1 and G2. WeekendDay = Union(Saturday, Sunday) <union>
  layerTwoGranularityArgument**
  layerTwoGranularityArgument**

</union>
it seems like for these we would have to do analysis on how the argument granularities were created and then do different things depending on this
Intersection G' = Intersection(G1, G2) The intersection operation generates a new granularity G' by taking the common granules from both G1 and G2. FullMoonWeekDay =
    Intersection(FullMoonDay, Weekday)
<intersection>
  layerTwoGranularityArgument**
  layerTwoGranularityArgument**

</intersection>
Difference G' = Difference(G1, G2) The difference operation generates a new granularity G' by excluding the granules of G2 from those of G1. BusinessDay =
    Difference(Weekday, FederalHoliday)
<difference>
  layerTwoGranularityArgument**
  layerTwoGranularityArgument**

</difference>
             
             
          * basicGranularityArgument = (<baseGranularity name = "STR"/> |
               (
<group> definition | <alter> definition | <shift> definition))
 
          ** layerTwoGranularityArgument = (basicGranularityArgument |
               (
<subset> definition | <select> definition | <set> definition))
 
          *** layerThreeGranularityArgument = (layerTwoGranularityArgument |
               (
<combine> definition | <anchored-group> definition))