@@ -0,0 +1,3083 @@
+package org.deidentifier.arx.examples;%0A%0Aimport java.io.IOException;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.deidentifier.arx.ARXAnonymizer;%0Aimport org.deidentifier.arx.ARXConfiguration;%0Aimport org.deidentifier.arx.ARXResult;%0Aimport org.deidentifier.arx.AttributeType.Hierarchy;%0Aimport org.deidentifier.arx.Data;%0Aimport org.deidentifier.arx.DataType;%0Aimport org.deidentifier.arx.criteria.KAnonymity;%0Aimport org.deidentifier.arx.io.importdata.CSVImportAdapter;%0Aimport org.deidentifier.arx.io.importdata.Column;%0A%0A/**%0A * This class implements an example on how to use the API to import data from%0A * a CSV file. It uses more advanced features than %7B@link #Example2%7D. Columns%0A * are renamed and could be ignored altogether.%0A */%0Apublic class Example2a extends Example %7B%0A%0A    /**%0A     * Main entry point%0A     */%0A    public static void main(final String%5B%5D args) throws IOException %7B%0A%0A        try %7B%0A%0A            // Define input adapter%0A            CSVImportAdapter adapter = new CSVImportAdapter(%22data/test.csv%22, ';', true);%0A%0A            // Define columns (index, name (optional) and datatype)%0A            List%3CColumn%3E columns = new ArrayList%3CColumn%3E();%0A            columns.add(new Column(0, %22Alter%22, DataType.INTEGER));%0A            columns.add(new Column(1, DataType.STRING));%0A            columns.add(new Column(2, DataType.STRING));%0A%0A            // Apply column definitions to adapter%0A            adapter.setColumns(columns);%0A%0A            // Create data object%0A            final Data data = Data.create(adapter);%0A%0A            // Define attribute hierarchies%0A            data.getDefinition()%0A                .setAttributeType(%22Alter%22,%0A                                  Hierarchy.create(%22data/test_hierarchy_age.csv%22,%0A                                                   ';'));%0A            data.getDefinition()%0A                .setAttributeType(%22gender%22,%0A                                  Hierarchy.create(%22data/test_hierarchy_gender.csv%22,%0A                                                   ';'));%0A            data.getDefinition()%0A                .setAttributeType(%22zipcode%22,%0A                                  Hierarchy.create(%22data/test_hierarchy_zipcode.csv%22,%0A                                                   ';'));%0A%0A            // Create an instance of the anonymizer%0A            final ARXAnonymizer anonymizer = new ARXAnonymizer();%0A%0A            // Execute the algorithm%0A            final ARXConfiguration config = ARXConfiguration.create();%0A            config.addCriterion(new KAnonymity(2));%0A            config.setMaxOutliers(0d);%0A            final ARXResult result = anonymizer.anonymize(data, config);%0A%0A            // Print info%0A            printResult(result, data);%0A%0A            // Write results%0A            System.out.print(%22 - Writing data...%22);%0A            result.getOutput(false).save(%22data/test_anonymized.csv%22, ';');%0A            System.out.println(%22Done!%22);%0A%0A        %7D catch (final IllegalArgumentException e) %7B%0A%0A            throw new RuntimeException(e);%0A%0A        %7D catch (Exception e) %7B%0A%0A            throw new RuntimeException(e);%0A%0A        %7D%0A%0A    %7D%0A%0A%7D%0A

Add extended version of Example2 using new API