Added resource and annotation services.
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 9c73af8..926db2a 100644
--- a/src/main/resources/db/new-mysql/V1__create_tables.sql
+++ b/src/main/resources/db/new-mysql/V1__create_tables.sql
@@ -1,13 +1,8 @@
---type
---0 value
---1 foundry
---2 layer
---3 key
CREATE TABLE IF NOT EXISTS annotation(
id INTEGER PRIMARY KEY AUTO_INCREMENT,
symbol VARCHAR(20) NOT NULL,
- type INTEGER DEFAULT 0,
+ type VARCHAR(20) NOT NULL,
description VARCHAR(100) NOT NULL,
UNIQUE INDEX unique_index (symbol, type)
);
@@ -31,21 +26,21 @@
CREATE TABLE IF NOT EXISTS annotation_pair_value(
id INTEGER PRIMARY KEY AUTO_INCREMENT,
pair_id INTEGER NOT NULL,
- value INTEGER NOT NULL,
- UNIQUE INDEX unique_index (pair_id, value),
+ value_id INTEGER NOT NULL,
+ UNIQUE INDEX unique_index (pair_id, value_id),
FOREIGN KEY (pair_id)
REFERENCES annotation_pair (id)
ON DELETE CASCADE,
- FOREIGN KEY (value)
+ FOREIGN KEY (value_id)
REFERENCES annotation (id)
ON DELETE CASCADE
);
CREATE TABLE resource(
id VARCHAR(100) PRIMARY KEY UNIQUE NOT NULL,
- title VARCHAR(100) NOT NULL,
+ de_title VARCHAR(100) NOT NULL,
en_title VARCHAR(100) NOT NULL,
- description VARCHAR(100)
+ en_description VARCHAR(100)
);
CREATE TABLE resource_layer(
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 12501a8..4131cc4 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,32 @@
--foundries
-INSERT INTO annotation (symbol, type, description) VALUES("base",1,"Base");
-INSERT INTO annotation (symbol, type, description) VALUES("dereko",1,"DeReKo");
-INSERT INTO annotation (symbol, type, description) VALUES("corenlp",1,"CoreNLP");
-INSERT INTO annotation (symbol, type, description) VALUES("cnx",1,"Connexor");
-INSERT INTO annotation (symbol, type, description) VALUES("drukola",1,"DruKoLa");
-INSERT INTO annotation (symbol, type, description) VALUES("glemm",1,"Glemm");
-INSERT INTO annotation (symbol, type, description) VALUES("malt",1,"Malt");
-INSERT INTO annotation (symbol, type, description) VALUES("marmot",1,"MarMot");
-INSERT INTO annotation (symbol, type, description) VALUES("mate",1,"Mate");
-INSERT INTO annotation (symbol, type, description) VALUES("mdp",1,"MD parser");
-INSERT INTO annotation (symbol, type, description) VALUES("opennlp",1,"OpenNLP");
-INSERT INTO annotation (symbol, type, description) VALUES("sgbr",1,"Schreibgebrauch");
-INSERT INTO annotation (symbol, type, description) VALUES("tt",1,"Tree Tagger");
-INSERT INTO annotation (symbol, type, description) VALUES("xip",1,"Xerox Incremental Parser");
+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");
--layers
-INSERT INTO annotation (symbol, type, description) VALUES("c",2,"Constituency");
-INSERT INTO annotation (symbol, type, description) VALUES("d",2,"Dependency");
-INSERT INTO annotation (symbol, type, description) VALUES("p",2,"Part of speech");
-INSERT INTO annotation (symbol, type, description) VALUES("l",2,"Lemma");
-INSERT INTO annotation (symbol, type, description) VALUES("lv",2,"Lemma variant");
-INSERT INTO annotation (symbol, type, description) VALUES("m",2,"Morphology");
-INSERT INTO annotation (symbol, type, description) VALUES("ne",2,"Named entity");
-INSERT INTO annotation (symbol, type, description) VALUES("s",2,"Structure");
-INSERT INTO annotation (symbol, type, description) VALUES("syn",2,"Syntax");
+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");
--values
-INSERT INTO annotation (symbol, type, description) VALUES("s",0,"Sentence");
-INSERT INTO annotation (symbol, type, description) VALUES("p",0,"Paragraph");
-INSERT INTO annotation (symbol, type, description) VALUES("t",0,"Text");
+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");
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 e2ad49c..9d8963d 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,11 +1,11 @@
-INSERT INTO annotation_pair_value (pair_id, value)
+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.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)
+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
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 14918c6..0afba04 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, 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","English Wikipedia Articles 2015");
diff --git a/src/main/resources/hibernate.properties b/src/main/resources/hibernate.properties
index fa35ac7..76c9add 100644
--- a/src/main/resources/hibernate.properties
+++ b/src/main/resources/hibernate.properties
@@ -1,5 +1,5 @@
hibernate.dialect=org.hibernate.dialect.MySQLDialect
-hibernate.hbm2ddl.auto=create-drop
+hibernate.hbm2ddl.auto=none
hibernate.show_sql=true
hibernate.cache.use_query_cache=false
hibernate.cache.use_second_level_cache=false