The prerequisite to execute the prototype is a set up database. Either the following database setup is used or the connections in the DatabaseService class must be adapted. The PostgreSQL database needs to be installed locally and be using the port 5432. Also, there must be a database called “watermarking”. The login data must be the user “postgres” with the password “admin”. In addition, the tables must be created according to the SQL script below. For the sake of simplicity, we do not use foreign keys, because we assume that the consistency of the data is checked beforehand. It should be noted that we do not store the sequence of (time, value) points as measurements but we store the sequence of measurements including their metadata in the measurements field of the fragment table.
CREATE TABLE fragment (
device_id text,
measurements jsonb,
type text,
date date,
unit text,
secret_key bigint,
CONSTRAINT fragment_pkey PRIMARY KEY (device_id, type, date, unit)
)
CREATE TABLE request (
device_id text,
type text,
unit text,
date date,
timestamps timestamp without time zone[],
number_of_watermark integer,
data_user integer,
CONSTRAINT request_pkey PRIMARY KEY (data_user, date, unit, type, device_id)
)
CREATE TABLE usability_constraint (
type text,
unit text,
maximum_error numeric,
minimum_value numeric,
maximum_value numeric,
number_of_ranges integer,
CONSTRAINT usability_constraint_pkey PRIMARY KEY (type, unit)
)
After the database is set up, the prototype can be executed as java program or as jar file. As java program, the ProgramUI class is used to execute simulators and the “files” folder in the project is used for the data. The prototype can be packaged into a jar file by running the maven install command. The resulting jar file is put into the “C:/temp” directory. In this case, the folder used for the data is the “C:/temp/files” folder. Also make sure that the “C:/temp/files” folder contains the test data file. The jar file can be executed in the command line or in batch files by java -jar C:/temp/prototype-1.jar. This basic prototype execution shows the possible commands which are also provided together with the configurable parameters below.
-reset -table -fragment
-reset -table -request
-reset -table -usability_constraint
-reset -files
-reset -log
-set -usability_constraint [maximumError] [numberOfRanges]
-generate [deviceId] [from] [to] [seed]
-store -random [datasetName]
-store -one [datasetName]
-request -patient [dataUserId] [deviceId] [from] [to]
-request -patients [dataUserId] [numberOfDevices] [from] [to]
-attack -deletion [datasetName] [frequency]
-attack -random [datasetName] [maximumError] [seed]
-attack -rounding [datasetName] [decimalDigit]
-attack -subset [datasetName] [startIndex] [endIndex]
-attack -collusion [datasetName1] ... [datasetNameN]
-detect [datasetName] [fragmentSimilarityThreshold] [watermarkSimilarityThreshold] [numberOfColluders]
[dataUserId]: data user identifier as integer
[datasetName]: dataset name as string
[decimalDigit]: decimal digit as integer
[deviceId]: device identifier as string
[endIndex]: end index as integer
[fragmentSimilarityThreshold]: fragment similarity threshold as double
[frequency]: frequency as integer
[from]: start date as string with the format [yyyy-MM-dd]
[maximumError]: maximum error as double
[numberOfColluders]: number of colluders as integer
[numberOfDevices]: number of devices as integer
[numberOfRanges]: number of ranges as integer
[seed]: seed as integer
[startIndex]: start index as integer
[to]: end date as string with the format [yyyy-MM-dd]
[watermarkSimilarityThreshold]: watermark similarity threshold as double