ClassCastException impl.SimpleIRI to Literal on owl n10s.onto.import.fetch

Hi,

I'm getting a ClassCastException when importing the Foodon ontology owl file. An earlier version of the ontology owl file works, but newer revisions fail with the following error:

Failed to invoke procedure n10s.onto.import.fetch: Caused by: java.lang.ClassCastException: class org.eclipse.rdf4j.model.impl.SimpleIRI cannot be cast to class org.eclipse.rdf4j.model.Literal (org.eclipse.rdf4j.model.impl.SimpleIRI and org.eclipse.rdf4j.model.Literal are in unnamed module of loader 'app')

Here's the command I'm running that fails:

CALL n10s.onto.import.fetch("https://github.com/FoodOntology/foodon/raw/master/foodon.owl", "RDF/XML", {commitSize: 10000, nodeCacheSize: 20000});

Using a specific revision of the file works:

CALL n10s.onto.import.fetch("https://github.com/FoodOntology/foodon/raw/3d6130586c0c795cd768823e9c2f43928b4fca62/foodon.owl", "RDF/XML", {commitSize: 10000, nodeCacheSize: 20000});

But the revision just after fails:

CALL n10s.onto.import.fetch("https://github.com/FoodOntology/foodon/raw/28bc881f27a24687269b5ad75eb99217f5c6c464/foodon.owl", "RDF/XML", {commitSize: 10000, nodeCacheSize: 20000});

Is there a problem with the Owl file that I should raise with the FoodOntology group or can this be fixed within neo4j?

Thanks!

I believe I've found the offending change. Revision 28bc881f27a24687269b5ad75eb99217f5c6c464 adds <rdfs:comment rdf:resource="&obo;IAO_0000122"/> at line 13025. When I comment this out, the import works fine. With it in, the import fails.

I can also import the current revision by commenting out all rdfs:comment tags that use the rdf:resource attribute.

Is the rdf:resource attribute not allowed on the rdfs:comment tag? Or is this a bug with neosemantics?

Hi @jwong,

Nice catch!

The RDFSchema spec says that the range of the rdfs:comment predicate is meant to be a literal.

This means that in RDF/XML serialisation the usage of the rdfs:comment tag should be like in the rest of the cases:
<rdfs:comment xml:lang="en">...some text...</rdfs:comment>
and not use the rdf:resource attribute.

Which leads me to think that this is a malformed RDF document.

That said, it would be relatively easy to have neosemantics deal with it and transform the uri in rdf:resource into a literal value. My concern is whether doing it would make neosemantics silently accept an error that should be flagged.
Let me think about it but I would suggest reporting it to the editors of the food onto.

Cheers,

JB.

Hi @jesus_barrasa!

We've been in contact with the Foodon ontology and confirmed that it is a mistake on their part, and they'll work on fixing it.

Thanks,
Jeffrey

1 Like