Corese Now Supports RDF Dataset Canonicalization (RDFC-1.0)

Dear all, 



We are pleased to announce that Corese now supports RDF Dataset Canonicalization (RDFC-1.0). This feature is available in the latest nightly builds of Corese, which you can download from the [ https://github.com/Wimmics/corese/releases | GitHub Corese releases page ] . Canonical RDF will be a key feature in the upcoming Corese release 4.5.1, and we invite you to test this functionality in the nightly builds and provide feedback. How to Test RDF Dataset Canonicalization in Corese 


Canonical RDF is supported in the following Corese interfaces: Corese-Command 


To test RDF Dataset Canonicalization in Corese-Command, use the following command: 

corese-command canonicalize -i "https://w3c.github.io/rdf-canon/tests/rdfc10/test036-in.nq" -a rdfc-1.0 


Here, the -i flag specifies the input RDF data file and the -a flag indicates the RDFC-1.0 algorithm. For more information, use the --help option. 





Two versions of the RDFC-1.0 algorithm are available in Corese: rdfc-1.0 and rdfc-1.0-sha384 . 

Corese-Gui 


To test RDF Dataset Canonicalization in Corese-Gui, open the GUI interface and load the data. Click on the + icon to add a new tab, and enter and execute the following SPARQL query: 

load < https://w3c.github.io/rdf-canon/tests/rdfc10/test036-in.nq > 


Next, you can generate the canonical form of the loaded data by clicking on the File/Save Graph/Canoni/RDFC-1.0 (sha256) or RDFC-1.0 (sha384) menu. Corese-Server 


To test RDF Dataset Canonicalization in Corese-Server, follow these steps: 



    1. Start the Corese-Server. 

java -jar corese-server.jar -su 

BQ_BEGIN


The -su flag starts the server in super user mode to enable update queries. 
BQ_END


    1. Load the data using the following SPARQL query: 

curl -X POST -H "Content-Type: application/sparql-query" --data "load <https://w3c.github.io/rdf-canon/tests/rdfc10/test036-in.nq>" http://localhost:8080/sparql 


or 

corese-command remote-sparql -q "load <https://w3c.github.io/rdf-canon/tests/rdfc10/test036-in.nq>" -e "http://localhost:8080/sparql" 


    1. Generate the canonical form of the loaded data using the following SPARQL query: 

curl -X GET -H 'Accept: application/n-quads;profile="https://www.w3.org/TR/rdf-canon#sha-256"' "http://localhost:8080/sparql?query=CONSTRUCT%20%7B%0A%20%20GRAPH%20%3Fg%20%7B%0A%20%20%20%20%3Fs%20%3Fp%20%3Fo%0A%20%20%7D%0A%7D%0AWHERE%20%7B%0A%20%20GRAPH%20%3Fg%20%7B%0A%20%20%20%20%3Fs%20%3Fp%20%3Fo%0A%20%20%7D%0A%7D%0A" 


or 

corese-command remote-sparql -e http://localhost:8080/sparql -q "CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }" -a 'application/n-quads;profile="https://www.w3.org/TR/rdf-canon#sha-256"' 

BQ_BEGIN


Note: Using the profile is not standard and not recommended (reasons are explained here [ https://github.com/w3c/rdf-canon/issues/190 | issue 190 ] ). We have chosen to implement it anyway to obtain the canonical form directly with Corese-Server. 
BQ_END
Corese-Core 


To test RDF Dataset Canonicalization in Corese-Core, you can use the following Java code: 

package com . example ; import java . io . FileWriter ; import java . io . IOException ; import fr . inria . corese . core . Graph ; import fr . inria . corese . core . load . Load ; import fr . inria . corese . core . load . LoadException ; import fr . inria . corese . core . print . ResultFormat ; /**
 * Canonicalization example
 */ public class Canonicalization { public static void main ( String [ ] args ) throws LoadException , IOException { Graph graph = Graph . create ( ) ; // Load data Load ld = Load . create ( graph ) ; ld . parse ( "https://w3c.github.io/rdf-canon/tests/rdfc10/test036-in.nq" ) ; // Canonicalize ResultFormat exporter = ResultFormat . create ( graph , ResultFormat . RDFC10_FORMAT ) ; // or ResultFormat.RDFC10_SHA384_FORMAT String result = exporter . toString ( ) ; // Write to file FileWriter writer = new FileWriter ( "./test036-out.nq" ) ; writer . write ( result ) ; writer . close ( ) ; } } 
Feedback and Contributions 


We invite you to test RDF Dataset Canonicalization in Corese and share your feedback. If you encounter any issues or have suggestions for improvement, please report them on the [ https://github.com/Wimmics/corese/issues | Corese GitHub repository ] . Thank you for your support and contributions to the Corese project. 


Best regards, 
Corese Team 

Received on Friday, 7 June 2024 16:18:56 UTC