Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ The backend of Amnesia is implemented in Java using the Spring framework. Its co

To successfully build the Amnesia engine follow these steps:
1. Clone the project
2. Download pixelmed.jar from http://www.dclunie.com/pixelmed/software/webstart/pixelmed.jar and install manaully to amnesia's Dependencies.
2. Download pixelmed.jar from http://www.dclunie.com/pixelmed/software/webstart/pixelmed.jar and install manually to amnesia's Dependencies.
3. Go to controller/AppCon.java and set the variable "os" with desired operation system ("windows" or "linux")
4. Build the project
5. Take the .jar from the "scr/target" directory.
6. Downoload https://amnesia.openaire.eu/countryDistributionZip.ser and put it in the same folder where Amnesia's jar file will be executed.
6. Download https://amnesia.openaire.eu/countryDistributionZip.set and put it in the same folder where Amnesia's jar file will be executed.
7. Run via terminal java -Xms1024m -Xmx4096m -Dorg.eclipse.jetty.server.Request.maxFormKeys=1000000 -Dorg.eclipse.jetty.server.Request.maxFormContentSize=1000000 -jar "path_to_jar_file" --server.port=8181
⋅⋅⋅Then you can use the Amnesia’s API as in the following steps.

Expand Down Expand Up @@ -281,7 +281,7 @@ The anonymized data are stored in “anonymized_mixedData.csv” file

**getAnonRules [POST]**
- sol: json string array which contain the anonymize level of each quasi-identifier e.g. [1,2] only for simple table data
- suppresed: boolean for only for simple table data
- suppressed: boolean for only for simple table data
- session: Set session id as header parameter

The current endpoint is not supported for disk-based data (Disk based simple table) because the algorithm is executed using clustering and similarities that do not generate anonymization rules.
Expand Down Expand Up @@ -586,7 +586,7 @@ $ curl -X POST -H "Cookie: JSESSIONID=D6DF59C4A03432B79BC61961F1671EDB" http:

- New clustering disk based algorithm.

- Setted limits on dataset's records and on hierarchy's nodes for on-line version.
- Set limits on dataset's records and on hierarchy's nodes for on-line version.

- Faster loading of date values in dataset.

Expand All @@ -604,7 +604,7 @@ $ curl -X POST -H "Cookie: JSESSIONID=D6DF59C4A03432B79BC61961F1671EDB" http:

- The on-line version of Amnesia is restricted to 3 minutes of processing time per anonymization task.

- Fixed bug with characher encoding on several Linux distributions.
- Fixed bug with character encoding on several Linux distributions.

**version: 1.1.0**

Expand Down Expand Up @@ -656,7 +656,7 @@ $ curl -X POST -H "Cookie: JSESSIONID=D6DF59C4A03432B79BC61961F1671EDB" http:

**version: 1.0.1**

- Better inteface in pie graph.
- Better interface in pie graph.

- Changes in suppressing.

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/algorithms/clusterbased/Clusters.java
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public void executeDeleteBatch(int clusterId){
this.counterDeletions -= counterDelete;
}
}catch(Exception e){
System.err.println("Error : cluster excute batch "+e.getMessage());
System.err.println("Error : cluster execute batch "+e.getMessage());
e.printStackTrace();
try {
this.conn.rollback();
Expand Down Expand Up @@ -343,7 +343,7 @@ public void executeDeleteBatch(){
this.counterDeletions = 0;
}
}catch(Exception e){
System.err.println("Error : cluster excute batch "+e.getMessage());
System.err.println("Error : cluster execute batch "+e.getMessage());
e.printStackTrace();
try {
this.conn.rollback();
Expand Down Expand Up @@ -399,7 +399,7 @@ public void executeBatch(int clusterId){
counterInserts -= counterUpdate;
}
}catch(Exception e){
System.err.println("Error : cluster excute batch "+e.getMessage());
System.err.println("Error : cluster execute batch "+e.getMessage());
System.err.println(errMessage);
e.printStackTrace();
try {
Expand Down Expand Up @@ -503,7 +503,7 @@ public void executeBatch(){
counterInserts = 0;
}
}catch(Exception e){
System.err.println("Error : cluster excute batch "+e.getMessage());
System.err.println("Error : cluster execute batch "+e.getMessage());
System.err.println(errMessage);
e.printStackTrace();
try {
Expand Down Expand Up @@ -692,7 +692,7 @@ public Map<Integer,Double[][]> getClusterDatasetRecs(List<Integer> clusters, boo

}catch(Exception e){
e.printStackTrace();
System.err.println("Error getClusterDatasetRecs : "+e.getMessage()+" clusterId "+cluster+" lenght "+this.currentSizeCl.get(cluster));
System.err.println("Error getClusterDatasetRecs : "+e.getMessage()+" clusterId "+cluster+" length "+this.currentSizeCl.get(cluster));
}finally{
if(stm!=null){
try {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/algorithms/kmanonymity/Apriori.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void populateTree(int size){
for (Map.Entry<Integer,String> entry : dict.idToString.entrySet()) {
System.out.println(entry.getKey()+" : "+entry.getValue());
}*/
System.out.println("trie construct start for m="+size);
System.out.println("try construct start for m="+size);

while((transaction = getNextTransaction()) != null){
// System.out.println("transaction = ");
Expand Down Expand Up @@ -157,7 +157,7 @@ public void populateTree(int size){
//System.out.println("i am hereeeeeee");
}

System.out.println("trie constrcted for m="+size);
System.out.println("tried construct for m="+size);

//System.out.println("Trieeeeeeeeeeeee " );
//trie.printTree(trie.getRoot());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ else if(this.anonymize_property.equals("relational") || this.anonymize_property.
while((transaction =(this.anonymize_property.equals("relational") ? getNextTransactionRelational() : getNextTransactionMixed())) != null){
// System.out.println("TRansaction "+Arrays.toString(transaction.toArray()));
Set<Pair<Integer,Object>> expandedTransaction = expandTransaction(transaction);
// System.out.println("Expaned TRansaction "+Arrays.toString(expandedTransaction.toArray()));
// System.out.println("Expanded TRansaction "+Arrays.toString(expandedTransaction.toArray()));
combinations = MixedCombinations.getCombinations(expandedTransaction, size, hierarchies);

if (combinations != null && !combinations.isEmpty()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ else if(o1.getValue() instanceof Double && o2.getValue() instanceof RangeDate){
}
}
}catch(Exception e){
System.out.println("PRoble with parsing "+e.getMessage());
System.out.println("PRoblem with parsing "+e.getMessage());
return 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/anonymizeddataset/AnonymizedDataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -2249,7 +2249,7 @@ else if(colNamesType.get(column).contains("double")){
*/
private Object anonymizeValue(Object value, Hierarchy h, int level) throws ParseException{
Object anonymizedValue = value;
// System.out.println("level "+level+" heirarchy "+h.getName()+"value "+value);
// System.out.println("level "+level+" hierarchy "+h.getName()+"value "+value);
for(int i=0; i<level; i++){
h.setLevel(i);
if(h.getHierarchyType().equals("range")){
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/controller/AppCon.java
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ else if(data instanceof DICOMData || data instanceof TXTData || data instanceof
DataInputStream in = null;
BufferedReader br = null;
String strLine = null;
String delimeter = null;
String delimiter = null;
String result = null;
Map<String,Hierarchy> hierarchies = null;
DictionaryString dict = null;
Expand Down Expand Up @@ -726,10 +726,10 @@ else if(data instanceof DICOMData || data instanceof TXTData || data instanceof
else if (datatype.equals("tabular")){

if ( del == null ){
delimeter = ",";
delimiter = ",";
}
else{
delimeter = del;
delimiter = del;
}

System.out.println("del "+del);
Expand All @@ -740,16 +740,16 @@ else if (datatype.equals("tabular")){

if(!fullPath.toLowerCase().endsWith(".xml")){
while ((strLine = br.readLine()) != null){
if ( strLine.contains(delimeter)){
data = new TXTData(fullPath,delimeter,dict);
if ( strLine.contains(delimiter)){
data = new TXTData(fullPath,delimiter,dict);
}
else{
if ((strLine = br.readLine()) != null){
if ( strLine.contains(delimeter)){
//data = new SETData(fullPath,delimeter);
if ( strLine.contains(delimiter)){
//data = new SETData(fullPath,delimiter);
}
else{
data = new TXTData(fullPath,delimeter,dict);
data = new TXTData(fullPath,delimiter,dict);
}
}
}
Expand Down Expand Up @@ -2187,7 +2187,7 @@ else if(data.getClass().toString().contains("Disk")){


byte[] outputByte = new byte[50000];
//copy binary contect to output stream
//copy binary context to output stream
while(fileIn.read(outputByte, 0, 50000) != -1)
{
out.write(outputByte, 0, 50000);
Expand Down Expand Up @@ -2884,7 +2884,7 @@ else if(tempNew.length == 2)
}
}
else{
//// TODO add check intdouble existance
//// TODO add check intdouble existence
if(newNode.equals("(null)")){
if(h.getParent(Double.NaN)!=null || h.getParent(2147483646.0)!=null){
return "The node exists in hierarchy";
Expand Down Expand Up @@ -3027,7 +3027,7 @@ else if(h.getDictionaryData().isEmpty()){
}
}
else{ // distinct
//// TODO edit check intdouble existance
//// TODO edit check intdouble existence
h.edit(Double.parseDouble(oldNode), Double.parseDouble(newNode));
}
}
Expand Down Expand Up @@ -4957,7 +4957,7 @@ public void getSuppressPercentage (@RequestParam("sol") String sol, HttpSession
jsonAnswer.put("Message","To produce a k="+k+" anonymity solution, it must be suppressed by "+suppress+"%");
}
else{
jsonAnswer.put("Message","The solution: ["+sol+"] statisfies k="+k+" anonymity");
jsonAnswer.put("Message","The solution: ["+sol+"] satisfies k="+k+" anonymity");
}
response.getOutputStream().print(jsonAnswer.toString());
}catch(Exception e){
Expand Down Expand Up @@ -5224,7 +5224,7 @@ else if(sol == null){
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
JSONObject jsonAnswer = new JSONObject();
jsonAnswer.put("Status","Fail");
jsonAnswer.put("Message","The \"sol\" field needs only fot simple table data!");
jsonAnswer.put("Message","The \"sol\" field needs only for simple table data!");
response.getOutputStream().print(jsonAnswer.toString());
}
else if(sol!=null){
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/data/CheckVariables.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public boolean isDate (String s){
Date date = sdf.parse(s);
if (s.equals(sdf.format(date))){
this.lastFormat = parse;
System.out.println("Printing the value of requst parse " + parse);
System.out.println("Printing the value of request parse " + parse);
return true;
}
System.out.println("Printing the value of " + parse);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/data/DICOMData.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public String save(boolean[] checkColumns) throws LimitException, DateParseExcep

try{
if(dictionary.isEmpty() && dictHier.isEmpty()){
System.out.println("Both empy load data");
System.out.println("Both empty load data");
stringCount = 1;
}
else if(!dictionary.isEmpty() && !dictHier.isEmpty()){
Expand Down Expand Up @@ -977,7 +977,7 @@ public SimpleDateFormat getDateFormat(int column) {
public void setMask(int column, int[] positions, char character, String option) {
int stringCount;
if(dictionary.isEmpty() && dictHier.isEmpty()){
System.out.println("Both empy load data");
System.out.println("Both empty load data");
stringCount = 1;
}
else if(!dictionary.isEmpty() && !dictHier.isEmpty()){
Expand Down Expand Up @@ -1079,7 +1079,7 @@ public Map<String, Double> getInformationLoss() {
public void setRegex(int column, char character, String regex) {
int stringCount;
if(dictionary.isEmpty() && dictHier.isEmpty()){
System.out.println("Both empy load data");
System.out.println("Both empty load data");
stringCount = 1;
}
else if(!dictionary.isEmpty() && !dictHier.isEmpty()){
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/data/DiskData.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class DiskData implements Data,Serializable{
private String inputFile = null;
@JsonView(View.GetColumnNames.class)
private String dataType = "disk";
private String delimeter = null;
private String delimiter = null;
private int sizeOfRows = 0;
private String urlDatabase = null;
private Connection conn = null;
Expand Down Expand Up @@ -134,7 +134,7 @@ public class DiskData implements Data,Serializable{
public DiskData(String inputfile,String del,DictionaryString dict){
this.recordsTotal = 0;
this.inputFile = inputfile;
this.delimeter = del;
this.delimiter = del;
colNamesType = new TreeMap<Integer,String>();
colNamesPosition = new HashMap<Integer,String>();
chVar = new CheckVariables();
Expand Down Expand Up @@ -530,7 +530,7 @@ else if(dataType.equals("date") || dataType.equals("string")){
if(strLine.trim().isEmpty()){
continue;
}
temp = strLine.split(delimeter,-1);
temp = strLine.split(delimiter,-1);
counter1 = 0;
for (int i = 0; i < temp.length ; i ++ ){
if (checkColumns[i] == true){
Expand Down Expand Up @@ -1112,7 +1112,7 @@ public void SaveClmnsAndTypeOfVar(String[] columnTypes, boolean[] checkColumns)

//save column names
if (FLAG == true){
colNames = strLine.split(delimeter,-1);
colNames = strLine.split(delimiter,-1);
for ( int i = 0 ; i < colNames.length ; i ++){
if ( checkColumns[i] == true){
colNamesType.put(counter,null);
Expand Down Expand Up @@ -1187,7 +1187,7 @@ public String findColumnTypes() {
while ((strLine = br.readLine()) != null) {
//escape first row
if (FLAG == true){
temp = strLine.split(delimeter,-1);
temp = strLine.split(delimiter,-1);
columnNames = new String[temp.length];
smallDataSet = new String[6][temp.length];
this.formatsDate = new String[temp.length];
Expand All @@ -1209,7 +1209,7 @@ else if(strLine.trim().isEmpty()){
}
//save column types
else{
temp = strLine.split(delimeter,-1);
temp = strLine.split(delimiter,-1);

if( temp.length != columnNames.length){
System.out.println("columnNames = " + columnNames.length +"\t temp = " + temp.length );
Expand Down Expand Up @@ -1454,7 +1454,7 @@ public Double[][] getSpecificDataset(int start,int max,boolean withIdenticals){
System.out.println("Records "+counterRow);

}catch (OutOfMemoryError e) {
System.err.println("Error outofMemory free"+Runtime.getRuntime().freeMemory()+" Curent "+Runtime.getRuntime().totalMemory()+" max "+Runtime.getRuntime().maxMemory());
System.err.println("Error outofMemory free"+Runtime.getRuntime().freeMemory()+" Current "+Runtime.getRuntime().totalMemory()+" max "+Runtime.getRuntime().maxMemory());
e.printStackTrace();
}

Expand Down Expand Up @@ -2607,7 +2607,7 @@ public boolean tableExists(String name){
return result;
}catch(SQLException ex){
ex.printStackTrace();
System.err.println("Error: "+ex.getMessage()+" check table existance disk");
System.err.println("Error: "+ex.getMessage()+" check table existence disk");
Logger.getLogger(Clusters.class.getName()).log(Level.SEVERE, null, ex);

if(rs!=null){
Expand Down Expand Up @@ -2678,7 +2678,7 @@ public void setMask(int column, int[] positions, char character, String option)

int stringCount;
if(dictionary.isEmpty() && dictHier.isEmpty()){
System.out.println("Both empy load data");
System.out.println("Both empty load data");
stringCount = 1;
}
else if(!dictionary.isEmpty() && !dictHier.isEmpty()){
Expand Down Expand Up @@ -2860,7 +2860,7 @@ public void setRegex(int column, char character, String regex) {

int stringCount;
if(dictionary.isEmpty() && dictHier.isEmpty()){
System.out.println("Both empy load data");
System.out.println("Both empty load data");
stringCount = 1;
}
else if(!dictionary.isEmpty() && !dictHier.isEmpty()){
Expand Down
Loading