Implemented parsing free resource info from json.

Change-Id: I034a71e0c30f72e864df7288d938e6d74d762801
diff --git a/full/src/main/java/de/ids_mannheim/korap/annotation/AnnotationParser.java b/full/src/main/java/de/ids_mannheim/korap/annotation/AnnotationParser.java
index 865f7cf..ab3cd02 100644
--- a/full/src/main/java/de/ids_mannheim/korap/annotation/AnnotationParser.java
+++ b/full/src/main/java/de/ids_mannheim/korap/annotation/AnnotationParser.java
@@ -123,14 +123,21 @@
             Annotation layer = retrieveOrCreateAnnotation(code, annotationType,
                     null, array.get(0));
             try {
-                annotationDao.createAnnotationLayer(foundry, layer);
+                AnnotationLayer annotationLayer =
+                        annotationDao.retrieveAnnotationLayer(foundry.getCode(),
+                                layer.getCode());
+                if (annotationLayer == null) {
+                    annotationDao.createAnnotationLayer(foundry, layer);
+                }
             }
             catch (Exception e) {
                 log.debug("Duplicate annotation layer: " + foundry.getCode()
                         + "/" + layer.getCode());
             }
         }
-        else if (annotationType.equals(AnnotationType.KEY)) {
+        else if (annotationType.equals(AnnotationType.KEY))
+
+        {
             if (layer == null) {
                 computeLayer(annotationCode);
             }
diff --git a/full/src/main/java/de/ids_mannheim/korap/annotation/FreeResourceParser.java b/full/src/main/java/de/ids_mannheim/korap/annotation/FreeResourceParser.java
new file mode 100644
index 0000000..1d7bc76
--- /dev/null
+++ b/full/src/main/java/de/ids_mannheim/korap/annotation/FreeResourceParser.java
@@ -0,0 +1,67 @@
+package de.ids_mannheim.korap.annotation;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import de.ids_mannheim.korap.dao.AnnotationDao;
+import de.ids_mannheim.korap.dao.ResourceDao;
+import de.ids_mannheim.korap.entity.AnnotationLayer;
+import de.ids_mannheim.korap.entity.Resource;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+
+@Component
+public class FreeResourceParser {
+    private Logger log = LogManager.getLogger(FreeResourceParser.class);
+
+    @Autowired
+    private ResourceDao resourceDao;
+    @Autowired
+    private AnnotationDao annotationDao;
+
+    public static String FREE_RESOURCE_FILE = "free-resources.json";
+    public static ObjectMapper mapper = new ObjectMapper();
+
+    public void run () throws IOException, KustvaktException {
+        InputStream is = FreeResourceParser.class.getClassLoader()
+                .getResourceAsStream(FREE_RESOURCE_FILE);
+        JsonNode node = mapper.readTree(is);
+        for (JsonNode resource : node) {
+            String resourceId = resource.at("/id").asText();
+            log.debug(resourceId);
+            Set<AnnotationLayer> layers = parseLayers(resource.at("/layers"));
+            try {
+                Resource r = resourceDao.retrieveResource(resourceId);
+                if (r == null) {
+                    resourceDao.createResource(resource.at("/id").asText(),
+                            resource.at("/de_title").asText(),
+                            resource.at("/en_title").asText(),
+                            resource.at("/en_description").asText(), layers);
+                }
+            }
+            catch (Exception e) {
+                log.warn("Failed creating resource: " + e.getMessage());
+            }
+        }
+    }
+
+    private Set<AnnotationLayer> parseLayers (JsonNode layers) {
+        Set<AnnotationLayer> layerSet = new HashSet<>(layers.size());
+        for (JsonNode layer : layers) {
+            String[] codes = layer.asText().split("/");
+            AnnotationLayer annotationLayer =
+                    annotationDao.retrieveAnnotationLayer(codes[0], codes[1]);
+            layerSet.add(annotationLayer);
+        }
+        return layerSet;
+    }
+}
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/Initializator.java b/full/src/main/java/de/ids_mannheim/korap/config/Initializator.java
index f0cace9..1cccb4f 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/Initializator.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/Initializator.java
@@ -6,6 +6,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 
 import de.ids_mannheim.korap.annotation.AnnotationParser;
+import de.ids_mannheim.korap.annotation.FreeResourceParser;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.oauth2.constant.OAuth2Scope;
 import de.ids_mannheim.korap.oauth2.dao.AccessScopeDao;
@@ -26,7 +27,9 @@
     private NamedVCLoader loader;
     @Autowired
     private AnnotationParser annotationParser;
-
+    @Autowired
+    private FreeResourceParser resourceParser;
+    
     public Initializator () {}
 
     public void init () throws IOException, QueryException, KustvaktException {
@@ -39,6 +42,7 @@
         setInitialAccessScope();
         loader.loadVCToCache();
         annotationParser.run();
+        resourceParser.run();
     }
 
     public void initTest () {
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/ResourceDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/ResourceDao.java
index 0de5c9c..ff3ffd0 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dao/ResourceDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dao/ResourceDao.java
@@ -1,6 +1,7 @@
 package de.ids_mannheim.korap.dao;
 
 import java.util.List;
+import java.util.Set;
 
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceContext;
@@ -10,9 +11,13 @@
 import javax.persistence.criteria.Root;
 
 import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
 
+import de.ids_mannheim.korap.entity.AnnotationLayer;
 import de.ids_mannheim.korap.entity.Resource;
 import de.ids_mannheim.korap.entity.Resource_;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.utils.ParameterChecker;
 
 /**
  * ResourceDao manages SQL queries regarding resource info and layers.
@@ -20,14 +25,16 @@
  * @author margaretha
  *
  */
+@Transactional
 @Repository
 public class ResourceDao {
 
     @PersistenceContext
     private EntityManager entityManager;
 
-    /** Select all from the resource table  
-     *  
+    /**
+     * Select all from the resource table
+     * 
      * @return a list of resources
      */
     @SuppressWarnings("unchecked")
@@ -36,9 +43,34 @@
         CriteriaQuery<Resource> query =
                 criteriaBuilder.createQuery(Resource.class);
         Root<Resource> resource = query.from(Resource.class);
-        resource.fetch(Resource_.layers);
         query.select(resource);
+        
         Query q = entityManager.createQuery(query);
         return q.getResultList();
     }
+
+    public Resource retrieveResource (String id) {
+        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<Resource> query =
+                criteriaBuilder.createQuery(Resource.class);
+        Root<Resource> resource = query.from(Resource.class);
+        query.select(resource);
+        query.where(criteriaBuilder.equal(resource.get(Resource_.id), id));
+
+        Query q = entityManager.createQuery(query);
+        return (Resource) q.getSingleResult();
+    }
+
+    public void createResource (String id, String germanTitle,
+            String englishTitle, String englishDescription, Set<AnnotationLayer> layers)
+            throws KustvaktException {
+        ParameterChecker.checkStringValue(id, "id");
+        ParameterChecker.checkStringValue(englishTitle, "en_title");
+        ParameterChecker.checkStringValue(germanTitle, "de_title");
+
+        Resource r = new Resource(id, germanTitle, englishTitle,
+                englishDescription, layers);
+        entityManager.persist(r);
+
+    }
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/entity/Resource.java b/full/src/main/java/de/ids_mannheim/korap/entity/Resource.java
index aa461c2..fbe3f92 100644
--- a/full/src/main/java/de/ids_mannheim/korap/entity/Resource.java
+++ b/full/src/main/java/de/ids_mannheim/korap/entity/Resource.java
@@ -14,9 +14,11 @@
 import lombok.Getter;
 import lombok.Setter;
 
-/** Describes resources having free licenses. Primarily for accommodating 
- *  clients in providing data without login such as KorapSRU. 
- *  
+/**
+ * Describes resources having free licenses. Primarily for
+ * accommodating
+ * clients in providing data without login such as KorapSRU.
+ * 
  * @author margaretha
  *
  */
@@ -38,7 +40,7 @@
     @Column(name = "en_description")
     private String englishDescription;
 
-    @ManyToMany(fetch = FetchType.LAZY)
+    @ManyToMany(fetch = FetchType.EAGER)
     @JoinTable(name = "resource_layer",
             joinColumns = @JoinColumn(name = "resource_id",
                     referencedColumnName = "id"),
@@ -46,6 +48,16 @@
                     referencedColumnName = "id"))
     private Set<AnnotationLayer> layers;
 
+    public Resource () {}
+
+    public Resource (String id, String germanTitle, String englishTitle,
+                     String englishDescription, Set<AnnotationLayer> layers) {
+        this.id = id;
+        this.germanTitle = germanTitle;
+        this.englishTitle = englishTitle;
+        this.englishDescription = englishDescription;
+        this.layers = layers;
+    }
 
     @Override
     public String toString () {
diff --git a/full/src/main/resources/db/insert/V2.3__insert_resources.sql b/full/src/main/resources/db/insert/V2.3__insert_resources.sql
deleted file mode 100644
index 55cf005..0000000
--- a/full/src/main/resources/db/insert/V2.3__insert_resources.sql
+++ /dev/null
@@ -1 +0,0 @@
-INSERT INTO resource (id, de_title, en_title) VALUES("WPD15","Deutsche Wikipedia Artikel 2015","German Wikipedia Articles 2015");
diff --git a/full/src/main/resources/db/temp/V2.0__insert_annotations.sql b/full/src/main/resources/db/temp/V2.0__insert_annotations.sql
deleted file mode 100644
index 911f5de..0000000
--- a/full/src/main/resources/db/temp/V2.0__insert_annotations.sql
+++ /dev/null
@@ -1,33 +0,0 @@
---foundries
-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 (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 (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/full/src/main/resources/db/temp/V2.1__insert_annotation_pairs.sql b/full/src/main/resources/db/temp/V2.1__insert_annotation_pairs.sql
deleted file mode 100644
index 3bf0f32..0000000
--- a/full/src/main/resources/db/temp/V2.1__insert_annotation_pairs.sql
+++ /dev/null
@@ -1,180 +0,0 @@
-INSERT INTO annotation_pair (annotation1, annotation2, description) 
-	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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.code="xip"),
-		(SELECT a.id FROM annotation as a WHERE a.description="Dependency"),
-		"Xerox Incremental Parser dependency layer"; 
diff --git a/full/src/main/resources/db/temp/V2.2__insert_annotation_pair_values.sql b/full/src/main/resources/db/temp/V2.2__insert_annotation_pair_values.sql
deleted file mode 100644
index 6f628d2..0000000
--- a/full/src/main/resources/db/temp/V2.2__insert_annotation_pair_values.sql
+++ /dev/null
@@ -1,27 +0,0 @@
-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="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.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/full/src/main/resources/db/temp/V2.4__insert_resource_layers.sql b/full/src/main/resources/db/temp/V2.4__insert_resource_layers.sql
deleted file mode 100644
index 98871f7..0000000
--- a/full/src/main/resources/db/temp/V2.4__insert_resource_layers.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-INSERT INTO resource_layer (resource_id, layer_id)	
-	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.code="opennlp") AND 
-			ap.annotation2 = (SELECT a.id FROM annotation as a WHERE a.description="Part of speech"));
\ No newline at end of file
diff --git a/full/src/main/resources/default-config.xml b/full/src/main/resources/default-config.xml
index d67d911..e5f2c1e 100644
--- a/full/src/main/resources/default-config.xml
+++ b/full/src/main/resources/default-config.xml
@@ -181,7 +181,7 @@
 	</bean>
 
 	<bean id="initializator" class="de.ids_mannheim.korap.config.Initializator"
-		init-method="init">
+		init-method="initAnnotation">
 	</bean>
 
 	<!-- Krill -->
diff --git a/full/src/main/resources/free-resources.json b/full/src/main/resources/free-resources.json
new file mode 100644
index 0000000..ea71020
--- /dev/null
+++ b/full/src/main/resources/free-resources.json
@@ -0,0 +1,10 @@
+[{
+    "id": "WPD15",
+    "de_title" : "Deutsche Wikipedia Artikel 2015",
+    "en_title" : "German Wikipedia Articles 2015",
+    "en_description" : "A collection of German Wikipedia articles from May 2015.",
+    "layers": [
+        "opennlp/p",
+        "corenlp/p"
+    ]
+}]
\ No newline at end of file