The ANO Language
Overview
The ANO language is a Domain Specific Language.
It is designed for the specific purpose of writing anonymization logic as code.
Recommendation
- Install Visual Studio Code to write
.ano
files - This allows you to install and use our ANO extension
- It provides error checking, syntax highlighting, syntax completion, hover information, and on-save formatting
Ano Sections
The ANO language is written in .ano
files. The .ano
file consists of four distinct sections.
- 1. Database Schema Information
- 2. Foreign Keys
- 3. User Defined Classes
- 4. Tasks and Rules
1. Database Schema Information Section
This section contains the translated Database Configuration, and is the result of using the DBano Service. It describes the
- database table names
- table column names and types
- primary keys
- unique keys
// - - - - Database Schema Information - - - - //
table <table-name>
column <column-type> <name>
size <size>
column <column-type> <name>
size <size>
primary-key <name>
unique-key <name> <name>
table <table-name>
column <column-type> <name>
size <size>
column <column-type> <name>
size <size>
primary-key <name>
unique-key <name> <name>
// - - - - Database Schema Information - - - - //
table Customer
column integer id
column integer customerNo
column text email
size 40
column text name
size 40
column datetime created
primary-key id
unique-key customerNo customerNo
table Address
column integer id
column text homeAddress
size 40
column text postalCode
column integer customerNo // Foreign key
primary-key id
2. Foreign Keys Section (Optional)
This optional section describes the relationships of the database tables, and is the result of the translatioin using the DBano Service.
- it describes the foreign key relationships between parent table primary or unique keys and child table foreign keys.
...
// - - - - Foreign Keys (Optional) - - - - //
foreign-key
<parent> <parent-key>
<child> <foeign-key>
foreign-key
<parent> <parent-key>
<child> <foeign-key>
...
...
// - - - - Foreign Keys (Optional) - - - - //
foreign-key
Customer customerNo
Address customerNo
...
3. User Defined Classes Section (Optional)
Whenever you want to write your own custom Java classes, you will refer to these in this section.
// - - - - User Defined Classes (Optional) - - - - //
conversion <package.path>
transformation <package.path>
distribution <package.path>
...
// - - - - User Defined Classes (Optional) - - - - //
// conversion no.esito.anonymizer.conversions.ParseDigits
transformation no.esito.anonymizer.transformations.Email
// distribution no.esito.anonymizer.distributions.MinPerParent
...
4. Tasks and Rules Section
This section will contain all the Tasks and Rules for anonymizing the tables.
// - - - - Tasks and Rules - - - - //
task UpdateTasks
{
update <table>
<rule-logic>
...
update <table2>
<rule-logic>
...
}
task CreateTasks
{ ...
}
// - - - - Tasks and Rules - - - - //
task UpdateTasks
{
update Address UpdateAddressFields
mask homeAddress UpdateAddressUsingFile
format %s
file src/main/resources/addresses.txt random-order
mask postalCode UpdateToRandomPostalCodeAsString
format "%d"
random-integer 1000 9999
update Customer UpdateCustomerNameNumberAndCreated
sql-before "delete from Customer where name is NULL"
mask name UpdateNamesUsingFiles
format "%s %s"
file src/main/resources/firstnames.txt random-order
file src/main/resources/lastnames.txt random-order map name_map.txt output
mask customerNo UpdateCustomerNoAndPropagateToAddressFk
format %d
unique
sequence 10000 1 // start at 10000, increment by 1
propagate Address.customerNo
shuffle created // name defaults to 'shuffle_created'
update Customer UpdateCustomerEmailNotNullSubset
where "email is not null"
mask email UpdateEmailsBasedOnNameColumn
format %s
transform Email // appends @mail.com to formatted names. E.g. firstname.lastname@mail.com
unique
column name
}
task CreateTasks
{ ...
}
Full Ano File Structure and Example
- Structure
- customer_address_db.ano
// - - - - Database Schema Information - - - - //
table ...
column ...
column ...
primary-key ...
unique-key ... ...
table ...
// - - - - Foreign Keys (Optional) - - - - //
foreign-key
<parent> <parent-key>
<child> <foeign-key>
// - - - - User Defined Classes (Optional) - - - - //
conversion <package.path>
transformation <package.path>
distribution <package.path>
// - - - - Tasks and Rules - - - - //
task UpdateTasks
{
update <table>
<rule-logic>
...
update <table2>
<rule-logic>
...
}
task CreateTasks
{ ...
}
// - - - - Database Schema Information - - - - //
table Customer
column integer id
column integer customerNo
column text email
size 40
column text name
size 40
column datetime created
primary-key id
unique-key customerNo customerNo
table Address
column integer id
column text homeAddress
size 40
column text postalCode
column integer customerNo // Foreign key
primary-key id
// - - - - Foreign Keys (Optional) - - - - //
foreign-key
Customer customerNo
Address customerNo
// - - - - User Defined Classes (Optional) - - - - //
// conversion no.esito.anonymizer.conversions.ParseDigits
transformation no.esito.anonymizer.transformations.Email
// distribution no.esito.anonymizer.distributions.MinPerParent
// - - - - Tasks and Rules - - - - //
task UpdateTasks
{
update Address UpdateAddressFields
mask homeAddress UpdateAddressUsingFile
format %s
file src/main/resources/addresses.txt random-order
mask postalCode UpdateToRandomPostalCodeAsString
format "%d"
random-integer 1000 9999
update Customer UpdateCustomerNameNumberAndCreated
sql-before "delete from Customer where name is NULL"
mask name UpdateNamesUsingFiles
format "%s %s"
file src/main/resources/firstnames.txt random-order
file src/main/resources/lastnames.txt random-order map name_map.txt output
mask customerNo UpdateCustomerNoAndPropagateToAddressFk
format %d
unique
sequence 10000 1 // start at 10000, increment by 1
propagate Address.customerNo
shuffle created // name defaults to 'shuffle_created'
update Customer UpdateCustomerEmailNotNullSubset
where "email is not null"
mask email UpdateEmailsBasedOnNameColumn
format %s
transform Email // appends @mail.com to formatted names. E.g. firstname.lastname@mail.com
unique
column name
}
task CreateTasks
{ ...
}