Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to convert from obographs .json #1081

Open
riiswa opened this issue Jan 8, 2023 · 3 comments
Open

Impossible to convert from obographs .json #1081

riiswa opened this issue Jan 8, 2023 · 3 comments

Comments

@riiswa
Copy link

riiswa commented Jan 8, 2023

With the latest robot.jar. I got this error when I try to convert a json file to owl (``robot convert -i abox.json -o test.owl -vvv
):

DEBUG Loading ontology abox.json with catalog file null
DEBUG Loading file META-INF/services/org.semanticweb.owlapi.model.OWLOntologyManager
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.model.OWLOntologyManager
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.model.OWLOntologyManager
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.model.OWLOntologyManager
DEBUG Loading file META-INF/services/org.semanticweb.owlapi.model.OWLDataFactory
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.model.OWLDataFactory
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.model.OWLDataFactory
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.model.OWLDataFactory
DEBUG Injecting object uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl@3f28bd56
DEBUG Loading file META-INF/services/org.semanticweb.owlapi.model.OWLOntologyIRIMapper
DEBUG No files found for META-INF/services/org.semanticweb.owlapi.model.OWLOntologyIRIMapper
DEBUG Injecting values [[]] on method public void uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.setIRIMappers(java.util.Set).
DEBUG Loading file META-INF/services/org.semanticweb.owlapi.io.OWLParserFactory
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.io.OWLParserFactory
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.io.OWLParserFactory
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.io.OWLParserFactory
DEBUG Injecting values [[org.semanticweb.owlapi.rio.RioNQuadsParserFactory@66629f63, org.semanticweb.owlapi.rio.RioTrigParserFactory@439a8f59, org.semanticweb.owlapi.owlxml.parser.OWLXMLParserFactory@26fb628, org.semanticweb.owlapi.rio.RioN3ParserFactory@47da3952, org.semanticweb.owlapi.rio.RioRDFXMLParserFactory@5c48c0c0, org.semanticweb.owlapi.rio.RioJsonLDParserFactory@5f3b9c57, org.semanticweb.owlapi.rio.RioRDFaParserFactory@6e521c1e, org.semanticweb.owlapi.rio.RioNTriplesParserFactory@1568159, org.semanticweb.owlapi.rdf.turtle.parser.TurtleOntologyParserFactory@52500920, org.semanticweb.owlapi.rdf.rdfxml.parser.RDFXMLParserFactory@6c67e137, org.semanticweb.owlapi.rio.RioTurtleParserFactory@71c5b236, org.semanticweb.owlapi.oboformat.OBOFormatOWLAPIParserFactory@1c98290c, org.semanticweb.owlapi.rio.RioTrixParserFactory@2f162cc0, org.semanticweb.owlapi.rio.RioJsonParserFactory@2484f433, org.semanticweb.owlapi.functional.parser.OWLFunctionalSyntaxOWLParserFactory@4215838f, org.semanticweb.owlapi.manchestersyntax.parser.ManchesterOWLSyntaxOntologyParserFactory@751d3241, org.semanticweb.owlapi.krss2.parser.KRSS2OWLParserFactory@611df6e3, org.semanticweb.owlapi.rio.RioBinaryRdfParserFactory@1d71006f]] on method public void uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.setOntologyParsers(java.util.Set).
DEBUG Loading file META-INF/services/org.semanticweb.owlapi.model.OWLOntologyFactory
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.model.OWLOntologyFactory
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.model.OWLOntologyFactory
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.model.OWLOntologyFactory
DEBUG Injecting values [[uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl@54361a9]] on method public void uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.setOntologyFactories(java.util.Set).
DEBUG Loading file META-INF/services/org.semanticweb.owlapi.model.OWLStorerFactory
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.model.OWLStorerFactory
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.model.OWLStorerFactory
DEBUG Loading URL for service jar:file:/usr/local/bin/robot.jar!/META-INF/services/org.semanticweb.owlapi.model.OWLStorerFactory
DEBUG Injecting values [[org.semanticweb.owlapi.rdf.turtle.renderer.TurtleStorerFactory@7997b197, org.semanticweb.owlapi.rio.RioNQuadsStorerFactory@3bffddff, org.semanticweb.owlapi.manchestersyntax.renderer.ManchesterSyntaxStorerFactory@6b5176f2, org.semanticweb.owlapi.oboformat.OBOFormatStorerFactory@4a067c25, org.semanticweb.owlapi.rio.RioBinaryRdfStorerFactory@a7e2d9d, org.semanticweb.owlapi.rio.RioTrigStorerFactory@114a85c2, org.semanticweb.owlapi.rdf.rdfxml.renderer.RDFXMLStorerFactory@2c177f9e, org.semanticweb.owlapi.owlxml.renderer.OWLXMLStorerFactory@f9b7332, org.semanticweb.owlapi.rio.RioNTriplesStorerFactory@142eef62, org.semanticweb.owlapi.dlsyntax.renderer.DLSyntaxHTMLStorerFactory@7bb3a9fe, org.semanticweb.owlapi.rio.RioJsonLDStorerFactory@7de0c6ae, org.semanticweb.owlapi.functional.renderer.FunctionalSyntaxStorerFactory@1bdf8190, org.semanticweb.owlapi.rio.RioN3StorerFactory@299266e2, org.semanticweb.owlapi.krss2.renderer.KRSS2OWLSyntaxStorerFactory@6e46d9f4, org.semanticweb.owlapi.dlsyntax.renderer.DLSyntaxStorerFactory@b91d8c4, org.semanticweb.owlapi.rio.RioTurtleStorerFactory@46074492, org.semanticweb.owlapi.rio.RioJsonStorerFactory@5dcbb60, org.semanticweb.owlapi.rio.RioTrixStorerFactory@37eeec90, org.semanticweb.owlapi.latex.renderer.LatexStorerFactory@1922e6d, org.semanticweb.owlapi.rio.RioRDFXMLStorerFactory@35d6ca49]] on method public void uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.setOntologyStorers(java.util.Set).
DEBUG Converting from JSON to RDF
DEBUG Add location: LocatorFile
DEBUG Add location: ClassLoaderLocator
DEBUG Failed to find configuration: file:location-mapping.rdf;file:location-mapping.n3;file:location-mapping.ttl;file:etc/location-mapping.rdf;file:etc/location-mapping.n3;file:etc/location-mapping.ttl
DEBUG Add location: LocatorFile
DEBUG Add location: LocatorURL
DEBUG Add location: ClassLoaderLocator
DEBUG Failed to find configuration: location-mapping.ttl;location-mapping.rdf;etc/location-mapping.rdf;etc/location-mapping.ttl
DEBUG System architecture: 64 bit
ERROR [line: 1, col: 1 ] document doesn't start with a valid json element : null
DEBUG Missing exception ID: org.apache.jena.riot.RiotException: [line: 1, col: 1 ] document doesn't start with a valid json element : null
org.apache.jena.riot.RiotException: [line: 1, col: 1 ] document doesn't start with a valid json element : null
java.lang.IllegalArgumentException: org.apache.jena.riot.RiotException: [line: 1, col: 1 ] document doesn't start with a valid json element : null
	at org.obolibrary.robot.CommandLineHelper.updateInputOntology(CommandLineHelper.java:585)
	at org.obolibrary.robot.CommandLineHelper.updateInputOntology(CommandLineHelper.java:539)
	at org.obolibrary.robot.ConvertCommand.execute(ConvertCommand.java:130)
	at org.obolibrary.robot.CommandManager.executeCommand(CommandManager.java:244)
	at org.obolibrary.robot.CommandManager.execute(CommandManager.java:188)
	at org.obolibrary.robot.CommandManager.main(CommandManager.java:135)
	at org.obolibrary.robot.CommandLineInterface.main(CommandLineInterface.java:61)
Caused by: org.apache.jena.riot.RiotException: [line: 1, col: 1 ] document doesn't start with a valid json element : null
	at org.apache.jena.riot.system.ErrorHandlerFactory$ErrorHandlerStd.error(ErrorHandlerFactory.java:146)
	at org.apache.jena.riot.lang.JsonLDReader.read(JsonLDReader.java:124)
	at org.apache.jena.riot.RDFParser.read(RDFParser.java:353)
	at org.apache.jena.riot.RDFParser.parseNotUri(RDFParser.java:343)
	at org.apache.jena.riot.RDFParser.parse(RDFParser.java:292)
	at org.apache.jena.riot.RDFParserBuilder.parse(RDFParserBuilder.java:540)
	at org.apache.jena.riot.RDFDataMgr.parseFromInputStream(RDFDataMgr.java:901)
	at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:299)
	at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:285)
	at org.apache.jena.riot.adapters.RDFReaderRIOT.read(RDFReaderRIOT.java:69)
	at org.apache.jena.rdf.model.impl.ModelCom.read(ModelCom.java:283)
	at org.obolibrary.robot.IOHelper.loadOntology(IOHelper.java:403)
	at org.obolibrary.robot.IOHelper.loadOntology(IOHelper.java:306)
	at org.obolibrary.robot.CommandLineHelper.getInputOntology(CommandLineHelper.java:483)
	at org.obolibrary.robot.CommandLineHelper.updateInputOntology(CommandLineHelper.java:581)
	... 6 more

I also tested with .json file that are in the obographs example/.

@jamesaoverton
Copy link
Member

Thanks for the report. Could you please provide or point to a specific JSON file, so that I can try to reproduce the problem?

@riiswa
Copy link
Author

riiswa commented Jan 10, 2023

@jamesaoverton
Copy link
Member

Ok thanks. I can reproduce the error with that file.

There are two problems here:

  1. The fundamental problem is that the Java implementation of obographs used by ROBOT does not convert obographs JSON to OWL, according to Implement reverse translation from OboGraphs to OWL geneontology/obographs#87. I'm not an expert on obographs, so I could be mistaken. That issue links to a Python implementation that might do what you need.

  2. While ROBOT can output obographs JSON, it is expecting to read JSON-LD. The error message is from the Jena library complaining that the obographs JSON input is not valid JSON-LD. The input handling code is here: https://github.com/ontodev/robot/blob/master/robot-core/src/main/java/org/obolibrary/robot/IOHelper.java#L380

I had forgotten this, and the documentation doesn't make this clear. I will add "fix the convert documentation" to my To Do list.

@jamesaoverton jamesaoverton changed the title Impossible to convert from .json Impossible to convert from obographs .json Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants