Dear Larysa, This sounds like a great option! Didn’t know this tool existed. I was able to get exactly the result I expected using Jena’s ‘riot’ tool and blabel:
riot --strict --output=ntriples input.ttl > input.nt mvn clean install java -jar target/blabel-0.2.0-SNAPSHOT-jar-with-dependencies.jar LabelRDFGraph \ -i input.nt -s 3 -p 'https://example.com/.well-known/genid/' -o output.nt riot --strict --formatted=turtle output.nt > output.ttl You may need to add prefixes from your original files to `output.ttl` and run it through `riot` again before the file looks compact. Good luck! –Andrii. On 8 Jul 2023, at 19:58, Larysa Zhuchyi <[email protected]> wrote: Dear Mr Berezovskyi Thank you for your prompt and thorough reply. I'm sorry I did not research rdfpatch tool enough and yes, I'm aware of a skolemizer library. Unfortunately, I'm nothing like a programmer so CLI is the only way for me. That is why also I would much like to use rdfpatch tool for the Skolemisation task. From what I understand, blabel [1] looks like my last resort for now. 8 июля 2023, 19:44:56, от "Andrii Berezovskyi" <[email protected]>: 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. -- Sincerely, Larysa Zhuchyi
