Added annotation parser and implemented key-value structure.

Change-Id: I8244f81dda48f6c4a002b13d74fc79a3066eac06
diff --git a/full/src/main/resources/db/new-sqlite/V1__initial_version.sql b/full/src/main/resources/db/new-sqlite/V1__initial_version.sql
index af81b54..af14f4f 100644
--- a/full/src/main/resources/db/new-sqlite/V1__initial_version.sql
+++ b/full/src/main/resources/db/new-sqlite/V1__initial_version.sql
@@ -1,42 +1,56 @@
 CREATE TABLE IF NOT EXISTS annotation(
 	id INTEGER PRIMARY KEY AUTOINCREMENT,
 	code VARCHAR(20) NOT NULL,
-	type VARCHAR(20) NOT NULL,	
+	type VARCHAR(20) NOT NULL,
+	text VARCHAR(20) NULL,
 	description VARCHAR(100) NOT NULL,
 	de_description VARCHAR(100)
 );
 
 CREATE UNIQUE INDEX annotation_index ON annotation (code, type);
 
-CREATE TABLE IF NOT EXISTS annotation_pair(
+CREATE TABLE IF NOT EXISTS annotation_layer(
 	id INTEGER PRIMARY KEY AUTOINCREMENT,
-	annotation1 INTEGER NOT NULL,
-	annotation2 INTEGER NOT NULL,
+	foundry_id INTEGER NOT NULL,
+	layer_id INTEGER NOT NULL,
 	description VARCHAR(255) NOT NULL,
-	FOREIGN KEY (annotation1)
+	FOREIGN KEY (foundry_id)
 		REFERENCES annotation (id)
 		ON DELETE CASCADE,
-	FOREIGN KEY (annotation2)
+	FOREIGN KEY (layer_id)
 		REFERENCES annotation (id)
 		ON DELETE CASCADE
-	
 );
 
-CREATE UNIQUE INDEX annotation_pair_index ON annotation_pair (annotation1, annotation2);
+CREATE UNIQUE INDEX annotation_layer_index ON annotation_layer (foundry_id, layer_id);
 
-CREATE TABLE IF NOT EXISTS annotation_pair_value(
+CREATE TABLE IF NOT EXISTS annotation_key(
 	id INTEGER PRIMARY KEY AUTOINCREMENT,
-	pair_id INTEGER NOT NULL,
-	value_id INTEGER NOT NULL,
-	FOREIGN KEY (pair_id)
-		REFERENCES annotation_pair (id)
+	layer_id INTEGER NOT NULL,
+	key_id INTEGER NOT NULL,
+	FOREIGN KEY (layer_id)
+		REFERENCES annotation_layer (id)
 		ON DELETE CASCADE,
-	FOREIGN KEY (value_id)
+	FOREIGN KEY (key_id)
 		REFERENCES annotation (id)
 		ON DELETE CASCADE
 );
 
-CREATE UNIQUE INDEX annotation_pair_value_index ON annotation_pair_value (pair_id, value_id);
+CREATE UNIQUE INDEX annotation_key_index ON annotation_key (layer_id, key_id);
+
+CREATE TABLE IF NOT EXISTS annotation_value(
+	id INTEGER PRIMARY KEY AUTOINCREMENT,
+	key_id INTEGER NOT NULL,
+	value_id INTEGER NOT NULL,
+	FOREIGN KEY (key_id)
+		REFERENCES annotation_key (id)
+		ON DELETE CASCADE,
+	FOREIGN KEY (key_id)
+		REFERENCES annotation (id)
+		ON DELETE CASCADE
+);
+
+CREATE UNIQUE INDEX annotation_value_index ON annotation_value (key_id, value_id);
 
 CREATE TABLE resource(
 	id VARCHAR(100) PRIMARY KEY UNIQUE NOT NULL,
@@ -53,7 +67,7 @@
 		REFERENCES resource (id)
 		ON DELETE CASCADE,
 	FOREIGN KEY (layer_id)
-		REFERENCES annotation_pair (id)
+		REFERENCES annotation_layer (id)
 		ON DELETE CASCADE	
 );
 
diff --git a/full/src/main/resources/db/insert/V2.0__insert_annotations.sql b/full/src/main/resources/db/temp/V2.0__insert_annotations.sql
similarity index 100%
rename from full/src/main/resources/db/insert/V2.0__insert_annotations.sql
rename to full/src/main/resources/db/temp/V2.0__insert_annotations.sql
diff --git a/full/src/main/resources/db/insert/V2.1__insert_annotation_pairs.sql b/full/src/main/resources/db/temp/V2.1__insert_annotation_pairs.sql
similarity index 100%
rename from full/src/main/resources/db/insert/V2.1__insert_annotation_pairs.sql
rename to full/src/main/resources/db/temp/V2.1__insert_annotation_pairs.sql
diff --git a/full/src/main/resources/db/insert/V2.2__insert_annotation_pair_values.sql b/full/src/main/resources/db/temp/V2.2__insert_annotation_pair_values.sql
similarity index 100%
rename from full/src/main/resources/db/insert/V2.2__insert_annotation_pair_values.sql
rename to full/src/main/resources/db/temp/V2.2__insert_annotation_pair_values.sql
diff --git a/full/src/main/resources/db/insert/V2.4__insert_resource_layers.sql b/full/src/main/resources/db/temp/V2.4__insert_resource_layers.sql
similarity index 100%
rename from full/src/main/resources/db/insert/V2.4__insert_resource_layers.sql
rename to full/src/main/resources/db/temp/V2.4__insert_resource_layers.sql
diff --git a/full/src/main/resources/kustvakt.conf b/full/src/main/resources/kustvakt.conf
index c5a4958..a36eef4 100644
--- a/full/src/main/resources/kustvakt.conf
+++ b/full/src/main/resources/kustvakt.conf
@@ -6,7 +6,7 @@
 krill.index.commit.auto = 500
 krill.index.relations.max = 100
 ## Directory path of virtual corpora to cache
-krill.namedVC = vc
+#krill.namedVC = vc
 
 ## LDAP
 ldap.config = file-path-to-ldap-config