Wimmics/corese

Corese and RDF dataset canonicalization

Closed this issue · 1 comments

https://w3c.github.io/rdf-canon/reports/#subj_Corese_Java has it that Corese fully supports https://www.w3.org/TR/rdf-canon/.

I run a simply test below (using rdfc10/test053-in.nq), but the output file does not correspond to the expected result (e.g., rdfc10/test053-rdfc10.nq).

I am probably missing something, so any insight from you will be much appreciated.

Graph graph = Graph.create();
Load ld = Load.create(graph);
ld.parse("/test053-in.nq");
ResultFormat exporter = ResultFormat.create(graph, ResultFormat.N_QUADS);
String result = exporter.toString();
FileWriter writer = new FileWriter("/test053-out.nq");
writer.write(result);
writer.close();

Hello Pawel,

Thank you for your question. I see two things to modify:

First, Canonical-RDF is implemented in the development version of Corese but has not been released yet (it will be released in the next few months with version 4.5.1). You can test it now by downloading the development version (Nightly Build) directly from the release page of Corese: https://github.com/Wimmics/corese/releases, file corese-core-xxxxxxx-nightly.jar.

Second, you must use the rdfc10 result format ResultFormat.RDFC10_FORMAT instead of 'ResultFormat.N_QUADS'. Here is the code with the modification:

Graph graph = Graph.create();

// Load data
Load ld = Load.create(graph);
ld.parse("/test053-in.nq");

// Export data
ResultFormat exporter = ResultFormat.create(graph, ResultFormat.RDFC10_FORMAT);
String result = exporter.toString();

// Write to file
FileWriter writer = new FileWriter("/test053-out.nq");
writer.write(result);
writer.close();

If you have any more questions, please don't hesitate to ask.