Giter Site home page Giter Site logo

edmcouncil / rdf-toolkit Goto Github PK

View Code? Open in Web Editor NEW
59.0 59.0 18.0 3.53 MB

RDF Serializer, to be used in a git commit-hook to force automatic correct rewrite of every OWL ontology

License: MIT License

Scala 23.89% Shell 1.67% Java 68.85% Python 5.57% Batchfile 0.02%

rdf-toolkit's People

Contributors

abcoates avatar corycasanave avatar dallemang avatar denniswisnosky avatar dependabot[bot] avatar jgeluk avatar mereolog avatar przemekgradzki avatar sa-bpelakh avatar trojczak avatar trypuz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rdf-toolkit's Issues

http://org.semanticweb.owlapi/error#Error3

There are some bad URIs in the output. I didn't notice them at first, becuase they don't impact the diff, but they do impact the file to save.

When I run the serializer on a file with blank node restrictions, it generates nodes with URIs with names like the one above.

I'll attach an example file to this issue once I figure out how.

BNodeComparator error

testcase1.ttl

@prefix ex: <https://ex.com/> .

_:b66 a ex:Execution ;
   ex:produces _:b67  .

_:b67 a ex:ContentExpression .
# _:b67 ex:a ex:ContentExpression .
$ java -jar rdf-toolkit-1.14.2.jar -tfmt turtle -sdt explicit -dtd -ibn -sni -s testcase1.ttl -t testoutput.ttl

produces:

14:35:52.273 ERROR o.e.rdf_toolkit.RdfFormatter - RdfFormatter: stopped by unexpected exception: 
14:35:52.274 ERROR o.e.rdf_toolkit.RdfFormatter - RDFHandlerException: unable to generate/write RDF output
14:35:52.275 ERROR o.e.rdf_toolkit.RdfFormatter - org.eclipse.rdf4j.rio.RDFHandlerException: unable to generate/write RDF output
        at org.edmcouncil.rdf_toolkit.writer.SortedTurtleWriter.endRDF(SortedTurtleWriter.java:179)
        at org.eclipse.rdf4j.rio.Rio.write(Rio.java:582)
        at org.edmcouncil.rdf_toolkit.runner.RdfToolkitRunner.runOnFile(RdfToolkitRunner.java:218)
        at org.edmcouncil.rdf_toolkit.runner.RdfToolkitRunner.run(RdfToolkitRunner.java:104)
        at org.edmcouncil.rdf_toolkit.RdfFormatter.run(RdfFormatter.java:64)
        at org.edmcouncil.rdf_toolkit.RdfFormatter.main(RdfFormatter.java:47)
Caused by: java.lang.NullPointerException
        at org.edmcouncil.rdf_toolkit.comparator.ComparisonUtils.isCollection(ComparisonUtils.java:138)
        at org.edmcouncil.rdf_toolkit.comparator.BNodeComparator.compareBlankNodesWithInlining(BNodeComparator.java:102)
        at org.edmcouncil.rdf_toolkit.comparator.BNodeComparator.compare(BNodeComparator.java:91)
        at org.edmcouncil.rdf_toolkit.comparator.ResourceComparator.compare(ResourceComparator.java:84)
        at org.edmcouncil.rdf_toolkit.comparator.ResourceComparator.compare(ResourceComparator.java:63)
        at org.edmcouncil.rdf_toolkit.comparator.ResourceComparator.compare(ResourceComparator.java:46)
        at java.base/java.util.TreeMap.put(TreeMap.java:550)
        at java.base/java.util.TreeSet.add(TreeSet.java:255)
        at java.base/java.util.AbstractCollection.addAll(AbstractCollection.java:352)
        at java.base/java.util.TreeSet.addAll(TreeSet.java:312)
        at org.edmcouncil.rdf_toolkit.model.UnsortedTurtleResourceList.toSorted(UnsortedTurtleResourceList.java:41)
        at org.edmcouncil.rdf_toolkit.writer.SortedTurtleWriter.endRDF(SortedTurtleWriter.java:169)
        ... 5 more

but if you move the comment to the line above it then it works.

Invalid tests org.edmcouncil.rdf_toolkit.writer.SortedRdfXmlWriterTest

The error described in #67 was not detected in the tests because the algorithm used in them is incorrect.


How to reproduce the error:

  1. Clone the rdf-toolkit repository in the version containing issue #67 and build project without tests:
    git clone https://github.com/edmcouncil/rdf-toolkit
    cd rdf-toolkit
    git reset --hard 2603921
    mvn -Dmaven.test.skip=true clean package
  2. Perform tests with different ordering of files in the src/test/resources/ontologies/literal directory (executed on Oracle Linux Server release 8.9 with XFS filesystem):
    1. test1.jsonld test1.rdf test1.ttl - will end with [ERROR] Tests run: 85, Failures: 4, Errors: 0, Skipped: 2, i.e. identifying issue #67:
      mv src/test/resources/ontologies/literal/* /tmp/
      mv /tmp/test1.{jsonld,rdf,ttl} src/test/resources/ontologies/literal/
      
      # check the order of files - the following command:
      ls -f src/test/resources/ontologies/literal/
      # should return:
      #    .  ..  test1.jsonld  test1.rdf  test1.ttl
      
      mvn test
    2. test1.rdf test1.ttl test1.jsonld - will end with a BUILD SUCCESS message, which is an incorrect result because #68 is not applied to the code yet:
      mv src/test/resources/ontologies/literal/* /tmp/
      mv /tmp/test1.{rdf,ttl,jsonld} src/test/resources/ontologies/literal/
      
      # check the order of files - the following command:
      ls -f src/test/resources/ontologies/literal/
      # should return:
      #    .  ..  test1.rdf  test1.ttl  test1.jsonld
      
      mvn test

Serializer doesn't reorder objects in parentheses

In a turtle file, the elements in parentheses, for example, owl:intersectionOf (...) are not re-ordered by the serializer. Protege does alphabetically re-order these constructions. So if one team member edits on Protege and another edits the code directly, they may not match after being run through the serializer.

Invalid serialization for rdf:type

rdf:type should only be serialized as a when it is a predicate, as per Turtle grammar, but the sorted serializer does it for subjects and objects as well. This leads to output that cannot be processed by standard-compliant parsers.

For example:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
rdf:type rdf:type rdf:Property .
<prop:list> a rdf:List; rdf:first rdf:type; rdf:rest rdf:nil .

should serialize as:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

rdf:type a rdf:Property .
<prop:list>
  a rdf:List ;
  rdf:first rdf:type ;
  rdf:rest rdf:nil  .

but instead produces:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

a a rdf:Property .
<prop:list>
  a rdf:List ;
  rdf:first a ;
  rdf:rest rdf:nil .

I will be creating a PR momentarily to address this issue.

Certain nesting pattern causes oscillation in "sorted" Turtle state

Hello,

I do some work with an open source community that has data maintenance processes that include using RDF Toolkit to normalize Turtle text.

Unfortunately, a few times we have encountered issues with nested blank nodes triggering some kind of incorrect sorting behavior. Most recently, this came up in a SHACL shape for a class that constrains values for two properties in a matching way. The constraint is that the properties' values need to be a class-member of neither class X nor class Y. Implementing this logic in SHACL ends up causing a 4-deep--5-deep reference path of blank nodes. (Alternative SHACL spellings are available using IRI-identified nodes to sidestep this issue with RDF Toolkit, but I do not think that would be an appropriate influence of a normalization tool on data management.)

Something about this structure---probably the blank node subgraphs being isomorphic except for one individual reference in the top blank node, and having an rdf:List deeper down---confuses RDF Toolkit's sorting, and causes a reliable oscillation between "sorted" states.

Here is a minimally reproducing example Turtle graph, excerpted from this file:

@prefix obo: <http://purl.obolibrary.org/obo/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://example.org/shapes/bfo/BFO_0000004-shape>
	a sh:NodeShape ;
	rdfs:comment "independent continuant"@en ;
	sh:property
		[
			a sh:PropertyShape ;
			sh:not [
				a sh:NodeShape ;
				sh:or (
					[
						a sh:NodeShape ;
						sh:class obo:BFO_0000020 ;
					]
					[
						a sh:NodeShape ;
						sh:class obo:BFO_0000031 ;
					]
				) ;
			] ;
			sh:path obo:BFO_0000176 ;
		] ,
		[
			a sh:PropertyShape ;
			sh:not [
				a sh:NodeShape ;
				sh:or (
					[
						a sh:NodeShape ;
						sh:class obo:BFO_0000020 ;
					]
					[
						a sh:NodeShape ;
						sh:class obo:BFO_0000031 ;
					]
				) ;
			] ;
			sh:path obo:BFO_0000186 ;
		]
		;
	sh:targetClass obo:BFO_0000004 ;
	.

The problem observed is that running the file in this state through RDF Toolkit, --source-format and --target-format both Turtle, causes the two lines with sh:path in them (values obo:BFO_0000176 and obo:BFO_0000186) to swap places. Running that state through RDF Toolkit returns the original input.

I encountered this issue today using Java 18, rdf-toolkit.jar v1.14.2. We've previously encountered this in Java Temurin v11, on the first version (or something close to there in time) of rdf-toolkit.jar that had dropped support for Java 8.

`--inline-blank-nodes` on Turtle-Turtle normalization fails on blank node that only bears a `rdf:type`

I've encountered another issue with the --inline-blank-nodes flag, which I don't wholly suspect is related to #49, but I could see something about some shared code being an influence.

My Java runtime is version 18, and I've freshly produced this issue on v1.14.2.

$ openssl dgst -sha3-256 rdf-toolkit-1.14.2.jar 
SHA3-256(rdf-toolkit-1.14.2.jar)= 2d0efd578994243d43e629629b3bf44da4350268aee8d3c1bae2784ca243a924

I have this input data:

@prefix ex: <http://example.org/ontology/> .
@prefix kb: <http://example.org/kb/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

kb:thing-1
	a owl:Thing ;
	ex:property-1 [
		a owl:Thing ;
	] ;
	.

On running this command ...

java -jar rdf-toolkit-1.14.2.jar --source-format turtle --target-format turtle --source test-input.ttl --target test-output.ttl

... I get output I roughly expect.

@prefix ex: <http://example.org/ontology/> .
@prefix kb: <http://example.org/kb/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

kb:thing-1
	a owl:Thing ;
	ex:property-1 _:blank1 ;
	.

_:blank1
	a owl:Thing ;
	.

However, on running this command, the prior with --inline-blank-nodes added ...

java -jar rdf-toolkit-1.14.2.jar --inline-blank-nodes --source-format turtle --target-format turtle --source test-input.ttl --target test-output.ttl

... I get a stack trace:

17:17:07.807 ERROR o.e.rdf_toolkit.RdfFormatter - RdfFormatter: stopped by unexpected exception: 
17:17:07.809 ERROR o.e.rdf_toolkit.RdfFormatter - RDFHandlerException: unable to generate/write RDF output
17:17:07.809 ERROR o.e.rdf_toolkit.RdfFormatter - org.eclipse.rdf4j.rio.RDFHandlerException: unable to generate/write RDF output
	at org.edmcouncil.rdf_toolkit.writer.SortedTurtleWriter.endRDF(SortedTurtleWriter.java:179)
	at org.eclipse.rdf4j.rio.Rio.write(Rio.java:582)
	at org.edmcouncil.rdf_toolkit.runner.RdfToolkitRunner.runOnFile(RdfToolkitRunner.java:218)
	at org.edmcouncil.rdf_toolkit.runner.RdfToolkitRunner.run(RdfToolkitRunner.java:104)
	at org.edmcouncil.rdf_toolkit.RdfFormatter.run(RdfFormatter.java:64)
	at org.edmcouncil.rdf_toolkit.RdfFormatter.main(RdfFormatter.java:47)
Caused by: org.eclipse.rdf4j.rio.RDFHandlerException: unable to generate/write RDF output
	at org.edmcouncil.rdf_toolkit.writer.SortedRdfWriter.endRDF(SortedRdfWriter.java:534)
	at org.edmcouncil.rdf_toolkit.writer.SortedTurtleWriter.endRDF(SortedTurtleWriter.java:177)
	... 5 more
Caused by: java.lang.NullPointerException: Cannot invoke "org.edmcouncil.rdf_toolkit.model.SortedTurtleObjectList.iterator()" because "firstValues" is null
	at org.edmcouncil.rdf_toolkit.comparator.ComparisonUtils.isCollection(ComparisonUtils.java:138)
	at org.edmcouncil.rdf_toolkit.writer.SortedTurtleWriter.writeObject(SortedTurtleWriter.java:410)
	at org.edmcouncil.rdf_toolkit.writer.SortedTurtleWriter.writeObject(SortedTurtleWriter.java:397)
	at org.edmcouncil.rdf_toolkit.writer.SortedTurtleWriter.writePredicateAndObjectValues(SortedTurtleWriter.java:335)
	at org.edmcouncil.rdf_toolkit.writer.SortedTurtleWriter.writeSubjectTriples(SortedTurtleWriter.java:294)
	at org.edmcouncil.rdf_toolkit.writer.SortedRdfWriter.endRDF(SortedRdfWriter.java:508)
	... 6 more

Strangely, none of these similar test inputs trigger an error:

@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

[]
	a owl:Thing ;
	.
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

[ a owl:Thing ; ] .
@prefix ex: <http://example.org/ontology/> .
@prefix kb: <http://example.org/kb/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

kb:thing-1
	a owl:Thing ;
	ex:property-1 [
		rdfs:label ""@en ;
	] ;
	.
@prefix ex: <http://example.org/ontology/> .
@prefix kb: <http://example.org/kb/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

kb:thing-1
	a owl:Thing ;
	ex:property-1 [] ;
	.

This next sample did fail with the same stack trace:

@prefix ex: <http://example.org/ontology/> .
@prefix kb: <http://example.org/kb/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

kb:thing-1
	a owl:Thing ;
	ex:property-1 _:blank1 ;
	.

kb:thing-2
	a owl:Thing ;
	ex:property-1 _:blank1 ;
	.

_:blank1
	a owl:Thing ;
	.

In summary, the stack trace seems to appear when:

  • --inline-blank-nodes is passed,
  • there is a blank node that is in the object position of one or more triples,
  • the only triple with that blank node as subject has predicate rdf:type.

Trying --target-format rdf-xml had no effect; I still got the stack trace in the same conditions with --target-format turtle.

Impact: This bug has lead to some code re-designs, because of running rdf-toolkit to normalize some inferencing results that could only infer anonymous nodes having a type.

Inconsistent conventions regarding owl:NamedIndividual

People using Protege to build ontologies end up with all individuals being explicit instances of owl:NamedIndividual. Other tools, and certainly, text editors used to develop ontologies do not. So here is the sort of thing that happens.

  1. Jill creates and ontology with a bunch of classes and properties and 10 instances in a text editor, runs it through the serializer and commits it to git. There are no instances of owl:NamedIndividual.
  2. Jane loads the ontology into Protege, to fix a typo in a single skos:definition for one of the classes and saves the ontology, serializes it and commits it to git.

Git thinks there are 11 changes, when there is really only one that matters.
SUGGESTION: have an option to suppress all instances of owl:NamedIndividual

Unable to publish my branch

@jgeluk When I try to publish my branch (a copy of scala-owlapi-based-serializer for the purpose of updating the artifact ontology), I get the following message:
"You may not have permission to access rdf-toolkit. Check Preferences to make sure youโ€™re still logged in."
Can you help?
Thanks.

rdf-toolkit discards information

testcase2.ttl:

@prefix ex: <https://ex.com/> .

_:b66 ex:a ex:Execution ;
   ex:produces _:b67  .

_:b67 ex:a ex:ContentExpression .

_:b0 ex:a ex:File ;
  ex:hasPart _:b67 .
java -jar ~/Downloads/rdf-toolkit-1.14.2.jar -tfmt turtle -sdt explicit -dtd -ibn -sni -s testcase2.ttl -t testoutput.ttl

produces:

@prefix ex: <https://ex.com/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .

[]
        ex:a ex:Execution ;
        ex:produces [
                ex:a ex:ContentExpression ;
        ] ;
        .

[]
        ex:a ex:File ;
        ex:hasPart [
                ex:a ex:ContentExpression ;
        ] ;
        .

which discards the fact that the blank node _:b67 is the same thing that is the part of the file.
rdf-toolkit makes it look like the part of the file could be the thing produced by the execution or not.

see how apache jena does not discard that fact:

$ ~/Downloads/apache-jena-4.9.0/bin/riot --formatted=turtle testcase2.ttl

produces

@prefix ex: <https://ex.com/> .

[ ex:a         ex:Execution;
  ex:produces  _:b0
] .

[ ex:a        ex:File;
  ex:hasPart  _:b0
] .

_:b0    ex:a    ex:ContentExpression .

see how it does not discard the fact that the file has a specific part _:b0

in this case, rdf-tool kit isn't wrong, but it is discarding information.
by that i mean the input data says "X is the case" and the output of rdf-toolkit says "X is or is not the case."

Protege exports an ontology with an invalid language code in cases where the code includes the jurisdiction

For the IOF, we have identified an issue in the exported ontology (from Protege, via the OWL API), which changes language tags from "en-US" to "en-us", which is not valid according to the IETF standard. The language code is lower case according to ISO 639, but the country code is upper case according to ISO 3166 and the IETF.

This is a bug not in the serializer but in Protege. Can we fix this in the serializer? It should always be as shown above - lower case language, upper case country, so there need not be an option to do this but rather make it a best practice.

'xml' prefix is โ€‹โ€‹not omitted when generating a DTD subset in a file formatted as sorted RDF/XML

The xml prefix is omitted when writing namespace declarations to the root element:

if ((USE_GENERATED_PREFIXES || !generatedNamespaceTable.containsKey(prefix)) && !"xml".equals(prefix)) {

but is not omitted when writing a DTD subset:

if (USE_GENERATED_PREFIXES || !generatedNamespaceTable.containsKey(prefix)) {


As a consequence, the result of the operation:

6. Format a Turtle file (`input.ttl`) as sorted RDF/XML (`output.rdf`), using entity references for URL shortening

executed with the command:

java -cp target/rdf-toolkit-1.14.2.jar org.edmcouncil.rdf_toolkit.RdfFormatter \
  -s src/test/resources/ontologies/literal/test1.ttl \
  -tfmt rdf-xml -dtd

is the file containing the entry <!ENTITY xml "http://www.w3.org/XML/1998/namespace">:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF [
	<!ENTITY owl "http://www.w3.org/2002/07/owl#">
	<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
	<!ENTITY xml "http://www.w3.org/XML/1998/namespace">
	<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
]>
<rdf:RDF
	xmlns="https://example.com/test1#"
	xmlns:owl="http://www.w3.org/2002/07/owl#"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
	
	<owl:Ontology rdf:about="https://example.com/test1">
	</owl:Ontology>
	
	<owl:Class rdf:about="https://example.com/test1#ClassA">
		<rdfs:label>label1</rdfs:label>
		<rdfs:label xml:lang="en">label2</rdfs:label>
		<rdfs:label xml:lang="pl">label3</rdfs:label>
		<rdfs:label>label4</rdfs:label>
		<rdfs:label rdf:datatype="&xsd;token">label5</rdfs:label>
		<rdfs:label>label6</rdfs:label>
	</owl:Class>

</rdf:RDF>

If you reapply the RDF/XML formatting operation to the resulting RDF/XML formatting using entity references for URL shortening:

java -cp target/rdf-toolkit-1.14.2.jar org.edmcouncil.rdf_toolkit.RdfFormatter \
  -s src/test/resources/ontologies/literal/test1.ttl \
  -tfmt rdf-xml -dtd | \
  java -cp ./target/rdf-toolkit-1.14.2.jar org.edmcouncil.rdf_toolkit.RdfFormatter \
    -sfmt rdf-xml \
    -tfmt rdf-xml -dtd

is the file without the entry <!ENTITY xml "http://www.w3.org/XML/1998/namespace">:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF [
	<!ENTITY owl "http://www.w3.org/2002/07/owl#">
	<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
	<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
]>
<rdf:RDF
	xmlns="https://example.com/test1#"
	xmlns:owl="http://www.w3.org/2002/07/owl#"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
	
	<owl:Ontology rdf:about="https://example.com/test1">
	</owl:Ontology>
	
	<owl:Class rdf:about="https://example.com/test1#ClassA">
		<rdfs:label>label1</rdfs:label>
		<rdfs:label xml:lang="en">label2</rdfs:label>
		<rdfs:label xml:lang="pl">label3</rdfs:label>
		<rdfs:label>label4</rdfs:label>
		<rdfs:label rdf:datatype="&xsd;token">label5</rdfs:label>
		<rdfs:label>label6</rdfs:label>
	</owl:Class>

</rdf:RDF>

The serializer throws an exception on a valid relative base value

Sample turtle:

@base  <file.ttl> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix ex: <https://example.com/> .

ex:Thing a owl:Class ;
    skos:prefLabel "Thing" ;
    .

Exception:

17:32:17.836 ERROR o.e.r.rio.helpers.ParseErrorLogger - [Rio fatal] Not a valid (absolute) IRI: /file.ttl (1, -1)
17:32:17.838 ERROR o.e.r.runner.RdfToolkitRunner - RdfFormatter: stopped by unexpected exception:
17:32:17.839 ERROR o.e.r.runner.RdfToolkitRunner - Unable to parse input file: /Users/ryounes/Projects/tol/models/test.ttl
17:32:17.839 ERROR o.e.r.runner.RdfToolkitRunner - Command line arguments: [-tfmt, turtle, -sdt, explicit, -dtd, -ibn, -s, test.ttl, -t, test.ttl.bak]
17:32:17.839 ERROR o.e.r.runner.RdfToolkitRunner - RDFParseException: Not a valid (absolute) IRI: /file.ttl [line 1]
17:32:17.840 ERROR o.e.r.runner.RdfToolkitRunner - org.eclipse.rdf4j.rio.RDFParseException: Not a valid (absolute) IRI: /file.ttl [line 1]
        at org.eclipse.rdf4j.rio.helpers.RDFParserHelper.reportFatalError(RDFParserHelper.java:373)
        at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.reportFatalError(AbstractRDFParser.java:772)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.reportFatalError(TurtleParser.java:1310)
        at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.createURI(AbstractRDFParser.java:424)
        at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.resolveURI(AbstractRDFParser.java:402)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseURI(TurtleParser.java:937)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseBase(TurtleParser.java:297)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseDirective(TurtleParser.java:216)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseStatement(TurtleParser.java:192)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parse(TurtleParser.java:162)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parse(TurtleParser.java:125)
        at org.eclipse.rdf4j.rio.Rio.parse(Rio.java:299)
        at org.eclipse.rdf4j.rio.Rio.parse(Rio.java:265)
        at org.eclipse.rdf4j.rio.Rio.parse(Rio.java:237)
        at org.edmcouncil.rdf_toolkit.runner.RdfToolkitRunner.readModel(RdfToolkitRunner.java:264)
        at org.edmcouncil.rdf_toolkit.runner.RdfToolkitRunner.runOnFile(RdfToolkitRunner.java:179)
        at org.edmcouncil.rdf_toolkit.runner.RdfToolkitRunner.run(RdfToolkitRunner.java:106)
        at org.edmcouncil.rdf_toolkit.RdfFormatter.run(RdfFormatter.java:64)
        at org.edmcouncil.rdf_toolkit.RdfFormatter.main(RdfFormatter.java:47)
Caused by: java.lang.IllegalArgumentException: Not a valid (absolute) IRI: /file.ttl
        at org.eclipse.rdf4j.model.impl.SimpleIRI.setIRIString(SimpleIRI.java:75)
        at org.eclipse.rdf4j.model.impl.SimpleIRI.<init>(SimpleIRI.java:64)
        at org.eclipse.rdf4j.model.impl.SimpleValueFactory.createIRI(SimpleValueFactory.java:102)
        at org.eclipse.rdf4j.rio.helpers.RDFStarDecodingValueFactory.createIRI(RDFStarDecodingValueFactory.java:42)
        at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.createURI(AbstractRDFParser.java:422)
        ... 15 more

This is valid Turtle, as you can see from the Turtle grammar, so the serializer be able to parse it.

I am using the latest release of rdf-toolkit.jar, version 1.14.2.

Serializer should not override letter casing in language and script tags

While lettercase is not significant in IANA language and script tags, the following conventions typically apply:

  • lowercase for language (e.g., "de")
  • uppercase for region (eg., "de-DE")
  • capitalized for script (e.g., "mn-Cyrl")

The serializer capitalizes the script portion, thus converting "mn-Cyrl" to "mn-CYRL." Again, since the case is not significant, this doesn't produce processing errors, but there is really no reason for the serializer to modify the input.

Note that there was a related issue that was fixed.

uri `<#>` is valid turtle

$ cat t.ttl 
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<#> a owl:Ontology .

$ ~/Downloads/apache-jena-4.10.0/bin/riot --formatted=turtle t.ttl 
@prefix owl:  <http://www.w3.org/2002/07/owl#> .
@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd:  <http://www.w3.org/2001/XMLSchema#> .

<file:///tmp/t.ttl#>  rdf:type  owl:Ontology .

java -jar rdf-toolkit.jar -tfmt turtle -sdt explicit -dtd -ibn -sni -s /tmp/t.ttl -t /tmp/p.ttl
...
11:47:55.976 ERROR o.e.r.runner.RdfToolkitRunner - RDFParseException: Not a valid (absolute) IRI: # [line 6]
...

shouldn't rdf-toolkit expand <#> like jena does?

NullPointerException in RDF writer

happens in old Qlaira and Pluvicto example in IDMP-O

11:10:12.668 ERROR o.e.rdf_toolkit.RdfFormatter - RdfFormatter: stopped by unexpected exception: 
11:10:12.671 ERROR o.e.rdf_toolkit.RdfFormatter - RDFHandlerException: unable to generate/write RDF output
11:10:12.672 ERROR o.e.rdf_toolkit.RdfFormatter - org.eclipse.rdf4j.rio.RDFHandlerException: unable to generate/write RDF output
	at org.edmcouncil.rdf_toolkit.writer.SortedRdfXmlWriter.endRDF(SortedRdfXmlWriter.java:172)
	at org.eclipse.rdf4j.rio.Rio.write(Rio.java:582)
	at org.edmcouncil.rdf_toolkit.runner.RdfToolkitRunner.runOnFile(RdfToolkitRunner.java:218)
	at org.edmcouncil.rdf_toolkit.runner.RdfToolkitRunner.run(RdfToolkitRunner.java:104)
	at org.edmcouncil.rdf_toolkit.RdfFormatter.run(RdfFormatter.java:64)
	at org.edmcouncil.rdf_toolkit.RdfFormatter.main(RdfFormatter.java:47)
Caused by: java.lang.NullPointerException
	at org.edmcouncil.rdf_toolkit.comparator.ComparisonUtils.isCollection(ComparisonUtils.java:138)
	at org.edmcouncil.rdf_toolkit.comparator.BNodeComparator.compareBlankNodesWithInlining(BNodeComparator.java:102)
	at org.edmcouncil.rdf_toolkit.comparator.BNodeComparator.compare(BNodeComparator.java:91)
	at org.edmcouncil.rdf_toolkit.comparator.ValueComparator.compareTwoBlankNodes(ValueComparator.java:119)
	at org.edmcouncil.rdf_toolkit.comparator.ValueComparator.compareExistingValues(ValueComparator.java:98)
	at org.edmcouncil.rdf_toolkit.comparator.ValueComparator.compare(ValueComparator.java:86)
	at org.edmcouncil.rdf_toolkit.comparator.ValueComparator.compare(ValueComparator.java:66)
	at org.edmcouncil.rdf_toolkit.comparator.ValueComparator.compare(ValueComparator.java:49)
	at java.base/java.util.TreeMap.put(TreeMap.java:550)
	at java.base/java.util.TreeSet.add(TreeSet.java:255)
	at java.base/java.util.AbstractCollection.addAll(AbstractCollection.java:352)
	at java.base/java.util.TreeSet.addAll(TreeSet.java:312)
	at org.edmcouncil.rdf_toolkit.model.UnsortedTurtleObjectList.toSorted(UnsortedTurtleObjectList.java:38)
	at org.edmcouncil.rdf_toolkit.model.UnsortedTurtlePredicateObjectMap.getSorted(UnsortedTurtlePredicateObjectMap.java:40)
	at org.edmcouncil.rdf_toolkit.model.UnsortedTurtlePredicateObjectMap.toSorted(UnsortedTurtlePredicateObjectMap.java:49)
	at org.edmcouncil.rdf_toolkit.model.UnsortedTurtleSubjectPredicateObjectMap.getSorted(UnsortedTurtleSubjectPredicateObjectMap.java:40)
	at org.edmcouncil.rdf_toolkit.model.UnsortedTurtleSubjectPredicateObjectMap.toSorted(UnsortedTurtleSubjectPredicateObjectMap.java:50)
	at org.edmcouncil.rdf_toolkit.writer.SortedRdfXmlWriter.endRDF(SortedRdfXmlWriter.java:159)

CURIE with / not supported

The tool does not seem to accept URIs like s:1/employees/1.

When using RdfFormatter (rdf-toolkit version 2.0)

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix s: <http://acme.org/departments/1/employees/> .
s:1 a foaf:Person .

works.

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix s: <http://acme.org/departments/> .
s:1/employees/1 a foaf:Person .

does not.

When I use angle brackets

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix s: <http://acme.org/departments/> .
<s:1/employees/1> a foaf:Person .

works and gets rewritten as

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix s: <http://acme.org/departments/> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .

s:1/employees/1
	a foaf:Person ;
	.

But the rewritten file is not accepted by rdf-toolkit.

Comments disappear after serialization

Comments disappear after serialization. Comments on separate lines disappear as well as comments at the end of a line. This is my experience with Turtle files. I have not tested the behavior for other syntaxes.

It would be very nice if there was a way to keep them.

SLF4J StaticLoggerBinder warning

I am getting the following error when I run either v1.11.0 or v1.14.0:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

You can find troubleshooting information at the following URL: https://www.slf4j.org/codes.html.

Blank node handling in RDFFormatter is incorrect

Blank nodes references are wrong:

original source:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF [
<!ENTITY cmns-dsg "https://www.omg.org/spec/Commons/Designators/">
<!ENTITY cmns-ra "https://www.omg.org/spec/Commons/RegistrationAuthorities/">
<!ENTITY cmns-txt "https://www.omg.org/spec/Commons/TextDatatype/">
<!ENTITY dct "http://purl.org/dc/terms/">
<!ENTITY owl "http://www.w3.org/2002/07/owl#">
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
<!ENTITY skos "http://www.w3.org/2004/02/skos/core#">
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
]>
<rdf:RDF xml:base="https://spec.pistoiaalliance.org/idmp/ontology/EXT/Examples/CTCAEExample/"
	xmlns:cmns-dsg="https://www.omg.org/spec/Commons/Designators/"
	xmlns:cmns-ra="https://www.omg.org/spec/Commons/RegistrationAuthorities/"
	xmlns:cmns-rga="https://www.omg.org/spec/Commons/RegulatoryAgencies/"
	xmlns:cmns-txt="https://www.omg.org/spec/Commons/TextDatatype/"
	xmlns:dct="http://purl.org/dc/terms/"
	xmlns:owl="http://www.w3.org/2002/07/owl#"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
	xmlns:skos="http://www.w3.org/2004/02/skos/core#"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema#">

	<!-- imported terms from CTCAE -->
	<owl:NamedIndividual rdf:nodeID="CTCAE">
		<rdf:type rdf:resource="&cmns-ra;Registry"/>
		<rdfs:label>Common Terminology Critera for Adverse Events (CTAE) v5.0</rdfs:label>
	</owl:NamedIndividual>


	<owl:NamedIndividual rdf:nodeID="CTCAE-Grade1">
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 1</rdfs:label>
		<skos:definition>Mild; asymptomatic or mild symptoms; clinical or diagnostic observations only; intervention not indicated. </skos:definition>
		<cmns-ra:isRegisteredIn rdf:nodeID="CTACE"/>
	</owl:NamedIndividual>

	<owl:NamedIndividual rdf:nodeID="CTCAE-Grade2">
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 2</rdfs:label>
		<skos:definition>Moderate; minimal, local or noninvasive intervention indicated; limiting ageappropriate instrumental ADL.</skos:definition>
		<cmns-ra:isRegisteredIn rdf:nodeID="CTACE"/>
	</owl:NamedIndividual>


	<owl:NamedIndividual rdf:nodeID="CTCAE-Grade3">
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 3</rdfs:label>
		<skos:definition>Severe or medically significant but not immediately life-threatening; hospitalization or prolongation of hospitalization indicated; disabling; limiting self care ADL.</skos:definition>
		<cmns-ra:isRegisteredIn rdf:nodeID="CTACE"/>
	</owl:NamedIndividual>

	<owl:NamedIndividual rdf:nodeID="CTCAE-Grade4">
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 4</rdfs:label>
		<skos:definition>Life-threatening consequences; urgent intervention indicated.</skos:definition>
		<cmns-ra:isRegisteredIn rdf:nodeID="CTACE"/>
	</owl:NamedIndividual>

	<owl:NamedIndividual rdf:nodeID="CTCAE-Grade5">
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 5</rdfs:label>
		<skos:definition>Death related to AE.</skos:definition>
		<cmns-ra:isRegisteredIn rdf:nodeID="CTACE"/>
	</owl:NamedIndividual>
</rdf:RDF>

output running RDFFormatter with

--source "CTCAE.rdf"   
--target "out.rdf" 
--target-format rdf-xml       
--use-dtd-subset
--infer-base-iri

is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF [
	<!ENTITY cmns-dsg "https://www.omg.org/spec/Commons/Designators/">
	<!ENTITY cmns-ra "https://www.omg.org/spec/Commons/RegistrationAuthorities/">
	<!ENTITY cmns-rga "https://www.omg.org/spec/Commons/RegulatoryAgencies/">
	<!ENTITY cmns-txt "https://www.omg.org/spec/Commons/TextDatatype/">
	<!ENTITY dct "http://purl.org/dc/terms/">
	<!ENTITY owl "http://www.w3.org/2002/07/owl#">
	<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
	<!ENTITY skos "http://www.w3.org/2004/02/skos/core#">
	<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
]>
<rdf:RDF
	xmlns:cmns-dsg="https://www.omg.org/spec/Commons/Designators/"
	xmlns:cmns-ra="https://www.omg.org/spec/Commons/RegistrationAuthorities/"
	xmlns:cmns-rga="https://www.omg.org/spec/Commons/RegulatoryAgencies/"
	xmlns:cmns-txt="https://www.omg.org/spec/Commons/TextDatatype/"
	xmlns:dct="http://purl.org/dc/terms/"
	xmlns:owl="http://www.w3.org/2002/07/owl#"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
	xmlns:skos="http://www.w3.org/2004/02/skos/core#"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
	
	<owl:NamedIndividual rdf:nodeID="blank2">
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 1</rdfs:label>
		<skos:definition>Mild; asymptomatic or mild symptoms; clinical or diagnostic observations only; intervention not indicated.</skos:definition>
		<cmns-ra:isRegisteredIn rdf:nodeID="blank1"/>
	</owl:NamedIndividual>
	
	<owl:NamedIndividual rdf:nodeID="blank3">
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 2</rdfs:label>
		<skos:definition>Moderate; minimal, local or noninvasive intervention indicated; limiting ageappropriate instrumental ADL.</skos:definition>
		<cmns-ra:isRegisteredIn rdf:nodeID="blank1"/>
	</owl:NamedIndividual>
	
	<owl:NamedIndividual rdf:nodeID="blank4">
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 3</rdfs:label>
		<skos:definition>Severe or medically significant but not immediately life-threatening; hospitalization or prolongation of hospitalization indicated; disabling; limiting self care ADL.</skos:definition>
		<cmns-ra:isRegisteredIn rdf:nodeID="blank1"/>
	</owl:NamedIndividual>
	
	<owl:NamedIndividual rdf:nodeID="blank5">
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 4</rdfs:label>
		<skos:definition>Life-threatening consequences; urgent intervention indicated.</skos:definition>
		<cmns-ra:isRegisteredIn rdf:nodeID="blank1"/>
	</owl:NamedIndividual>
	
	<owl:NamedIndividual rdf:nodeID="blank6">
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 5</rdfs:label>
		<skos:definition>Death related to AE.</skos:definition>
		<cmns-ra:isRegisteredIn rdf:nodeID="blank1"/>
	</owl:NamedIndividual>
	
	<owl:NamedIndividual rdf:nodeID="blank7">
		<rdf:type rdf:resource="&cmns-ra;Registry"/>
		<rdfs:label>Common Terminology Critera for Adverse Events (CTAE) v5.0</rdfs:label>
	</owl:NamedIndividual>

</rdf:RDF>

Note that the blank node with the original id CTCAE is referenced as blank1, but declared as blank7.

With --inline-blank-nodes it fails completely, but this might be expected.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF [
	<!ENTITY cmns-dsg "https://www.omg.org/spec/Commons/Designators/">
	<!ENTITY cmns-ra "https://www.omg.org/spec/Commons/RegistrationAuthorities/">
	<!ENTITY cmns-rga "https://www.omg.org/spec/Commons/RegulatoryAgencies/">
	<!ENTITY cmns-txt "https://www.omg.org/spec/Commons/TextDatatype/">
	<!ENTITY dct "http://purl.org/dc/terms/">
	<!ENTITY owl "http://www.w3.org/2002/07/owl#">
	<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
	<!ENTITY skos "http://www.w3.org/2004/02/skos/core#">
	<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
]>
<rdf:RDF
	xmlns:cmns-dsg="https://www.omg.org/spec/Commons/Designators/"
	xmlns:cmns-ra="https://www.omg.org/spec/Commons/RegistrationAuthorities/"
	xmlns:cmns-rga="https://www.omg.org/spec/Commons/RegulatoryAgencies/"
	xmlns:cmns-txt="https://www.omg.org/spec/Commons/TextDatatype/"
	xmlns:dct="http://purl.org/dc/terms/"
	xmlns:owl="http://www.w3.org/2002/07/owl#"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
	xmlns:skos="http://www.w3.org/2004/02/skos/core#"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
	
	<owl:NamedIndividual>
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 1</rdfs:label>
		<skos:definition>Mild; asymptomatic or mild symptoms; clinical or diagnostic observations only; intervention not indicated.</skos:definition>
		<cmns-ra:isRegisteredIn>
			<rdf:Description>
			</rdf:Description>
		</cmns-ra:isRegisteredIn>
	</owl:NamedIndividual>
	<owl:NamedIndividual>
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 2</rdfs:label>
		<skos:definition>Moderate; minimal, local or noninvasive intervention indicated; limiting ageappropriate instrumental ADL.</skos:definition>
		<cmns-ra:isRegisteredIn>
			<rdf:Description>
			</rdf:Description>
		</cmns-ra:isRegisteredIn>
	</owl:NamedIndividual>
	<owl:NamedIndividual>
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 3</rdfs:label>
		<skos:definition>Severe or medically significant but not immediately life-threatening; hospitalization or prolongation of hospitalization indicated; disabling; limiting self care ADL.</skos:definition>
		<cmns-ra:isRegisteredIn>
			<rdf:Description>
			</rdf:Description>
		</cmns-ra:isRegisteredIn>
	</owl:NamedIndividual>
	<owl:NamedIndividual>
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 4</rdfs:label>
		<skos:definition>Life-threatening consequences; urgent intervention indicated.</skos:definition>
		<cmns-ra:isRegisteredIn>
			<rdf:Description>
			</rdf:Description>
		</cmns-ra:isRegisteredIn>
	</owl:NamedIndividual>
	<owl:NamedIndividual>
		<rdf:type rdf:resource="&cmns-dsg;Designation"/>
		<rdfs:label>Grade 5</rdfs:label>
		<skos:definition>Death related to AE.</skos:definition>
		<cmns-ra:isRegisteredIn>
			<rdf:Description>
			</rdf:Description>
		</cmns-ra:isRegisteredIn>
	</owl:NamedIndividual>
	<owl:NamedIndividual>
		<rdf:type rdf:resource="&cmns-ra;Registry"/>
		<rdfs:label>Common Terminology Critera for Adverse Events (CTAE) v5.0</rdfs:label>
	</owl:NamedIndividual>
</rdf:RDF>

download the rdf-toolkit

Hi,

I'm trying to download the rdf-toolkit, but unable to do that. After login with my GitHub credentials, it redirect me to a Jenkins page where I get the message: Access Denied: ... is missing the Overall/Read permission.

How can I download this tool?

The RDF toolkit incorrectly revises IRIs for those with non-standard structure

When serializing IRIs such as those found in the Qlaira example for the IDMP project (i.e., any IRI that is associated with the SPOR repository managed by the European Medicines Agency), the serializer incorrectly re-writes some of the abbreviated IRIs and completely replaces others with the full string value of the IRI. Certain SPOR product IRIs were changed from "spor-p;" to "spor-p;/products/", and similarly with "spor-s;" replaced with "spor-s;/substances/". The replacements tend to occur in the named class or individual rather than other references to them.

See the Qlaira Example ontology in IDMP/EXT/Examples.

Update version number in pom file

The new version 1.15 still identifies itself as 1.14.2:

 <groupId>org.edmcouncil</groupId>
  <artifactId>rdf-toolkit</artifactId>
  <version>1.14.2</version>

To exist, or not to exits

If the --output-file does not exit, you get an error message saying that the Output file does not exist. If it does exist, you get an error message saying Output File exists.

In the output file case, it creates it anyway. But you get an error no matter what.

Add option to add a default language tag to untyped, untagged strings

The proposal is to provide an option which would allow the user to specify a default language tag which would be used to tag any untyped, untagged strings. This is different from the -osl option in that existing language tags and datatypes are not overridden by the default.

Example:

java -jar rdf-toolkit.jar -s <source-file> -t <target-file> --add-default-language en-US

Input:

gist:Organization
	a owl:Class ;
	skos:prefLabel "Organization" ;
        skos:prefLabel "Organisation"@en-GB ;
        skos:altLabel "ORG"^^xsd:string ;
	.

Output:

gist:Organization
	a owl:Class ;
	skos:prefLabel "Organization"@en-US ;
        skos:prefLabel "Organisation"@en-GB ;
        skos:altLabel "ORG"^^xsd:string ;
	.

The --osl en-US output is:

gist:Organization
	a owl:Class ;
	skos:prefLabel "Organization"@en-US ;
        skos:prefLabel "Organisation"@en-US ;
        skos:altLabel "ORG"@en-US ;
	.

Currently -osl <arg> takes precedence over -sdt explicit in case both are specified, which makes sense. I would think the proposed argument would take precedence over -osl.

Lists with one element

rdf-toolkit crashes when processing rdf:list with one element.

Example:

rdf-toolkit: sesame-serializer: java_home = /Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk/Contents/Home/
rdf-toolkit: sesame-serializer: whichJava = /Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk/Contents/Home//bin/java
rdf-toolkit: sesame-serializer: Found rdf-toolkit: ***idmp/.git/hooks/rdf-toolkit.jar
rdf-toolkit: sesame-serializer: Launching the sesame-serializer with --source EXT/Examples/QlairaExample.rdf
+ /Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk/Contents/Home//bin/java -Xmx1g -Dorg.clapper.avsl.config=/tmp/sesame-serializer-log -cp ***/idmp/.git/hooks/rdf-toolkit.jar org.edmcouncil.rdf_toolkit.RdfFormatter --source EXT/Examples/QlairaExample.rdf --target EXT/Examples/QlairaExample.rdfX --target-format rdf-xml --use-dtd-subset --inline-blank-nodes --infer-base-iri
10:08:23.551 ERROR o.e.rdf_toolkit.RdfFormatter - RdfFormatter: stopped by unexpected exception: 
10:08:23.554 ERROR o.e.rdf_toolkit.RdfFormatter - RDFHandlerException: unable to generate/write RDF output
10:08:23.555 ERROR o.e.rdf_toolkit.RdfFormatter - org.eclipse.rdf4j.rio.RDFHandlerException: unable to generate/write RDF output
	at org.edmcouncil.rdf_toolkit.writer.SortedRdfXmlWriter.endRDF(SortedRdfXmlWriter.java:172)
	at org.eclipse.rdf4j.rio.Rio.write(Rio.java:582)
	at org.edmcouncil.rdf_toolkit.runner.RdfToolkitRunner.runOnFile(RdfToolkitRunner.java:218)
	at org.edmcouncil.rdf_toolkit.runner.RdfToolkitRunner.run(RdfToolkitRunner.java:104)
	at org.edmcouncil.rdf_toolkit.RdfFormatter.run(RdfFormatter.java:64)
	at org.edmcouncil.rdf_toolkit.RdfFormatter.main(RdfFormatter.java:47)
Caused by: java.lang.NullPointerException: Cannot invoke "org.edmcouncil.rdf_toolkit.model.SortedTurtleObjectList.iterator()" because "firstValues" is null
	at org.edmcouncil.rdf_toolkit.comparator.ComparisonUtils.isCollection(ComparisonUtils.java:138)
	at org.edmcouncil.rdf_toolkit.comparator.BNodeComparator.compareBlankNodesWithInlining(BNodeComparator.java:102)
	at org.edmcouncil.rdf_toolkit.comparator.BNodeComparator.compare(BNodeComparator.java:91)
	at org.edmcouncil.rdf_toolkit.comparator.ResourceComparator.compare(ResourceComparator.java:84)
	at org.edmcouncil.rdf_toolkit.comparator.ResourceComparator.compare(ResourceComparator.java:63)
	at org.edmcouncil.rdf_toolkit.comparator.ResourceComparator.compare(ResourceComparator.java:46)
	at java.base/java.util.TreeMap.put(TreeMap.java:787)
	at java.base/java.util.TreeMap.put(TreeMap.java:534)
	at java.base/java.util.TreeSet.add(TreeSet.java:255)
	at java.base/java.util.AbstractCollection.addAll(AbstractCollection.java:336)
	at java.base/java.util.TreeSet.addAll(TreeSet.java:310)
	at org.edmcouncil.rdf_toolkit.model.UnsortedTurtleResourceList.toSorted(UnsortedTurtleResourceList.java:41)
	at org.edmcouncil.rdf_toolkit.writer.SortedRdfXmlWriter.endRDF(SortedRdfXmlWriter.java:162)
	... 5 more

"java.io.IOException: Error while instrumenting" error in org.jacoco for Java v21

When executing a Maven "test" target, i.e.:

mvn test

the following errors appear for java/sql/Timestamp:

[INFO] Running org.edmcouncil.rdf_toolkit.writer.SortedJsonLdWriterTest
java.lang.instrument.IllegalClassFormatException: Error while instrumenting java/sql/Timestamp.
at org.jacoco.agent.rt.internal_3570298.CoverageTransformer.transform(CoverageTransformer.java:94)
...
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 65

Similar errors also appear for:

  • java/sql/Date
  • java/sql/Time

Software versions used:

Apache Maven 3.8.5 (Red Hat 3.8.5-4)
Maven home: /usr/share/maven
Java version: 21.0.1, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-21-openjdk-21.0.1.0.12-2.0.1.el8.x86_64
Default locale: pl_PL, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-202.135.2.el8uek.x86_64", arch: "amd64", family: "unix"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.