RestUtils { public static String modelToSkolemizedString(Model model, RDFFormat format, SesameTransformer transformer, BNodeService service) { long start = System.currentTimeMillis(); try { StringWriter sw = new StringWriter(); Rio.write(new SkolemizedStatementIterable(model, transformer, service), sw, format); return sw.toString(); } finally { LOG.trace("modelToSkolemizedString took {}ms", System.currentTimeMillis() - start); } }  static RDFFormat getRDFFormat(String format); static String modelToString(Model model, RDFFormat format, SesameTransformer transformer); static String modelToString(Model model, String format, SesameTransformer transformer); static String modelToSkolemizedString(Model model, RDFFormat format, SesameTransformer transformer,
                                                 BNodeService service); static String modelToSkolemizedString(Model model, String format, SesameTransformer transformer,
                                                 BNodeService service); static String groupedModelToString(Model model, RDFFormat format, SesameTransformer transformer); static String groupedModelToString(Model model, String format, SesameTransformer transformer); static String groupedModelToSkolemizedString(Model model, RDFFormat format, SesameTransformer transformer,
                                                        BNodeService service); static String groupedModelToSkolemizedString(Model model, String format, SesameTransformer transformer,
                                                        BNodeService service); static Model jsonldToModel(String jsonld, SesameTransformer transformer); static Model jsonldToDeskolemizedModel(String jsonld, SesameTransformer transformer, BNodeService service); static String modelToJsonld(Model model, SesameTransformer transformer); static String modelToSkolemizedJsonld(Model model, SesameTransformer transformer, BNodeService service); static String modelToTrig(Model model, SesameTransformer transformer); static String getRDFFormatFileExtension(String format); static String getRDFFormatMimeType(String format); static User getActiveUser(ContainerRequestContext context, EngineManager engineManager); static String getActiveUsername(ContainerRequestContext context); static Optional<User> optActiveUser(ContainerRequestContext context, EngineManager engineManager); static Optional<String> optActiveUsername(ContainerRequestContext context); static void checkStringParam(@Nullable String param, String errorMessage); static JSONObject getObjectFromJsonld(String json); static ObjectNode getObjectNodeFromJsonld(String json); static JSONObject getTypedObjectFromJsonld(String json, String type); static JsonNode getTypedObjectNodeFromJsonld(String json, String type); static IRI createIRI(String requestId, ValueFactory vf); static JSONObject thingToJsonObject(Thing thing, String type, SesameTransformer transformer); static JsonNode thingToObjectNode(Thing thing, String type, SesameTransformer transformer); static JSONObject thingToSkolemizedJsonObject(Thing thing, String type, SesameTransformer transformer,
                                                         BNodeService bNodeService); static JsonNode thingToSkolemizedObjectNode(Thing thing, String type, SesameTransformer transformer,
                                                         BNodeService bNodeService); static Response createPaginatedThingResponse(UriInfo uriInfo, Set<T> things,
                                                                          IRI sortIRI, int offset, int limit,
                                                                          boolean asc,
                                                                          Function<T, Boolean> filterFunction,
                                                                          String type, SesameTransformer transformer,
                                                                          BNodeService bNodeService); static Response createPaginatedThingResponseJackson(UriInfo uriInfo, Set<T> things,
                                                                          IRI sortIRI, int offset, int limit,
                                                                          boolean asc,
                                                                          Function<T, Boolean> filterFunction,
                                                                          String type, SesameTransformer transformer,
                                                                          BNodeService bNodeService); static Response createPaginatedResponse(UriInfo uriInfo, Collection<T> items,
                                                                     int totalSize, int limit, int offset, String type,
                                                                     SesameTransformer transformer); static Response createPaginatedResponse(UriInfo uriInfo, Collection<T> items,
                                                                     int totalSize, int limit, int offset,
                                                                     String type, SesameTransformer transformer,
                                                                      BNodeService bNodeService); static Response createPaginatedResponseJackson(UriInfo uriInfo, Collection<T> items,
                                                                            int totalSize, int limit,
                                                                            int offset, String type,
                                                                            SesameTransformer transformer,
                                                                            BNodeService bNodeService); static Response createPaginatedResponseWithJson(UriInfo uriInfo, JSONArray items, int totalSize, int limit,
                                                           int offset); static Response createPaginatedResponseWithJsonNode(UriInfo uriInfo, ArrayNode items,
                                                               int totalSize, int limit, int offset); static void validatePaginationParams(String sortIRI, Set<String> sortResources, int limit, int offset);  }
@Test public void modelToSkolemizedStringWithRDFFormatTest() throws Exception { assertEquals(removeWhitespace(expectedJsonld), removeWhitespace(RestUtils.modelToSkolemizedString(model, RDFFormat.JSONLD, transformer, service))); assertEquals(expectedTurtle, RestUtils.modelToSkolemizedString(model, RDFFormat.TURTLE, transformer, service)); assertTrue(equalsIgnoreNewline(expectedRdfxml, RestUtils.modelToSkolemizedString(model, RDFFormat.RDFXML, transformer, service))); }
@Test public void modelToSkolemizedStringTest() throws Exception { assertEquals(removeWhitespace(expectedJsonld), removeWhitespace(RestUtils.modelToSkolemizedString(model, "jsonld", transformer, service))); assertEquals(expectedTurtle, RestUtils.modelToSkolemizedString(model, "turtle", transformer, service)); assertTrue(equalsIgnoreNewline(expectedRdfxml, RestUtils.modelToSkolemizedString(model, "rdf/xml", transformer, service))); assertEquals(removeWhitespace(expectedJsonld), removeWhitespace(RestUtils.modelToSkolemizedString(model, "something", transformer, service))); }