phyloref / jphyloref

MIT License
0 stars 0 forks source link

Get rid of RDFHandler hack #11

Closed gaurav closed 3 years ago

gaurav commented 6 years ago

The current implementation of JSON-LD processing works by using RioOWLRDFConsumerAdapter to translate between RDF in Rio (which can read JSON-LD) and OWL in the OWL API (which cannot). Unfortunately, RioOWLRDFConsumerAdapter implements org.openrdf.rio.RDFHandler while the JSON-LD parser expects org.eclipse.rdf4j.rio.RDFHandler. I've tried adding https://mvnrepository.com/artifact/org.openrdf.sesame/sesame-rio-jsonld as version 2.9.0, 4.0.2 and 4.1.2, but neither version registers as a JSON-LD handler, giving the following error message:

Caused by: org.openrdf.rio.UnsupportedRDFormatException: Did not recognise RDF format object JSON-LD (mimeTypes=application/ld+json; ext=jsonld)

So as to keep moving, I've written a very hacky translator from an org.openrdf.rio.RDFHandler to an org.eclipse.rdf4j.rio.RDFHandler. This should be replaced, either by figuring out which class exactly RioOWLRDFConsumerAdapter is looking for in order to implement JSON-LD, or by updating RioOWLRDFConsumerAdapter so that it uses org.eclipse.rdf4j.rio.RDFHandler.