WorkspaceResource extends TransactionalResource { @Timed @Path("{workspace}/meta") @POST public ExecutionResult queryMeta(@Auth AuthorizedPrincipal principal, @PathParam("workspace") String workspace, @SuppressWarnings("rawtypes") Map request, @Context DSLContext create) { if (request == null) { throw new WebApplicationException("Query request cannot be null", Status.BAD_REQUEST); } if (request.get(QUERY) == null) { throw new WebApplicationException("Query cannot be null", Status.BAD_REQUEST); } return mutate(principal, model -> { UUID uuid = uuidFrom(workspace); Product definingProduct = model.records() .resolve(uuid); if (definingProduct == null) { throw new WebApplicationException(String.format("Workspace not found [%s] %s", uuid, workspace), Status.NOT_FOUND); } MetaContext crud = new MetaContext(model, definingProduct); if (!model.checkRead((UpdatableRecord<?>) definingProduct) || !model.checkRead((UpdatableRecord<?>) definingProduct)) { Agency p = model.getCurrentPrincipal() .getPrincipal(); log.info(String.format("Failed executing query on workspace [%s:%s] by: %s:%s", definingProduct.getName(), uuid, p.getName(), p.getId())); return null; } Map<String, Object> variables = getVariables(request); ExecutionResult result = crud.execute(metaSchema, (String) request.get(QUERY), variables); if (result.getErrors() .isEmpty()) { return result; } return result; }, create); } WorkspaceResource();  WorkspaceResource(URLClassLoader executionScope); @SuppressWarnings({ "unchecked", "rawtypes" }) static Map<String, Object> getVariables(Map request); @Timed @GET List<Map<String, Object>> getWorkspaces(@Auth AuthorizedPrincipal principal,
                                                   @Context DSLContext create); @Timed @Path("loadSnapshot") @POST void loadSnapshot(@Auth AuthorizedPrincipal principal,
                             @Context HttpServletRequest request,
                             InputStream requestBody,
                             @Context DSLContext create); @Timed @Path("loadWorkspace") @POST String loadWorkspace(@Auth AuthorizedPrincipal principal,
                                @Context HttpServletRequest request,
                                InputStream requestBody,
                                @Context DSLContext create); @Timed @Path("manifest") @POST String manifest(@Auth AuthorizedPrincipal principal,
                           @Context HttpServletRequest request,
                           InputStream requestBody,
                           @Context DSLContext create); @Path("{workspace}") @GET @Produces({ MediaType.TEXT_HTML }) String workspaceGraphIql(@Auth AuthorizedPrincipal principal,
                                    @PathParam("workspace") String workspace); @Path("{workspace}/meta") @GET @Produces({ MediaType.TEXT_HTML }) String workspaceMetaGraphIql(@Auth AuthorizedPrincipal principal,
                                        @PathParam("workspace") String workspace); @Timed @Path("{workspace}") @POST ExecutionResult query(@Auth AuthorizedPrincipal principal,
                                 @PathParam("workspace") String workspace,
                                 @SuppressWarnings("rawtypes") Map request,
                                 @Context DSLContext create); @Timed @Path("{workspace}/meta") @POST ExecutionResult queryMeta(@Auth AuthorizedPrincipal principal,
                                     @PathParam("workspace") String workspace,
                                     @SuppressWarnings("rawtypes") Map request,
                                     @Context DSLContext create); @Timed @Path("{workspace}/serialize") @GET String serializeWorkspace(@Auth AuthorizedPrincipal principal,
                                     @PathParam("workspace") String workspace,
                                     @Context DSLContext create); @Timed @Path("snapshot") @GET String snapshot(@Auth AuthorizedPrincipal principal,
                           @Context DSLContext create);  }
@Test public void testMeta() throws Exception { WorkspaceResource resource = new WorkspaceResource(); assertNotNull(resource.queryMeta(model.getCurrentPrincipal(), WellKnownObject.KERNEL_IRI, new QueryRequest(getIntrospectionQuery()).asMap(), model.create())); }