Hello Larysa,

I don’t think the rdfpatch tool is good fit for this, it’s designed for a 
different purpose. The tool itself expects to receive a patch file (which is 
not a regular RDF file), at which point the skolemization should already be 
done:

$ rdfpatch turtletest.ttl
org.apache.jena.rdfpatch.PatchException: [line: 1, col: 1 ] Expected keyword at 
start of patch record

And testing it on the example from the docs ( 
https://jena.apache.org/documentation/rdf-patch/ ):

$ rdfpatch sample.patch
TX .
PA "rdf" "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; .
PA "owl" "http://www.w3.org/2002/07/owl#"; .
PA "rdfs" "http://www.w3.org/2000/01/rdf-schema#"; .
A <http://example/SubClass> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.w3.org/2002/07/owl#Class> .
A <http://example/SubClass> <http://www.w3.org/2000/01/rdf-schema#subClassOf> 
<http://example/SUPER_CLASS> .
A <http://example/SubClass> <http://www.w3.org/2000/01/rdf-schema#label> 
"SubClass" .
TC .
# Data:     Adds=3 Deletes=0
# Prefixes: Adds=3 Deletes=0
# Txn:      TX=1, TC=1, TA=


There is also an attempt to provide an algorithm for stable skolemization 
(among other things) such as to allow meaningful hashing: 
https://github.com/iherman/canonical_rdf. But that code does not truly 
skolemize bnodes, i.e. it does not convert them into IRIs.

I would suggest you look instead at https://pypi.org/project/skolemizer/, for 
example. Though it produces skolem URIs with the `/.well-known/skolem/` path 
prefix instead of `/.well-known/genid/` prefix recommended by 
https://www.w3.org/TR/rdf11-concepts/#section-skolemization.

If you really want use Jena, you could try using this snippet: 
https://github.com/EricssonResearch/scott-eu/blob/master/lyo-services/lib-common/src/main/kotlin/eu/scott/warehouse/lib/RdfHelpers.kt#L82-L91
 though it should be improved. For example, the '/.well-known/genid/‘ path 
prefix should be used (but I learned that long after I wrote that code). The 
code instead uses URNs in a namespace that was not allocated for that.

–Andrii.

On 8 Jul 2023, at 11:36, Larysa Zhuchyi <[email protected]> wrote:

I would be grateful if you could tell me whether it is possible to use 
rdfpatch.bat CLI to skolemnize RDF dataset.



Reply via email to