Added annotation description service.

Change-Id: I3c30a2815f63924a89af1ca7d251c46a54a21a7c
diff --git a/src/main/resources/db/new-mysql/V1__create_tables.sql b/src/main/resources/db/new-mysql/V1__create_tables.sql
index 926db2a..e68a45f 100644
--- a/src/main/resources/db/new-mysql/V1__create_tables.sql
+++ b/src/main/resources/db/new-mysql/V1__create_tables.sql
@@ -1,10 +1,10 @@
 
 CREATE TABLE IF NOT EXISTS annotation(
 	id INTEGER PRIMARY KEY AUTO_INCREMENT,
-	symbol VARCHAR(20) NOT NULL,
+	code VARCHAR(20) NOT NULL,
 	type VARCHAR(20) NOT NULL,	
 	description VARCHAR(100) NOT NULL,
-	UNIQUE INDEX unique_index (symbol, type)
+	UNIQUE INDEX unique_index (code, type)
 );
 
 CREATE TABLE IF NOT EXISTS annotation_pair(
diff --git a/src/main/resources/db/new-mysql/V2.0__insert_annotations.sql b/src/main/resources/db/new-mysql/V2.0__insert_annotations.sql
index 4131cc4..911f5de 100644
--- a/src/main/resources/db/new-mysql/V2.0__insert_annotations.sql
+++ b/src/main/resources/db/new-mysql/V2.0__insert_annotations.sql
@@ -1,32 +1,33 @@
 --foundries
-INSERT INTO annotation (symbol, type, description) VALUES("base","foundry","Base");
-INSERT INTO annotation (symbol, type, description) VALUES("dereko","foundry","DeReKo");
-INSERT INTO annotation (symbol, type, description) VALUES("corenlp","foundry","CoreNLP");
-INSERT INTO annotation (symbol, type, description) VALUES("cnx","foundry","Connexor");
-INSERT INTO annotation (symbol, type, description) VALUES("drukola","foundry","DruKoLa");
-INSERT INTO annotation (symbol, type, description) VALUES("glemm","foundry","Glemm");
-INSERT INTO annotation (symbol, type, description) VALUES("malt","foundry","Malt");
-INSERT INTO annotation (symbol, type, description) VALUES("marmot","foundry","MarMot");
-INSERT INTO annotation (symbol, type, description) VALUES("mate","foundry","Mate");
-INSERT INTO annotation (symbol, type, description) VALUES("mdp","foundry","MD parser");
-INSERT INTO annotation (symbol, type, description) VALUES("opennlp","foundry","OpenNLP");
-INSERT INTO annotation (symbol, type, description) VALUES("sgbr","foundry","Schreibgebrauch");
-INSERT INTO annotation (symbol, type, description) VALUES("tt","foundry","Tree Tagger");
-INSERT INTO annotation (symbol, type, description) VALUES("xip","foundry","Xerox Incremental Parser");
+INSERT INTO annotation (code, type, description) VALUES("base","foundry","Base");
+INSERT INTO annotation (code, type, description) VALUES("dereko","foundry","DeReKo");
+INSERT INTO annotation (code, type, description) VALUES("corenlp","foundry","CoreNLP");
+INSERT INTO annotation (code, type, description) VALUES("cnx","foundry","Connexor");
+INSERT INTO annotation (code, type, description) VALUES("drukola","foundry","DruKoLa");
+INSERT INTO annotation (code, type, description) VALUES("glemm","foundry","Glemm");
+INSERT INTO annotation (code, type, description) VALUES("malt","foundry","Malt");
+INSERT INTO annotation (code, type, description) VALUES("marmot","foundry","MarMot");
+INSERT INTO annotation (code, type, description) VALUES("mate","foundry","Mate");
+INSERT INTO annotation (code, type, description) VALUES("mdp","foundry","MD parser");
+INSERT INTO annotation (code, type, description) VALUES("opennlp","foundry","OpenNLP");
+INSERT INTO annotation (code, type, description) VALUES("sgbr","foundry","Schreibgebrauch");
+INSERT INTO annotation (code, type, description) VALUES("tt","foundry","Tree Tagger");
+INSERT INTO annotation (code, type, description) VALUES("xip","foundry","Xerox Incremental Parser");
 
 --layers
-INSERT INTO annotation (symbol, type, description) VALUES("c","layer","Constituency");
-INSERT INTO annotation (symbol, type, description) VALUES("d","layer","Dependency");
-INSERT INTO annotation (symbol, type, description) VALUES("p","layer","Part of speech");
-INSERT INTO annotation (symbol, type, description) VALUES("l","layer","Lemma");
-INSERT INTO annotation (symbol, type, description) VALUES("lv","layer","Lemma variant");
-INSERT INTO annotation (symbol, type, description) VALUES("m","layer","Morphology");
-INSERT INTO annotation (symbol, type, description) VALUES("ne","layer","Named entity");
-INSERT INTO annotation (symbol, type, description) VALUES("s","layer","Structure");
-INSERT INTO annotation (symbol, type, description) VALUES("syn","layer","Syntax");
+INSERT INTO annotation (code, type, description) VALUES("c","layer","Constituency");
+INSERT INTO annotation (code, type, description) VALUES("d","layer","Dependency");
+INSERT INTO annotation (code, type, description) VALUES("p","layer","Part of speech");
+INSERT INTO annotation (code, type, description) VALUES("l","layer","Lemma");
+INSERT INTO annotation (code, type, description) VALUES("lv","layer","Lemma variant");
+INSERT INTO annotation (code, type, description) VALUES("m","layer","Morphology");
+INSERT INTO annotation (code, type, description) VALUES("ne","layer","Named entity");
+INSERT INTO annotation (code, type, description) VALUES("s","layer","Structure");
+INSERT INTO annotation (code, type, description) VALUES("syn","layer","Syntax");
 
 --values
-INSERT INTO annotation (symbol, type, description) VALUES("s","value","Sentence");
-INSERT INTO annotation (symbol, type, description) VALUES("p","value","Paragraph");
-INSERT INTO annotation (symbol, type, description) VALUES("t","value","Text");
+INSERT INTO annotation (code, type, description) VALUES("s","value","Sentence");
+INSERT INTO annotation (code, type, description) VALUES("p","value","Paragraph");
+INSERT INTO annotation (code, type, description) VALUES("t","value","Text");
+INSERT INTO annotation (code, type, description) VALUES("ADJA","value","Attributive Adjective");
 
diff --git a/src/main/resources/db/new-mysql/V2.1__insert_annotation_pairs.sql b/src/main/resources/db/new-mysql/V2.1__insert_annotation_pairs.sql
index 62f01e1..3bf0f32 100644
--- a/src/main/resources/db/new-mysql/V2.1__insert_annotation_pairs.sql
+++ b/src/main/resources/db/new-mysql/V2.1__insert_annotation_pairs.sql
@@ -1,180 +1,180 @@
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="base"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="base"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Structure"),
 		"Base structure layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="dereko"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="dereko"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Structure"),
 		"DeReKo structure layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="cnx"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="cnx"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Constituency"),
 		"Connexor constituency layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="cnx"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="cnx"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Syntax"),
 		"Connexor syntax layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="cnx"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="cnx"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Part of speech"),
 		"Connexor part of speech layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="cnx"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="cnx"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Lemma"),
 		"Connexor lemma layer"; 
 		
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="cnx"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="cnx"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Morphology"),
 		"Connexor morphology layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="corenlp"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="corenlp"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Constituency"),
 		"CoreNLP constituency layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="corenlp"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="corenlp"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Part of speech"),
 		"CoreNLP part of speech layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="corenlp"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="corenlp"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Structure"),
 		"CoreNLP structure layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="corenlp"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="corenlp"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Named entity"),
 		"CoreNLP named entity layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="drukola"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="drukola"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Lemma"),
 		"DruKoLa lemma layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="drukola"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="drukola"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Part of speech"),
 		"DruKoLa part of speech layer"; 
 		
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="drukola"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="drukola"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Morphology"),
 		"DruKoLa morphology layer"; 
 
 		
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="glemm"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="glemm"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Lemma"),
 		"Glemm lemma layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="malt"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="malt"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Dependency"),
 		"Malt dependency layer"; 
 		
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="marmot"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="marmot"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Part of speech"),
 		"MarMot part of speech layer"; 
 		
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="marmot"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="marmot"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Morphology"),
 		"MarMot morphology layer"; 
 		
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="mate"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="mate"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Dependency"),
 		"Mate dependency layer";
 		
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="mate"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="mate"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Lemma"),
 		"Mate lemma layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="mate"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="mate"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Part of speech"),
 		"Mate part of speech layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="mate"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="mate"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Morphology"),
 		"Mate morphology layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="mdp"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="mdp"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Dependency"),
 		"MD parser dependency layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="opennlp"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="opennlp"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Part of speech"),
 		"OpenNLP part of speech layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="opennlp"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="opennlp"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Structure"),
 		"OpenNLP structure layer"; 
 		
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="sgbr"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="sgbr"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Part of speech"),
 		"Schreibgebrauch part of speech layer"; 
 		
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="sgbr"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="sgbr"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Lemma"),
 		"Schreibgebrauch lemma layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="sgbr"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="sgbr"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Lemma variant"),
 		"Schreibgebrauch lemma variant layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="tt"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="tt"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Part of speech"),
 		"Tree Tagger part of speech layer"; 
 		
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="tt"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="tt"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Lemma"),
 		"Tree Tagger lemma layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="tt"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="tt"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Structure"),
 		"Tree Tagger structure layer"; 
 		
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="xip"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="xip"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Lemma"),
 		"Xerox Incremental Parser lemma layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="xip"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="xip"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Structure"),
 		"Xerox Incremental Parser structure layer"; 
 		
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="xip"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="xip"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Part of speech"),
 		"Xerox Incremental Parser part of speech layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="xip"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="xip"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Constituency"),
 		"Xerox Incremental Parser constituency layer"; 
 
 INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	SELECT (SELECT a.id FROM annotation as a WHERE a.symbol="xip"),
+	SELECT (SELECT a.id FROM annotation as a WHERE a.code="xip"),
 		(SELECT a.id FROM annotation as a WHERE a.description="Dependency"),
 		"Xerox Incremental Parser dependency layer"; 
diff --git a/src/main/resources/db/new-mysql/V2.2__insert_annotation_pair_values.sql b/src/main/resources/db/new-mysql/V2.2__insert_annotation_pair_values.sql
index 9d8963d..6f628d2 100644
--- a/src/main/resources/db/new-mysql/V2.2__insert_annotation_pair_values.sql
+++ b/src/main/resources/db/new-mysql/V2.2__insert_annotation_pair_values.sql
@@ -1,13 +1,27 @@
 INSERT INTO annotation_pair_value (pair_id, value_id) 
 	SELECT 
 		(SELECT ap.id FROM annotation_pair as ap WHERE 
-			ap.annotation1 = (SELECT a.id FROM annotation as a WHERE a.symbol="base") AND 
+			ap.annotation1 = (SELECT a.id FROM annotation as a WHERE a.code="opennlp") AND 
 			ap.annotation2 = (SELECT a.id FROM annotation as a WHERE a.description="Structure")), 
 		(SELECT a.id FROM annotation as a WHERE a.description="Sentence");
 		
 INSERT INTO annotation_pair_value (pair_id, value_id) 
 	SELECT 
 		(SELECT ap.id FROM annotation_pair as ap WHERE 
-			ap.annotation1 = (SELECT a.id FROM annotation as a WHERE a.symbol="dereko") AND 
+			ap.annotation1 = (SELECT a.id FROM annotation as a WHERE a.code="opennlp") AND 
+			ap.annotation2 = (SELECT a.id FROM annotation as a WHERE a.description="Structure")), 
+		(SELECT a.id FROM annotation as a WHERE a.description="Paragraph");
+
+INSERT INTO annotation_pair_value (pair_id, value_id) 
+	SELECT 
+		(SELECT ap.id FROM annotation_pair as ap WHERE 
+			ap.annotation1 = (SELECT a.id FROM annotation as a WHERE a.code="opennlp") AND 
+			ap.annotation2 = (SELECT a.id FROM annotation as a WHERE a.description="Part of speech")), 
+		(SELECT a.id FROM annotation as a WHERE a.description="Attributive Adjective");
+
+INSERT INTO annotation_pair_value (pair_id, value_id) 
+	SELECT 
+		(SELECT ap.id FROM annotation_pair as ap WHERE 
+			ap.annotation1 = (SELECT a.id FROM annotation as a WHERE a.code="dereko") AND 
 			ap.annotation2 = (SELECT a.id FROM annotation as a WHERE a.description="Structure")), 
 		(SELECT a.id FROM annotation as a WHERE a.description="Sentence");
diff --git a/src/main/resources/db/new-mysql/V2.3__insert_resources.sql b/src/main/resources/db/new-mysql/V2.3__insert_resources.sql
index 0afba04..55cf005 100644
--- a/src/main/resources/db/new-mysql/V2.3__insert_resources.sql
+++ b/src/main/resources/db/new-mysql/V2.3__insert_resources.sql
@@ -1 +1 @@
-INSERT INTO resource (id, de_title, en_title) VALUES("WPD15","Deutsche Wikipedia Artikel 2015","English Wikipedia Articles 2015");
+INSERT INTO resource (id, de_title, en_title) VALUES("WPD15","Deutsche Wikipedia Artikel 2015","German Wikipedia Articles 2015");
diff --git a/src/main/resources/db/new-mysql/V2.4__insert_resource_layers.sql b/src/main/resources/db/new-mysql/V2.4__insert_resource_layers.sql
index 94ea9a4..98871f7 100644
--- a/src/main/resources/db/new-mysql/V2.4__insert_resource_layers.sql
+++ b/src/main/resources/db/new-mysql/V2.4__insert_resource_layers.sql
@@ -2,5 +2,5 @@
 	SELECT 
 		(SELECT id FROM resource WHERE id = "WPD15"),
 		(SELECT ap.id FROM annotation_pair as ap WHERE 
-			ap.annotation1 = (SELECT a.id FROM annotation as a WHERE a.symbol="opennlp") AND 
+			ap.annotation1 = (SELECT a.id FROM annotation as a WHERE a.code="opennlp") AND 
 			ap.annotation2 = (SELECT a.id FROM annotation as a WHERE a.description="Part of speech"));
\ No newline at end of file