private Context getContext(final Model model, final Node subject) { final FieldTool fieldTool = new FieldTool(); final Context context = new VelocityContext(); final String[] baseUrl = uriInfo.getBaseUri().getPath().split("/"); if (baseUrl.length > 0) { final String staticBaseUrl = String.join("/", Arrays.copyOf(baseUrl, baseUrl.length - 1)); context.put("staticBaseUrl", staticBaseUrl); } else { context.put("staticBaseUrl", "/"); } context.put("rdfLexicon", fieldTool.in(RdfLexicon.class)); context.put("helpers", VIEW_HELPERS); context.put("esc", escapeTool); context.put("rdf", model.getGraph()); context.put("model", model); context.put("subjects", model.listSubjects()); context.put("nodeany", ANY); context.put("topic", subject); context.put("originalResource", VIEW_HELPERS.getOriginalResource(subject)); context.put("uriInfo", uriInfo); return context; }