dice-group / LD2NL

Linked Data to Natural Language
GNU Affero General Public License v3.0
11 stars 6 forks source link

RDF/XML format error running owl2nl.sh #19

Open Demirrr opened 9 months ago

Demirrr commented 9 months ago

Execitng the following example command ./owl2nl.sh -a ./home/demir/Desktop/Softwares/Ontolearn/examples/best_pred.owl -u false -o ./home/demir/Desktop/Softwares/Ontolearn/KGs/Family/family.owl -t json -s test_out.json -m rule leads to the following RDF parsing error

(onto) demir@demir:~/Desktop/Softwares/Ontolearn/LD2NL/owl2nl$ ./owl2nl.sh -a ./home/demir/Desktop/Softwares/Ontolearn/examples/best_pred.owl -u false -o ./home/demir/Desktop/Softwares/Ontolearn/KGs/Family/family.owl -t json -s test_out.json -m rule
15/Jan/202409:49:33  INFO (RAKICommandLineInterface.java:main:27) - 
==============================
Parsing arguments ...
15/Jan/202409:49:33  INFO (RAKICommandLineInterface.java:main:61) - ==============================Checking arguments...
15/Jan/202409:49:33  INFO (RAKICommandLineInterface.java:main:83) - 
==============================
Running Pipeline ...
15/Jan/202409:49:33 DEBUG (RakiIO.java:readRDFXML:23) - ./home/demir/Desktop/Softwares/Ontolearn/examples/best_pred.owl
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.aksw.jena_sparql_api.mapper.proxy.MapperProxyUtils (file:/home/demir/.m2/repository/org/aksw/jena-sparql-api/jena-sparql-api-mapper-proxy/3.14.0-1/jena-sparql-api-mapper-proxy-3.14.0-1.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class)
WARNING: Please consider reporting this to the maintainers of org.aksw.jena_sparql_api.mapper.proxy.MapperProxyUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
15/Jan/202409:49:34 ERROR (RakiIO.java:readRDFXML:28) - Could not read: ./home/demir/Desktop/Softwares/Ontolearn/examples/best_pred.owl
15/Jan/202409:49:34 ERROR (RakiIO.java:readRDFXML:29) - Not found: ./home/demir/Desktop/Softwares/Ontolearn/examples/best_pred.owl
org.apache.jena.riot.RiotNotFoundException: Not found: ./home/demir/Desktop/Softwares/Ontolearn/examples/best_pred.owl
        at org.apache.jena.riot.RDFParser.openTypedInputStream(RDFParser.java:394) ~[jena-arq-3.12.0.jar:3.12.0]
        at org.apache.jena.riot.RDFParser.parseURI(RDFParser.java:301) ~[jena-arq-3.12.0.jar:3.12.0]
        at org.apache.jena.riot.RDFParser.parse(RDFParser.java:295) ~[jena-arq-3.12.0.jar:3.12.0]
        at org.apache.jena.riot.RDFParserBuilder.parse(RDFParserBuilder.java:506) ~[jena-arq-3.12.0.jar:3.12.0]
        at org.apache.jena.riot.RDFDataMgr.parseFromURI(RDFDataMgr.java:890) ~[jena-arq-3.12.0.jar:3.12.0]
        at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:221) ~[jena-arq-3.12.0.jar:3.12.0]
        at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:190) ~[jena-arq-3.12.0.jar:3.12.0]
        at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:120) ~[jena-arq-3.12.0.jar:3.12.0]
        at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:111) ~[jena-arq-3.12.0.jar:3.12.0]
        at org.apache.jena.riot.adapters.RDFReaderRIOT.read(RDFReaderRIOT.java:76) ~[jena-arq-3.12.0.jar:3.12.0]
        at org.apache.jena.rdf.model.impl.ModelCom.read(ModelCom.java:263) ~[jena-core-3.12.0.jar:3.12.0]
        at org.aksw.owl2nl.pipeline.io.RakiIO.readRDFXML(RakiIO.java:24) ~[classes/:?]
        at org.aksw.owl2nl.pipeline.data.input.RAKIInput.init(RAKIInput.java:86) ~[classes/:?]
        at org.aksw.owl2nl.pipeline.data.input.RAKIInput.setAxioms(RAKIInput.java:122) ~[classes/:?]
        at org.aksw.owl2nl.pipeline.ui.RAKICommandLineInterface.main(RAKICommandLineInterface.java:88) ~[classes/:?]
        at org.codehaus.mojo.exec.ExecJavaMojo.lambda$execute$0(ExecJavaMojo.java:283) ~[?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.1:java (default-cli) on project owl2nl: An exception occurred while executing the Java class. 
[ERROR] 
[ERROR] -> !! The given input seem to be not in RDF/XML format!!
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Files are here Prediction_and_kb.zip

The two files can be ready without a problem with rdflib see below

>>> import rdflib
>>> rdflib.Graph().parse("best_pred.owl")
<Graph identifier=N2f70772cfc4741f7bf78bfdef644c864 (<class 'rdflib.graph.Graph'>)>

Any suggestion to solve this problem ?

renespeck commented 9 months ago

Hi I assume the file is not found since you using a relative path? ./home/......

Demirrr commented 9 months ago

Thank you for the point.

Yet, this works

./owl2nl.sh -a ./src/test/resources/test_axioms.owl \
            -u false -o ./src/test/resources/test_ontology.owl \
            -t json -s test_out.json -m rule

but this doesn't

./owl2nl.sh -a ./src/test/resources/best_pred.owl \
            -u false -o ./src/test/resources/family.owl \
            -t json -s test_out.json -m rule

where /src/test/resources/ contains best_pred.owland family.owl

Demirrr commented 9 months ago

Oh I guess I might understood the problem. Replacing the following

<owl:Ontology rdf:about="https://dice-research.org/predictions/1705308430.7992284">
  <owl:imports rdf:resource="file://../KGs/Family/family.owl"/>
</owl:Ontology>

with <owl:Ontology rdf:about="http://example.com/asdasda"/> does the trick.

renespeck commented 9 months ago

As far as i know, Jena tries to import. Maybe it works when the file exists. I have to test that. Thanks for reporting.

Demirrr commented 9 months ago

I was wondering whether creating a JAR file for owl2nl script would be a much of a work.

If it is not much work, creating a JAR file and uploading it into https://files.dice-research.org would help you and others to avoid possible future issues. What do yo think ?