diff --git a/core/Changes b/core/Changes
index 056aed2..0662426 100644
--- a/core/Changes
+++ b/core/Changes
@@ -12,6 +12,8 @@
  - Bumped spring.version from 5.3.13 to 5.3.14
 2022-01-25
  - Added show-tokens option to the search API.
+2022-01-31
+ - Added an API retrieving fields of a virtual corpus.
 
 # version 0.64
 
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java b/core/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
index 27665a2..2eb98ab 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
@@ -12,6 +12,8 @@
 import org.apache.logging.log4j.Logger;
 import org.apache.lucene.store.MMapDirectory;
 
+import com.fasterxml.jackson.databind.JsonNode;
+
 import de.ids_mannheim.korap.Krill;
 import de.ids_mannheim.korap.KrillCollection;
 import de.ids_mannheim.korap.KrillIndex;
@@ -60,11 +62,13 @@
         };
     };
 
+
     public KrillIndex getIndex () {
         return index;
     };
-    
-    public void closeIndexReader() throws KustvaktException{
+
+
+    public void closeIndexReader () throws KustvaktException {
         try {
             index.closeReader();
         }
@@ -73,6 +77,7 @@
         }
     }
 
+
     /**
      * Search in the Lucene index.
      * 
@@ -96,6 +101,7 @@
         return kr.toJsonString();
     };
 
+
     /**
      * Search in the Lucene index and return matches as token lists.
      * 
@@ -115,6 +121,7 @@
         return kr.toJsonString();
     };
 
+
     /**
      * Get info on a match - by means of a richly annotated html
      * snippet.
@@ -124,7 +131,8 @@
      * @param availabilityList
      * @throws KustvaktException
      */
-    public String getMatch (String id, Pattern licensePattern) throws KustvaktException {
+    public String getMatch (String id, Pattern licensePattern)
+            throws KustvaktException {
         Match km;
         if (index != null) {
             try {
@@ -144,6 +152,7 @@
         return km.toJsonString();
     };
 
+
     private void checkAvailability (Pattern licensePattern, String availability,
             String id) throws KustvaktException {
         if (DEBUG) {
@@ -165,12 +174,13 @@
         }
 
     }
-    
+
+
     /*
      * Retrieve the meta fields for a certain document
      */
-    public String getFields (String id, List<String> fields, Pattern licensePattern)
-            throws KustvaktException {
+    public String getFields (String id, List<String> fields,
+            Pattern licensePattern) throws KustvaktException {
         MetaFields meta;
 
         // No index found
@@ -180,7 +190,7 @@
         }
 
         // Index available
-        else if (fields !=null){
+        else if (fields != null) {
             // Get fields
             meta = index.getFields(id, fields);
         }
@@ -188,7 +198,7 @@
             // Get fields
             meta = index.getFields(id);
         }
-        
+
         // EM: this approach forbids the whole metadata
         // this should be refined by filtering out only the restricted
         // metadata fields
@@ -197,7 +207,7 @@
 
         return meta.toJsonString();
     };
-    
+
 
     public String getMatch (String id, List<String> foundries,
             List<String> layers, boolean includeSpans,
@@ -223,6 +233,7 @@
         return km.toJsonString();
     };
 
+
     /**
      * Get info on a match - by means of a richly annotated html
      * snippet.
@@ -270,6 +281,7 @@
         return km.toJsonString();
     };
 
+
     /**
      * Get statistics on (virtual) collections.
      * 
@@ -277,7 +289,7 @@
      * 
      * @param json
      *            JSON-LD string with potential meta filters.
-     * @throws KustvaktException 
+     * @throws KustvaktException
      */
     public String getStatistics (String json) throws KustvaktException {
         if (index == null) {
@@ -317,7 +329,7 @@
         catch (IOException e) {
             e.printStackTrace();
         };
-        
+
         if (kc.hasErrors()) {
             throw new KustvaktException(
                     "{\"errors\":" + kc.getErrors().toJsonString() + "}");
@@ -330,6 +342,7 @@
         return sb.toString();
     };
 
+
     /**
      * Return the match identifier as a string.
      * This is a convenient method to deal with legacy instantiation
@@ -345,6 +358,7 @@
         return sb.toString();
     };
 
+
     /**
      * Return the text sigle as a string.
      */
@@ -356,14 +370,20 @@
         return sb.toString();
     };
 
+
     /**
      * Return the fingerprint of the latest index revision.
      */
-    public String getIndexFingerprint() {
+    public String getIndexFingerprint () {
         if (index != null) {
             return index.getFingerprint();
         };
         return "null";
     }
 
+
+    public JsonNode getFieldValuesForVC (String koralQuery, String fieldName) {
+        return new Krill().retrieveFieldValues(koralQuery, index, fieldName);
+    }
+
 };
diff --git a/full/Changes b/full/Changes
index d84e29a..c32a2f7 100644
--- a/full/Changes
+++ b/full/Changes
@@ -20,6 +20,8 @@
  - Updated tests.
 2022-01-25
  - Added show-tokens option to the search API.
+2022-01-31
+ - Added an API retrieving fields of a virtual corpus.
 
 # version 0.64.1
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/authentication/KustvaktAuthenticationManager.java b/full/src/main/java/de/ids_mannheim/korap/authentication/KustvaktAuthenticationManager.java
index 3fd5722..c135506 100644
--- a/full/src/main/java/de/ids_mannheim/korap/authentication/KustvaktAuthenticationManager.java
+++ b/full/src/main/java/de/ids_mannheim/korap/authentication/KustvaktAuthenticationManager.java
@@ -315,6 +315,7 @@
 		return false;
 	}
 
+	@Deprecated
 	private User authenticateShib(Map<String, Object> attributes) throws KustvaktException {
 		// todo use persistent id, since eppn is not unique
 		String eppn = (String) attributes.get(Attributes.EPPN);
@@ -648,8 +649,8 @@
 
 		entHandler.createAccount(user);
 
-		s.setUserId(user.getId());
-		d.setUserId(user.getId());
+//		s.setUserId(user.getId());
+//		d.setUserId(user.getId());
 
 		UserDataDbIface dao = BeansFactory.getTypeFactory().getTypeInterfaceBean(userdatadaos, UserDetails.class);
 		assert dao != null;
diff --git a/full/src/main/java/de/ids_mannheim/korap/service/QueryService.java b/full/src/main/java/de/ids_mannheim/korap/service/QueryService.java
index 6cfe8ee..7e042f1 100644
--- a/full/src/main/java/de/ids_mannheim/korap/service/QueryService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/service/QueryService.java
@@ -65,8 +65,7 @@
 @Service
 public class QueryService {
 
-    public static Logger jlog =
-            LogManager.getLogger(QueryService.class);
+    public static Logger jlog = LogManager.getLogger(QueryService.class);
 
     public static boolean DEBUG = false;
 
@@ -99,13 +98,13 @@
         }
     }
 
-    public List<QueryDto> listOwnerQuery (String username,
-            String queryCreator, QueryType queryType) throws KustvaktException {
+    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<QueryDto> listSystemQuery (QueryType queryType)
             throws KustvaktException {
         List<QueryDO> list = queryDao.retrieveQueryByType(ResourceType.SYSTEM,
@@ -130,14 +129,12 @@
         else {
             username = authenticatedUsername;
         }
-        List<QueryDO> list =
-                queryDao.retrieveQueryByUser(username, queryType);
+        List<QueryDO> list = queryDao.retrieveQueryByUser(username, queryType);
         return createQueryDtos(list, queryType);
     }
 
-    public List<QueryDto> listQueryByType (String username,
-            String createdBy, ResourceType type, QueryType queryType)
-            throws KustvaktException {
+    public List<QueryDto> listQueryByType (String username, String createdBy,
+            ResourceType type, QueryType queryType) throws KustvaktException {
 
         boolean isAdmin = adminDao.isAdmin(username);
 
@@ -153,21 +150,19 @@
         }
     }
 
-    private ArrayList<QueryDto> createQueryDtos (
-            List<QueryDO> queryList, QueryType queryType)
-            throws KustvaktException {
+    private ArrayList<QueryDto> createQueryDtos (List<QueryDO> queryList,
+            QueryType queryType) throws KustvaktException {
         ArrayList<QueryDto> dtos = new ArrayList<>(queryList.size());
         QueryDO query;
         Iterator<QueryDO> i = queryList.iterator();
         while (i.hasNext()) {
             query = i.next();
-//            String json = query.getKoralQuery();
+            // String json = query.getKoralQuery();
             String statistics = null;
-//            if (queryType.equals(QueryType.VIRTUAL_CORPUS)) {
-//                statistics = krill.getStatistics(json);
-//            }
-            QueryDto dto =
-                    converter.createQueryDto(query, statistics);
+            // if (queryType.equals(QueryType.VIRTUAL_CORPUS)) {
+            // statistics = krill.getStatistics(json);
+            // }
+            QueryDto dto = converter.createQueryDto(query, statistics);
             dtos.add(dto);
         }
         return dtos;
@@ -181,8 +176,7 @@
         if (query == null) {
             String code = createdBy + "/" + queryName;
             throw new KustvaktException(StatusCodes.NO_RESOURCE_FOUND,
-                    "Query " + code + " is not found.",
-                    String.valueOf(code));
+                    "Query " + code + " is not found.", String.valueOf(code));
         }
         else if (query.getCreatedBy().equals(username)
                 || adminDao.isAdmin(username)) {
@@ -196,7 +190,7 @@
             }
             if (type.equals(QueryType.VIRTUAL_CORPUS)
                     && VirtualCorpusCache.contains(queryName)) {
-               VirtualCorpusCache.delete(queryName);
+                VirtualCorpusCache.delete(queryName);
             }
             queryDao.deleteQuery(query);
         }
@@ -211,7 +205,7 @@
 
         verifyUsername(username, queryCreator);
         QueryDO query = queryDao.retrieveQueryByName(queryName, queryCreator);
-        
+
         if (query == null) {
             storeQuery(queryJson, queryName, queryCreator, username);
             return Status.CREATED;
@@ -238,8 +232,8 @@
         String queryLanguage = newQuery.getQueryLanguage();
         if (corpusQuery != null && !corpusQuery.isEmpty()) {
             koralQuery = serializeCorpusQuery(corpusQuery);
-            requiredAccess = determineRequiredAccess(newQuery.isCached(), queryName,
-                    koralQuery);
+            requiredAccess = determineRequiredAccess(newQuery.isCached(),
+                    queryName, koralQuery);
         }
         else if (query != null && !query.isEmpty() && queryLanguage != null
                 && !queryLanguage.isEmpty()) {
@@ -251,8 +245,8 @@
             if (existingQuery.getType().equals(ResourceType.PUBLISHED)) {
                 // withdraw from publication
                 if (!type.equals(ResourceType.PUBLISHED)) {
-                    QueryAccess hiddenAccess =
-                            accessDao.retrieveHiddenAccess(existingQuery.getId());
+                    QueryAccess hiddenAccess = accessDao
+                            .retrieveHiddenAccess(existingQuery.getId());
                     deleteQueryAccess(hiddenAccess.getId(), "system");
                     int groupId = hiddenAccess.getUserGroup().getId();
                     userGroupService.deleteAutoHiddenGroup(groupId, "system");
@@ -269,7 +263,8 @@
 
         queryDao.editQuery(existingQuery, queryName, type, requiredAccess,
                 koralQuery, newQuery.getDefinition(), newQuery.getDescription(),
-                newQuery.getStatus(), newQuery.isCached(), query, queryLanguage);
+                newQuery.getStatus(), newQuery.isCached(), query,
+                queryLanguage);
     }
 
     private void publishQuery (int queryId) throws KustvaktException {
@@ -291,7 +286,7 @@
                     + ". Hidden access exists! Access id: " + access.getId());
         }
     }
-    
+
     public void storeQuery (QueryJson query, String queryName,
             String queryCreator, String username) throws KustvaktException {
         String koralQuery = null;
@@ -323,22 +318,22 @@
         ParameterChecker.checkObjectValue(type, "type");
 
         if (!queryNamePattern.matcher(queryName).matches()) {
-            throw new KustvaktException(StatusCodes.INVALID_ARGUMENT,
-                    queryType.displayName() + " name must only contain "
-                            + "letters, numbers, underscores, hypens and spaces",
+            throw new KustvaktException(StatusCodes.INVALID_ARGUMENT, queryType
+                    .displayName() + " name must only contain "
+                    + "letters, numbers, underscores, hypens and spaces",
                     queryName);
         }
 
-        if (type.equals(ResourceType.SYSTEM)){
+        if (type.equals(ResourceType.SYSTEM)) {
             if (adminDao.isAdmin(username)) {
-                queryCreator="system";
+                queryCreator = "system";
             }
             else if (!username.equals("system")) {
                 throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
-                        "Unauthorized operation for user: " + username, username);    
+                        "Unauthorized operation for user: " + username,
+                        username);
             }
         }
-        
 
         CorpusAccess requiredAccess = CorpusAccess.PUB;
         if (queryType.equals(QueryType.VIRTUAL_CORPUS)) {
@@ -346,10 +341,10 @@
                     determineRequiredAccess(isCached, queryName, koralQuery);
         }
 
-        if (DEBUG){
+        if (DEBUG) {
             jlog.debug("Storing query: " + queryName + "in the database ");
         }
-        
+
         int queryId = 0;
         try {
             queryId = queryDao.createQuery(queryName, type, queryType,
@@ -453,8 +448,7 @@
         if (query == null) {
             String code = createdBy + "/" + queryName;
             throw new KustvaktException(StatusCodes.NO_RESOURCE_FOUND,
-                    "Query " + code + " is not found.",
-                    String.valueOf(code));
+                    "Query " + code + " is not found.", String.valueOf(code));
         }
         if (!username.equals(query.getCreatedBy())
                 && !adminDao.isAdmin(username)) {
@@ -546,10 +540,12 @@
 
         List<QueryAccess> accessList;
         if (adminDao.isAdmin(username)) {
-            accessList = accessDao.retrieveAllAccessByQuery(queryCreator, queryName);
+            accessList =
+                    accessDao.retrieveAllAccessByQuery(queryCreator, queryName);
         }
         else {
-            accessList = accessDao.retrieveActiveAccessByQuery(queryCreator, queryName);
+            accessList = accessDao.retrieveActiveAccessByQuery(queryCreator,
+                    queryName);
             List<QueryAccess> filteredAccessList = new ArrayList<>();
             for (QueryAccess access : accessList) {
                 UserGroup userGroup = access.getUserGroup();
@@ -617,22 +613,38 @@
         }
 
     }
-    
+
     public JsonNode retrieveKoralQuery (String username, String queryName,
             String createdBy, QueryType queryType) throws KustvaktException {
-        QueryDO query = searchQueryByName(username, queryName, createdBy, queryType);
+        QueryDO query =
+                searchQueryByName(username, queryName, createdBy, queryType);
         String koralQuery = query.getKoralQuery();
-        JsonNode kq = JsonUtils.readTree(koralQuery); 
+        JsonNode kq = JsonUtils.readTree(koralQuery);
         return kq;
     }
 
+    public JsonNode retrieveFieldValues (String username, String queryName,
+            String createdBy, QueryType queryType, String fieldName)
+            throws KustvaktException {
+        if (fieldName.equals("tokens") || fieldName.equals("base")) {
+            throw new KustvaktException(StatusCodes.NOT_ALLOWED,
+                    "Retrieving values of field "+fieldName+" is not allowed.");
+        }
+        else {
+            QueryDO query = searchQueryByName(username, queryName, createdBy,
+                    queryType);
+            String koralQuery = query.getKoralQuery();
+            return krill.getFieldValuesForVC(koralQuery, fieldName);
+        }
+    }
+
     public QueryDO searchQueryByName (String username, String queryName,
             String createdBy, QueryType queryType) throws KustvaktException {
         QueryDO query = queryDao.retrieveQueryByName(queryName, createdBy);
         if (query == null) {
             String code = createdBy + "/" + queryName;
             throw new KustvaktException(StatusCodes.NO_RESOURCE_FOUND,
-                    queryType.displayName()+ " " + code + " is not found.",
+                    queryType.displayName() + " " + code + " is not found.",
                     String.valueOf(code));
         }
         checkQueryAccess(query, username);
@@ -641,16 +653,19 @@
 
     public QueryDto retrieveQueryByName (String username, String queryName,
             String createdBy, QueryType queryType) throws KustvaktException {
-        QueryDO query = searchQueryByName(username, queryName, createdBy, queryType);
-//        String json = query.getKoralQuery();
+        QueryDO query =
+                searchQueryByName(username, queryName, createdBy, queryType);
+        // String json = query.getKoralQuery();
         String statistics = null;
-//        long start,end;
-//        start = System.currentTimeMillis();
-//        if (query.getQueryType().equals(QueryType.VIRTUAL_CORPUS)) {
-//            statistics = krill.getStatistics(json);
-//        }
-//        end = System.currentTimeMillis();
-//        jlog.debug("{} statistics duration: {}", queryName, (end - start));
+        // long start,end;
+        // start = System.currentTimeMillis();
+        // if (query.getQueryType().equals(QueryType.VIRTUAL_CORPUS))
+        // {
+        // statistics = krill.getStatistics(json);
+        // }
+        // end = System.currentTimeMillis();
+        // jlog.debug("{} statistics duration: {}", queryName, (end -
+        // start));
         return converter.createQueryDto(query, statistics);
     }
 
@@ -659,8 +674,8 @@
 
         QueryDO query = queryDao.retrieveQueryById(queryId);
         checkQueryAccess(query, username);
-//        String json = query.getKoralQuery();
-//        String statistics = krill.getStatistics(json);
+        // String json = query.getKoralQuery();
+        // String statistics = krill.getStatistics(json);
         return converter.createQueryDto(query, null);
     }
 
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 8a9f16f..31a2c19 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
@@ -173,6 +173,25 @@
         }
     }
     
+    @GET
+    @Path("/field/~{createdBy}/{vcName}")
+    @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
+    public JsonNode retrieveVCField (
+            @Context SecurityContext securityContext,
+            @PathParam("createdBy") String createdBy,
+            @PathParam("vcName") String vcName,
+            @QueryParam("fieldName") String fieldName) {
+        TokenContext context =
+                (TokenContext) securityContext.getUserPrincipal();
+        try {
+            scopeService.verifyScope(context, OAuth2Scope.VC_INFO);
+            return service.retrieveFieldValues(context.getUsername(), vcName,
+                    createdBy, QueryType.VIRTUAL_CORPUS, fieldName);
+        }
+        catch (KustvaktException e) {
+            throw kustvaktResponseHandler.throwit(e);
+        }
+    }
     
     /**
      * Lists all virtual corpora available to the authenticated user.
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusFieldTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusFieldTest.java
new file mode 100644
index 0000000..583629b
--- /dev/null
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusFieldTest.java
@@ -0,0 +1,135 @@
+package de.ids_mannheim.korap.web.controller;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.apache.http.entity.ContentType;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.net.HttpHeaders;
+import com.sun.jersey.api.client.ClientHandlerException;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.ClientResponse.Status;
+import com.sun.jersey.api.client.UniformInterfaceException;
+
+import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
+import de.ids_mannheim.korap.cache.VirtualCorpusCache;
+import de.ids_mannheim.korap.config.Attributes;
+import de.ids_mannheim.korap.config.NamedVCLoader;
+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;
+import de.ids_mannheim.korap.utils.JsonUtils;
+
+public class VirtualCorpusFieldTest extends VirtualCorpusTestBase {
+
+    @Autowired
+    private NamedVCLoader vcLoader;
+    @Autowired
+    private QueryDao dao;
+
+    private JsonNode testRetrieveField (String username, String vcName,
+            String field) throws UniformInterfaceException,
+            ClientHandlerException, KustvaktException {
+        ClientResponse response = resource().path(API_VERSION).path("vc")
+                .path("field").path("~" + username).path(vcName)
+                .queryParam("fieldName", field)
+                .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
+                        .createBasicAuthorizationHeaderValue("dory", "pass"))
+                .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
+                .get(ClientResponse.class);
+
+        assertEquals(Status.OK.getStatusCode(), response.getStatus());
+        String entity = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(entity);
+        return node;
+    }
+
+    private void testRetrieveProhibitedField (String username, String vcName,
+            String field) throws UniformInterfaceException,
+            ClientHandlerException, KustvaktException {
+        ClientResponse response = resource().path(API_VERSION).path("vc")
+                .path("field").path("~" + username).path(vcName)
+                .queryParam("fieldName", field)
+                .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
+                        .createBasicAuthorizationHeaderValue("dory", "pass"))
+                .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
+                .get(ClientResponse.class);
+
+        assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
+        String entity = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(entity);
+        assertEquals(StatusCodes.NOT_ALLOWED, node.at("/errors/0/0").asInt());
+    }
+    
+    private void deleteVcFromDB (String vcName) throws KustvaktException {
+        QueryDO vc = dao.retrieveQueryByName(vcName, "system");
+        dao.deleteQuery(vc);
+        vc = dao.retrieveQueryByName(vcName, "system");
+        assertEquals(null, vc);
+    }
+
+    @Test
+    public void testRetrieveFieldsNamedVC1 ()
+            throws IOException, QueryException, KustvaktException {
+
+        vcLoader.loadVCToCache("named-vc1", "/vc/named-vc1.jsonld");
+
+        JsonNode n = testRetrieveField("system", "named-vc1", "textSigle");
+        assertEquals(
+                "http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld",
+                n.at("/@context").asText());
+        assertEquals("textSigle", n.at("/corpus/key").asText());
+        assertEquals(2, n.at("/corpus/value").size());
+
+        n = testRetrieveField("system", "named-vc1", "author");
+        assertEquals(2, n.at("/corpus/value").size());
+        assertEquals("Goethe, Johann Wolfgang von",
+                n.at("/corpus/value/0").asText());
+
+        testRetrieveUnknownTokens();
+        testRetrieveProhibitedField("system", "named-vc1", "tokens");
+        testRetrieveProhibitedField("system", "named-vc1", "base");
+
+        VirtualCorpusCache.delete("named-vc1");
+        
+        deleteVcFromDB("named-vc1");
+    }
+
+    private void testRetrieveUnknownTokens () throws UniformInterfaceException,
+            ClientHandlerException, KustvaktException {
+        JsonNode n = testRetrieveField("system", "named-vc1", "unknown");
+        assertEquals("unknown", n.at("/corpus/key").asText());
+        assertEquals(0, n.at("/corpus/value").size());
+    }
+
+    @Test
+    public void testRetrieveTextSigleNamedVC2 ()
+            throws IOException, QueryException, KustvaktException {
+        vcLoader.loadVCToCache("named-vc2", "/vc/named-vc2.jsonld");
+
+        JsonNode n = testRetrieveField("system", "named-vc2", "textSigle");
+        assertEquals(2, n.at("/corpus/value").size());
+        VirtualCorpusCache.delete("named-vc2");
+        deleteVcFromDB("named-vc2");
+    }
+
+    @Test
+    public void testRetrieveTextSigleNamedVC3 ()
+            throws IOException, QueryException, KustvaktException {
+        vcLoader.loadVCToCache("named-vc3", "/vc/named-vc3.jsonld");
+
+        JsonNode n = testRetrieveField("system", "named-vc3", "textSigle");
+        n = n.at("/corpus/value");
+        assertEquals(1, n.size());
+        assertEquals("GOE/AGI/00000", n.get(0).asText());
+
+        VirtualCorpusCache.delete("named-vc3");
+        deleteVcFromDB("named-vc3");
+    }
+}
diff --git a/full/src/test/resources/vc/named-vc3.jsonld b/full/src/test/resources/vc/named-vc3.jsonld
new file mode 100644
index 0000000..a690744
--- /dev/null
+++ b/full/src/test/resources/vc/named-vc3.jsonld
@@ -0,0 +1,9 @@
+{
+    "collection": {
+        "@type": "koral:doc",
+        "key": "title",
+        "match": "match:eq",
+        "type": "type:string",
+        "value": "Italienische Reise"
+    }
+}
