anonymizer
Class AnonRecordTable

java.lang.Object
  extended by anonymizer.AnonRecordTable

public class AnonRecordTable
extends java.lang.Object

The class that manages anonymized records. Typical schema of the table contains:

All privacy definitions (e.g., k-anonymity, l-diversity, t-closeness) are implemented within this class.


Field Summary
private  java.lang.Integer[] qidIndices
          Indices of quasi-identifier attributes
private  java.lang.Integer[] sensIndices
          Indices of sensitive attributes
private  SQLWrapper sqlwrapper
          SQL connection/querying object
private  java.lang.String tableName
          Name of the table
 
Constructor Summary
AnonRecordTable(java.lang.Integer[] qidIndices, java.lang.Integer[] sensIndices, java.lang.String tableName)
          Class constructor
 
Method Summary
 boolean checkKAnonymityRequirement(int k)
          Checks the k-anonymity privacy definition
 boolean checkKAnonymityRequirement(int k, int suppThreshold)
          Checks the k-anonymity privacy definition while considering the suppression threshold (i.e., k-anonymity holds only if the total size of all equivalences with size less than k is below the suppression threshold)
 boolean checkLDiversityRequirement(double l, double c, int sensIndex)
          Checks the recursive (c,l)-diversity privacy definition
 boolean checkLDiversityRequirement(double l, int sensIndex)
          Checks the entropy l-diversity privacy definition
 boolean checkTClosenessRequirement_Cat(double t, int sensIndex, int sensDomSize)
          Checks the t-closeness privacy definition
 boolean checkTClosenessRequirement_Num(double t, int sensIndex)
          Checks the t-closeness privacy definition
 void copyFrom(AnonRecordTable that, java.lang.Long oldEID, java.lang.Long newEID)
          From table that, copy the records with EID = oldEID into this table, overwriting oldEID as newEID
private  void createTable()
          Creates the table that will store AnonRecord objects
 void cutFrom(AnonRecordTable that, java.lang.Long oldEID, java.lang.Long newEID)
          (1) From table that, copy the records with EID = oldEID into this table, overwriting oldEID as newEID and (2) From table that, delete the records with EID = oldEID
 void cutRecord(AnonRecordTable that, java.lang.Long RID, java.lang.Long newEID)
          (1) From table that, copy the record with the specified RID into this table, overwriting oldEID as newEID and (2) From table that, delete the records wth the speicified RID
 void drop()
          Drops this table from the database
 int getEquivalenceSize(long eid)
          Get the number of AnonRecords generalized to the Equivalence with ID eid
 java.lang.String getName()
          Getter for tableName
 void insert(long eid, double[] qiVals, double[] sensVals)
          Inserts new AnonRecord to the table (Record ID (RID) assigned automatically)
 void moveRecords(java.lang.Long fromEID, java.lang.Long toEID)
          Moves records of one equivalence to the other, effectively deleting the fromEID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

qidIndices

private java.lang.Integer[] qidIndices
Indices of quasi-identifier attributes


sensIndices

private java.lang.Integer[] sensIndices
Indices of sensitive attributes


tableName

private java.lang.String tableName
Name of the table


sqlwrapper

private SQLWrapper sqlwrapper
SQL connection/querying object

Constructor Detail

AnonRecordTable

public AnonRecordTable(java.lang.Integer[] qidIndices,
                       java.lang.Integer[] sensIndices,
                       java.lang.String tableName)
Class constructor

Parameters:
qidIndices - Indices of quasi-identifier attributes
sensIndices - Indices of sensitive attributes
tableName - Name of the table
Method Detail

createTable

private void createTable()
Creates the table that will store AnonRecord objects


getName

public java.lang.String getName()
Getter for tableName

Returns:
Name of the table

getEquivalenceSize

public int getEquivalenceSize(long eid)
                       throws java.sql.SQLException
Get the number of AnonRecords generalized to the Equivalence with ID eid

Parameters:
eid - Equivalence ID
Returns:
Number of records r where r.eid = eid
Throws:
java.sql.SQLException

insert

public void insert(long eid,
                   double[] qiVals,
                   double[] sensVals)
            throws java.sql.SQLException
Inserts new AnonRecord to the table (Record ID (RID) assigned automatically)

Parameters:
eid - Equivalence ID
qiVals - Quasi-identifier attribute values
sensVals - Sensitive attribute values (if not necessary, pass "new double[0]" as argument
Throws:
java.sql.SQLException

checkKAnonymityRequirement

public boolean checkKAnonymityRequirement(int k)
                                   throws java.sql.SQLException
Checks the k-anonymity privacy definition

Parameters:
k - Privacy parameter
Returns:
True if k-anonymous (or empty), False otherwise
Throws:
java.sql.SQLException

checkKAnonymityRequirement

public boolean checkKAnonymityRequirement(int k,
                                          int suppThreshold)
                                   throws java.sql.SQLException
Checks the k-anonymity privacy definition while considering the suppression threshold (i.e., k-anonymity holds only if the total size of all equivalences with size less than k is below the suppression threshold)

Parameters:
k - Privacy parameter
suppThreshold - Suppression threshold
Returns:
True if k-anonymous (or empty), False otherwise
Throws:
java.sql.SQLException

checkLDiversityRequirement

public boolean checkLDiversityRequirement(double l,
                                          int sensIndex)
                                   throws java.sql.SQLException
Checks the entropy l-diversity privacy definition

Parameters:
l - Privacy parameter
sensIndex - index of the sensitive attribute
Returns:
True if entropy l-diverse, False otherwise
Throws:
java.sql.SQLException

checkLDiversityRequirement

public boolean checkLDiversityRequirement(double l,
                                          double c,
                                          int sensIndex)
                                   throws java.sql.SQLException
Checks the recursive (c,l)-diversity privacy definition

Parameters:
l - Privacy parameter
c - Privacy parameter
sensIndex - index of the sensitive attribute
Returns:
True if (c,l)-diverse, False otherwise
Throws:
java.sql.SQLException

checkTClosenessRequirement_Cat

public boolean checkTClosenessRequirement_Cat(double t,
                                              int sensIndex,
                                              int sensDomSize)
                                       throws java.sql.SQLException
Checks the t-closeness privacy definition

Parameters:
t - Privacy parameter
sensIndex - index of a categorical sensitive attribute
sensDomSize - domain size of the sensitive attribute
Returns:
True if t-close, False otherwise
Throws:
java.sql.SQLException

checkTClosenessRequirement_Num

public boolean checkTClosenessRequirement_Num(double t,
                                              int sensIndex)
                                       throws java.sql.SQLException
Checks the t-closeness privacy definition

Parameters:
t - Privacy parameter
sensIndex - index of a categorical sensitive attribute
Returns:
True if t-close, False otherwise
Throws:
java.sql.SQLException

moveRecords

public void moveRecords(java.lang.Long fromEID,
                        java.lang.Long toEID)
Moves records of one equivalence to the other, effectively deleting the fromEID

Parameters:
fromEID - Source of the records to be moved
toEID - Destination of the records to be moved

copyFrom

public void copyFrom(AnonRecordTable that,
                     java.lang.Long oldEID,
                     java.lang.Long newEID)
From table that, copy the records with EID = oldEID into this table, overwriting oldEID as newEID

Parameters:
that - Another AnonRecordTable
oldEID - EID of the records to be copied
newEID - New EID to be assigned to the copied records

cutFrom

public void cutFrom(AnonRecordTable that,
                    java.lang.Long oldEID,
                    java.lang.Long newEID)
(1) From table that, copy the records with EID = oldEID into this table, overwriting oldEID as newEID and (2) From table that, delete the records with EID = oldEID

Parameters:
that - Another AnonRecordTable
oldEID - EID of the records to be copied
newEID - New EID to be assigned to the copied records

cutRecord

public void cutRecord(AnonRecordTable that,
                      java.lang.Long RID,
                      java.lang.Long newEID)
(1) From table that, copy the record with the specified RID into this table, overwriting oldEID as newEID and (2) From table that, delete the records wth the speicified RID

Parameters:
that - Another AnonRecordTable
RID - record ID of the tuple to be moved
newEID - new EID to be assigned to the copied record

drop

public void drop()
Drops this table from the database