Upload a large TTL file to virtuoso graph

Viewed 73

I am trying to write a ttl file to a graph in virtuoso using HTTP post call to the graph endpoint,

resource = new ClassPathResource("beil0.ttl").getFile();
        String text = new String(Files.readAllBytes(resource.toPath()));
        WebClient webClient = webConfig.webClientBuilder().build();
        WebClient.ResponseSpec responseSpec = webClient.post()
                .uri("?graph-uri=http://data.else.com/voca/comp/")
                .header("Content-Type", "text/turtle")
                .bodyValue(text)
                .retrieve();
        String responseBody = responseSpec.bodyToMono(String.class).block();

Here i am reading the file first in variable 'text' and then passing it to the post call which eventually gives me an error as follows :-

java.lang.IndexOutOfBoundsException: writerIndex(0) + minWritableBytes(-1932256561) exceeds maxCapacity(2147483647): PooledUnsafeDirectByteBuf(ridx: 0, widx: 0, cap: 2147483647)

I am assuming its a big file so this error is being thrown from the virtuoso endpoint, if my assumption is right then what i want to do is stream this file content to the endpoint rather than sending it all together. Does anyone has an idea how can i achieve such functionality here. FYI - I tried to use INPUTSTREAM, MULTIPART and many other ways that i can find online but i am still not able to achieve it because of one reason or another.

1 Answers
Related