mondrian
Class Mondrian

java.lang.Object
  extended by anonymizer.Anonymizer
      extended by mondrian.Mondrian

public class Mondrian
extends Anonymizer

Implementation of the Mondrian multi-dimensional partitioning algorithm for satisfying k-anonymity described in the following paper:

 @article{mondrian,
 author = {Kristen Lefevre and David J. Dewitt and Raghu Ramakrishnan},
 title = {Mondrian multidimensional k-anonymity},
 booktitle = {In ICDE},
 year = {2006}
 }
 
Our dimension selection heuristic is the one described in Section 4 of the paper. Namely, at each iteration, we "choose the dimension with the widest (normalized) range of values".

When multiple dimensions have the same width, our implementation chooses the first dimension that contains an allowable cut.

Given dimension, partitions are built by splitting the domain on the median value. If med represents the median, LHS contains all values <= med and RHS contains all values > med.


Field Summary
private  java.lang.String[] suppEq
          Generalized values for the suppression equivalence
 
Fields inherited from class anonymizer.Anonymizer
anonTable, conf, eqTable, sqlwrapper, suppressionThreshold
 
Constructor Summary
Mondrian(Configuration conf)
          Class constructor
 
Method Summary
 void anonymize()
          Anonymizes the input.
 void changeKAnonymityRequirement(int newKvalue)
          Overwrites the privacy parameter k
protected  AnonRecordTable createAnonRecordsTable(java.lang.String tableName)
          Create anonRecords table
protected  EquivalenceTable createEquivalenceTable(java.lang.String tableName)
          Create equivalence table
 java.lang.Double getMedian(long eid, int att)
          Computes the median value on attribute indexed att for equivalence with ID eid
private  double getNormalizedWidth(java.lang.String gen, java.lang.String sup)
          Calculates the normalized width of a generalized value, based on the suppression value
protected  void insertTupleToAnonTable(java.lang.String[] vals, long eid)
          Insert a tuple to the anonRecords table
protected  long insertTupleToEquivalenceTable(java.lang.String[] vals)
          Insert a tuple to the equivalence table
private  void updateEIDs(long oldEID, long newEID, Interval range, int index)
          Updates the EIDs of equivalences with EID = oldEID to newEID if the predicate indicated by the interval is satisfied on the qi-attribute at the specified index
 
Methods inherited from class anonymizer.Anonymizer
anonymizeDataset, anonymizeDataset, isReadyForSuppression, main, outputResults_Anatomy, outputResults_GenVals, outputResults_GenValsDist, outputResults, readData, suppressEquivalences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

suppEq

private java.lang.String[] suppEq
Generalized values for the suppression equivalence

Constructor Detail

Mondrian

public Mondrian(Configuration conf)
         throws java.lang.Exception
Class constructor

Parameters:
conf - Configuration instance
Throws:
java.lang.Exception
Method Detail

changeKAnonymityRequirement

public void changeKAnonymityRequirement(int newKvalue)
Overwrites the privacy parameter k

Parameters:
newKvalue - New value of k

createAnonRecordsTable

protected AnonRecordTable createAnonRecordsTable(java.lang.String tableName)
Create anonRecords table

Specified by:
createAnonRecordsTable in class Anonymizer
Parameters:
tableName - Name of the table
Returns:
A new anonymization records table

createEquivalenceTable

protected EquivalenceTable createEquivalenceTable(java.lang.String tableName)
Create equivalence table

Specified by:
createEquivalenceTable in class Anonymizer
Parameters:
tableName - Name of the table
Returns:
A new equivalence table

insertTupleToEquivalenceTable

protected long insertTupleToEquivalenceTable(java.lang.String[] vals)
                                      throws java.lang.Exception
Insert a tuple to the equivalence table

Specified by:
insertTupleToEquivalenceTable in class Anonymizer
Parameters:
vals - All values of the tuple to be inserted (as read from the source, i.e., before any generalization)
Returns:
Equivalence id of the equivalence to which the tuple belongs
Throws:
java.lang.Exception

insertTupleToAnonTable

protected void insertTupleToAnonTable(java.lang.String[] vals,
                                      long eid)
                               throws java.lang.Exception
Insert a tuple to the anonRecords table

Specified by:
insertTupleToAnonTable in class Anonymizer
Parameters:
vals - All values of the tuple to be inserted (as read from the source, i.e., before any generalization)
eid - Equivalence id of the equivalence to which the tuple belongs
Throws:
java.lang.Exception

anonymize

public void anonymize()
               throws java.lang.Exception
Anonymizes the input. This function can be reused (with new k maybe), as long as eqTable and anonTable objects are fresh and the configuration has not changed.

Specified by:
anonymize in class Anonymizer
Throws:
java.lang.Exception

getNormalizedWidth

private double getNormalizedWidth(java.lang.String gen,
                                  java.lang.String sup)
                           throws java.lang.Exception
Calculates the normalized width of a generalized value, based on the suppression value

Parameters:
gen - String representation of the generalization interval
sup - String representation of the suppresion interval (i.e., the entire domain)
Returns:
normalized width of the generalization (genWidth / supWidth)
Throws:
java.lang.Exception

updateEIDs

private void updateEIDs(long oldEID,
                        long newEID,
                        Interval range,
                        int index)
Updates the EIDs of equivalences with EID = oldEID to newEID if the predicate indicated by the interval is satisfied on the qi-attribute at the specified index

Parameters:
oldEID - ID of the equivalence being split
newEID - New ID assigned to those records matching the range
range - The interval that specifies the new range on newEID for attribute at index
index - Index of the partitioning dimension

getMedian

public java.lang.Double getMedian(long eid,
                                  int att)
                           throws java.lang.Exception
Computes the median value on attribute indexed att for equivalence with ID eid

Parameters:
eid - Equivalence ID
att - An attribute index
Returns:
the median value
Throws:
java.lang.Exception