diff --git a/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java b/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java
index 8ef8070..faa150c 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java
@@ -20,9 +20,9 @@
 import de.ids_mannheim.korap.KrillCollection;
 import de.ids_mannheim.korap.constant.QueryType;
 import de.ids_mannheim.korap.constant.ResourceType;
-import de.ids_mannheim.korap.entity.VirtualCorpus;
+import de.ids_mannheim.korap.entity.QueryDO;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.service.VirtualCorpusService;
+import de.ids_mannheim.korap.service.QueryService;
 import de.ids_mannheim.korap.util.QueryException;
 import de.ids_mannheim.korap.web.SearchKrill;
 
@@ -38,7 +38,7 @@
     @Autowired
     private SearchKrill searchKrill;
     @Autowired
-    private VirtualCorpusService vcService;
+    private QueryService vcService;
 
     public static Logger jlog = LogManager.getLogger(NamedVCLoader.class);
     public static boolean DEBUG = false;
@@ -92,7 +92,7 @@
             if (json != null) {
                 cacheVC(json, filename);
                 try {
-                    VirtualCorpus vc = vcService.searchVCByName("system",
+                    QueryDO vc = vcService.searchQueryByName("system",
                             filename, "system", QueryType.VIRTUAL_CORPUS);
                     if (vc != null) {
                         if (DEBUG) {
diff --git a/full/src/main/java/de/ids_mannheim/korap/constant/PredefinedRole.java b/full/src/main/java/de/ids_mannheim/korap/constant/PredefinedRole.java
index d784cb0..6e794aa 100644
--- a/full/src/main/java/de/ids_mannheim/korap/constant/PredefinedRole.java
+++ b/full/src/main/java/de/ids_mannheim/korap/constant/PredefinedRole.java
@@ -6,7 +6,7 @@
  *
  */
 public enum PredefinedRole {
-    USER_GROUP_ADMIN(1), USER_GROUP_MEMBER(2), VC_ACCESS_ADMIN(3), VC_ACCESS_MEMBER(4);
+    USER_GROUP_ADMIN(1), USER_GROUP_MEMBER(2), QUERY_ACCESS_ADMIN(3), QUERY_ACCESS_MEMBER(4);
     
     private int id;
     private String name;
diff --git a/full/src/main/java/de/ids_mannheim/korap/constant/QueryAccessStatus.java b/full/src/main/java/de/ids_mannheim/korap/constant/QueryAccessStatus.java
new file mode 100644
index 0000000..de78d54
--- /dev/null
+++ b/full/src/main/java/de/ids_mannheim/korap/constant/QueryAccessStatus.java
@@ -0,0 +1,19 @@
+package de.ids_mannheim.korap.constant;
+
+import de.ids_mannheim.korap.entity.QueryAccess;
+
+/** Defines possible statuses of {@link QueryAccess}
+ * 
+ * @author margaretha
+ * @see QueryAccess
+ *
+ */
+public enum QueryAccessStatus {
+
+    ACTIVE, DELETED,
+    // has not been used yet
+    PENDING,
+    // access for hidden group
+    // maybe not necessary?
+    HIDDEN;
+}
diff --git a/full/src/main/java/de/ids_mannheim/korap/constant/ResourceType.java b/full/src/main/java/de/ids_mannheim/korap/constant/ResourceType.java
index 27cd9b8..8c2e2ac 100644
--- a/full/src/main/java/de/ids_mannheim/korap/constant/ResourceType.java
+++ b/full/src/main/java/de/ids_mannheim/korap/constant/ResourceType.java
@@ -1,8 +1,8 @@
 package de.ids_mannheim.korap.constant;
 
-import de.ids_mannheim.korap.entity.VirtualCorpus;
+import de.ids_mannheim.korap.entity.QueryDO;
 
-/** Defines types of {@link VirtualCorpus} 
+/** Defines types of {@link QueryDO} 
  * 
  * @author margaretha
  *
diff --git a/full/src/main/java/de/ids_mannheim/korap/constant/VirtualCorpusAccessStatus.java b/full/src/main/java/de/ids_mannheim/korap/constant/VirtualCorpusAccessStatus.java
deleted file mode 100644
index 437038c..0000000
--- a/full/src/main/java/de/ids_mannheim/korap/constant/VirtualCorpusAccessStatus.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package de.ids_mannheim.korap.constant;
-
-import de.ids_mannheim.korap.entity.VirtualCorpusAccess;
-
-/** Defines possible statuses of {@link VirtualCorpusAccess}
- * 
- * @author margaretha
- * @see VirtualCorpusAccess
- *
- */
-public enum VirtualCorpusAccessStatus {
-
-    ACTIVE, DELETED,
-    // has not been used yet
-    PENDING,
-    // access for hidden group
-    // maybe not necessary?
-    HIDDEN;
-}
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/QueryAccessDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/QueryAccessDao.java
new file mode 100644
index 0000000..f28c4ee
--- /dev/null
+++ b/full/src/main/java/de/ids_mannheim/korap/dao/QueryAccessDao.java
@@ -0,0 +1,265 @@
+package de.ids_mannheim.korap.dao;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Join;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import de.ids_mannheim.korap.constant.QueryAccessStatus;
+import de.ids_mannheim.korap.entity.UserGroup;
+import de.ids_mannheim.korap.entity.UserGroup_;
+import de.ids_mannheim.korap.entity.QueryAccess;
+import de.ids_mannheim.korap.entity.QueryAccess_;
+import de.ids_mannheim.korap.entity.QueryDO;
+import de.ids_mannheim.korap.entity.QueryDO_;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.exceptions.StatusCodes;
+import de.ids_mannheim.korap.utils.ParameterChecker;
+
+/**
+ * Manages database queries and transactions regarding
+ * {@link QueryAccess} entity and its corresponding database
+ * table.
+ * 
+ * @author margaretha
+ *
+ * @see QueryAccess
+ * @see Query
+ */
+@Transactional
+@Repository
+public class QueryAccessDao {
+
+    @PersistenceContext
+    private EntityManager entityManager;
+
+    public QueryAccess retrieveAccessById (int accessId)
+            throws KustvaktException {
+        ParameterChecker.checkIntegerValue(accessId, "accessId");
+
+        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryAccess> query =
+                builder.createQuery(QueryAccess.class);
+
+        Root<QueryAccess> access =
+                query.from(QueryAccess.class);
+        query.select(access);
+        query.where(
+                builder.equal(access.get(QueryAccess_.id), accessId));
+        Query q = entityManager.createQuery(query);
+        try{
+            return (QueryAccess) q.getSingleResult();
+        }
+        catch (NoResultException e) {
+            throw new KustvaktException(StatusCodes.NO_RESOURCE_FOUND,
+                    "Query access is not found",
+                    String.valueOf(accessId));
+        }
+    }
+
+    // for query-access admins
+    public List<QueryAccess> retrieveActiveAccessByQuery (int queryId)
+            throws KustvaktException {
+        ParameterChecker.checkIntegerValue(queryId, "queryId");
+
+        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryAccess> query =
+                builder.createQuery(QueryAccess.class);
+
+        Root<QueryAccess> access =
+                query.from(QueryAccess.class);
+        Join<QueryAccess, QueryDO> accessQuery =
+                access.join(QueryAccess_.query);
+
+        Predicate p = builder.and(
+                builder.equal(accessQuery.get(QueryDO_.id), queryId),
+                builder.equal(access.get(QueryAccess_.status),
+                        QueryAccessStatus.ACTIVE));
+        query.select(access);
+        query.where(p);
+        TypedQuery<QueryAccess> q = entityManager.createQuery(query);
+        return q.getResultList();
+    }
+
+    public List<QueryAccess> retrieveActiveAccessByQuery (String queryCreator,
+            String queryName) throws KustvaktException {
+        ParameterChecker.checkStringValue(queryCreator, "queryCreator");
+        ParameterChecker.checkStringValue(queryName, "queryName");
+
+        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryAccess> query =
+                builder.createQuery(QueryAccess.class);
+
+        Root<QueryAccess> access =
+                query.from(QueryAccess.class);
+        Join<QueryAccess, QueryDO> accessQuery =
+                access.join(QueryAccess_.query);
+
+        Predicate p = builder.and(
+                builder.equal(accessQuery.get(QueryDO_.name), queryName),
+                builder.equal(accessQuery.get(QueryDO_.createdBy), queryCreator),
+                builder.equal(access.get(QueryAccess_.status),
+                        QueryAccessStatus.ACTIVE));
+        query.select(access);
+        query.where(p);
+        TypedQuery<QueryAccess> q = entityManager.createQuery(query);
+        return q.getResultList();
+    }
+    
+    public List<QueryAccess> retrieveAllAccess ()
+            throws KustvaktException {
+
+        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryAccess> query =
+                builder.createQuery(QueryAccess.class);
+        Root<QueryAccess> access =
+                query.from(QueryAccess.class);
+        query.select(access);
+        TypedQuery<QueryAccess> q = entityManager.createQuery(query);
+        return q.getResultList();
+    }
+
+    public List<QueryAccess> retrieveAllAccessByQuery (String queryCreator,
+            String queryName) throws KustvaktException {
+        ParameterChecker.checkStringValue(queryCreator, "queryCreator");
+        ParameterChecker.checkStringValue(queryName, "queryName");
+
+        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryAccess> query =
+                builder.createQuery(QueryAccess.class);
+
+        Root<QueryAccess> access =
+                query.from(QueryAccess.class);
+        Join<QueryAccess, QueryDO> accessQuery =
+                access.join(QueryAccess_.query);
+
+        Predicate conditions = builder.and(
+                builder.equal(accessQuery.get(QueryDO_.createdBy),
+                        queryCreator),
+                builder.equal(accessQuery.get(QueryDO_.name), queryName));
+        query.select(access);
+        query.where(conditions);
+        TypedQuery<QueryAccess> q = entityManager.createQuery(query);
+        return q.getResultList();
+    }
+
+    public List<QueryAccess> retrieveAllAccessByGroup (int groupId)
+            throws KustvaktException {
+        ParameterChecker.checkIntegerValue(groupId, "groupId");
+
+        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryAccess> query =
+                builder.createQuery(QueryAccess.class);
+
+        Root<QueryAccess> access =
+                query.from(QueryAccess.class);
+        Join<QueryAccess, UserGroup> accessQuery =
+                access.join(QueryAccess_.userGroup);
+
+        query.select(access);
+        query.where(builder.equal(accessQuery.get(UserGroup_.id), groupId));
+        TypedQuery<QueryAccess> q = entityManager.createQuery(query);
+        return q.getResultList();
+    }
+
+    public List<QueryAccess> retrieveActiveAccessByGroup (int groupId)
+            throws KustvaktException {
+        ParameterChecker.checkIntegerValue(groupId, "groupId");
+
+        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryAccess> query =
+                builder.createQuery(QueryAccess.class);
+
+        Root<QueryAccess> access =
+                query.from(QueryAccess.class);
+        Join<QueryAccess, UserGroup> accessQuery =
+                access.join(QueryAccess_.userGroup);
+
+        Predicate p =
+                builder.and(builder.equal(accessQuery.get(UserGroup_.id), groupId),
+                        builder.equal(access.get(QueryAccess_.status),
+                                QueryAccessStatus.ACTIVE));
+
+        query.select(access);
+        query.where(p);
+        TypedQuery<QueryAccess> q = entityManager.createQuery(query);
+        return q.getResultList();
+    }
+
+    /**
+     * Hidden accesses are only created for published or system query.
+     * 
+     * Warn: The actual hidden accesses are not checked.
+     * 
+     * @param queryId
+     *            queryId
+     * @return true if there is a hidden access, false otherwise
+     * @throws KustvaktException
+     */
+    public QueryAccess retrieveHiddenAccess (int queryId)
+            throws KustvaktException {
+        ParameterChecker.checkIntegerValue(queryId, "queryId");
+
+        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryAccess> query =
+                builder.createQuery(QueryAccess.class);
+
+        Root<QueryAccess> access =
+                query.from(QueryAccess.class);
+        Join<QueryAccess, QueryDO> accessQuery =
+                access.join(QueryAccess_.query);
+
+        Predicate p = builder.and(
+                builder.equal(accessQuery.get(QueryDO_.id), queryId),
+                builder.equal(access.get(QueryAccess_.status),
+                        QueryAccessStatus.HIDDEN)
+        // ,
+        // builder.notEqual(access.get(QueryAccess_.deletedBy),
+        // "NULL")
+        );
+
+        query.select(access);
+        query.where(p);
+
+        try {
+            Query q = entityManager.createQuery(query);
+            return (QueryAccess) q.getSingleResult();
+        }
+        catch (NoResultException e) {
+            return null;
+        }
+    }
+
+    public void createAccessToQuery (QueryDO query,
+            UserGroup userGroup, String createdBy,
+            QueryAccessStatus status) {
+        QueryAccess queryAccess = new QueryAccess();
+        queryAccess.setQuery(query);
+        queryAccess.setUserGroup(userGroup);
+        queryAccess.setCreatedBy(createdBy);
+        queryAccess.setStatus(status);
+        entityManager.persist(queryAccess);
+    }
+
+    public void deleteAccess (QueryAccess access, String deletedBy) {
+        // soft delete
+
+        // hard delete
+        if (!entityManager.contains(access)) {
+            access = entityManager.merge(access);
+        }
+        entityManager.remove(access);
+    }
+
+}
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/QueryDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/QueryDao.java
new file mode 100644
index 0000000..27d3b9f
--- /dev/null
+++ b/full/src/main/java/de/ids_mannheim/korap/dao/QueryDao.java
@@ -0,0 +1,372 @@
+package de.ids_mannheim.korap.dao;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
+import javax.persistence.NonUniqueResultException;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Join;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import de.ids_mannheim.korap.constant.GroupMemberStatus;
+import de.ids_mannheim.korap.constant.QueryType;
+import de.ids_mannheim.korap.constant.ResourceType;
+import de.ids_mannheim.korap.constant.UserGroupStatus;
+import de.ids_mannheim.korap.constant.QueryAccessStatus;
+import de.ids_mannheim.korap.entity.QueryDO;
+import de.ids_mannheim.korap.entity.QueryDO_;
+import de.ids_mannheim.korap.entity.UserGroup;
+import de.ids_mannheim.korap.entity.UserGroupMember;
+import de.ids_mannheim.korap.entity.UserGroupMember_;
+import de.ids_mannheim.korap.entity.UserGroup_;
+import de.ids_mannheim.korap.entity.QueryAccess;
+import de.ids_mannheim.korap.entity.QueryAccess_;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.exceptions.StatusCodes;
+import de.ids_mannheim.korap.user.User.CorpusAccess;
+import de.ids_mannheim.korap.utils.ParameterChecker;
+
+/**
+ * QueryDao manages database queries and transactions
+ * regarding KorAP queries, e.g. retrieving and storing queries.
+ * 
+ * @author margaretha
+ *
+ */
+@Transactional
+@Repository
+public class QueryDao {
+
+    @PersistenceContext
+    private EntityManager entityManager;
+
+    public int createQuery (String name, ResourceType type,
+            QueryType queryType, CorpusAccess requiredAccess, String koralQuery,
+            String definition, String description, String status,
+            boolean isCached, String createdBy, String query,
+            String queryLanguage) throws KustvaktException {
+
+        QueryDO q = new QueryDO();
+        q.setName(name);
+        q.setType(type);
+        q.setQueryType(queryType);
+        q.setRequiredAccess(requiredAccess);
+        q.setKoralQuery(koralQuery);
+        q.setDefinition(definition);
+        q.setDescription(description);
+        q.setStatus(status);
+        q.setCreatedBy(createdBy);
+        q.setCached(isCached);
+        q.setQuery(query);
+        q.setQueryLanguage(queryLanguage);
+
+        entityManager.persist(q);
+        return q.getId();
+    }
+
+    public void editQuery (QueryDO query, String name,
+            ResourceType type, CorpusAccess requiredAccess, String koralQuery,
+            String definition, String description, String status,
+            boolean isCached) throws KustvaktException {
+
+        if (name != null && !name.isEmpty()) {
+            query.setName(name);
+        }
+        if (type != null) {
+            query.setType(type);
+        }
+        if (requiredAccess != null) {
+            query.setRequiredAccess(requiredAccess);
+        }
+        if (koralQuery != null) {
+            query.setKoralQuery(koralQuery);
+        }
+        if (definition != null && !definition.isEmpty()) {
+            query.setDefinition(definition);
+        }
+        if (description != null && !description.isEmpty()) {
+            query.setDescription(description);
+        }
+        if (status != null && !status.isEmpty()) {
+            query.setStatus(status);
+        }
+        query.setCached(isCached);
+        entityManager.merge(query);
+    }
+
+    public void deleteQuery (QueryDO query)
+            throws KustvaktException {
+        if (!entityManager.contains(query)) {
+            query = entityManager.merge(query);
+        }
+        entityManager.remove(query);
+
+    }
+
+    /**
+     * System admin function.
+     * 
+     * Retrieves queries by creator and type. If type is not
+     * specified, retrieves queries of all types. If createdBy is not
+     * specified, retrieves queries of all users.
+     * 
+     * @param type
+     *            {@link ResourceType}
+     * @param createdBy
+     *            username of the query creator
+     * @return a list of {@link Query}
+     * @throws KustvaktException
+     */
+    @SuppressWarnings("unchecked")
+    public List<QueryDO> retrieveQueryByType (ResourceType type,
+            String createdBy, QueryType queryType) throws KustvaktException {
+
+        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryDO> criteriaQuery =
+                criteriaBuilder.createQuery(QueryDO.class);
+        Root<QueryDO> query = criteriaQuery.from(QueryDO.class);
+
+        Predicate conditions = criteriaBuilder
+                .equal(query.get(QueryDO_.queryType), queryType);
+        if (createdBy != null && !createdBy.isEmpty()) {
+            conditions = criteriaBuilder.and(conditions, criteriaBuilder.equal(
+                    query.get(QueryDO_.createdBy), createdBy));
+            if (type != null) {
+                conditions = criteriaBuilder.and(conditions, criteriaBuilder
+                        .equal(query.get(QueryDO_.type), type));
+            }
+        }
+        else if (type != null) {
+            conditions = criteriaBuilder.and(conditions, criteriaBuilder
+                    .equal(query.get(QueryDO_.type), type));
+        }
+
+        criteriaQuery.select(query);
+        criteriaQuery.where(conditions);
+        Query q = entityManager.createQuery(criteriaQuery);
+        return q.getResultList();
+    }
+
+    public QueryDO retrieveQueryById (int id) throws KustvaktException {
+        ParameterChecker.checkIntegerValue(id, "id");
+
+        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryDO> criteriaQuery =
+                criteriaBuilder.createQuery(QueryDO.class);
+        Root<QueryDO> query = criteriaQuery.from(QueryDO.class);
+        criteriaQuery.select(query);
+        criteriaQuery.where(criteriaBuilder.equal(query.get(QueryDO_.id),
+                id));
+
+        QueryDO qe = null;
+        try {
+            Query q = entityManager.createQuery(criteriaQuery);
+            qe = (QueryDO) q.getSingleResult();
+        }
+        catch (NoResultException e) {
+            throw new KustvaktException(StatusCodes.NO_RESOURCE_FOUND,
+                    "Query with id: " + id + " is not found",
+                    String.valueOf(id), e);
+        }
+        return qe;
+    }
+
+    public QueryDO retrieveQueryByName (String queryName, String createdBy)
+            throws KustvaktException {
+        ParameterChecker.checkStringValue(createdBy, "createdBy");
+        ParameterChecker.checkStringValue(queryName, "queryName");
+
+        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryDO> criteriaQuery =
+                builder.createQuery(QueryDO.class);
+
+        Root<QueryDO> query = criteriaQuery.from(QueryDO.class);
+
+        Predicate condition = builder.and(
+                builder.equal(query.get(QueryDO_.createdBy),
+                        createdBy),
+                builder.equal(query.get(QueryDO_.name), queryName));
+
+        criteriaQuery.select(query);
+        criteriaQuery.where(condition);
+
+        Query q = entityManager.createQuery(criteriaQuery);
+        QueryDO qe = null;
+        try {
+            qe = (QueryDO) q.getSingleResult();
+        }
+        catch (NoResultException e) {
+            return null;
+        }
+        catch (NonUniqueResultException e) {
+            String code = createdBy + "/" + queryName;
+            throw new KustvaktException(StatusCodes.NON_UNIQUE_RESULT_FOUND,
+                    "Non unique result found for query: retrieve query by name "
+                            + code,
+                    String.valueOf(code), e);
+        }
+        return qe;
+    }
+
+    @SuppressWarnings("unchecked")
+    public List<QueryDO> retrieveOwnerQuery (String userId,
+            QueryType queryType) throws KustvaktException {
+        ParameterChecker.checkStringValue(userId, "userId");
+
+        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryDO> cq =
+                builder.createQuery(QueryDO.class);
+
+        Root<QueryDO> query = cq.from(QueryDO.class);
+        Predicate conditions = builder.and(
+                builder.equal(query.get(QueryDO_.createdBy),
+                        userId),
+                builder.equal(query.get(QueryDO_.queryType),
+                        queryType));
+
+        cq.select(query);
+        cq.where(conditions);
+
+        Query q = entityManager.createQuery(cq);
+        return q.getResultList();
+    }
+
+    @SuppressWarnings("unchecked")
+    public List<QueryDO> retrieveOwnerQueryByType (String userId,
+            ResourceType type) throws KustvaktException {
+        ParameterChecker.checkStringValue(userId, "userId");
+
+        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryDO> cq =
+                builder.createQuery(QueryDO.class);
+
+        Root<QueryDO> query = cq.from(QueryDO.class);
+        cq.select(query);
+
+        Predicate p = builder.and(
+                builder.equal(query.get(QueryDO_.createdBy),
+                        userId),
+                builder.equal(query.get(QueryDO_.type), type));
+        cq.where(p);
+
+        Query q = entityManager.createQuery(cq);
+        return q.getResultList();
+    }
+
+    @SuppressWarnings("unchecked")
+    public List<QueryDO> retrieveGroupQueryByUser (String userId, QueryType queryType)
+            throws KustvaktException {
+        ParameterChecker.checkStringValue(userId, "userId");
+
+        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryDO> cq =
+                builder.createQuery(QueryDO.class);
+
+        Root<QueryDO> query = cq.from(QueryDO.class);
+        Join<QueryDO, QueryAccess> access =
+                query.join(QueryDO_.queryAccess);
+
+        // Predicate corpusStatus = builder.and(
+        // builder.notEqual(access.get(QueryAccess_.status),
+        // VirtualCorpusAccessStatus.HIDDEN),
+        // builder.notEqual(access.get(QueryAccess_.status),
+        // VirtualCorpusAccessStatus.DELETED));
+
+        Predicate type = builder
+                .equal(query.get(QueryDO_.queryType), queryType);
+                
+        Predicate accessStatus =
+                builder.notEqual(access.get(QueryAccess_.status),
+                        QueryAccessStatus.DELETED);
+
+        Predicate userGroupStatus =
+                builder.notEqual(access.get(QueryAccess_.userGroup)
+                        .get(UserGroup_.status), UserGroupStatus.DELETED);
+        Join<UserGroup, UserGroupMember> members = access
+                .join(QueryAccess_.userGroup).join(UserGroup_.members);
+
+        Predicate memberStatus = builder.equal(
+                members.get(UserGroupMember_.status), GroupMemberStatus.ACTIVE);
+
+        Predicate user =
+                builder.equal(members.get(UserGroupMember_.userId), userId);
+
+        cq.select(query);
+        cq.where(
+                builder.and(type, accessStatus, userGroupStatus, memberStatus, user));
+
+        Query q = entityManager.createQuery(cq);
+        return q.getResultList();
+    }
+
+    public List<QueryDO> retrieveQueryByUser (String userId,
+            QueryType queryType) throws KustvaktException {
+        ParameterChecker.checkStringValue(userId, "userId");
+        ParameterChecker.checkObjectValue(queryType, "queryType");
+
+        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryDO> criteriaQuery =
+                builder.createQuery(QueryDO.class);
+
+        Root<QueryDO> query = criteriaQuery.from(QueryDO.class);
+        Predicate predicate = builder.and(
+                builder.equal(query.get(QueryDO_.queryType),
+                        queryType),
+                builder.or(builder.equal(
+                        query.get(QueryDO_.createdBy), userId),
+                        builder.equal(query.get(QueryDO_.type),
+                                ResourceType.SYSTEM)));
+
+        criteriaQuery.select(query);
+        criteriaQuery.where(predicate);
+        criteriaQuery.distinct(true);
+        Query q = entityManager.createQuery(criteriaQuery);
+
+        @SuppressWarnings("unchecked")
+        List<QueryDO> queryList = q.getResultList();
+        List<QueryDO> groupQuery = retrieveGroupQueryByUser(userId, queryType);
+        Set<QueryDO> querySet = new HashSet<QueryDO>();
+        querySet.addAll(queryList);
+        querySet.addAll(groupQuery);
+
+        List<QueryDO> merger = new ArrayList<QueryDO>(querySet.size());
+        merger.addAll(querySet);
+        Collections.sort(merger);
+        return merger;
+    }
+
+    // for admins
+    @SuppressWarnings("unchecked")
+    public List<QueryDO> retrieveQueryByGroup (int groupId)
+            throws KustvaktException {
+        ParameterChecker.checkIntegerValue(groupId, "groupId");
+
+        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<QueryDO> criteriaQuery =
+                builder.createQuery(QueryDO.class);
+
+        Root<QueryDO> query = criteriaQuery.from(QueryDO.class);
+        Join<QueryDO, QueryAccess> queryAccess =
+                query.join(QueryDO_.queryAccess);
+        Join<QueryAccess, UserGroup> accessGroup =
+                queryAccess.join(QueryAccess_.userGroup);
+
+        criteriaQuery.select(query);
+        criteriaQuery.where(builder.equal(accessGroup.get(UserGroup_.id), groupId));
+        Query q = entityManager.createQuery(criteriaQuery);
+        return q.getResultList();
+    }
+
+}
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/QueryReferenceDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/QueryReferenceDao.java
deleted file mode 100644
index 0cb4ae7..0000000
--- a/full/src/main/java/de/ids_mannheim/korap/dao/QueryReferenceDao.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package de.ids_mannheim.korap.dao;
-
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.persistence.EntityManager;
-import javax.persistence.NoResultException;
-import javax.persistence.NonUniqueResultException;
-import javax.persistence.PersistenceContext;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.exceptions.StatusCodes;
-
-import de.ids_mannheim.korap.constant.ResourceType;
-import de.ids_mannheim.korap.utils.ParameterChecker;
-
-import de.ids_mannheim.korap.entity.QueryReference;
-import de.ids_mannheim.korap.entity.QueryReference_;
-
-/**
- * QueryReferenceDao manages database queries and transactions
- * regarding query fragments, e.g. retrieving and storing queries
- * for embedding in more complex queries.
- * 
- * Based on VirtualCorpusDao.
- *
- * @author diewald
- *
- */
-
-@Transactional
-@Repository
-public class QueryReferenceDao {
-
-    @PersistenceContext
-    private EntityManager entityManager;
-
-    /**
-     * Create query reference and return ID.
-     * Does not support any access management yet
-     */
-    public int createQuery(
-        String qName,
-        ResourceType type,
-        // CorpusAccess requiredAccess,
-        String koralQuery,
-        String definition,
-        String description,
-        String status,
-        String createdBy
-        ) throws KustvaktException {
-        
-        QueryReference q = new QueryReference();
-        q.setName(qName);
-        q.setType(type);
-        q.setKoralQuery(koralQuery);
-        q.setDefinition(definition);
-        q.setDescription(description);
-        q.setStatus(status);
-        q.setCreatedBy(createdBy);
-
-        // Maybe unused
-        q.setRequiredAccess("");
-
-        entityManager.persist(q);
-        return q.getId();
-    };
-
-
-    /**
-     * Retrieve a single query reference based on its name.
-     */
-    public QueryReference retrieveQueryByName (String qName, String createdBy)
-        throws KustvaktException {
-        ParameterChecker.checkStringValue(createdBy, "createdBy");
-        ParameterChecker.checkStringValue(qName, "q");
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<QueryReference> query =
-            builder.createQuery(QueryReference.class);
-
-        Root<QueryReference> qref = query.from(QueryReference.class);
-
-        Predicate condition = builder.and(
-            builder.equal(qref.get(QueryReference_.createdBy),
-                          createdBy),
-            builder.equal(qref.get(QueryReference_.name), qName));
-
-        query.select(qref);
-        query.where(condition);
-
-        Query q = entityManager.createQuery(query);
-        QueryReference qr = null;
-        try {
-            qr = (QueryReference) q.getSingleResult();
-        }
-        catch (NoResultException e) {
-            return null;
-        }
-        catch (NonUniqueResultException e) {
-            String refCode = createdBy + "/" + qName;
-            throw new KustvaktException(StatusCodes.NON_UNIQUE_RESULT_FOUND,
-                    "Non unique result found for query: retrieve virtual corpus by name "
-                            + refCode,
-                    String.valueOf(refCode), e);
-        }
-        return qr;
-    };
-
-    /**
-     * Remove a query reference from the database.
-     */
-    public void deleteQueryReference (QueryReference q)
-            throws KustvaktException {
-        if (!entityManager.contains(q)) {
-            q = entityManager.merge(q);
-        }
-        entityManager.remove(q);
-    }
-};
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java
index 7564121..6527d37 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java
@@ -22,16 +22,16 @@
 import de.ids_mannheim.korap.constant.GroupMemberStatus;
 import de.ids_mannheim.korap.constant.PredefinedRole;
 import de.ids_mannheim.korap.constant.UserGroupStatus;
-import de.ids_mannheim.korap.constant.VirtualCorpusAccessStatus;
+import de.ids_mannheim.korap.constant.QueryAccessStatus;
 import de.ids_mannheim.korap.entity.Role;
 import de.ids_mannheim.korap.entity.UserGroup;
 import de.ids_mannheim.korap.entity.UserGroupMember;
 import de.ids_mannheim.korap.entity.UserGroupMember_;
 import de.ids_mannheim.korap.entity.UserGroup_;
-import de.ids_mannheim.korap.entity.VirtualCorpus;
-import de.ids_mannheim.korap.entity.VirtualCorpusAccess;
-import de.ids_mannheim.korap.entity.VirtualCorpusAccess_;
-import de.ids_mannheim.korap.entity.VirtualCorpus_;
+import de.ids_mannheim.korap.entity.QueryDO;
+import de.ids_mannheim.korap.entity.QueryAccess;
+import de.ids_mannheim.korap.entity.QueryAccess_;
+import de.ids_mannheim.korap.entity.QueryDO_;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.utils.ParameterChecker;
@@ -72,7 +72,7 @@
         roles.add(roleDao
                 .retrieveRoleById(PredefinedRole.USER_GROUP_ADMIN.getId()));
         roles.add(roleDao
-                .retrieveRoleById(PredefinedRole.VC_ACCESS_ADMIN.getId()));
+                .retrieveRoleById(PredefinedRole.QUERY_ACCESS_ADMIN.getId()));
 
         UserGroupMember owner = new UserGroupMember();
         owner.setUserId(createdBy);
@@ -233,37 +233,37 @@
         }
     }
 
-    public UserGroup retrieveHiddenGroupByVC (int vcId)
+    public UserGroup retrieveHiddenGroupByQuery (int queryId)
             throws KustvaktException {
-        ParameterChecker.checkIntegerValue(vcId, "vcId");
+        ParameterChecker.checkIntegerValue(queryId, "queryId");
 
         CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<UserGroup> query =
+        CriteriaQuery<UserGroup> criteriaQuery =
                 criteriaBuilder.createQuery(UserGroup.class);
 
-        Root<UserGroup> root = query.from(UserGroup.class);
-        Join<UserGroup, VirtualCorpusAccess> access =
-                root.join(UserGroup_.virtualCorpusAccess);
-        Join<VirtualCorpusAccess, VirtualCorpus> vc =
-                access.join(VirtualCorpusAccess_.virtualCorpus);
+        Root<UserGroup> root = criteriaQuery.from(UserGroup.class);
+        Join<UserGroup, QueryAccess> access =
+                root.join(UserGroup_.queryAccess);
+        Join<QueryAccess, QueryDO> query =
+                access.join(QueryAccess_.query);
 
         Predicate p = criteriaBuilder.and(
                 criteriaBuilder.equal(root.get(UserGroup_.status),
                         UserGroupStatus.HIDDEN),
-                criteriaBuilder.equal(vc.get(VirtualCorpus_.id), vcId));
+                criteriaBuilder.equal(query.get(QueryDO_.id), queryId));
 
-        query.select(root);
-        query.where(p);
-        Query q = entityManager.createQuery(query);
+        criteriaQuery.select(root);
+        criteriaQuery.where(p);
+        Query q = entityManager.createQuery(criteriaQuery);
 
         try {
             return (UserGroup) q.getSingleResult();
         }
         catch (NoResultException e) {
             throw new KustvaktException(StatusCodes.NO_RESULT_FOUND,
-                    "No hidden group for virtual corpus with id " + vcId
+                    "No hidden group for query with id " + queryId
                             + " is found",
-                    String.valueOf(vcId), e);
+                    String.valueOf(queryId), e);
         }
 
     }
@@ -325,51 +325,51 @@
 
     }
 
-    public void addVCToGroup (VirtualCorpus virtualCorpus, String createdBy,
-            VirtualCorpusAccessStatus status, UserGroup group) {
-        VirtualCorpusAccess accessGroup = new VirtualCorpusAccess();
+    public void addQueryToGroup (QueryDO query, String createdBy,
+            QueryAccessStatus status, UserGroup group) {
+        QueryAccess accessGroup = new QueryAccess();
         accessGroup.setCreatedBy(createdBy);
         accessGroup.setStatus(status);
         accessGroup.setUserGroup(group);
-        accessGroup.setVirtualCorpus(virtualCorpus);
+        accessGroup.setQuery(query);;
         entityManager.persist(accessGroup);
     }
 
-    public void addVCToGroup (List<VirtualCorpus> virtualCorpora,
+    public void addQueryToGroup (List<QueryDO> queries,
             String createdBy, UserGroup group,
-            VirtualCorpusAccessStatus status) {
+            QueryAccessStatus status) {
 
-        for (VirtualCorpus vc : virtualCorpora) {
-            addVCToGroup(vc, createdBy, status, group);
+        for (QueryDO q : queries) {
+            addQueryToGroup(q, createdBy, status, group);
         }
     }
 
-    public void deleteVCFromGroup (int virtualCorpusId, int groupId)
+    public void deleteQueryFromGroup (int queryId, int groupId)
             throws KustvaktException {
-        ParameterChecker.checkIntegerValue(virtualCorpusId, "virtualCorpusId");
+        ParameterChecker.checkIntegerValue(queryId, "queryId");
         ParameterChecker.checkIntegerValue(groupId, "groupId");
 
         CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpusAccess> query =
-                criteriaBuilder.createQuery(VirtualCorpusAccess.class);
+        CriteriaQuery<QueryAccess> criteriaQuery =
+                criteriaBuilder.createQuery(QueryAccess.class);
 
-        Root<VirtualCorpusAccess> root = query.from(VirtualCorpusAccess.class);
-        Join<VirtualCorpusAccess, VirtualCorpus> vc =
-                root.join(VirtualCorpusAccess_.virtualCorpus);
-        Join<VirtualCorpusAccess, UserGroup> group =
-                root.join(VirtualCorpusAccess_.userGroup);
+        Root<QueryAccess> root = criteriaQuery.from(QueryAccess.class);
+        Join<QueryAccess, QueryDO> queryAccess =
+                root.join(QueryAccess_.query);
+        Join<QueryAccess, UserGroup> group =
+                root.join(QueryAccess_.userGroup);
 
-        Predicate virtualCorpus = criteriaBuilder
-                .equal(vc.get(VirtualCorpus_.id), virtualCorpusId);
+        Predicate query = criteriaBuilder
+                .equal(queryAccess.get(QueryDO_.id), queryId);
         Predicate userGroup =
                 criteriaBuilder.equal(group.get(UserGroup_.id), groupId);
 
-        query.select(root);
-        query.where(criteriaBuilder.and(virtualCorpus, userGroup));
-        Query q = entityManager.createQuery(query);
-        VirtualCorpusAccess vcAccess =
-                (VirtualCorpusAccess) q.getSingleResult();
-        entityManager.remove(vcAccess);
+        criteriaQuery.select(root);
+        criteriaQuery.where(criteriaBuilder.and(query, userGroup));
+        Query q = entityManager.createQuery(criteriaQuery);
+        QueryAccess access =
+                (QueryAccess) q.getSingleResult();
+        entityManager.remove(access);
     }
 
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusAccessDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusAccessDao.java
deleted file mode 100644
index 3b372ab..0000000
--- a/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusAccessDao.java
+++ /dev/null
@@ -1,266 +0,0 @@
-package de.ids_mannheim.korap.dao;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.NoResultException;
-import javax.persistence.PersistenceContext;
-import javax.persistence.Query;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-import de.ids_mannheim.korap.constant.VirtualCorpusAccessStatus;
-import de.ids_mannheim.korap.entity.UserGroup;
-import de.ids_mannheim.korap.entity.UserGroup_;
-import de.ids_mannheim.korap.entity.VirtualCorpus;
-import de.ids_mannheim.korap.entity.VirtualCorpusAccess;
-import de.ids_mannheim.korap.entity.VirtualCorpusAccess_;
-import de.ids_mannheim.korap.entity.VirtualCorpus_;
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.exceptions.StatusCodes;
-import de.ids_mannheim.korap.oauth2.constant.OAuth2Error;
-import de.ids_mannheim.korap.utils.ParameterChecker;
-
-/**
- * Manages database queries and transactions regarding
- * {@link VirtualCorpusAccess} entity and its corresponding database
- * table.
- * 
- * @author margaretha
- *
- * @see VirtualCorpusAccess
- * @see VirtualCorpus
- */
-@Transactional
-@Repository
-public class VirtualCorpusAccessDao {
-
-    @PersistenceContext
-    private EntityManager entityManager;
-
-    public VirtualCorpusAccess retrieveAccessById (int accessId)
-            throws KustvaktException {
-        ParameterChecker.checkIntegerValue(accessId, "accessId");
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpusAccess> query =
-                builder.createQuery(VirtualCorpusAccess.class);
-
-        Root<VirtualCorpusAccess> access =
-                query.from(VirtualCorpusAccess.class);
-        query.select(access);
-        query.where(
-                builder.equal(access.get(VirtualCorpusAccess_.id), accessId));
-        Query q = entityManager.createQuery(query);
-        try{
-            return (VirtualCorpusAccess) q.getSingleResult();
-        }
-        catch (NoResultException e) {
-            throw new KustvaktException(StatusCodes.NO_RESOURCE_FOUND,
-                    "Virtual corpus access is not found",
-                    String.valueOf(accessId));
-        }
-    }
-
-    // for vca admins
-    public List<VirtualCorpusAccess> retrieveActiveAccessByVC (int vcId)
-            throws KustvaktException {
-        ParameterChecker.checkIntegerValue(vcId, "vcId");
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpusAccess> query =
-                builder.createQuery(VirtualCorpusAccess.class);
-
-        Root<VirtualCorpusAccess> access =
-                query.from(VirtualCorpusAccess.class);
-        Join<VirtualCorpusAccess, VirtualCorpus> accessVC =
-                access.join(VirtualCorpusAccess_.virtualCorpus);
-
-        Predicate p = builder.and(
-                builder.equal(accessVC.get(VirtualCorpus_.id), vcId),
-                builder.equal(access.get(VirtualCorpusAccess_.status),
-                        VirtualCorpusAccessStatus.ACTIVE));
-        query.select(access);
-        query.where(p);
-        TypedQuery<VirtualCorpusAccess> q = entityManager.createQuery(query);
-        return q.getResultList();
-    }
-
-    public List<VirtualCorpusAccess> retrieveActiveAccessByVC (String vcCreator,
-            String vcName) throws KustvaktException {
-        ParameterChecker.checkStringValue(vcCreator, "vcCreator");
-        ParameterChecker.checkStringValue(vcCreator, "vcName");
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpusAccess> query =
-                builder.createQuery(VirtualCorpusAccess.class);
-
-        Root<VirtualCorpusAccess> access =
-                query.from(VirtualCorpusAccess.class);
-        Join<VirtualCorpusAccess, VirtualCorpus> accessVC =
-                access.join(VirtualCorpusAccess_.virtualCorpus);
-
-        Predicate p = builder.and(
-                builder.equal(accessVC.get(VirtualCorpus_.name), vcName),
-                builder.equal(accessVC.get(VirtualCorpus_.createdBy), vcCreator),
-                builder.equal(access.get(VirtualCorpusAccess_.status),
-                        VirtualCorpusAccessStatus.ACTIVE));
-        query.select(access);
-        query.where(p);
-        TypedQuery<VirtualCorpusAccess> q = entityManager.createQuery(query);
-        return q.getResultList();
-    }
-    
-    public List<VirtualCorpusAccess> retrieveAllAccess ()
-            throws KustvaktException {
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpusAccess> query =
-                builder.createQuery(VirtualCorpusAccess.class);
-        Root<VirtualCorpusAccess> access =
-                query.from(VirtualCorpusAccess.class);
-        query.select(access);
-        TypedQuery<VirtualCorpusAccess> q = entityManager.createQuery(query);
-        return q.getResultList();
-    }
-
-    public List<VirtualCorpusAccess> retrieveAllAccessByVC (String vcCreator,
-            String vcName) throws KustvaktException {
-        ParameterChecker.checkStringValue(vcCreator, "vcCreator");
-        ParameterChecker.checkStringValue(vcCreator, "vcName");
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpusAccess> query =
-                builder.createQuery(VirtualCorpusAccess.class);
-
-        Root<VirtualCorpusAccess> access =
-                query.from(VirtualCorpusAccess.class);
-        Join<VirtualCorpusAccess, VirtualCorpus> accessVC =
-                access.join(VirtualCorpusAccess_.virtualCorpus);
-
-        Predicate conditions = builder.and(
-                builder.equal(accessVC.get(VirtualCorpus_.createdBy),
-                        vcCreator),
-                builder.equal(accessVC.get(VirtualCorpus_.name), vcName));
-        query.select(access);
-        query.where(conditions);
-        TypedQuery<VirtualCorpusAccess> q = entityManager.createQuery(query);
-        return q.getResultList();
-    }
-
-    public List<VirtualCorpusAccess> retrieveAllAccessByGroup (int groupId)
-            throws KustvaktException {
-        ParameterChecker.checkIntegerValue(groupId, "groupId");
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpusAccess> query =
-                builder.createQuery(VirtualCorpusAccess.class);
-
-        Root<VirtualCorpusAccess> access =
-                query.from(VirtualCorpusAccess.class);
-        Join<VirtualCorpusAccess, UserGroup> accessVC =
-                access.join(VirtualCorpusAccess_.userGroup);
-
-        query.select(access);
-        query.where(builder.equal(accessVC.get(UserGroup_.id), groupId));
-        TypedQuery<VirtualCorpusAccess> q = entityManager.createQuery(query);
-        return q.getResultList();
-    }
-
-    public List<VirtualCorpusAccess> retrieveActiveAccessByGroup (int groupId)
-            throws KustvaktException {
-        ParameterChecker.checkIntegerValue(groupId, "groupId");
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpusAccess> query =
-                builder.createQuery(VirtualCorpusAccess.class);
-
-        Root<VirtualCorpusAccess> access =
-                query.from(VirtualCorpusAccess.class);
-        Join<VirtualCorpusAccess, UserGroup> accessVC =
-                access.join(VirtualCorpusAccess_.userGroup);
-
-        Predicate p =
-                builder.and(builder.equal(accessVC.get(UserGroup_.id), groupId),
-                        builder.equal(access.get(VirtualCorpusAccess_.status),
-                                VirtualCorpusAccessStatus.ACTIVE));
-
-        query.select(access);
-        query.where(p);
-        TypedQuery<VirtualCorpusAccess> q = entityManager.createQuery(query);
-        return q.getResultList();
-    }
-
-    /**
-     * Hidden accesses are only created for published or system VC.
-     * 
-     * Warn: The actual hidden accesses are not checked.
-     * 
-     * @param vcId
-     *            vcId
-     * @return true if there is a hidden access, false otherwise
-     * @throws KustvaktException
-     */
-    public VirtualCorpusAccess retrieveHiddenAccess (int vcId)
-            throws KustvaktException {
-        ParameterChecker.checkIntegerValue(vcId, "vcId");
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpusAccess> query =
-                builder.createQuery(VirtualCorpusAccess.class);
-
-        Root<VirtualCorpusAccess> access =
-                query.from(VirtualCorpusAccess.class);
-        Join<VirtualCorpusAccess, VirtualCorpus> accessVC =
-                access.join(VirtualCorpusAccess_.virtualCorpus);
-
-        Predicate p = builder.and(
-                builder.equal(accessVC.get(VirtualCorpus_.id), vcId),
-                builder.equal(access.get(VirtualCorpusAccess_.status),
-                        VirtualCorpusAccessStatus.HIDDEN)
-        // ,
-        // builder.notEqual(access.get(VirtualCorpusAccess_.deletedBy),
-        // "NULL")
-        );
-
-        query.select(access);
-        query.where(p);
-
-        try {
-            Query q = entityManager.createQuery(query);
-            return (VirtualCorpusAccess) q.getSingleResult();
-        }
-        catch (NoResultException e) {
-            return null;
-        }
-    }
-
-    public void createAccessToVC (VirtualCorpus virtualCorpus,
-            UserGroup userGroup, String createdBy,
-            VirtualCorpusAccessStatus status) {
-        VirtualCorpusAccess vca = new VirtualCorpusAccess();
-        vca.setVirtualCorpus(virtualCorpus);
-        vca.setUserGroup(userGroup);
-        vca.setCreatedBy(createdBy);
-        vca.setStatus(status);
-        entityManager.persist(vca);
-    }
-
-    public void deleteAccess (VirtualCorpusAccess access, String deletedBy) {
-        // soft delete
-
-        // hard delete
-        if (!entityManager.contains(access)) {
-            access = entityManager.merge(access);
-        }
-        entityManager.remove(access);
-    }
-
-}
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusDao.java
deleted file mode 100644
index e4f02fa..0000000
--- a/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusDao.java
+++ /dev/null
@@ -1,382 +0,0 @@
-package de.ids_mannheim.korap.dao;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.persistence.EntityManager;
-import javax.persistence.NoResultException;
-import javax.persistence.NonUniqueResultException;
-import javax.persistence.PersistenceContext;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-import de.ids_mannheim.korap.constant.GroupMemberStatus;
-import de.ids_mannheim.korap.constant.QueryType;
-import de.ids_mannheim.korap.constant.ResourceType;
-import de.ids_mannheim.korap.constant.UserGroupStatus;
-import de.ids_mannheim.korap.constant.VirtualCorpusAccessStatus;
-import de.ids_mannheim.korap.entity.UserGroup;
-import de.ids_mannheim.korap.entity.UserGroupMember;
-import de.ids_mannheim.korap.entity.UserGroupMember_;
-import de.ids_mannheim.korap.entity.UserGroup_;
-import de.ids_mannheim.korap.entity.VirtualCorpus;
-import de.ids_mannheim.korap.entity.VirtualCorpusAccess;
-import de.ids_mannheim.korap.entity.VirtualCorpusAccess_;
-import de.ids_mannheim.korap.entity.VirtualCorpus_;
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.exceptions.StatusCodes;
-import de.ids_mannheim.korap.user.User.CorpusAccess;
-import de.ids_mannheim.korap.utils.ParameterChecker;
-
-/**
- * VirtualCorpusDao manages database queries and transactions
- * regarding virtual corpora, e.g. retrieving and storing virtual
- * corpora.
- * 
- * @author margaretha
- *
- */
-@Transactional
-@Repository
-public class VirtualCorpusDao {
-
-    @PersistenceContext
-    private EntityManager entityManager;
-
-    public int createVirtualCorpus (String name, ResourceType type,
-            QueryType queryType, CorpusAccess requiredAccess, String koralQuery,
-            String definition, String description, String status,
-            boolean isCached, String createdBy, String query,
-            String queryLanguage) throws KustvaktException {
-
-        VirtualCorpus vc = new VirtualCorpus();
-        vc.setName(name);
-        vc.setType(type);
-        vc.setQueryType(queryType);
-        vc.setRequiredAccess(requiredAccess);
-        vc.setKoralQuery(koralQuery);
-        vc.setDefinition(definition);
-        vc.setDescription(description);
-        vc.setStatus(status);
-        vc.setCreatedBy(createdBy);
-        vc.setCached(isCached);
-        vc.setQuery(query);
-        vc.setQueryLanguage(queryLanguage);
-
-        entityManager.persist(vc);
-        return vc.getId();
-    }
-
-    public void editVirtualCorpus (VirtualCorpus vc, String name,
-            ResourceType type, CorpusAccess requiredAccess, String koralQuery,
-            String definition, String description, String status,
-            boolean isCached) throws KustvaktException {
-
-        if (name != null && !name.isEmpty()) {
-            vc.setName(name);
-        }
-        if (type != null) {
-            vc.setType(type);
-        }
-        if (requiredAccess != null) {
-            vc.setRequiredAccess(requiredAccess);
-        }
-        if (koralQuery != null) {
-            vc.setKoralQuery(koralQuery);
-        }
-        if (definition != null && !definition.isEmpty()) {
-            vc.setDefinition(definition);
-        }
-        if (description != null && !description.isEmpty()) {
-            vc.setDescription(description);
-        }
-        if (status != null && !status.isEmpty()) {
-            vc.setStatus(status);
-        }
-        vc.setCached(isCached);
-        entityManager.merge(vc);
-    }
-
-    public void deleteVirtualCorpus (VirtualCorpus vc)
-            throws KustvaktException {
-        if (!entityManager.contains(vc)) {
-            vc = entityManager.merge(vc);
-        }
-        entityManager.remove(vc);
-
-    }
-
-    /**
-     * System admin function.
-     * 
-     * Retrieves virtual corpus by creator and type. If type is not
-     * specified,
-     * retrieves virtual corpora of all types. If createdBy is not
-     * specified,
-     * retrieves virtual corpora of all users.
-     * 
-     * @param type
-     *            {@link ResourceType}
-     * @param createdBy
-     *            username of the virtual corpus creator
-     * @return a list of {@link VirtualCorpus}
-     * @throws KustvaktException
-     */
-    @SuppressWarnings("unchecked")
-    public List<VirtualCorpus> retrieveVCByType (ResourceType type,
-            String createdBy, QueryType queryType) throws KustvaktException {
-
-        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpus> query =
-                criteriaBuilder.createQuery(VirtualCorpus.class);
-        Root<VirtualCorpus> virtualCorpus = query.from(VirtualCorpus.class);
-
-        Predicate conditions = criteriaBuilder
-                .equal(virtualCorpus.get(VirtualCorpus_.queryType), queryType);
-        if (createdBy != null && !createdBy.isEmpty()) {
-            conditions = criteriaBuilder.and(conditions, criteriaBuilder.equal(
-                    virtualCorpus.get(VirtualCorpus_.createdBy), createdBy));
-            if (type != null) {
-                conditions = criteriaBuilder.and(conditions, criteriaBuilder
-                        .equal(virtualCorpus.get(VirtualCorpus_.type), type));
-            }
-        }
-        else if (type != null) {
-            conditions = criteriaBuilder.and(conditions, criteriaBuilder
-                    .equal(virtualCorpus.get(VirtualCorpus_.type), type));
-        }
-
-        query.select(virtualCorpus);
-        query.where(conditions);
-        Query q = entityManager.createQuery(query);
-        return q.getResultList();
-    }
-
-    public VirtualCorpus retrieveVCById (int id) throws KustvaktException {
-        ParameterChecker.checkIntegerValue(id, "id");
-
-        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpus> query =
-                criteriaBuilder.createQuery(VirtualCorpus.class);
-        Root<VirtualCorpus> virtualCorpus = query.from(VirtualCorpus.class);
-        query.select(virtualCorpus);
-        query.where(criteriaBuilder.equal(virtualCorpus.get(VirtualCorpus_.id),
-                id));
-
-        VirtualCorpus vc = null;
-        try {
-            Query q = entityManager.createQuery(query);
-            vc = (VirtualCorpus) q.getSingleResult();
-        }
-        catch (NoResultException e) {
-            throw new KustvaktException(StatusCodes.NO_RESOURCE_FOUND,
-                    "Virtual corpus with id: " + id + " is not found",
-                    String.valueOf(id), e);
-        }
-        return vc;
-    }
-
-    public VirtualCorpus retrieveVCByName (String vcName, String createdBy)
-            throws KustvaktException {
-        ParameterChecker.checkStringValue(createdBy, "createdBy");
-        ParameterChecker.checkStringValue(vcName, "vcName");
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpus> query =
-                builder.createQuery(VirtualCorpus.class);
-
-        Root<VirtualCorpus> virtualCorpus = query.from(VirtualCorpus.class);
-
-        Predicate condition = builder.and(
-                builder.equal(virtualCorpus.get(VirtualCorpus_.createdBy),
-                        createdBy),
-                builder.equal(virtualCorpus.get(VirtualCorpus_.name), vcName));
-
-        query.select(virtualCorpus);
-        query.where(condition);
-
-        Query q = entityManager.createQuery(query);
-        VirtualCorpus vc = null;
-        try {
-            vc = (VirtualCorpus) q.getSingleResult();
-        }
-        catch (NoResultException e) {
-            return null;
-            // String vcCode = createdBy + "/" + vcName;
-            // throw new
-            // KustvaktException(StatusCodes.NO_RESULT_FOUND,
-            // "No result found for query: retrieve virtual corpus by
-            // name "
-            // + vcCode,
-            // String.valueOf(vcCode), e);
-        }
-        catch (NonUniqueResultException e) {
-            String vcCode = createdBy + "/" + vcName;
-            throw new KustvaktException(StatusCodes.NON_UNIQUE_RESULT_FOUND,
-                    "Non unique result found for query: retrieve virtual corpus by name "
-                            + vcCode,
-                    String.valueOf(vcCode), e);
-        }
-        return vc;
-    }
-
-    @SuppressWarnings("unchecked")
-    public List<VirtualCorpus> retrieveOwnerVC (String userId,
-            QueryType queryType) throws KustvaktException {
-        ParameterChecker.checkStringValue(userId, "userId");
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpus> query =
-                builder.createQuery(VirtualCorpus.class);
-
-        Root<VirtualCorpus> virtualCorpus = query.from(VirtualCorpus.class);
-        Predicate conditions = builder.and(
-                builder.equal(virtualCorpus.get(VirtualCorpus_.createdBy),
-                        userId),
-                builder.equal(virtualCorpus.get(VirtualCorpus_.queryType),
-                        queryType));
-
-        query.select(virtualCorpus);
-        query.where(conditions);
-
-        Query q = entityManager.createQuery(query);
-        return q.getResultList();
-    }
-
-    @SuppressWarnings("unchecked")
-    public List<VirtualCorpus> retrieveOwnerVCByType (String userId,
-            ResourceType type) throws KustvaktException {
-        ParameterChecker.checkStringValue(userId, "userId");
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpus> query =
-                builder.createQuery(VirtualCorpus.class);
-
-        Root<VirtualCorpus> virtualCorpus = query.from(VirtualCorpus.class);
-        query.select(virtualCorpus);
-
-        Predicate p = builder.and(
-                builder.equal(virtualCorpus.get(VirtualCorpus_.createdBy),
-                        userId),
-                builder.equal(virtualCorpus.get(VirtualCorpus_.type), type));
-        query.where(p);
-
-        Query q = entityManager.createQuery(query);
-        return q.getResultList();
-    }
-
-    @SuppressWarnings("unchecked")
-    public List<VirtualCorpus> retrieveGroupVCByUser (String userId, QueryType queryType)
-            throws KustvaktException {
-        ParameterChecker.checkStringValue(userId, "userId");
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpus> query =
-                builder.createQuery(VirtualCorpus.class);
-
-        Root<VirtualCorpus> virtualCorpus = query.from(VirtualCorpus.class);
-        Join<VirtualCorpus, VirtualCorpusAccess> access =
-                virtualCorpus.join(VirtualCorpus_.virtualCorpusAccess);
-
-        // Predicate corpusStatus = builder.and(
-        // builder.notEqual(access.get(VirtualCorpusAccess_.status),
-        // VirtualCorpusAccessStatus.HIDDEN),
-        // builder.notEqual(access.get(VirtualCorpusAccess_.status),
-        // VirtualCorpusAccessStatus.DELETED));
-
-        Predicate type = builder
-                .equal(virtualCorpus.get(VirtualCorpus_.queryType), queryType);
-                
-        Predicate corpusStatus =
-                builder.notEqual(access.get(VirtualCorpusAccess_.status),
-                        VirtualCorpusAccessStatus.DELETED);
-
-        Predicate userGroupStatus =
-                builder.notEqual(access.get(VirtualCorpusAccess_.userGroup)
-                        .get(UserGroup_.status), UserGroupStatus.DELETED);
-        Join<UserGroup, UserGroupMember> members = access
-                .join(VirtualCorpusAccess_.userGroup).join(UserGroup_.members);
-
-        Predicate memberStatus = builder.equal(
-                members.get(UserGroupMember_.status), GroupMemberStatus.ACTIVE);
-
-        Predicate user =
-                builder.equal(members.get(UserGroupMember_.userId), userId);
-
-        query.select(virtualCorpus);
-        query.where(
-                builder.and(type, corpusStatus, userGroupStatus, memberStatus, user));
-
-        Query q = entityManager.createQuery(query);
-        return q.getResultList();
-    }
-
-    public List<VirtualCorpus> retrieveVCByUser (String userId,
-            QueryType queryType) throws KustvaktException {
-        ParameterChecker.checkStringValue(userId, "userId");
-        ParameterChecker.checkObjectValue(queryType, "queryType");
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpus> query =
-                builder.createQuery(VirtualCorpus.class);
-
-        Root<VirtualCorpus> virtualCorpus = query.from(VirtualCorpus.class);
-        Predicate predicate = builder.and(
-                builder.equal(virtualCorpus.get(VirtualCorpus_.queryType),
-                        queryType),
-                builder.or(builder.equal(
-                        virtualCorpus.get(VirtualCorpus_.createdBy), userId),
-                        builder.equal(virtualCorpus.get(VirtualCorpus_.type),
-                                ResourceType.SYSTEM)));
-
-        query.select(virtualCorpus);
-        query.where(predicate);
-        query.distinct(true);
-        Query q = entityManager.createQuery(query);
-
-        @SuppressWarnings("unchecked")
-        List<VirtualCorpus> vcList = q.getResultList();
-        List<VirtualCorpus> groupVC = retrieveGroupVCByUser(userId, queryType);
-        Set<VirtualCorpus> vcSet = new HashSet<VirtualCorpus>();
-        vcSet.addAll(vcList);
-        vcSet.addAll(groupVC);
-
-        List<VirtualCorpus> merger = new ArrayList<VirtualCorpus>(vcSet.size());
-        merger.addAll(vcSet);
-        Collections.sort(merger);
-        return merger;
-    }
-
-    // for admins
-    @SuppressWarnings("unchecked")
-    public List<VirtualCorpus> retrieveVCByGroup (int groupId)
-            throws KustvaktException {
-        ParameterChecker.checkIntegerValue(groupId, "groupId");
-
-        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
-        CriteriaQuery<VirtualCorpus> query =
-                builder.createQuery(VirtualCorpus.class);
-
-        Root<VirtualCorpus> virtualCorpus = query.from(VirtualCorpus.class);
-        Join<VirtualCorpus, VirtualCorpusAccess> corpusAccess =
-                virtualCorpus.join(VirtualCorpus_.virtualCorpusAccess);
-        Join<VirtualCorpusAccess, UserGroup> accessGroup =
-                corpusAccess.join(VirtualCorpusAccess_.userGroup);
-
-        query.select(virtualCorpus);
-        query.where(builder.equal(accessGroup.get(UserGroup_.id), groupId));
-        Query q = entityManager.createQuery(query);
-        return q.getResultList();
-    }
-
-}
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/VirtualCorpusAccessDto.java b/full/src/main/java/de/ids_mannheim/korap/dto/QueryAccessDto.java
similarity index 64%
rename from full/src/main/java/de/ids_mannheim/korap/dto/VirtualCorpusAccessDto.java
rename to full/src/main/java/de/ids_mannheim/korap/dto/QueryAccessDto.java
index d79b7d3..9687317 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/VirtualCorpusAccessDto.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/QueryAccessDto.java
@@ -4,7 +4,7 @@
 import lombok.Setter;
 
 /**
- * Defines the structure of virtual corpus accesses, e.g. as JSON
+ * Defines the structure of query accesses, e.g. as JSON
  * objects in HTTP Responses.
  * 
  * @author margaretha
@@ -12,18 +12,18 @@
  */
 @Getter
 @Setter
-public class VirtualCorpusAccessDto {
+public class QueryAccessDto {
     private int accessId;
     private String createdBy;
-    private int vcId;
-    private String vcName;
+    private int queryId;
+    private String queryName;
     private int userGroupId;
     private String userGroupName;
 
     @Override
     public String toString () {
-        return "accessId=" + accessId + ", createdBy=" + createdBy + " , vcId="
-                + vcId + ", vcName=" + vcName + ", userGroupId=" + userGroupId
+        return "accessId=" + accessId + ", createdBy=" + createdBy + " , queryId="
+                + queryId + ", queryName=" + queryName + ", userGroupId=" + userGroupId
                 + ", userGroupName=" + userGroupName;
     }
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/VirtualCorpusDto.java b/full/src/main/java/de/ids_mannheim/korap/dto/QueryDto.java
similarity index 83%
rename from full/src/main/java/de/ids_mannheim/korap/dto/VirtualCorpusDto.java
rename to full/src/main/java/de/ids_mannheim/korap/dto/QueryDto.java
index f6863c4..fe221cf 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/VirtualCorpusDto.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/QueryDto.java
@@ -4,11 +4,11 @@
 import com.fasterxml.jackson.annotation.JsonInclude.Include;
 import com.fasterxml.jackson.databind.JsonNode;
 
-import de.ids_mannheim.korap.entity.VirtualCorpus;
+import de.ids_mannheim.korap.entity.QueryDO;
 import lombok.Getter;
 import lombok.Setter;
 
-/** Defines the structure of {@link VirtualCorpus} description to be 
+/** Defines the structure of {@link QueryDO} description to be 
  *  sent as JSON objects in HTTP responses. 
  * 
  * @author margaretha
@@ -17,7 +17,7 @@
 @Getter
 @Setter
 @JsonInclude(Include.NON_DEFAULT)
-public class VirtualCorpusDto {
+public class QueryDto {
 
     private int id;
     private String name;
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/converter/QueryAccessConverter.java b/full/src/main/java/de/ids_mannheim/korap/dto/converter/QueryAccessConverter.java
new file mode 100644
index 0000000..5dfad63
--- /dev/null
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/converter/QueryAccessConverter.java
@@ -0,0 +1,42 @@
+package de.ids_mannheim.korap.dto.converter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import de.ids_mannheim.korap.dto.QueryAccessDto;
+import de.ids_mannheim.korap.entity.QueryAccess;
+
+/**
+ * QueryAccessConverter prepares data transfer objects (DTOs)
+ * from {@link QueryAccess} entities. DTO structure defines
+ * controllers output, namely the structure of JSON objects in HTTP
+ * responses.
+ * 
+ * @author margaretha
+ *
+ */
+@Component
+public class QueryAccessConverter {
+
+    public List<QueryAccessDto> createQueryAccessDto (
+            List<QueryAccess> accessList) {
+        List<QueryAccessDto> dtos = new ArrayList<>(accessList.size());
+        for (QueryAccess access : accessList) {
+            QueryAccessDto dto = new QueryAccessDto();
+            dto.setAccessId(access.getId());
+            dto.setCreatedBy(access.getCreatedBy());
+
+            dto.setQueryId(access.getQuery().getId());
+            dto.setQueryName(access.getQuery().getName());
+
+            dto.setUserGroupId(access.getUserGroup().getId());
+            dto.setUserGroupName(access.getUserGroup().getName());
+
+            dtos.add(dto);
+        }
+        return dtos;
+    }
+
+}
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/converter/QueryConverter.java b/full/src/main/java/de/ids_mannheim/korap/dto/converter/QueryConverter.java
new file mode 100644
index 0000000..4d9052e
--- /dev/null
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/converter/QueryConverter.java
@@ -0,0 +1,51 @@
+package de.ids_mannheim.korap.dto.converter;
+
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+import de.ids_mannheim.korap.dto.QueryDto;
+import de.ids_mannheim.korap.entity.QueryDO;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.utils.JsonUtils;
+
+/**
+ * QueryConverter prepares data transfer objects (DTOs) from
+ * {@link QueryDO} entities. DTO structure defines controllers
+ * output, namely the structure of JSON objects in HTTP responses.
+ * 
+ * @author margaretha
+ *
+ */
+@Component
+public class QueryConverter {
+
+    public QueryDto createQueryDto (QueryDO query,
+            String statistics) throws KustvaktException {
+
+        QueryDto dto = new QueryDto();
+        dto.setId(query.getId());
+        dto.setName(query.getName());
+        dto.setCreatedBy(query.getCreatedBy());
+        dto.setRequiredAccess(query.getRequiredAccess().name());
+        dto.setStatus(query.getStatus());
+        dto.setDescription(query.getDescription());
+        dto.setType(query.getType().displayName());
+        
+        dto.setQuery(query.getQuery());
+        dto.setQueryLanguage(query.getQueryLanguage());
+        
+        JsonNode kq = JsonUtils.readTree(query.getKoralQuery());
+        dto.setKoralQuery(kq);
+        
+        if (statistics != null) {
+            JsonNode node = JsonUtils.readTree(statistics);
+            dto.setNumberOfDoc(node.at("/documents").asInt());
+            dto.setNumberOfParagraphs(node.at("/paragraphs").asInt());
+            dto.setNumberOfSentences(node.at("/sentences").asInt());
+            dto.setNumberOfTokens(node.at("/tokens").asInt());
+        }
+        return dto;
+
+    }
+}
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusAccessConverter.java b/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusAccessConverter.java
deleted file mode 100644
index 74ebeec..0000000
--- a/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusAccessConverter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package de.ids_mannheim.korap.dto.converter;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.springframework.stereotype.Component;
-
-import de.ids_mannheim.korap.dto.VirtualCorpusAccessDto;
-import de.ids_mannheim.korap.entity.VirtualCorpusAccess;
-
-/**
- * VirtualCorpusAccessConverter prepares data transfer objects (DTOs)
- * from {@link VirtualCorpusAccess} entities. DTO structure defines
- * controllers output, namely the structure of JSON objects in HTTP
- * responses.
- * 
- * @author margaretha
- *
- */
-@Component
-public class VirtualCorpusAccessConverter {
-
-    public List<VirtualCorpusAccessDto> createVCADto (
-            List<VirtualCorpusAccess> accessList) {
-        List<VirtualCorpusAccessDto> dtos = new ArrayList<>(accessList.size());
-        for (VirtualCorpusAccess access : accessList) {
-            VirtualCorpusAccessDto dto = new VirtualCorpusAccessDto();
-            dto.setAccessId(access.getId());
-            dto.setCreatedBy(access.getCreatedBy());
-
-            dto.setVcId(access.getVirtualCorpus().getId());
-            dto.setVcName(access.getVirtualCorpus().getName());
-
-            dto.setUserGroupId(access.getUserGroup().getId());
-            dto.setUserGroupName(access.getUserGroup().getName());
-
-            dtos.add(dto);
-        }
-        return dtos;
-    }
-
-}
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java b/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java
deleted file mode 100644
index 974c6b9..0000000
--- a/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package de.ids_mannheim.korap.dto.converter;
-
-import org.springframework.stereotype.Component;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-import de.ids_mannheim.korap.dto.VirtualCorpusDto;
-import de.ids_mannheim.korap.entity.VirtualCorpus;
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.utils.JsonUtils;
-
-/**
- * VirtualCorpusConverter prepares data transfer objects (DTOs) from
- * {@link VirtualCorpus} entities. DTO structure defines controllers
- * output, namely the structure of JSON objects in HTTP responses.
- * 
- * @author margaretha
- *
- */
-@Component
-public class VirtualCorpusConverter {
-
-    public VirtualCorpusDto createVirtualCorpusDto (VirtualCorpus vc,
-            String statistics) throws KustvaktException {
-
-        VirtualCorpusDto dto = new VirtualCorpusDto();
-        dto.setId(vc.getId());
-        dto.setName(vc.getName());
-        dto.setCreatedBy(vc.getCreatedBy());
-        dto.setRequiredAccess(vc.getRequiredAccess().name());
-        dto.setStatus(vc.getStatus());
-        dto.setDescription(vc.getDescription());
-        dto.setType(vc.getType().displayName());
-        
-        dto.setQuery(vc.getQuery());
-        dto.setQueryLanguage(vc.getQueryLanguage());
-        
-        JsonNode kq = JsonUtils.readTree(vc.getKoralQuery());
-        dto.setKoralQuery(kq);
-        
-        if (statistics != null) {
-            JsonNode node = JsonUtils.readTree(statistics);
-            dto.setNumberOfDoc(node.at("/documents").asInt());
-            dto.setNumberOfParagraphs(node.at("/paragraphs").asInt());
-            dto.setNumberOfSentences(node.at("/sentences").asInt());
-            dto.setNumberOfTokens(node.at("/tokens").asInt());
-        }
-        return dto;
-
-    }
-}
diff --git a/full/src/main/java/de/ids_mannheim/korap/entity/VirtualCorpusAccess.java b/full/src/main/java/de/ids_mannheim/korap/entity/QueryAccess.java
similarity index 77%
rename from full/src/main/java/de/ids_mannheim/korap/entity/VirtualCorpusAccess.java
rename to full/src/main/java/de/ids_mannheim/korap/entity/QueryAccess.java
index ba80f59..a7b518a 100644
--- a/full/src/main/java/de/ids_mannheim/korap/entity/VirtualCorpusAccess.java
+++ b/full/src/main/java/de/ids_mannheim/korap/entity/QueryAccess.java
@@ -12,7 +12,7 @@
 import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 
-import de.ids_mannheim.korap.constant.VirtualCorpusAccessStatus;
+import de.ids_mannheim.korap.constant.QueryAccessStatus;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -21,14 +21,14 @@
  *  of group-access management.  
  * 
  * @author margaretha
- * @see VirtualCorpus
+ * @see QueryDO
  * @see UserGroup
  */
 @Setter
 @Getter
 @Entity
-@Table(name = "virtual_corpus_access")
-public class VirtualCorpusAccess {
+@Table(name = "query_access")
+public class QueryAccess {
 
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -41,11 +41,11 @@
     private String deletedBy;
 
     @Enumerated(EnumType.STRING)
-    private VirtualCorpusAccessStatus status;
+    private QueryAccessStatus status;
 
     @ManyToOne(fetch = FetchType.EAGER)
-    @JoinColumn(name = "virtual_corpus_id", referencedColumnName = "id")
-    private VirtualCorpus virtualCorpus;
+    @JoinColumn(name = "query_id", referencedColumnName = "id")
+    private QueryDO query;
 
     @ManyToOne(fetch = FetchType.EAGER)
     @JoinColumn(name = "user_group_id", referencedColumnName = "id")
@@ -54,7 +54,7 @@
 
     @Override
     public String toString () {
-        return "id=" + id + ", virtualCorpus= " + virtualCorpus
+        return "id=" + id + ", query= " + query
                 + ", userGroup= " + userGroup;
     }
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/entity/VirtualCorpus.java b/full/src/main/java/de/ids_mannheim/korap/entity/QueryDO.java
similarity index 76%
rename from full/src/main/java/de/ids_mannheim/korap/entity/VirtualCorpus.java
rename to full/src/main/java/de/ids_mannheim/korap/entity/QueryDO.java
index 6cb08ea..4e95e22 100644
--- a/full/src/main/java/de/ids_mannheim/korap/entity/VirtualCorpus.java
+++ b/full/src/main/java/de/ids_mannheim/korap/entity/QueryDO.java
@@ -21,23 +21,22 @@
 import lombok.Setter;
 
 /**
- * Describes the virtual corpora table and its relation to
- * VirtualCorpusAccess.
+ * Describes the query table and its relation to {@link QueryAccess}.
  * 
- * Any user may create a virtual corpus and share it to a user group.
- * However, if the user is not a user-group admin, the virtual corpus
+ * Any user may create a query and share it to a user group.
+ * However, if the user is not a user-group admin, the query
  * will not be shared until a user-group admin accept his/her request.
  * 
  * @author margaretha
  *
- * @see VirtualCorpusAccess
+ * @see QueryAccess
  * @see UserGroup
  */
 @Setter
 @Getter
 @Entity
-@Table(name = "virtual_corpus")
-public class VirtualCorpus implements Comparable<VirtualCorpus> {
+@Table(name = "query")
+public class QueryDO implements Comparable<QueryDO> {
 
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -50,7 +49,7 @@
     @Enumerated(EnumType.STRING)
     @Column(name = "required_access")
     private CorpusAccess requiredAccess;
-    @Column(name = "corpus_query")
+    @Column(name = "koral_query")
     private String koralQuery;
     private String definition;
     @Column(name = "created_by")
@@ -65,15 +64,15 @@
     @Column(name = "query_language")
     private String queryLanguage;
 
-    @OneToMany(mappedBy = "virtualCorpus", fetch = FetchType.LAZY,
+    @OneToMany(mappedBy = "query", fetch = FetchType.LAZY,
             cascade = CascadeType.REMOVE)
-    private List<VirtualCorpusAccess> virtualCorpusAccess;
+    private List<QueryAccess> queryAccess;
 
     @Override
     public String toString () {
         return "id=" + id + ", name= " + name + ", type= " + type + ", status= "
                 + status + ", description=" + description + ", requiredAccess="
-                + requiredAccess + ", corpusQuery= " + koralQuery
+                + requiredAccess + ", koralQuery= " + koralQuery
                 + ", definition= " + definition + ", createdBy= " + createdBy;
     }
 
@@ -89,12 +88,12 @@
 
     @Override
     public boolean equals (Object obj) {
-        VirtualCorpus vc = (VirtualCorpus) obj;
-        return (this.id == vc.getId()) ? true : false;
+        QueryDO query = (QueryDO) obj;
+        return (this.id == query.getId()) ? true : false;
     }
 
     @Override
-    public int compareTo (VirtualCorpus o) {
+    public int compareTo (QueryDO o) {
         if (this.getId() > o.getId()) {
             return 1;
         }
diff --git a/full/src/main/java/de/ids_mannheim/korap/entity/QueryReference.java b/full/src/main/java/de/ids_mannheim/korap/entity/QueryReference.java
deleted file mode 100644
index 1a9c843..0000000
--- a/full/src/main/java/de/ids_mannheim/korap/entity/QueryReference.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package de.ids_mannheim.korap.entity;
-
-import java.util.List;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
-
-import de.ids_mannheim.korap.constant.ResourceType;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * Describes the query reference table.
- *
- * It is yet not as complete as the Virtual Corpus implementation,
- * as it has no mechanism for sharing any query references.
- * 
- * @author diewald
- *
- * @see VirtualCorpus
- */
-@Setter
-@Getter
-@Entity
-@Table(name = "query_reference")
-public class QueryReference implements Comparable<QueryReference> {
-
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    private int id;
-    private String name;
-    @Enumerated(EnumType.STRING)
-    private ResourceType type;
-    private String status;
-    private String description;
-    // @Enumerated(EnumType.STRING)
-    @Column(name = "required_access")
-    private String requiredAccess;
-    //private CorpusAccess requiredAccess;
-    @Column(name = "query")
-    private String koralQuery;
-    private String definition;
-    @Column(name = "created_by")
-    private String createdBy;
-
-    /*
-    @OneToMany(mappedBy = "queryReference", fetch = FetchType.LAZY,
-            cascade = CascadeType.REMOVE)
-    private List<VirtualCorpusAccess> virtualCorpusAccess;
-    */
-
-    @Override
-    public String toString () {
-        return "id=" + id +
-            ", name= " + name +
-            ", type= " + type +
-            ", status= " + status +
-            ", description=" + description +
-            // ", requiredAccess=" + requiredAccess +
-            ", query= " + koralQuery +
-            ", definition= " + definition +
-            ", createdBy= " + createdBy;
-    }
-
-    @Override
-    public int hashCode () {
-        int prime = 37;
-        int result = 1;
-        result = prime * result + id;
-        result = prime * result + name.hashCode();
-        result = prime * result + createdBy.hashCode();
-        return result;
-    }
-
-    @Override
-    public boolean equals (Object obj) {
-        QueryReference q = (QueryReference) obj;
-        return (this.id == q.getId()) ? true : false;
-    }
-
-    @Override
-    public int compareTo (QueryReference o) {
-        if (this.getId() > o.getId()) {
-            return 1;
-        }
-        else if (this.getId() < o.getId()) {
-            return -1;
-        }
-        return 0;
-    }
-}
diff --git a/full/src/main/java/de/ids_mannheim/korap/entity/UserGroup.java b/full/src/main/java/de/ids_mannheim/korap/entity/UserGroup.java
index 0f2d7fd..3612ea9 100644
--- a/full/src/main/java/de/ids_mannheim/korap/entity/UserGroup.java
+++ b/full/src/main/java/de/ids_mannheim/korap/entity/UserGroup.java
@@ -20,7 +20,7 @@
 
 /**
  * Describes user group table and its relations to UserGroupMember and
- * VirtualCorpusAccess.
+ * {@link QueryAccess}.
  * 
  * Any user may create a user group and send invitations to group
  * member by username. Any group member may reject the invitation
@@ -28,7 +28,7 @@
  * 
  * @author margaretha
  * @see UserGroupMember
- * @see VirtualCorpusAccess
+ * @see QueryAccess
  */
 @Setter
 @Getter
@@ -56,7 +56,7 @@
 
     @OneToMany(mappedBy = "userGroup", fetch = FetchType.LAZY,
             cascade = CascadeType.REMOVE)
-    private List<VirtualCorpusAccess> virtualCorpusAccess;
+    private List<QueryAccess> queryAccess;
 
     @Override
     public String toString () {
diff --git a/full/src/main/java/de/ids_mannheim/korap/rewrite/QueryReferenceRewrite.java b/full/src/main/java/de/ids_mannheim/korap/rewrite/QueryReferenceRewrite.java
index 4b7e755..f14bf56 100644
--- a/full/src/main/java/de/ids_mannheim/korap/rewrite/QueryReferenceRewrite.java
+++ b/full/src/main/java/de/ids_mannheim/korap/rewrite/QueryReferenceRewrite.java
@@ -8,11 +8,11 @@
 
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.constant.QueryType;
-import de.ids_mannheim.korap.entity.VirtualCorpus;
+import de.ids_mannheim.korap.entity.QueryDO;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.rewrite.KoralNode.RewriteIdentifier;
-import de.ids_mannheim.korap.service.VirtualCorpusService;
+import de.ids_mannheim.korap.service.QueryService;
 import de.ids_mannheim.korap.user.User;
 import de.ids_mannheim.korap.utils.JsonUtils;
 
@@ -29,7 +29,7 @@
 public class QueryReferenceRewrite implements RewriteTask.RewriteQuery {
 
     @Autowired
-    private VirtualCorpusService service;
+    private QueryService service;
 
     @Override
     public KoralNode rewriteQuery (KoralNode node,
@@ -63,7 +63,7 @@
                     }
                 }
 
-                VirtualCorpus qr = service.searchVCByName(username,
+                QueryDO qr = service.searchQueryByName(username,
                         queryRefName, queryRefOwner, QueryType.QUERY);
 
                 if (qr == null) {
diff --git a/full/src/main/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewrite.java b/full/src/main/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewrite.java
index 297680e..7ea386f 100644
--- a/full/src/main/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewrite.java
+++ b/full/src/main/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewrite.java
@@ -8,10 +8,10 @@
 
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.constant.QueryType;
-import de.ids_mannheim.korap.entity.VirtualCorpus;
+import de.ids_mannheim.korap.entity.QueryDO;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.rewrite.KoralNode.RewriteIdentifier;
-import de.ids_mannheim.korap.service.VirtualCorpusService;
+import de.ids_mannheim.korap.service.QueryService;
 import de.ids_mannheim.korap.user.User;
 import de.ids_mannheim.korap.util.StatusCodes;
 import de.ids_mannheim.korap.utils.JsonUtils;
@@ -29,7 +29,7 @@
     @Autowired
     private KustvaktConfiguration config;
     @Autowired
-    private VirtualCorpusService vcService;
+    private QueryService queryService;
 
     @Override
     public KoralNode rewriteQuery (KoralNode node, KustvaktConfiguration config,
@@ -71,8 +71,8 @@
                             koralNode.get("ref"));
                 }
                 
-                VirtualCorpus vc =
-                        vcService.searchVCByName(username, vcName, vcOwner, QueryType.VIRTUAL_CORPUS);
+                QueryDO vc =
+                        queryService.searchQueryByName(username, vcName, vcOwner, QueryType.VIRTUAL_CORPUS);
                 if (!vc.isCached()) {
                     rewriteVC(vc, koralNode);
                 }
@@ -105,7 +105,7 @@
         koralNode.set("ref", ref, new RewriteIdentifier("ref", ref));
     }
 
-    private void rewriteVC (VirtualCorpus vc, KoralNode koralNode)
+    private void rewriteVC (QueryDO vc, KoralNode koralNode)
             throws KustvaktException {
         String koralQuery = vc.getKoralQuery();
         JsonNode kq = JsonUtils.readTree(koralQuery).at("/collection");
diff --git a/full/src/main/java/de/ids_mannheim/korap/service/QueryReferenceService.java b/full/src/main/java/de/ids_mannheim/korap/service/QueryReferenceService.java
deleted file mode 100644
index c7e0f8b..0000000
--- a/full/src/main/java/de/ids_mannheim/korap/service/QueryReferenceService.java
+++ /dev/null
@@ -1,301 +0,0 @@
-package de.ids_mannheim.korap.service;
-
-import java.sql.SQLException;
-
-import java.util.regex.Pattern;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.exceptions.StatusCodes;
-import de.ids_mannheim.korap.utils.ParameterChecker;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import de.ids_mannheim.korap.utils.JsonUtils;
-
-import de.ids_mannheim.korap.dao.AdminDao;
-import de.ids_mannheim.korap.dao.QueryReferenceDao;
-
-import de.ids_mannheim.korap.constant.ResourceType;
-
-import de.ids_mannheim.korap.entity.QueryReference;
-
-
-/**
- * This service is similar to VirtualCorpusService,
- * while not as complete.
- * For the moment, e.g., there is no mechanism supported to
- * share a query reference with other users or groups.
- * Only private queries are supported.
- *
- * @author diewald
- */
-@Deprecated
-@Service
-public class QueryReferenceService {
-
-    public static Pattern qNamePattern = Pattern.compile("[-\\w.]+");
-
-    @Autowired
-    private AdminDao adminDao;
-
-    @Autowired
-    private QueryReferenceDao qDao;
-
-
-    /**
-     * Serch for a query by its name.
-     */
-    public JsonNode searchQueryByName (String username,
-                                       String qName,
-                                       String createdBy) throws KustvaktException {
-
-        QueryReference qr = qDao.retrieveQueryByName(qName, createdBy);
-        if (qr == null) {
-            String refCode = createdBy + "/" + qName;
-            throw new KustvaktException(
-                StatusCodes.NO_RESOURCE_FOUND,
-                "Query reference " + refCode + " is not found.",
-                String.valueOf(refCode));
-        }
-
-        // TODO:
-        //   checkVCAcess(q, username);
-        return JsonUtils.readTree(qr.getKoralQuery());
-    };
-
-
-    /**
-     * Store a query in the database.
-     */
-    public void storeQuery (String qJson,
-                            String qName,
-                            String createdBy)
-        throws KustvaktException {
-
-        // TODO:
-        //   This doesn't support a whole bunch of applicable
-        //   information from VCs, like 'definition', 'description',
-        //   'status' etc.
-        
-        storeQuery(
-            qJson,
-            qName,
-            "",
-            createdBy
-            );
-    }
-
-
-    /**
-     * Store a query in the database.
-     */
-    public void storeQuery (String qJson,
-                            String qName,
-                            String desc,
-                            String username)
-        throws KustvaktException {
-        ParameterChecker.checkStringValue(qJson, "q");
-        ParameterChecker.checkNameValue(qName, "qName");
-
-        if (!qNamePattern.matcher(qName).matches()) {
-            throw new KustvaktException(
-                StatusCodes.INVALID_ARGUMENT,
-                "Query name must only contain letters, numbers, "
-                + "underscores, hypens and spaces",
-                qName);
-        }
-
-        if (username.equals("system") && !adminDao.isAdmin(username)) {
-            throw new KustvaktException(
-                StatusCodes.AUTHORIZATION_FAILED,
-                "Unauthorized operation for user: " + username, username);            
-        };
-
-        int qId = 0;
-        try {
-            qId = qDao.createQuery(
-                qName,
-                ResourceType.PRIVATE,
-                qJson,
-                "", // TODO: definition,
-                desc,
-                "", // TODO: status,
-                username);
-
-        }
-        catch (Exception e) {
-            Throwable cause = e;
-            Throwable lastCause = null;
-            while ((cause = cause.getCause()) != null
-                   && !cause.equals(lastCause)) {
-                if (cause instanceof SQLException) {
-                    break;
-                }
-                lastCause = cause;
-            }
-            throw new KustvaktException(
-                StatusCodes.DB_INSERT_FAILED,
-                cause.getMessage()
-                );
-        };
-
-        // TODO:
-        //   This doesn't publish the query, if it is meant to be published
-        //   based on its type.
-    };
-
-    /*
-    public Status handlePutRequest (String username,
-                                    String qCreator,
-                                    String qName,
-                                    String qJson) throws KustvaktException {
-        
-        verifyUsername(username, qCreator);
-        String q = vcDao.retrieveQueryByName(qName, qCreator);
-        // ParameterChecker.checkObjectValue(qJson, "request entity");
-        ParameterChecker.checkStringValue(qJson, "q");
-        if (q == null) {
-            storeQuery(qJson, qName, username);
-            return Status.CREATED;
-        }
-        else {
-            editQuery(q, qJson, qName, username);
-            return Status.NO_CONTENT;
-        };
-    };
-    */
-
-    /*
-    public void editQuery (QueryRefrence existingQ,
-                           String newQJson,
-                           String qName,
-                           String username) throws KustvaktException {
-
-        if (!username.equals(existingQ.getCreatedBy())
-            && !adminDao.isAdmin(username)) {
-            throw new KustvaktException(
-                StatusCodes.AUTHORIZATION_FAILED,
-                "Unauthorized operation for user: " + username, username);
-        };
-
-        String corpusQuery = newVC.getCorpusQuery();
-
-        if (newQJson != null && !newQJson.isEmpty()) {
-            koralQuery = serializeCorpusQuery(corpusQuery);
-            requiredAccess = determineRequiredAccess(newVC.isCached(), vcName,
-                    koralQuery);
-        };
-
-        VirtualCorpusType type = newVC.getType();
-        if (type != null) {
-            if (existingVC.getType().equals(VirtualCorpusType.PUBLISHED)) {
-                // withdraw from publication
-                if (!type.equals(VirtualCorpusType.PUBLISHED)) {
-                    VirtualCorpusAccess hiddenAccess =
-                            accessDao.retrieveHiddenAccess(existingVC.getId());
-                    deleteVCAccess(hiddenAccess.getId(), "system");
-                    int groupId = hiddenAccess.getUserGroup().getId();
-                    userGroupService.deleteAutoHiddenGroup(groupId, "system");
-                    // EM: should the users within the hidden group receive 
-                    // notifications? 
-                }
-                // else remains the same
-            }
-            else if (type.equals(VirtualCorpusType.PUBLISHED)) {
-                publishVC(existingVC.getId());
-            }
-        }
-
-        vcDao.editVirtualCorpus(existingVC, vcName, type, requiredAccess,
-                koralQuery, newVC.getDefinition(), newVC.getDescription(),
-                newVC.getStatus(), newVC.isCached());
-    }
-    */
-
-    
-    /**
-     * Only admin and the owner of the virtual corpus are allowed to
-     * delete a virtual corpus.
-     */
-    public void deleteQueryByName (
-        String username,
-        String qName,
-        String createdBy
-        ) throws KustvaktException {
-
-        QueryReference q = qDao.retrieveQueryByName(qName, createdBy);
-
-        if (q == null) {
-            String refCode = createdBy + "/" + qName;
-            throw new KustvaktException(
-                StatusCodes.NO_RESOURCE_FOUND,
-                "Query reference " + refCode + " is not found.",
-                String.valueOf(refCode));
-        }
-
-        // Check if the user created the qr or is admin
-        else if (q.getCreatedBy().equals(username)
-                 || adminDao.isAdmin(username)) {
-            // TODO:
-            //   Here checks for publication status is missing
-            qDao.deleteQueryReference(q);
-        }
-
-        else {
-            throw new KustvaktException(
-                StatusCodes.AUTHORIZATION_FAILED,
-                "Unauthorized operation for user: " + username, username);
-        };
-    };
-
-
-    /*
-    public void editVC (
-        VirtualCorpus existingVC,
-        VirtualCorpusJson newVC,
-        String vcName,
-        String username) throws KustvaktException {
-
-        if (!username.equals(existingVC.getCreatedBy())
-                && !adminDao.isAdmin(username)) {
-            throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
-                    "Unauthorized operation for user: " + username, username);
-        }
-
-        String koralQuery = null;
-        CorpusAccess requiredAccess = null;
-        String corpusQuery = newVC.getCorpusQuery();
-        if (corpusQuery != null && !corpusQuery.isEmpty()) {
-            koralQuery = serializeCorpusQuery(corpusQuery);
-            requiredAccess = determineRequiredAccess(newVC.isCached(), vcName,
-                    koralQuery);
-        }
-
-        VirtualCorpusType type = newVC.getType();
-        if (type != null) {
-            if (existingVC.getType().equals(VirtualCorpusType.PUBLISHED)) {
-                // withdraw from publication
-                if (!type.equals(VirtualCorpusType.PUBLISHED)) {
-                    VirtualCorpusAccess hiddenAccess =
-                            accessDao.retrieveHiddenAccess(existingVC.getId());
-                    deleteVCAccess(hiddenAccess.getId(), "system");
-                    int groupId = hiddenAccess.getUserGroup().getId();
-                    userGroupService.deleteAutoHiddenGroup(groupId, "system");
-                    // EM: should the users within the hidden group receive 
-                    // notifications? 
-                }
-                // else remains the same
-            }
-            else if (type.equals(VirtualCorpusType.PUBLISHED)) {
-                publishVC(existingVC.getId());
-            }
-        }
-
-        vcDao.editVirtualCorpus(existingVC, vcName, type, requiredAccess,
-                koralQuery, newVC.getDefinition(), newVC.getDescription(),
-                newVC.getStatus(), newVC.isCached());
-    }
-    */
-};
diff --git a/full/src/main/java/de/ids_mannheim/korap/service/VirtualCorpusService.java b/full/src/main/java/de/ids_mannheim/korap/service/QueryService.java
similarity index 67%
rename from full/src/main/java/de/ids_mannheim/korap/service/VirtualCorpusService.java
rename to full/src/main/java/de/ids_mannheim/korap/service/QueryService.java
index 3204656..2289a47 100644
--- a/full/src/main/java/de/ids_mannheim/korap/service/VirtualCorpusService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/service/QueryService.java
@@ -21,19 +21,19 @@
 import de.ids_mannheim.korap.config.FullConfiguration;
 import de.ids_mannheim.korap.constant.GroupMemberStatus;
 import de.ids_mannheim.korap.constant.QueryType;
-import de.ids_mannheim.korap.constant.VirtualCorpusAccessStatus;
+import de.ids_mannheim.korap.constant.QueryAccessStatus;
 import de.ids_mannheim.korap.constant.ResourceType;
 import de.ids_mannheim.korap.dao.AdminDao;
-import de.ids_mannheim.korap.dao.VirtualCorpusAccessDao;
-import de.ids_mannheim.korap.dao.VirtualCorpusDao;
-import de.ids_mannheim.korap.dto.VirtualCorpusAccessDto;
-import de.ids_mannheim.korap.dto.VirtualCorpusDto;
-import de.ids_mannheim.korap.dto.converter.VirtualCorpusAccessConverter;
-import de.ids_mannheim.korap.dto.converter.VirtualCorpusConverter;
+import de.ids_mannheim.korap.dao.QueryAccessDao;
+import de.ids_mannheim.korap.dao.QueryDao;
+import de.ids_mannheim.korap.dto.QueryAccessDto;
+import de.ids_mannheim.korap.dto.QueryDto;
+import de.ids_mannheim.korap.dto.converter.QueryAccessConverter;
+import de.ids_mannheim.korap.dto.converter.QueryConverter;
 import de.ids_mannheim.korap.entity.UserGroup;
 import de.ids_mannheim.korap.entity.UserGroupMember;
-import de.ids_mannheim.korap.entity.VirtualCorpus;
-import de.ids_mannheim.korap.entity.VirtualCorpusAccess;
+import de.ids_mannheim.korap.entity.QueryDO;
+import de.ids_mannheim.korap.entity.QueryAccess;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
@@ -48,26 +48,26 @@
 /**
  * VirtualCorpusService handles the logic behind
  * {@link VirtualCorpusController}.
- * It communicates with {@link VirtualCorpusDao} and returns
- * {@link VirtualCorpusDto} to {@link VirtualCorpusController}.
+ * It communicates with {@link QueryDao} and returns
+ * {@link QueryDto} to {@link VirtualCorpusController}.
  * 
  * @author margaretha
  *
  */
 @Service
-public class VirtualCorpusService {
+public class QueryService {
 
     public static Logger jlog =
-            LogManager.getLogger(VirtualCorpusService.class);
+            LogManager.getLogger(QueryService.class);
 
     public static boolean DEBUG = false;
 
     public static Pattern queryNamePattern = Pattern.compile("[-\\w.]+");
 
     @Autowired
-    private VirtualCorpusDao vcDao;
+    private QueryDao queryDao;
     @Autowired
-    private VirtualCorpusAccessDao accessDao;
+    private QueryAccessDao accessDao;
     @Autowired
     private AdminDao adminDao;
     @Autowired
@@ -77,9 +77,9 @@
     @Autowired
     private FullConfiguration config;
     @Autowired
-    private VirtualCorpusConverter converter;
+    private QueryConverter converter;
     @Autowired
-    private VirtualCorpusAccessConverter accessConverter;
+    private QueryAccessConverter accessConverter;
 
     private void verifyUsername (String contextUsername, String pathUsername)
             throws KustvaktException {
@@ -91,14 +91,14 @@
         }
     }
 
-    public List<VirtualCorpusDto> listOwnerVC (String username,
-            String vcCreator, QueryType queryType) throws KustvaktException {
-        verifyUsername(username, vcCreator);
-        List<VirtualCorpus> vcList = vcDao.retrieveOwnerVC(username, queryType);
-        return createVCDtos(vcList, queryType);
+    public List<QueryDto> listOwnerQuery (String username,
+            String queryCreator, QueryType queryType) throws KustvaktException {
+        verifyUsername(username, queryCreator);
+        List<QueryDO> list = queryDao.retrieveOwnerQuery(username, queryType);
+        return createQueryDtos(list, queryType);
     }
 
-    public List<VirtualCorpusDto> listAvailableVCForUser (
+    public List<QueryDto> listAvailableQueryForUser (
             String authenticatedUsername, String username, QueryType queryType)
             throws KustvaktException {
 
@@ -115,22 +115,22 @@
         else {
             username = authenticatedUsername;
         }
-        List<VirtualCorpus> vcList =
-                vcDao.retrieveVCByUser(username, queryType);
-        return createVCDtos(vcList, queryType);
+        List<QueryDO> list =
+                queryDao.retrieveQueryByUser(username, queryType);
+        return createQueryDtos(list, queryType);
     }
 
-    public List<VirtualCorpusDto> listVCByType (String username,
+    public List<QueryDto> listQueryByType (String username,
             String createdBy, ResourceType type, QueryType queryType)
             throws KustvaktException {
 
         boolean isAdmin = adminDao.isAdmin(username);
 
         if (isAdmin) {
-            List<VirtualCorpus> virtualCorpora =
-                    vcDao.retrieveVCByType(type, createdBy, queryType);
+            List<QueryDO> virtualCorpora =
+                    queryDao.retrieveQueryByType(type, createdBy, queryType);
             Collections.sort(virtualCorpora);
-            return createVCDtos(virtualCorpora, queryType);
+            return createQueryDtos(virtualCorpora, queryType);
         }
         else {
             throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
@@ -138,51 +138,51 @@
         }
     }
 
-    private ArrayList<VirtualCorpusDto> createVCDtos (
-            List<VirtualCorpus> vcList, QueryType queryType)
+    private ArrayList<QueryDto> createQueryDtos (
+            List<QueryDO> queryList, QueryType queryType)
             throws KustvaktException {
-        ArrayList<VirtualCorpusDto> dtos = new ArrayList<>(vcList.size());
-        VirtualCorpus vc;
-        Iterator<VirtualCorpus> i = vcList.iterator();
+        ArrayList<QueryDto> dtos = new ArrayList<>(queryList.size());
+        QueryDO query;
+        Iterator<QueryDO> i = queryList.iterator();
         while (i.hasNext()) {
-            vc = i.next();
-            String json = vc.getKoralQuery();
+            query = i.next();
+            String json = query.getKoralQuery();
             String statistics = null;
             if (queryType.equals(QueryType.VIRTUAL_CORPUS)) {
                 statistics = krill.getStatistics(json);
             }
-            VirtualCorpusDto vcDto =
-                    converter.createVirtualCorpusDto(vc, statistics);
-            dtos.add(vcDto);
+            QueryDto dto =
+                    converter.createQueryDto(query, statistics);
+            dtos.add(dto);
         }
         return dtos;
     }
 
     /**
-     * Only admin and the owner of the virtual corpus are allowed to
-     * delete a virtual corpus.
+     * Only admin and the owner of the query are allowed to
+     * delete a query.
      * 
      * @param username
      *            username
-     * @param vcId
-     *            virtual corpus id
+     * @param queryId
+     *            query id
      * @throws KustvaktException
      */
     @Deprecated
     public void deleteVC (String username, int vcId) throws KustvaktException {
 
-        VirtualCorpus vc = vcDao.retrieveVCById(vcId);
+        QueryDO vc = queryDao.retrieveQueryById(vcId);
 
         if (vc.getCreatedBy().equals(username) || adminDao.isAdmin(username)) {
 
             if (vc.getType().equals(ResourceType.PUBLISHED)) {
-                VirtualCorpusAccess access =
+                QueryAccess access =
                         accessDao.retrieveHiddenAccess(vcId);
                 accessDao.deleteAccess(access, "system");
                 userGroupService.deleteAutoHiddenGroup(
                         access.getUserGroup().getId(), "system");
             }
-            vcDao.deleteVirtualCorpus(vc);
+            queryDao.deleteQuery(vc);
         }
         else {
             throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
@@ -196,37 +196,37 @@
      * 
      * @param username
      *            username
-     * @param vcName
+     * @param queryName
      *            virtual corpus name
      * @param createdBy
      *            virtual corpus creator
      * @throws KustvaktException
      */
-    public void deleteVCByName (String username, String vcName,
+    public void deleteQueryByName (String username, String queryName,
             String createdBy) throws KustvaktException {
 
-        VirtualCorpus vc = vcDao.retrieveVCByName(vcName, createdBy);
+        QueryDO query = queryDao.retrieveQueryByName(queryName, createdBy);
 
-        if (vc == null) {
-            String vcCode = createdBy + "/" + vcName;
+        if (query == null) {
+            String code = createdBy + "/" + queryName;
             throw new KustvaktException(StatusCodes.NO_RESOURCE_FOUND,
-                    "Virtual corpus " + vcCode + " is not found.",
-                    String.valueOf(vcCode));
+                    "Virtual corpus " + code + " is not found.",
+                    String.valueOf(code));
         }
-        else if (vc.getCreatedBy().equals(username)
+        else if (query.getCreatedBy().equals(username)
                 || adminDao.isAdmin(username)) {
 
-            if (vc.getType().equals(ResourceType.PUBLISHED)) {
-                VirtualCorpusAccess access =
-                        accessDao.retrieveHiddenAccess(vc.getId());
+            if (query.getType().equals(ResourceType.PUBLISHED)) {
+                QueryAccess access =
+                        accessDao.retrieveHiddenAccess(query.getId());
                 accessDao.deleteAccess(access, "system");
                 userGroupService.deleteAutoHiddenGroup(
                         access.getUserGroup().getId(), "system");
             }
-            if (KrillCollection.cache.get(vc.getName()) != null) {
-                KrillCollection.cache.remove(vc.getName());
+            if (KrillCollection.cache.get(query.getName()) != null) {
+                KrillCollection.cache.remove(query.getName());
             }
-            vcDao.deleteVirtualCorpus(vc);
+            queryDao.deleteQuery(query);
         }
         else {
             throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
@@ -234,34 +234,26 @@
         }
     }
 
-    // @Deprecated
-    // public void editVC (VirtualCorpusJson vcJson, String username)
-    // throws KustvaktException {
-    // ParameterChecker.checkIntegerValue(vcJson.getId(), "id");
-    // VirtualCorpus vc = vcDao.retrieveVCById(vcJson.getId());
-    // editVC(vc, vcJson, vcJson.getName(), username);
-    // }
+    public Status handlePutRequest (String username, String queryCreator,
+            String queryName, QueryJson queryJson) throws KustvaktException {
 
-    public Status handlePutRequest (String username, String vcCreator,
-            String vcName, QueryJson queryJson) throws KustvaktException {
-
-        verifyUsername(username, vcCreator);
-        VirtualCorpus vc = vcDao.retrieveVCByName(vcName, vcCreator);
+        verifyUsername(username, queryCreator);
+        QueryDO query = queryDao.retrieveQueryByName(queryName, queryCreator);
         ParameterChecker.checkObjectValue(queryJson, "request entity");
-        if (vc == null) {
-            storeQuery(queryJson, vcName, username);
+        if (query == null) {
+            storeQuery(queryJson, queryName, username);
             return Status.CREATED;
         }
         else {
-            editVC(vc, queryJson, vcName, username);
+            editQuery(query, queryJson, queryName, username);
             return Status.NO_CONTENT;
         }
     }
 
-    public void editVC (VirtualCorpus existingVC, QueryJson newVC,
-            String vcName, String username) throws KustvaktException {
+    public void editQuery (QueryDO existingQuery, QueryJson newQuery,
+            String queryName, String username) throws KustvaktException {
 
-        if (!username.equals(existingVC.getCreatedBy())
+        if (!username.equals(existingQuery.getCreatedBy())
                 && !adminDao.isAdmin(username)) {
             throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
                     "Unauthorized operation for user: " + username, username);
@@ -269,21 +261,21 @@
 
         String koralQuery = null;
         CorpusAccess requiredAccess = null;
-        String corpusQuery = newVC.getCorpusQuery();
+        String corpusQuery = newQuery.getCorpusQuery();
         if (corpusQuery != null && !corpusQuery.isEmpty()) {
             koralQuery = serializeCorpusQuery(corpusQuery);
-            requiredAccess = determineRequiredAccess(newVC.isCached(), vcName,
+            requiredAccess = determineRequiredAccess(newQuery.isCached(), queryName,
                     koralQuery);
         }
 
-        ResourceType type = newVC.getType();
+        ResourceType type = newQuery.getType();
         if (type != null) {
-            if (existingVC.getType().equals(ResourceType.PUBLISHED)) {
+            if (existingQuery.getType().equals(ResourceType.PUBLISHED)) {
                 // withdraw from publication
                 if (!type.equals(ResourceType.PUBLISHED)) {
-                    VirtualCorpusAccess hiddenAccess =
-                            accessDao.retrieveHiddenAccess(existingVC.getId());
-                    deleteVCAccess(hiddenAccess.getId(), "system");
+                    QueryAccess hiddenAccess =
+                            accessDao.retrieveHiddenAccess(existingQuery.getId());
+                    deleteQueryAccess(hiddenAccess.getId(), "system");
                     int groupId = hiddenAccess.getUserGroup().getId();
                     userGroupService.deleteAutoHiddenGroup(groupId, "system");
                     // EM: should the users within the hidden group
@@ -293,31 +285,31 @@
                 // else remains the same
             }
             else if (type.equals(ResourceType.PUBLISHED)) {
-                publishVC(existingVC.getId());
+                publishQuery(existingQuery.getId());
             }
         }
 
-        vcDao.editVirtualCorpus(existingVC, vcName, type, requiredAccess,
-                koralQuery, newVC.getDefinition(), newVC.getDescription(),
-                newVC.getStatus(), newVC.isCached());
+        queryDao.editQuery(existingQuery, queryName, type, requiredAccess,
+                koralQuery, newQuery.getDefinition(), newQuery.getDescription(),
+                newQuery.getStatus(), newQuery.isCached());
     }
 
-    private void publishVC (int vcId) throws KustvaktException {
+    private void publishQuery (int queryId) throws KustvaktException {
 
-        VirtualCorpusAccess access = accessDao.retrieveHiddenAccess(vcId);
+        QueryAccess access = accessDao.retrieveHiddenAccess(queryId);
         // check if hidden access exists
         if (access == null) {
-            VirtualCorpus vc = vcDao.retrieveVCById(vcId);
+            QueryDO query = queryDao.retrieveQueryById(queryId);
             // create and assign a new hidden group
             int groupId = userGroupService.createAutoHiddenGroup();
             UserGroup autoHidden =
                     userGroupService.retrieveUserGroupById(groupId);
-            accessDao.createAccessToVC(vc, autoHidden, "system",
-                    VirtualCorpusAccessStatus.HIDDEN);
+            accessDao.createAccessToQuery(query, autoHidden, "system",
+                    QueryAccessStatus.HIDDEN);
         }
         else {
             // should not happened
-            jlog.error("Cannot publish VC with id: " + vcId
+            jlog.error("Cannot publish query with id: " + queryId
                     + ". Hidden access exists! Access id: " + access.getId());
         }
     }
@@ -370,12 +362,13 @@
                     determineRequiredAccess(isCached, queryName, koralQuery);
         }
 
-        if (DEBUG) jlog.debug("Storing virtul corpus or query: " + queryName
-                + "in the database ");
+        if (DEBUG){
+            jlog.debug("Storing query: " + queryName + "in the database ");
+        }
         
         int queryId = 0;
         try {
-            queryId = vcDao.createVirtualCorpus(queryName, type, queryType,
+            queryId = queryDao.createQuery(queryName, type, queryType,
                     requiredAccess, koralQuery, definition, description, status,
                     isCached, username, query, queryLanguage);
 
@@ -394,7 +387,7 @@
                     cause.getMessage());
         }
         if (type.equals(ResourceType.PUBLISHED)) {
-            publishVC(queryId);
+            publishQuery(queryId);
         }
     }
 
@@ -469,17 +462,17 @@
         return (numberOfDoc > 0) ? true : false;
     }
 
-    public void shareVC (String username, String createdBy, String vcName,
+    public void shareQuery (String username, String createdBy, String queryName,
             String groupName) throws KustvaktException {
 
-        VirtualCorpus vc = vcDao.retrieveVCByName(vcName, createdBy);
-        if (vc == null) {
-            String vcCode = createdBy + "/" + vcName;
+        QueryDO query = queryDao.retrieveQueryByName(queryName, createdBy);
+        if (query == null) {
+            String code = createdBy + "/" + queryName;
             throw new KustvaktException(StatusCodes.NO_RESOURCE_FOUND,
-                    "Virtual corpus " + vcCode + " is not found.",
-                    String.valueOf(vcCode));
+                    "Query " + code + " is not found.",
+                    String.valueOf(code));
         }
-        if (!username.equals(vc.getCreatedBy())
+        if (!username.equals(query.getCreatedBy())
                 && !adminDao.isAdmin(username)) {
             throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
                     "Unauthorized operation for user: " + username, username);
@@ -488,15 +481,15 @@
         UserGroup userGroup =
                 userGroupService.retrieveUserGroupByName(groupName);
 
-        if (!isVCAccessAdmin(userGroup, username)
+        if (!isQueryAccessAdmin(userGroup, username)
                 && !adminDao.isAdmin(username)) {
             throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
                     "Unauthorized operation for user: " + username, username);
         }
         else {
             try {
-                accessDao.createAccessToVC(vc, userGroup, username,
-                        VirtualCorpusAccessStatus.ACTIVE);
+                accessDao.createAccessToQuery(query, userGroup, username,
+                        QueryAccessStatus.ACTIVE);
             }
             catch (Exception e) {
                 Throwable cause = e;
@@ -512,15 +505,15 @@
                         cause.getMessage());
             }
 
-            vcDao.editVirtualCorpus(vc, null, ResourceType.PROJECT, null, null,
-                    null, null, null, vc.isCached());
+            queryDao.editQuery(query, null, ResourceType.PROJECT, null, null,
+                    null, null, null, query.isCached());
         }
     }
 
-    private boolean isVCAccessAdmin (UserGroup userGroup, String username)
+    private boolean isQueryAccessAdmin (UserGroup userGroup, String username)
             throws KustvaktException {
         List<UserGroupMember> accessAdmins =
-                userGroupService.retrieveVCAccessAdmins(userGroup);
+                userGroupService.retrieveQueryAccessAdmins(userGroup);
         for (UserGroupMember m : accessAdmins) {
             if (username.equals(m.getUserId())) {
                 return true;
@@ -545,9 +538,9 @@
     // }
     // }
 
-    public List<VirtualCorpusAccessDto> listVCAccessByUsername (String username)
+    public List<QueryAccessDto> listQueryAccessByUsername (String username)
             throws KustvaktException {
-        List<VirtualCorpusAccess> accessList = new ArrayList<>();
+        List<QueryAccess> accessList = new ArrayList<>();
         if (adminDao.isAdmin(username)) {
             accessList = accessDao.retrieveAllAccess();
         }
@@ -555,46 +548,46 @@
             List<UserGroup> groups =
                     userGroupService.retrieveUserGroup(username);
             for (UserGroup g : groups) {
-                if (isVCAccessAdmin(g, username)) {
+                if (isQueryAccessAdmin(g, username)) {
                     accessList.addAll(
                             accessDao.retrieveActiveAccessByGroup(g.getId()));
                 }
             }
         }
-        return accessConverter.createVCADto(accessList);
+        return accessConverter.createQueryAccessDto(accessList);
     }
 
-    public List<VirtualCorpusAccessDto> listVCAccessByVC (String username,
-            String vcCreator, String vcName) throws KustvaktException {
+    public List<QueryAccessDto> listQueryAccessByQuery (String username,
+            String queryCreator, String queryName) throws KustvaktException {
 
-        List<VirtualCorpusAccess> accessList;
+        List<QueryAccess> accessList;
         if (adminDao.isAdmin(username)) {
-            accessList = accessDao.retrieveAllAccessByVC(vcCreator, vcName);
+            accessList = accessDao.retrieveAllAccessByQuery(queryCreator, queryName);
         }
         else {
-            accessList = accessDao.retrieveActiveAccessByVC(vcCreator, vcName);
-            List<VirtualCorpusAccess> filteredAccessList = new ArrayList<>();
-            for (VirtualCorpusAccess access : accessList) {
+            accessList = accessDao.retrieveActiveAccessByQuery(queryCreator, queryName);
+            List<QueryAccess> filteredAccessList = new ArrayList<>();
+            for (QueryAccess access : accessList) {
                 UserGroup userGroup = access.getUserGroup();
-                if (isVCAccessAdmin(userGroup, username)) {
+                if (isQueryAccessAdmin(userGroup, username)) {
                     filteredAccessList.add(access);
                 }
             }
             accessList = filteredAccessList;
         }
-        return accessConverter.createVCADto(accessList);
+        return accessConverter.createQueryAccessDto(accessList);
     }
 
     @Deprecated
-    public List<VirtualCorpusAccessDto> listVCAccessByGroup (String username,
+    public List<QueryAccessDto> listVCAccessByGroup (String username,
             int groupId) throws KustvaktException {
         UserGroup userGroup = userGroupService.retrieveUserGroupById(groupId);
 
-        List<VirtualCorpusAccess> accessList;
+        List<QueryAccess> accessList;
         if (adminDao.isAdmin(username)) {
             accessList = accessDao.retrieveAllAccessByGroup(groupId);
         }
-        else if (isVCAccessAdmin(userGroup, username)) {
+        else if (isQueryAccessAdmin(userGroup, username)) {
             accessList = accessDao.retrieveActiveAccessByGroup(groupId);
         }
         else {
@@ -602,19 +595,19 @@
                     "Unauthorized operation for user: " + username, username);
         }
 
-        return accessConverter.createVCADto(accessList);
+        return accessConverter.createQueryAccessDto(accessList);
     }
 
-    public List<VirtualCorpusAccessDto> listVCAccessByGroup (String username,
+    public List<QueryAccessDto> listQueryAccessByGroup (String username,
             String groupName) throws KustvaktException {
         UserGroup userGroup =
                 userGroupService.retrieveUserGroupByName(groupName);
 
-        List<VirtualCorpusAccess> accessList;
+        List<QueryAccess> accessList;
         if (adminDao.isAdmin(username)) {
             accessList = accessDao.retrieveAllAccessByGroup(userGroup.getId());
         }
-        else if (isVCAccessAdmin(userGroup, username)) {
+        else if (isQueryAccessAdmin(userGroup, username)) {
             accessList =
                     accessDao.retrieveActiveAccessByGroup(userGroup.getId());
         }
@@ -622,15 +615,15 @@
             throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
                     "Unauthorized operation for user: " + username, username);
         }
-        return accessConverter.createVCADto(accessList);
+        return accessConverter.createQueryAccessDto(accessList);
     }
 
-    public void deleteVCAccess (int accessId, String username)
+    public void deleteQueryAccess (int accessId, String username)
             throws KustvaktException {
 
-        VirtualCorpusAccess access = accessDao.retrieveAccessById(accessId);
+        QueryAccess access = accessDao.retrieveAccessById(accessId);
         UserGroup userGroup = access.getUserGroup();
-        if (isVCAccessAdmin(userGroup, username)
+        if (isQueryAccessAdmin(userGroup, username)
                 || adminDao.isAdmin(username)) {
             accessDao.deleteAccess(access, username);
         }
@@ -641,49 +634,49 @@
 
     }
 
-    public VirtualCorpus searchVCByName (String username, String vcName,
+    public QueryDO searchQueryByName (String username, String queryName,
             String createdBy, QueryType queryType) throws KustvaktException {
-        VirtualCorpus vc = vcDao.retrieveVCByName(vcName, createdBy);
-        if (vc == null) {
-            String vcCode = createdBy + "/" + vcName;
+        QueryDO query = queryDao.retrieveQueryByName(queryName, createdBy);
+        if (query == null) {
+            String code = createdBy + "/" + queryName;
             throw new KustvaktException(StatusCodes.NO_RESOURCE_FOUND,
-                    queryType.displayName()+ " " + vcCode + " is not found.",
-                    String.valueOf(vcCode));
+                    queryType.displayName()+ " " + code + " is not found.",
+                    String.valueOf(code));
         }
-        checkVCAccess(vc, username);
-        return vc;
+        checkQueryAccess(query, username);
+        return query;
     }
 
-    public VirtualCorpusDto retrieveVCByName (String username, String vcName,
+    public QueryDto retrieveQueryByName (String username, String queryName,
             String createdBy, QueryType queryType) throws KustvaktException {
-        VirtualCorpus vc = searchVCByName(username, vcName, createdBy, queryType);
-        String json = vc.getKoralQuery();
+        QueryDO query = searchQueryByName(username, queryName, createdBy, queryType);
+        String json = query.getKoralQuery();
         String statistics = null;
-        if (vc.getQueryType().equals(QueryType.VIRTUAL_CORPUS)) {
+        if (query.getQueryType().equals(QueryType.VIRTUAL_CORPUS)) {
             statistics = krill.getStatistics(json);
         }
-        return converter.createVirtualCorpusDto(vc, statistics);
+        return converter.createQueryDto(query, statistics);
     }
 
-    public VirtualCorpusDto searchVCById (String username, int vcId)
+    public QueryDto searchQueryById (String username, int queryId)
             throws KustvaktException {
 
-        VirtualCorpus vc = vcDao.retrieveVCById(vcId);
-        checkVCAccess(vc, username);
-        String json = vc.getKoralQuery();
+        QueryDO query = queryDao.retrieveQueryById(queryId);
+        checkQueryAccess(query, username);
+        String json = query.getKoralQuery();
         String statistics = krill.getStatistics(json);
-        return converter.createVirtualCorpusDto(vc, statistics);
+        return converter.createQueryDto(query, statistics);
     }
 
-    private void checkVCAccess (VirtualCorpus vc, String username)
+    private void checkQueryAccess (QueryDO query, String username)
             throws KustvaktException {
-        ResourceType type = vc.getType();
+        ResourceType type = query.getType();
 
         if (!adminDao.isAdmin(username)
-                && !username.equals(vc.getCreatedBy())) {
+                && !username.equals(query.getCreatedBy())) {
             if (type.equals(ResourceType.PRIVATE)
                     || (type.equals(ResourceType.PROJECT)
-                            && !hasAccess(username, vc.getId()))) {
+                            && !hasAccess(username, query.getId()))) {
                 throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
                         "Unauthorized operation for user: " + username,
                         username);
@@ -691,9 +684,9 @@
 
             else if (ResourceType.PUBLISHED.equals(type)
                     && !username.equals("guest")) {
-                // add user in the VC's auto group
+                // add user in the query's auto group
                 UserGroup userGroup = userGroupService
-                        .retrieveHiddenUserGroupByVC(vc.getId());
+                        .retrieveHiddenUserGroupByQuery(query.getId());
                 try {
                     userGroupService.addGroupMember(username, userGroup,
                             "system", GroupMemberStatus.ACTIVE);
@@ -708,12 +701,12 @@
         }
     }
 
-    private boolean hasAccess (String username, int vcId)
+    private boolean hasAccess (String username, int queryId)
             throws KustvaktException {
         UserGroup userGroup;
-        List<VirtualCorpusAccess> accessList =
-                accessDao.retrieveActiveAccessByVC(vcId);
-        for (VirtualCorpusAccess access : accessList) {
+        List<QueryAccess> accessList =
+                accessDao.retrieveActiveAccessByQuery(queryId);
+        for (QueryAccess access : accessList) {
             userGroup = access.getUserGroup();
             if (userGroupService.isMember(username, userGroup)) {
                 return true;
diff --git a/full/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java b/full/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
index 7b0724f..077ce9d 100644
--- a/full/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
@@ -137,9 +137,9 @@
         return userGroupDao.retrieveGroupByName(groupName, false);
     }
 
-    public UserGroup retrieveHiddenUserGroupByVC (int vcId)
+    public UserGroup retrieveHiddenUserGroupByQuery (int queryId)
             throws KustvaktException {
-        return userGroupDao.retrieveHiddenGroupByVC(vcId);
+        return userGroupDao.retrieveHiddenGroupByQuery(queryId);
     }
 
     public List<UserGroupDto> retrieveUserGroupByStatus (String username,
@@ -172,10 +172,10 @@
         }
     }
 
-    public List<UserGroupMember> retrieveVCAccessAdmins (UserGroup userGroup)
+    public List<UserGroupMember> retrieveQueryAccessAdmins (UserGroup userGroup)
             throws KustvaktException {
         List<UserGroupMember> groupAdmins = groupMemberDao.retrieveMemberByRole(
-                userGroup.getId(), PredefinedRole.VC_ACCESS_ADMIN.getId());
+                userGroup.getId(), PredefinedRole.QUERY_ACCESS_ADMIN.getId());
         return groupAdmins;
     }
 
@@ -185,7 +185,7 @@
             memberRoles.add(roleDao.retrieveRoleById(
                     PredefinedRole.USER_GROUP_MEMBER.getId()));
             memberRoles.add(roleDao
-                    .retrieveRoleById(PredefinedRole.VC_ACCESS_MEMBER.getId()));
+                    .retrieveRoleById(PredefinedRole.QUERY_ACCESS_MEMBER.getId()));
         }
     }
 
@@ -194,15 +194,15 @@
      * Do not include owners in group members.
      * 
      * {@link PredefinedRole#USER_GROUP_MEMBER} and
-     * {@link PredefinedRole#VC_ACCESS_MEMBER} roles are
+     * {@link PredefinedRole#QUERY_ACCESS_MEMBER} roles are
      * automatically assigned to each group member.
      * 
      * {@link PredefinedRole#USER_GROUP_MEMBER} restrict users
      * to see other group members and allow users to remove
      * themselves from the groups.
      * 
-     * {@link PredefinedRole#VC_ACCESS_MEMBER} allow user to
-     * read group VC.
+     * {@link PredefinedRole#QUERY_ACCESS_MEMBER} allow user to
+     * read group query.
      * 
      * @see /full/src/main/resources/db/predefined/V3.2__insert_predefined_roles.sql
      * 
@@ -318,7 +318,7 @@
      * @param userGroup
      *            a user group
      * @param createdBy
-     *            the user (VCA/system) adding the user the user-group
+     *            the user (query-access admin/system) adding the user the user-group
      * @param status
      *            the status of the membership
      * @throws KustvaktException
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/QueryReferenceController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/QueryReferenceController.java
index 4f42679..2ebd938 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/QueryReferenceController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/QueryReferenceController.java
@@ -22,11 +22,11 @@
 
 import de.ids_mannheim.korap.constant.OAuth2Scope;
 import de.ids_mannheim.korap.constant.QueryType;
-import de.ids_mannheim.korap.dto.VirtualCorpusDto;
+import de.ids_mannheim.korap.dto.QueryDto;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.oauth2.service.OAuth2ScopeService;
 import de.ids_mannheim.korap.security.context.TokenContext;
-import de.ids_mannheim.korap.service.VirtualCorpusService;
+import de.ids_mannheim.korap.service.QueryService;
 import de.ids_mannheim.korap.web.KustvaktResponseHandler;
 import de.ids_mannheim.korap.web.filter.APIVersionFilter;
 import de.ids_mannheim.korap.web.filter.AuthenticationFilter;
@@ -53,7 +53,7 @@
     @Autowired
     private KustvaktResponseHandler kustvaktResponseHandler;
     @Autowired
-    private VirtualCorpusService service;
+    private QueryService service;
     @Autowired
     private OAuth2ScopeService scopeService;
 
@@ -113,7 +113,7 @@
     @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
     @ResourceFilters({ APIVersionFilter.class, AuthenticationFilter.class,
         DemoUserFilter.class, PiwikFilter.class })
-    public VirtualCorpusDto retrieveQueryByName (
+    public QueryDto retrieveQueryByName (
             @Context SecurityContext securityContext,
             @PathParam("createdBy") String createdBy,
             @PathParam("qName") String qName) {
@@ -121,7 +121,7 @@
                 (TokenContext) securityContext.getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.VC_INFO);
-            return service.retrieveVCByName(context.getUsername(), qName,
+            return service.retrieveQueryByName(context.getUsername(), qName,
                     createdBy, QueryType.QUERY);
         }
         catch (KustvaktException e) {
@@ -161,17 +161,31 @@
     */
 
     
-    // TODO: List all queries available to the logged in user
+    /**
+     * Lists all queries available to the authenticated user.
+     *
+     * System-admins can list available queries for a specific user by
+     * specifiying the username parameter.
+     * 
+     * Normal users cannot list queries available for other users. 
+     * Thus, username parameter is optional
+     * and must be identical to the authenticated username.
+     * 
+     * @param securityContext
+     * @param username
+     *            a username (optional)
+     * @return a list of queries
+     */
     @GET
     @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
-    public List<VirtualCorpusDto> listAvailableQuery (
+    public List<QueryDto> listAvailableQuery (
             @Context SecurityContext securityContext,
             @QueryParam("username") String username) {
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.VC_INFO);
-            List<VirtualCorpusDto> dtos = service.listAvailableVCForUser(
+            List<QueryDto> dtos = service.listAvailableQueryForUser(
                     context.getUsername(), username, QueryType.QUERY);
             return dtos;
         }
@@ -179,7 +193,39 @@
             throw kustvaktResponseHandler.throwit(e);
         }
     }
-    // TODO: List all queries of a sepcific user
+    
+//    // TODO: List all queries of a sepcific user
+//    /**
+//     * Lists all queries created by a user. This list is only
+//     * available to the owner of the queries. Users, except system-admins, 
+//     * are not allowed to list queries created by other users. 
+//     * 
+//     * Thus, the path parameter "createdBy" must be the same as the
+//     * authenticated username. 
+//     * 
+//     * @param securityContext
+//     * @return a list of queries created by the user
+//     *         in the security context.
+//     */
+//    @GET
+//    @Path("~{createdBy}")
+//    @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
+//    public List<VirtualCorpusDto> listUserVC (
+//            @PathParam("createdBy") String createdBy,
+//            @Context SecurityContext securityContext) {
+//        TokenContext context =
+//                (TokenContext) securityContext.getUserPrincipal();
+//        try {
+//            scopeService.verifyScope(context, OAuth2Scope.VC_INFO);
+//            return service.listOwnerVC(context.getUsername(), createdBy,
+//                    QueryType.QUERY);
+//        }
+//        catch (KustvaktException e) {
+//            throw kustvaktResponseHandler.throwit(e);
+//        }
+//    }
+    
+    
     // TODO: Some admin routes missing.
     // TODO: Some sharing routes missing
 };
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
index 14b4ed2..8f74282 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
@@ -25,12 +25,12 @@
 import de.ids_mannheim.korap.constant.OAuth2Scope;
 import de.ids_mannheim.korap.constant.QueryType;
 import de.ids_mannheim.korap.constant.ResourceType;
-import de.ids_mannheim.korap.dto.VirtualCorpusAccessDto;
-import de.ids_mannheim.korap.dto.VirtualCorpusDto;
+import de.ids_mannheim.korap.dto.QueryAccessDto;
+import de.ids_mannheim.korap.dto.QueryDto;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.oauth2.service.OAuth2ScopeService;
 import de.ids_mannheim.korap.security.context.TokenContext;
-import de.ids_mannheim.korap.service.VirtualCorpusService;
+import de.ids_mannheim.korap.service.QueryService;
 import de.ids_mannheim.korap.web.KustvaktResponseHandler;
 import de.ids_mannheim.korap.web.filter.APIVersionFilter;
 import de.ids_mannheim.korap.web.filter.AuthenticationFilter;
@@ -66,7 +66,7 @@
     @Autowired
     private KustvaktResponseHandler kustvaktResponseHandler;
     @Autowired
-    private VirtualCorpusService service;
+    private QueryService service;
     @Autowired
     private OAuth2ScopeService scopeService;
 
@@ -125,7 +125,7 @@
     @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
     @ResourceFilters({ APIVersionFilter.class, AuthenticationFilter.class,
         DemoUserFilter.class, PiwikFilter.class })
-    public VirtualCorpusDto retrieveVCByName (
+    public QueryDto retrieveVCByName (
             @Context SecurityContext securityContext,
             @PathParam("createdBy") String createdBy,
             @PathParam("vcName") String vcName) {
@@ -133,7 +133,7 @@
                 (TokenContext) securityContext.getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.VC_INFO);
-            return service.retrieveVCByName(context.getUsername(), vcName,
+            return service.retrieveQueryByName(context.getUsername(), vcName,
                     createdBy, QueryType.VIRTUAL_CORPUS);
         }
         catch (KustvaktException e) {
@@ -158,14 +158,14 @@
      */
     @GET
     @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
-    public List<VirtualCorpusDto> listAvailableVC (
+    public List<QueryDto> listAvailableVC (
             @Context SecurityContext securityContext,
             @QueryParam("username") String username) {
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.VC_INFO);
-            return service.listAvailableVCForUser(context.getUsername(),
+            return service.listAvailableQueryForUser(context.getUsername(),
                     username, QueryType.VIRTUAL_CORPUS);
         }
         catch (KustvaktException e) {
@@ -188,14 +188,14 @@
     @GET
     @Path("~{createdBy}")
     @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
-    public List<VirtualCorpusDto> listUserVC (
+    public List<QueryDto> listUserVC (
             @PathParam("createdBy") String createdBy,
             @Context SecurityContext securityContext) {
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.VC_INFO);
-            return service.listOwnerVC(context.getUsername(), createdBy,
+            return service.listOwnerQuery(context.getUsername(), createdBy,
                     QueryType.VIRTUAL_CORPUS);
         }
         catch (KustvaktException e) {
@@ -221,7 +221,7 @@
     @GET
     @Path("list/system-admin")
     @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
-    public List<VirtualCorpusDto> listVCByType (
+    public List<QueryDto> listVCByType (
             @Context SecurityContext securityContext,
             @QueryParam("createdBy") String createdBy,
             @QueryParam("type") ResourceType type) {
@@ -229,7 +229,7 @@
                 (TokenContext) securityContext.getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.ADMIN);
-            return service.listVCByType(context.getUsername(), createdBy, type,
+            return service.listQueryByType(context.getUsername(), createdBy, type,
                     QueryType.VIRTUAL_CORPUS);
         }
         catch (KustvaktException e) {
@@ -259,7 +259,7 @@
                 (TokenContext) securityContext.getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.DELETE_VC);
-            service.deleteVCByName(context.getUsername(), vcName, createdBy);
+            service.deleteQueryByName(context.getUsername(), vcName, createdBy);
         }
         catch (KustvaktException e) {
             throw kustvaktResponseHandler.throwit(e);
@@ -294,7 +294,7 @@
                 (TokenContext) securityContext.getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.SHARE_VC);
-            service.shareVC(context.getUsername(), vcCreator, vcName, groupName);
+            service.shareQuery(context.getUsername(), vcCreator, vcName, groupName);
         }
         catch (KustvaktException e) {
             throw kustvaktResponseHandler.throwit(e);
@@ -322,7 +322,7 @@
                 (TokenContext) securityContext.getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.DELETE_VC_ACCESS);
-            service.deleteVCAccess(accessId, context.getUsername());
+            service.deleteQueryAccess(accessId, context.getUsername());
         }
         catch (KustvaktException e) {
             throw kustvaktResponseHandler.throwit(e);
@@ -342,7 +342,7 @@
     @GET
     @Path("access")
     @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
-    public List<VirtualCorpusAccessDto> listVCAccesses (
+    public List<QueryAccessDto> listVCAccesses (
             @Context SecurityContext securityContext,
             @QueryParam("groupName") String groupName) {
         TokenContext context =
@@ -350,10 +350,10 @@
         try {
             scopeService.verifyScope(context, OAuth2Scope.VC_ACCESS_INFO);
             if (groupName!=null && !groupName.isEmpty()){
-                return service.listVCAccessByGroup(context.getUsername(), groupName);
+                return service.listQueryAccessByGroup(context.getUsername(), groupName);
             }
             else {
-                return service.listVCAccessByUsername(context.getUsername());
+                return service.listQueryAccessByUsername(context.getUsername());
             }
         }
         catch (KustvaktException e) {
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/input/QueryJson.java b/full/src/main/java/de/ids_mannheim/korap/web/input/QueryJson.java
index 8d061a9..8badd38 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/input/QueryJson.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/input/QueryJson.java
@@ -3,17 +3,19 @@
 
 import de.ids_mannheim.korap.constant.QueryType;
 import de.ids_mannheim.korap.constant.ResourceType;
-import de.ids_mannheim.korap.service.VirtualCorpusService;
+import de.ids_mannheim.korap.service.QueryService;
+import de.ids_mannheim.korap.web.controller.QueryReferenceController;
 import de.ids_mannheim.korap.web.controller.VirtualCorpusController;
 import lombok.Getter;
 import lombok.Setter;
 
-/** Java POJO of JSON input of the virtual corpus controller for 
- * creating and editing virtual corpora.
+/** Java POJO of JSON input of the virtual corpus and query controllers 
+ * for creating and editing virtual corpora and query references.
  * 
  * @author margaretha
  * @see VirtualCorpusController
- * @see VirtualCorpusService
+ * @see QueryReferenceController
+ * @see QueryService
  */
 @Getter
 @Setter
diff --git a/full/src/main/resources/db/predefined/V2.1__insert_predefined_roles.sql b/full/src/main/resources/db/predefined/V2.1__insert_predefined_roles.sql
index 6fb6991..1c3f75f 100644
--- a/full/src/main/resources/db/predefined/V2.1__insert_predefined_roles.sql
+++ b/full/src/main/resources/db/predefined/V2.1__insert_predefined_roles.sql
@@ -1,8 +1,8 @@
 -- roles
 INSERT INTO role(name) VALUES ("USER_GROUP_ADMIN");
 INSERT INTO role(name) VALUES ("USER_GROUP_MEMBER");
-INSERT INTO role(name) VALUES ("VC_ACCESS_ADMIN");
-INSERT INTO role(name) VALUES ("VC_ACCESS_MEMBER");
+INSERT INTO role(name) VALUES ("QUERY_ACCESS_ADMIN");
+INSERT INTO role(name) VALUES ("QUERY_ACCESS_MEMBER");
 
 -- privileges
 INSERT INTO privilege(name,role_id)
diff --git a/full/src/main/resources/db/sqlite/V1.1__create_virtual_corpus_tables.sql b/full/src/main/resources/db/sqlite/V1.1__create_virtual_corpus_tables.sql
index febf97b..2a62319 100644
--- a/full/src/main/resources/db/sqlite/V1.1__create_virtual_corpus_tables.sql
+++ b/full/src/main/resources/db/sqlite/V1.1__create_virtual_corpus_tables.sql
@@ -78,10 +78,10 @@
   is_cached BOOLEAN DEFAULT 0
 );
 
-CREATE INDEX IF NOT EXISTS virtual_corpus_owner_index ON virtual_corpus(created_by);
-CREATE INDEX IF NOT EXISTS virtual_corpus_type_index ON virtual_corpus(type);
-CREATE UNIQUE INDEX IF NOT EXISTS  virtual_corpus_unique_name 
-	ON virtual_corpus(name,created_by);
+--CREATE INDEX IF NOT EXISTS virtual_corpus_owner_index ON virtual_corpus(created_by);
+--CREATE INDEX IF NOT EXISTS virtual_corpus_type_index ON virtual_corpus(type);
+--CREATE UNIQUE INDEX IF NOT EXISTS  virtual_corpus_unique_name 
+--	ON virtual_corpus(name,created_by);
 
 CREATE TABLE IF NOT EXISTS virtual_corpus_access (
   id INTEGER PRIMARY KEY AUTOINCREMENT,
diff --git a/full/src/main/resources/db/sqlite/V1.9__query_alteration.sql b/full/src/main/resources/db/sqlite/V1.9__query_alteration.sql
index 384faf5..0d3bf8c 100644
--- a/full/src/main/resources/db/sqlite/V1.9__query_alteration.sql
+++ b/full/src/main/resources/db/sqlite/V1.9__query_alteration.sql
@@ -7,6 +7,31 @@
 ALTER TABLE virtual_corpus 
 ADD COLUMN query_language VARCHAR(100) DEFAULT NULL;
 
+ALTER TABLE virtual_corpus 
+RENAME COLUMN corpus_query TO koral_query;
+
+ALTER TABLE virtual_corpus
+RENAME TO query;
+
+DROP INDEX IF EXISTS virtual_corpus_owner_index;
+DROP INDEX IF EXISTS virtual_corpus_type_index;
+DROP INDEX IF EXISTS  virtual_corpus_unique_name; 
+
+CREATE INDEX IF NOT EXISTS query_owner_index ON query(created_by);
+CREATE INDEX IF NOT EXISTS query_type_index ON query(type);
+CREATE UNIQUE INDEX IF NOT EXISTS  query_unique_name 
+	ON query(name,created_by);
+
+
+
+ALTER TABLE virtual_corpus_access 
+RENAME COLUMN virtual_corpus_id TO query_id;
+
+ALTER TABLE virtual_corpus_access
+RENAME TO query_access;
+
+
+
 
 DROP TABLE IF EXISTS query_reference;
 
diff --git a/full/src/main/resources/db/test/V3.1__insert_virtual_corpus.sql b/full/src/main/resources/db/test/V3.1__insert_virtual_corpus.sql
index 778fb4b..d9d2c13 100644
--- a/full/src/main/resources/db/test/V3.1__insert_virtual_corpus.sql
+++ b/full/src/main/resources/db/test/V3.1__insert_virtual_corpus.sql
@@ -61,52 +61,52 @@
 
 		
 -- virtual corpora
-INSERT INTO virtual_corpus(name, type, query_type, required_access, created_by, description, status, corpus_query) 
+INSERT INTO query(name, type, query_type, required_access, created_by, description, status, koral_query) 
 	VALUES ("dory-vc", "PRIVATE", "VIRTUAL_CORPUS", "FREE", "dory", "test vc", "experimental",
 	'{"collection": { "@type": "koral:docGroup", "operands": [ { "@type": "koral:doc", "key": "corpusSigle", "match": "match:eq", "value": "GOE" }, { "@type": "koral:doc", "key": "creationDate", "match": "match:geq", "type": "type:date", "value": "1820" } ], "operation": "operation:and" }}');
 	
-INSERT INTO virtual_corpus(name, type, query_type, required_access, created_by, description, status, corpus_query) 
+INSERT INTO query(name, type, query_type, required_access, created_by, description, status, koral_query) 
 	VALUES ("group-vc", "PROJECT", "VIRTUAL_CORPUS", "PUB", "dory", "test vc", "experimental",
 	'{"collection": { "@type": "koral:docGroup", "operands": [ { "@type": "koral:doc", "key": "corpusSigle", "match": "match:eq", "value": "GOE" }, { "@type": "koral:doc", "key": "creationDate", "match": "match:leq", "type": "type:date", "value": "1810" } ], "operation": "operation:and" }}');
 
-INSERT INTO virtual_corpus(name, type, query_type, required_access, created_by, description, status, corpus_query) 
+INSERT INTO query(name, type, query_type, required_access, created_by, description, status, koral_query) 
 	VALUES ("system-vc", "SYSTEM", "VIRTUAL_CORPUS", "ALL", "system", "test vc", "experimental",
 	'{"collection":{"@type":"koral:doc","value":"GOE","match":"match:eq","key":"corpusSigle"}}');
 
-INSERT INTO virtual_corpus(name, type, query_type, required_access, created_by, description, status, corpus_query) 
+INSERT INTO query(name, type, query_type, required_access, created_by, description, status, koral_query) 
 	VALUES ("published-vc", "PUBLISHED", "VIRTUAL_CORPUS", "ALL", "marlin", "test vc", "experimental",
 	'{"collection":{"@type":"koral:doc","value":"GOE","match":"match:eq","key":"corpusSigle"}}');
 
-INSERT INTO virtual_corpus(name, type, query_type, required_access, created_by, description, status, corpus_query) 
+INSERT INTO query(name, type, query_type, required_access, created_by, description, status, koral_query) 
 	VALUES ("marlin-vc", "PRIVATE", "VIRTUAL_CORPUS", "FREE", "marlin", "marlin test share vc", "experimental",
 	'{"collection": { "@type": "koral:docGroup", "operands": [ { "@type": "koral:doc", "key": "corpusSigle", "match": "match:eq", "value": "GOE" }, { "@type": "koral:doc", "key": "creationDate", "match": "match:geq", "type": "type:date", "value": "1820" } ], "operation": "operation:and" }}');
 
-INSERT INTO virtual_corpus(name, type, query_type, required_access, created_by, description, status, corpus_query) 
+INSERT INTO query(name, type, query_type, required_access, created_by, description, status, koral_query) 
 	VALUES ("nemo-vc", "PRIVATE", "VIRTUAL_CORPUS", "ALL", "nemo", "nemo test vc", "experimental",
 	'{"collection":{"@type":"koral:doc","value":"GOE","match":"match:eq","key":"corpusSigle"}}');	
 	
 -- virtual corpus access
-INSERT INTO virtual_corpus_access(virtual_corpus_id, user_group_id, status, created_by) 
+INSERT INTO query_access(query_id, user_group_id, status, created_by) 
 	SELECT 
-		(SELECT id from virtual_corpus where name = "group-vc"), 
+		(SELECT id from query where name = "group-vc"), 
 		(SELECT id from user_group where name = "dory-group"), 
 		"ACTIVE", "dory";
 
---INSERT INTO virtual_corpus_access(virtual_corpus_id, user_group_id, status, created_by) 
+--INSERT INTO query_access(query_id, user_group_id, status, created_by) 
 --	SELECT 
---		(SELECT id from virtual_corpus where name = "system-vc"), 
+--		(SELECT id from query where name = "system-vc"), 
 --		(SELECT id from user_group where name = "all users"),
 --		"ACTIVE", "system";
 
-INSERT INTO virtual_corpus_access(virtual_corpus_id, user_group_id, status, created_by) 
+INSERT INTO query_access(query_id, user_group_id, status, created_by) 
 	SELECT 
-		(SELECT id from virtual_corpus where name = "published-vc"),
+		(SELECT id from query where name = "published-vc"),
 		(SELECT id from user_group where name = "marlin-group"),
 		"ACTIVE", "marlin";
 
-INSERT INTO virtual_corpus_access(virtual_corpus_id, user_group_id, status, created_by) 
+INSERT INTO query_access(query_id, user_group_id, status, created_by) 
 	SELECT 
-		(SELECT id from virtual_corpus where name = "published-vc"),
+		(SELECT id from query where name = "published-vc"),
 		(SELECT id from user_group where name = "auto-group"),
 		"HIDDEN", "system";
 
diff --git a/full/src/main/resources/db/test/V3.3__insert_member_roles.sql b/full/src/main/resources/db/test/V3.3__insert_member_roles.sql
index effbbcb..6832575 100644
--- a/full/src/main/resources/db/test/V3.3__insert_member_roles.sql
+++ b/full/src/main/resources/db/test/V3.3__insert_member_roles.sql
@@ -9,7 +9,7 @@
 INSERT INTO group_member_role(group_member_id,role_id)
 SELECT
 	(SELECT id FROM user_group_member WHERE user_id="marlin" AND group_id=1),
-	(SELECT id FROM role WHERE name = "VC_ACCESS_ADMIN");
+	(SELECT id FROM role WHERE name = "QUERY_ACCESS_ADMIN");
 	
 INSERT INTO group_member_role(group_member_id,role_id)
 SELECT
@@ -19,7 +19,7 @@
 INSERT INTO group_member_role(group_member_id,role_id)
 SELECT
 	(SELECT id FROM user_group_member WHERE user_id="dory" AND group_id=1),
-	(SELECT id FROM role WHERE name = "VC_ACCESS_ADMIN");
+	(SELECT id FROM role WHERE name = "QUERY_ACCESS_ADMIN");
 	
 	
 -- dory group
@@ -31,7 +31,7 @@
 INSERT INTO group_member_role(group_member_id,role_id)
 SELECT
 	(SELECT id FROM user_group_member WHERE user_id="dory" AND group_id=2),
-	(SELECT id FROM role WHERE name = "VC_ACCESS_ADMIN");
+	(SELECT id FROM role WHERE name = "QUERY_ACCESS_ADMIN");
 	
 INSERT INTO group_member_role(group_member_id,role_id)
 SELECT
@@ -41,12 +41,12 @@
 INSERT INTO group_member_role(group_member_id,role_id)
 SELECT
 	(SELECT id FROM user_group_member WHERE user_id="nemo" AND group_id=2),
-	(SELECT id FROM role WHERE name = "VC_ACCESS_MEMBER");
+	(SELECT id FROM role WHERE name = "QUERY_ACCESS_MEMBER");
 
 
 -- auto group
 INSERT INTO group_member_role(group_member_id,role_id)
 SELECT
 	(SELECT id FROM user_group_member WHERE user_id="pearl" AND group_id=3),
-	(SELECT id FROM role WHERE name = "VC_ACCESS_MEMBER");
+	(SELECT id FROM role WHERE name = "QUERY_ACCESS_MEMBER");
 
diff --git a/full/src/main/resources/db/test/V3.7__insert_query_references.sql b/full/src/main/resources/db/test/V3.7__insert_query_references.sql
index a1ec5fb..0507380 100644
--- a/full/src/main/resources/db/test/V3.7__insert_query_references.sql
+++ b/full/src/main/resources/db/test/V3.7__insert_query_references.sql
@@ -1,10 +1,10 @@
 -- query references
-INSERT INTO virtual_corpus(name, type, query_type, required_access, created_by, description, status, 
-    corpus_query, query, query_language) 
+INSERT INTO query(name, type, query_type, required_access, created_by, description, status, 
+    koral_query, query, query_language) 
 	VALUES ("dory-q", "PRIVATE", "QUERY", "FREE", "dory", "test query", "experimental",
 	'{ "@type": "koral:token" }', "[]", "poliqarp");
 
-INSERT INTO virtual_corpus(name, type, query_type, required_access, created_by, description, status, 
-    corpus_query, query, query_language) 
+INSERT INTO query(name, type, query_type, required_access, created_by, description, status, 
+    koral_query, query, query_language) 
 	VALUES ("system-q", "SYSTEM", "QUERY", "FREE", "system", '"system" query', "experimental",
 	'{ "@type": "koral:token" }', "[]", "poliqarp");
diff --git a/full/src/test/java/de/ids_mannheim/korap/cache/NamedVCLoaderTest.java b/full/src/test/java/de/ids_mannheim/korap/cache/NamedVCLoaderTest.java
index 7e3736a..ef57687 100644
--- a/full/src/test/java/de/ids_mannheim/korap/cache/NamedVCLoaderTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/cache/NamedVCLoaderTest.java
@@ -12,8 +12,8 @@
 import de.ids_mannheim.korap.collection.CachedVCData;
 import de.ids_mannheim.korap.config.NamedVCLoader;
 import de.ids_mannheim.korap.config.SpringJerseyTest;
-import de.ids_mannheim.korap.dao.VirtualCorpusDao;
-import de.ids_mannheim.korap.entity.VirtualCorpus;
+import de.ids_mannheim.korap.dao.QueryDao;
+import de.ids_mannheim.korap.entity.QueryDO;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.util.QueryException;
 import net.sf.ehcache.CacheManager;
@@ -24,7 +24,7 @@
     @Autowired
     private NamedVCLoader vcLoader;
     @Autowired
-    private VirtualCorpusDao dao;
+    private QueryDao dao;
 
     @Test
     public void testNamedVCLoader ()
@@ -41,7 +41,7 @@
         assertTrue(cachedData.getDocIdMap().size() > 0);
         
         KrillCollection.cache.removeAll();
-        VirtualCorpus vc = dao.retrieveVCByName("named-vc1", "system");
-        dao.deleteVirtualCorpus(vc);
+        QueryDO vc = dao.retrieveQueryByName("named-vc1", "system");
+        dao.deleteQuery(vc);
     }
 }
diff --git a/full/src/test/java/de/ids_mannheim/korap/config/SpringJerseyTest.java b/full/src/test/java/de/ids_mannheim/korap/config/SpringJerseyTest.java
index cbb6977..ac11283 100644
--- a/full/src/test/java/de/ids_mannheim/korap/config/SpringJerseyTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/config/SpringJerseyTest.java
@@ -76,7 +76,8 @@
             socket.close();
         }
         catch (IOException e) {
-            e.printStackTrace();
+//            e.printStackTrace();
+            System.out.println("[WARNING] " + e.getMessage());
             port = getPort(port);
         }
         return port;
diff --git a/full/src/test/java/de/ids_mannheim/korap/dao/UserGroupDaoTest.java b/full/src/test/java/de/ids_mannheim/korap/dao/UserGroupDaoTest.java
index 3df8c24..e81ed11 100644
--- a/full/src/test/java/de/ids_mannheim/korap/dao/UserGroupDaoTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/dao/UserGroupDaoTest.java
@@ -20,12 +20,12 @@
 import de.ids_mannheim.korap.constant.PredefinedRole;
 import de.ids_mannheim.korap.constant.QueryType;
 import de.ids_mannheim.korap.constant.UserGroupStatus;
-import de.ids_mannheim.korap.constant.VirtualCorpusAccessStatus;
+import de.ids_mannheim.korap.constant.QueryAccessStatus;
 import de.ids_mannheim.korap.constant.ResourceType;
 import de.ids_mannheim.korap.entity.Role;
 import de.ids_mannheim.korap.entity.UserGroup;
 import de.ids_mannheim.korap.entity.UserGroupMember;
-import de.ids_mannheim.korap.entity.VirtualCorpus;
+import de.ids_mannheim.korap.entity.QueryDO;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.user.User.CorpusAccess;
 import edu.emory.mathcs.backport.java.util.Collections;
@@ -37,7 +37,7 @@
     @Autowired
     private UserGroupDao userGroupDao;
     @Autowired
-    private VirtualCorpusDao virtualCorpusDao;
+    private QueryDao virtualCorpusDao;
     @Autowired
     private RoleDao roleDao;
     @Autowired
@@ -78,11 +78,11 @@
         Collections.sort(roleList);
         assertEquals(PredefinedRole.USER_GROUP_ADMIN.getId(),
                 roleList.get(0).getId());
-        assertEquals(PredefinedRole.VC_ACCESS_ADMIN.getId(),
+        assertEquals(PredefinedRole.QUERY_ACCESS_ADMIN.getId(),
                 roleList.get(1).getId());
 
         //retrieve VC by group
-        List<VirtualCorpus> vc = virtualCorpusDao.retrieveVCByGroup(groupId);
+        List<QueryDO> vc = virtualCorpusDao.retrieveQueryByGroup(groupId);
         assertEquals(0, vc.size());
 
         // soft delete group
@@ -113,7 +113,7 @@
 
         assertEquals(PredefinedRole.USER_GROUP_MEMBER.name(),
                 sortedRoles.get(0).getName());
-        assertEquals(PredefinedRole.VC_ACCESS_MEMBER.name(),
+        assertEquals(PredefinedRole.QUERY_ACCESS_MEMBER.name(),                
                 sortedRoles.get(1).getName());
     }
 
@@ -134,26 +134,26 @@
         UserGroup group = userGroupDao.retrieveGroupById(groupId);
         String createdBy = "dory";
         String name = "dory new vc";
-        int id = virtualCorpusDao.createVirtualCorpus(name,
+        int id = virtualCorpusDao.createQuery(name,
                 ResourceType.PROJECT, QueryType.VIRTUAL_CORPUS,
                 CorpusAccess.PUB, "corpusSigle=WPD15", "", "", "", false,
                 createdBy, null, null);
 
-        VirtualCorpus virtualCorpus = virtualCorpusDao.retrieveVCById(id);
-        userGroupDao.addVCToGroup(virtualCorpus, createdBy,
-                VirtualCorpusAccessStatus.ACTIVE, group);
+        QueryDO virtualCorpus = virtualCorpusDao.retrieveQueryById(id);
+        userGroupDao.addQueryToGroup(virtualCorpus, createdBy,
+                QueryAccessStatus.ACTIVE, group);
 
-        List<VirtualCorpus> vc = virtualCorpusDao.retrieveVCByGroup(groupId);
+        List<QueryDO> vc = virtualCorpusDao.retrieveQueryByGroup(groupId);
         assertEquals(2, vc.size());
         assertEquals(name, vc.get(1).getName());
 
         // delete vc from group
-        userGroupDao.deleteVCFromGroup(virtualCorpus.getId(), groupId);
+        userGroupDao.deleteQueryFromGroup(virtualCorpus.getId(), groupId);
 
-        vc = virtualCorpusDao.retrieveVCByGroup(groupId);
+        vc = virtualCorpusDao.retrieveQueryByGroup(groupId);
         assertEquals(1, vc.size());
 
         // delete vc
-        virtualCorpusDao.deleteVirtualCorpus(virtualCorpus);
+        virtualCorpusDao.deleteQuery(virtualCorpus);
     }
 }
diff --git a/full/src/test/java/de/ids_mannheim/korap/dao/UserGroupMemberDaoTest.java b/full/src/test/java/de/ids_mannheim/korap/dao/UserGroupMemberDaoTest.java
index 8b38d7b..6059e2b 100644
--- a/full/src/test/java/de/ids_mannheim/korap/dao/UserGroupMemberDaoTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/dao/UserGroupMemberDaoTest.java
@@ -30,7 +30,7 @@
     public void testRetrieveMemberByRole () throws KustvaktException {
         // dory group
         List<UserGroupMember> vcaAdmins = dao.retrieveMemberByRole(2,
-                PredefinedRole.VC_ACCESS_ADMIN.getId());
+                PredefinedRole.QUERY_ACCESS_ADMIN.getId());
         // System.out.println(vcaAdmins);
         assertEquals(1, vcaAdmins.size());
         assertEquals("dory", vcaAdmins.get(0).getUserId());
diff --git a/full/src/test/java/de/ids_mannheim/korap/dao/VirtualCorpusAccessDaoTest.java b/full/src/test/java/de/ids_mannheim/korap/dao/VirtualCorpusAccessDaoTest.java
index 006ca9c..bfdb84c 100644
--- a/full/src/test/java/de/ids_mannheim/korap/dao/VirtualCorpusAccessDaoTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/dao/VirtualCorpusAccessDaoTest.java
@@ -12,9 +12,9 @@
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
-import de.ids_mannheim.korap.constant.VirtualCorpusAccessStatus;
+import de.ids_mannheim.korap.constant.QueryAccessStatus;
 import de.ids_mannheim.korap.entity.UserGroup;
-import de.ids_mannheim.korap.entity.VirtualCorpusAccess;
+import de.ids_mannheim.korap.entity.QueryAccess;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 
 @RunWith(SpringJUnit4ClassRunner.class)
@@ -22,16 +22,16 @@
 public class VirtualCorpusAccessDaoTest {
 
     @Autowired
-    private VirtualCorpusAccessDao dao;
+    private QueryAccessDao dao;
 
     @Rule
     public ExpectedException thrown = ExpectedException.none();
 
     @Test
     public void getAccessByVC () throws KustvaktException {
-        List<VirtualCorpusAccess> vcaList = dao.retrieveActiveAccessByVC(2);
-        VirtualCorpusAccess access = vcaList.get(0);
-        assertEquals(VirtualCorpusAccessStatus.ACTIVE, access.getStatus());
+        List<QueryAccess> vcaList = dao.retrieveActiveAccessByQuery(2);
+        QueryAccess access = vcaList.get(0);
+        assertEquals(QueryAccessStatus.ACTIVE, access.getStatus());
         assertEquals("dory", access.getCreatedBy());
         
         UserGroup group = access.getUserGroup();
diff --git a/full/src/test/java/de/ids_mannheim/korap/dao/VirtualCorpusDaoTest.java b/full/src/test/java/de/ids_mannheim/korap/dao/VirtualCorpusDaoTest.java
index 3294099..10b3eb2 100644
--- a/full/src/test/java/de/ids_mannheim/korap/dao/VirtualCorpusDaoTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/dao/VirtualCorpusDaoTest.java
@@ -15,25 +15,25 @@
 import de.ids_mannheim.korap.config.SpringJerseyTest;
 import de.ids_mannheim.korap.constant.QueryType;
 import de.ids_mannheim.korap.constant.ResourceType;
-import de.ids_mannheim.korap.entity.VirtualCorpus;
+import de.ids_mannheim.korap.entity.QueryDO;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.user.User;
 
 public class VirtualCorpusDaoTest extends SpringJerseyTest {
 
     @Autowired
-    private VirtualCorpusDao dao;
+    private QueryDao dao;
 
     @Rule
     public ExpectedException thrown = ExpectedException.none();
 
     @Test
     public void testListVCByType () throws KustvaktException {
-        List<VirtualCorpus> vcList =
-                dao.retrieveVCByType(ResourceType.PUBLISHED, null, QueryType.VIRTUAL_CORPUS);
+        List<QueryDO> vcList =
+                dao.retrieveQueryByType(ResourceType.PUBLISHED, null, QueryType.VIRTUAL_CORPUS);
         assertEquals(1, vcList.size());
 
-        VirtualCorpus vc = vcList.get(0);
+        QueryDO vc = vcList.get(0);
         assertEquals(4, vc.getId());
         assertEquals("published-vc", vc.getName());
         assertEquals("marlin", vc.getCreatedBy());
@@ -42,23 +42,23 @@
     @Test
     public void testSystemVC () throws KustvaktException {
         // insert vc
-        int id = dao.createVirtualCorpus("system-vc", ResourceType.SYSTEM,
+        int id = dao.createQuery("system-vc", ResourceType.SYSTEM,
                 QueryType.VIRTUAL_CORPUS, User.CorpusAccess.FREE,
                 "corpusSigle=GOE", "definition", "description", "experimental",
                 false, "test class", null, null);
 
         // select vc
-        List<VirtualCorpus> vcList =
-                dao.retrieveVCByType(ResourceType.SYSTEM, null, QueryType.VIRTUAL_CORPUS);
+        List<QueryDO> vcList =
+                dao.retrieveQueryByType(ResourceType.SYSTEM, null, QueryType.VIRTUAL_CORPUS);
         assertEquals(2, vcList.size());
 
-        VirtualCorpus vc = dao.retrieveVCById(id);
+        QueryDO vc = dao.retrieveQueryById(id);
         // delete vc
-        dao.deleteVirtualCorpus(vc);
+        dao.deleteQuery(vc);
 
         // check if vc has been deleted
         thrown.expect(KustvaktException.class);
-        dao.retrieveVCById(id);
+        dao.retrieveQueryById(id);
     }
 
     @Test
@@ -66,7 +66,7 @@
         thrown.expect(PersistenceException.class);
         thrown.expectMessage("could not execute statement");
         
-        dao.createVirtualCorpus("system-vc", ResourceType.SYSTEM,
+        dao.createQuery("system-vc", ResourceType.SYSTEM,
                 QueryType.VIRTUAL_CORPUS, User.CorpusAccess.FREE,
                 "corpusSigle=GOE", "definition", "description", "experimental",
                 false, "system", null, null);
@@ -74,8 +74,8 @@
 
     @Test
     public void retrieveSystemVC () throws KustvaktException {
-        List<VirtualCorpus> vc =
-                dao.retrieveVCByType(ResourceType.SYSTEM, null, QueryType.VIRTUAL_CORPUS);
+        List<QueryDO> vc =
+                dao.retrieveQueryByType(ResourceType.SYSTEM, null, QueryType.VIRTUAL_CORPUS);
         assertEquals(1, vc.size());
     }
 
@@ -86,12 +86,12 @@
      */
     @Test
     public void retrieveVCByUserDory () throws KustvaktException {
-        List<VirtualCorpus> virtualCorpora =
-                dao.retrieveVCByUser("dory", QueryType.VIRTUAL_CORPUS);
+        List<QueryDO> virtualCorpora =
+                dao.retrieveQueryByUser("dory", QueryType.VIRTUAL_CORPUS);
         // System.out.println(virtualCorpora);
         assertEquals(4, virtualCorpora.size());
         // ordered by id
-        Iterator<VirtualCorpus> i = virtualCorpora.iterator();
+        Iterator<QueryDO> i = virtualCorpora.iterator();
         assertEquals("dory-vc", i.next().getName());
         assertEquals("group-vc", i.next().getName());
         assertEquals("system-vc", i.next().getName());
@@ -106,10 +106,10 @@
      */
     @Test
     public void retrieveVCByUserNemo () throws KustvaktException {
-        List<VirtualCorpus> virtualCorpora =
-                dao.retrieveVCByUser("nemo", QueryType.VIRTUAL_CORPUS);
+        List<QueryDO> virtualCorpora =
+                dao.retrieveQueryByUser("nemo", QueryType.VIRTUAL_CORPUS);
         assertEquals(3, virtualCorpora.size());
-        Iterator<VirtualCorpus> i = virtualCorpora.iterator();
+        Iterator<QueryDO> i = virtualCorpora.iterator();
         assertEquals("group-vc", i.next().getName());
         assertEquals("system-vc", i.next().getName());
         assertEquals("nemo-vc", i.next().getName());
@@ -123,10 +123,10 @@
      */
     @Test
     public void retrieveVCByUserMarlin () throws KustvaktException {
-        List<VirtualCorpus> virtualCorpora =
-                dao.retrieveVCByUser("marlin", QueryType.VIRTUAL_CORPUS);
+        List<QueryDO> virtualCorpora =
+                dao.retrieveQueryByUser("marlin", QueryType.VIRTUAL_CORPUS);
         assertEquals(3, virtualCorpora.size());
-        Iterator<VirtualCorpus> i = virtualCorpora.iterator();
+        Iterator<QueryDO> i = virtualCorpora.iterator();
         assertEquals("system-vc", i.next().getName());
         assertEquals("published-vc", i.next().getName());
         assertEquals("marlin-vc", i.next().getName());
@@ -140,10 +140,10 @@
      */
     @Test
     public void retrieveVCByUserPearl () throws KustvaktException {
-        List<VirtualCorpus> virtualCorpora =
-                dao.retrieveVCByUser("pearl", QueryType.VIRTUAL_CORPUS);
+        List<QueryDO> virtualCorpora =
+                dao.retrieveQueryByUser("pearl", QueryType.VIRTUAL_CORPUS);
         assertEquals(2, virtualCorpora.size());
-        Iterator<VirtualCorpus> i = virtualCorpora.iterator();
+        Iterator<QueryDO> i = virtualCorpora.iterator();
         assertEquals("system-vc", i.next().getName());
         assertEquals("published-vc", i.next().getName());
     }
diff --git a/full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
index b911877..d019dd2 100644
--- a/full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
@@ -17,8 +17,8 @@
 import de.ids_mannheim.korap.config.Attributes;
 import de.ids_mannheim.korap.config.NamedVCLoader;
 import de.ids_mannheim.korap.config.SpringJerseyTest;
-import de.ids_mannheim.korap.dao.VirtualCorpusDao;
-import de.ids_mannheim.korap.entity.VirtualCorpus;
+import de.ids_mannheim.korap.dao.QueryDao;
+import de.ids_mannheim.korap.entity.QueryDO;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.util.QueryException;
 import de.ids_mannheim.korap.utils.JsonUtils;
@@ -33,7 +33,7 @@
     @Autowired
     private NamedVCLoader vcLoader;
     @Autowired
-    private VirtualCorpusDao dao;
+    private QueryDao dao;
 
     @Test
     public void testCachedVCRef ()
@@ -56,8 +56,8 @@
         testCachedVCRefWithUsername();
 
         KrillCollection.cache.removeAll();
-        VirtualCorpus vc = dao.retrieveVCByName("named-vc1", "system");
-        dao.deleteVirtualCorpus(vc);
+        QueryDO vc = dao.retrieveQueryByName("named-vc1", "system");
+        dao.deleteQuery(vc);
     }
 
     private void testCachedVCRefWithUsername ()
diff --git a/full/src/test/java/de/ids_mannheim/korap/service/QueryReferenceServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/service/QueryReferenceServiceTest.java
deleted file mode 100644
index 9590209..0000000
--- a/full/src/test/java/de/ids_mannheim/korap/service/QueryReferenceServiceTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package de.ids_mannheim.korap.service;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-
-@Ignore
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:test-config.xml")
-public class QueryReferenceServiceTest {
-
-    @Autowired
-    private QueryReferenceService qService;
-
-    @Rule
-    public ExpectedException thrown = ExpectedException.none();
-
-    @Test
-    public void createQuery () throws KustvaktException {
-        qService.storeQuery("{\"@type\":\"koral:token\"}", "new-query", "me" );
-        JsonNode json = qService.searchQueryByName("me", "new-query", "me");
-        assertEquals("koral:token", json.at("/@type").asText());
-        qService.deleteQueryByName("me", "new-query", "me");
-    };
-
-    @Test
-    public void testCreateNonUniqueQuery () throws KustvaktException {
-        qService.storeQuery("{\"@type\":\"koral:token\"}", "new-query", "me" );
-        thrown.expect(KustvaktException.class);
-        qService.storeQuery("{\"@type\":\"koral:token\"}", "new-query", "me" );
-        qService.deleteQueryByName("me", "new-query", "me");        
-    };
-};
diff --git a/full/src/test/java/de/ids_mannheim/korap/service/VirtualCorpusServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/service/VirtualCorpusServiceTest.java
index 7d1e2f6..529efbd 100644
--- a/full/src/test/java/de/ids_mannheim/korap/service/VirtualCorpusServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/service/VirtualCorpusServiceTest.java
@@ -16,10 +16,10 @@
 import de.ids_mannheim.korap.constant.QueryType;
 import de.ids_mannheim.korap.constant.UserGroupStatus;
 import de.ids_mannheim.korap.constant.ResourceType;
-import de.ids_mannheim.korap.dto.VirtualCorpusAccessDto;
-import de.ids_mannheim.korap.dto.VirtualCorpusDto;
+import de.ids_mannheim.korap.dto.QueryAccessDto;
+import de.ids_mannheim.korap.dto.QueryDto;
 import de.ids_mannheim.korap.entity.UserGroup;
-import de.ids_mannheim.korap.entity.VirtualCorpus;
+import de.ids_mannheim.korap.entity.QueryDO;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.web.input.QueryJson;
 
@@ -28,7 +28,7 @@
 public class VirtualCorpusServiceTest {
 
     @Autowired
-    private VirtualCorpusService vcService;
+    private QueryService vcService;
     @Autowired
     private UserGroupService groupService;
 
@@ -62,12 +62,12 @@
         String username = "VirtualCorpusServiceTest";
         vcService.storeQuery(vc, vcName, username );
 
-        List<VirtualCorpusAccessDto> accesses =
-                vcService.listVCAccessByUsername("admin");
+        List<QueryAccessDto> accesses =
+                vcService.listQueryAccessByUsername("admin");
         int size = accesses.size();
 
-        VirtualCorpusAccessDto dto = accesses.get(accesses.size() - 1);
-        assertEquals(vcName, dto.getVcName());
+        QueryAccessDto dto = accesses.get(accesses.size() - 1);
+        assertEquals(vcName, dto.getQueryName());
         assertEquals("system", dto.getCreatedBy());
         assertTrue(dto.getUserGroupName().startsWith("auto"));
 
@@ -77,10 +77,10 @@
         assertEquals(UserGroupStatus.HIDDEN, group.getStatus());
 
         //delete vc
-        vcService.deleteVCByName(username, vcName, username);
+        vcService.deleteQueryByName(username, vcName, username);
         
         // check hidden access
-        accesses = vcService.listVCAccessByUsername("admin");
+        accesses = vcService.listQueryAccessByUsername("admin");
         assertEquals(size-1, accesses.size());
         
         // check hidden group
@@ -95,25 +95,25 @@
         int vcId = 2;
 
         String vcName = "group-vc";
-        VirtualCorpus existingVC =
-                vcService.searchVCByName(username, vcName, username, QueryType.VIRTUAL_CORPUS);
+        QueryDO existingVC =
+                vcService.searchQueryByName(username, vcName, username, QueryType.VIRTUAL_CORPUS);
         QueryJson vcJson = new QueryJson();
         vcJson.setType(ResourceType.PUBLISHED);
 
-        vcService.editVC(existingVC, vcJson, vcName, username);
+        vcService.editQuery(existingVC, vcJson, vcName, username);
 
         // check VC
-        VirtualCorpusDto vcDto = vcService.searchVCById("dory", vcId);
+        QueryDto vcDto = vcService.searchQueryById("dory", vcId);
         assertEquals(vcName, vcDto.getName());
         assertEquals(ResourceType.PUBLISHED.displayName(),
                 vcDto.getType());
 
         // check access
-        List<VirtualCorpusAccessDto> accesses =
-                vcService.listVCAccessByUsername("admin");
+        List<QueryAccessDto> accesses =
+                vcService.listQueryAccessByUsername("admin");
         int size = accesses.size();
-        VirtualCorpusAccessDto dto = accesses.get(accesses.size() - 1);
-        assertEquals(vcName, dto.getVcName());
+        QueryAccessDto dto = accesses.get(accesses.size() - 1);
+        assertEquals(vcName, dto.getQueryName());
         assertEquals("system", dto.getCreatedBy());
         assertTrue(dto.getUserGroupName().startsWith("auto"));
 
@@ -127,15 +127,15 @@
         vcJson = new QueryJson();
         vcJson.setType(ResourceType.PROJECT);
 
-        vcService.editVC(existingVC, vcJson, vcName, username);
+        vcService.editQuery(existingVC, vcJson, vcName, username);
 
         // check VC
-        vcDto = vcService.searchVCById("dory", vcId);
+        vcDto = vcService.searchQueryById("dory", vcId);
         assertEquals("group-vc", vcDto.getName());
         assertEquals(ResourceType.PROJECT.displayName(), vcDto.getType());
 
         // check access
-        accesses = vcService.listVCAccessByUsername("admin");
+        accesses = vcService.listQueryAccessByUsername("admin");
         assertEquals(size - 1, accesses.size());
 
         thrown.expect(KustvaktException.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java
index bf78727..059ceee 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java
@@ -214,7 +214,7 @@
             if (member.at("/userId").asText().equals(memberUsername)) {
                 assertEquals(3, member.at("/roles").size());
                 assertEquals(PredefinedRole.USER_GROUP_ADMIN.name(),
-                        member.at("/roles/0").asText());
+                        member.at("/roles/1").asText());
                 break;
             }
         }
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
index a03110d..b5623d6 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
@@ -244,9 +244,9 @@
         assertEquals(username, node.at("/members/0/userId").asText());
         assertEquals(GroupMemberStatus.ACTIVE.name(),
                 node.at("/members/0/status").asText());
-        assertEquals(PredefinedRole.USER_GROUP_ADMIN.name(),
+        assertEquals(PredefinedRole.QUERY_ACCESS_ADMIN.name(),
                 node.at("/members/0/roles/0").asText());
-        assertEquals(PredefinedRole.VC_ACCESS_ADMIN.name(),
+        assertEquals(PredefinedRole.USER_GROUP_ADMIN.name(),
                 node.at("/members/0/roles/1").asText());
 
         testUpdateUserGroup(groupName);
@@ -647,9 +647,9 @@
         assertEquals(0, group.at("/members").size());
         assertEquals(GroupMemberStatus.ACTIVE.name(),
                 group.at("/userMemberStatus").asText());
-        assertEquals(PredefinedRole.USER_GROUP_MEMBER.name(),
+        assertEquals(PredefinedRole.QUERY_ACCESS_MEMBER.name(),
                 group.at("/userRoles/0").asText());
-        assertEquals(PredefinedRole.VC_ACCESS_MEMBER.name(),
+        assertEquals(PredefinedRole.USER_GROUP_MEMBER.name(),
                 group.at("/userRoles/1").asText());
 
         // unsubscribe marlin from dory-group
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java
index e74105c..dbeecf1 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java
@@ -18,8 +18,8 @@
 import de.ids_mannheim.korap.config.Attributes;
 import de.ids_mannheim.korap.config.NamedVCLoader;
 import de.ids_mannheim.korap.config.SpringJerseyTest;
-import de.ids_mannheim.korap.dao.VirtualCorpusDao;
-import de.ids_mannheim.korap.entity.VirtualCorpus;
+import de.ids_mannheim.korap.dao.QueryDao;
+import de.ids_mannheim.korap.entity.QueryDO;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.util.QueryException;
@@ -31,7 +31,7 @@
     @Autowired
     private NamedVCLoader vcLoader;
     @Autowired
-    private VirtualCorpusDao dao;
+    private QueryDao dao;
 
     @Test
     public void testRefPredefinedVC ()
@@ -52,10 +52,10 @@
         testSearchWithVCRefNotEqual();
 
         KrillCollection.cache.removeAll();
-        VirtualCorpus vc = dao.retrieveVCByName("named-vc1", "system");
-        dao.deleteVirtualCorpus(vc);
-        vc = dao.retrieveVCByName("named-vc2", "system");
-        dao.deleteVirtualCorpus(vc);
+        QueryDO vc = dao.retrieveQueryByName("named-vc1", "system");
+        dao.deleteQuery(vc);
+        vc = dao.retrieveQueryByName("named-vc2", "system");
+        dao.deleteQuery(vc);
     }
 
     private void testSearchWithoutVCRefOr () throws KustvaktException {
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
index 666cac3..4b85b4b 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
@@ -349,9 +349,9 @@
         node = testlistAccessByGroup("admin", "");
         node = node.get(node.size() - 1);
         assertEquals("system", node.at("/createdBy").asText());
-        assertEquals(vcName, node.at("/vcName").asText());
+        assertEquals(vcName, node.at("/queryName").asText());
         assertTrue(node.at("/userGroupName").asText().startsWith("auto"));
-        assertEquals(vcName, node.at("/vcName").asText());
+        assertEquals(vcName, node.at("/queryName").asText());
 
         String groupName = node.at("/userGroupName").asText();
 
@@ -763,7 +763,7 @@
         node = testlistAccessByGroup("admin", "");
         assertEquals(4, node.size());
         node = node.get(node.size() - 1);
-        assertEquals(vcName, node.at("/vcName").asText());
+        assertEquals(vcName, node.at("/queryName").asText());
         assertEquals("system", node.at("/createdBy").asText());
         assertTrue(node.at("/userGroupName").asText().startsWith("auto"));
 
@@ -831,8 +831,8 @@
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(1, node.at("/0/accessId").asInt());
-        assertEquals(2, node.at("/0/vcId").asInt());
-        assertEquals("group-vc", node.at("/0/vcName").asText());
+        assertEquals(2, node.at("/0/queryId").asInt());
+        assertEquals("group-vc", node.at("/0/queryName").asText());
         assertEquals(2, node.at("/0/userGroupId").asInt());
 
         assertEquals("dory-group", node.at("/0/userGroupName").asText());
@@ -862,8 +862,8 @@
         node = testlistAccessByGroup("marlin", groupName);
         assertEquals(2, node.size());
         node = node.get(1);
-        assertEquals(5, node.at("/vcId").asInt());
-        assertEquals(vcName, node.at("/vcName").asText());
+        assertEquals(5, node.at("/queryId").asInt());
+        assertEquals(vcName, node.at("/queryName").asText());
         assertEquals(1, node.at("/userGroupId").asInt());
         assertEquals(groupName, node.at("/userGroupName").asText());
 
