edmcouncil / rdf-toolkit

RDF Serializer, to be used in a git commit-hook to force automatic correct rewrite of every OWL ontology
MIT License
66 stars 18 forks source link

NullPointerException in RDF writer #54

Closed tw-osthus closed 1 year ago

tw-osthus commented 1 year ago

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)
mereolog commented 1 year ago

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)

@tw-osthus could you point to a particular commit for which it fails?

tw-osthus commented 1 year ago

No, because I can't commit because of this bug. I guess it happens with this xml structure:

<owl:NamedIndividual rdf:about="s">
<p>
   <owl:NamedIndividual />
   <owl:NamedIndividual />
</p>
</owl:NamedIndividual>
mereolog commented 1 year ago

Can you send me the outcome from git diff and the last commit you are at (i.e., the first item on the list from git log)?

tw-osthus commented 1 year ago

As I have said before, I could not commit, so I do not have any git log that I am aware of. The failed rdf tool run, prevents the commit to proceed.

I am using TortoiseGit on windows and I only know the git basics.

I have fixed both the Qlaira example (which is now merged in master) and now the Pluvicto example in IDMP-648, so that it does not trigger the bug.

tw-osthus commented 1 year ago

Unfortunately I cannot reproduce the bug with the examples I have. The RDFToolkit version is 1.14.1 according to the manifest. I will update the toolkit.

mereolog commented 1 year ago

I am closing the issue because I cannot reproduce it.