Skip to content

Exception while GET: Parsing of imported Ontology due to usage of ttl-parser together with xml-file #22

@keiligch

Description

@keiligch

Server answer with stack trace

<body>Exception occured while processing /models
    <pre>Message: net.enilink.komma.core.KommaException: Invalid RDF data:
IRI included an unencoded space: '32' [line 1]
    net.enilink.komma.model.ModelUtil.readData(ModelUtil.java:644)
    net.enilink.komma.model.rdf4j.SerializableModelSupport$1.run(SerializableModelSupport.java:211)
    java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    java.base/java.lang.Thread.run(Thread.java:829)
Caught and thrown by:
Message: org.eclipse.rdf4j.rio.RDFParseException: IRI included an unencoded space: '32' [line 1]
    org.eclipse.rdf4j.rio.helpers.RDFParserHelper.reportError(RDFParserHelper.java:276)
    org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.reportError(AbstractRDFParser.java:584)
    org.eclipse.rdf4j.rio.turtle.TurtleParser.reportError(TurtleParser.java:1298)
    org.eclipse.rdf4j.rio.turtle.TurtleParser.parseURI(TurtleParser.java:900)
    org.eclipse.rdf4j.rio.turtle.TurtleParser.parseValue(TurtleParser.java:568)
    org.eclipse.rdf4j.rio.turtle.TurtleParser.parseSubject(TurtleParser.java:395)
    org.eclipse.rdf4j.rio.turtle.TurtleParser.parseTriples(TurtleParser.java:330)
    org.eclipse.rdf4j.rio.turtle.TurtleParser.parseStatement(TurtleParser.java:200)
    org.eclipse.rdf4j.rio.turtle.TurtleParser.parse(TurtleParser.java:162)
    org.eclipse.rdf4j.rio.turtle.TurtleParser.parse(TurtleParser.java:125)
    net.enilink.komma.model.ModelUtil.readData(ModelUtil.java:642)
    net.enilink.komma.model.rdf4j.SerializableModelSupport$1.run(SerializableModelSupport.java:211)
    java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    java.base/java.lang.Thread.run(Thread.java:829)
</pre>
</body>

Process

  • posting a new model in ttl-format to the /models-endpoint . Ontology imports another ontology in rdf/xml which is accessable in the web (example ttl below)
  • sending GET with the same model as parameter -> only the first time server exception is thrown
  • sending GET again -> everything ok

Reason (most likely)
When sending GET request model is being parsed with the RDF4J.rio-TurtleParser, but also the imported rdf/xml. The first line of the xml is <?xml version="1.0" encoding="UTF-8"?> which probably is interpreted as an IRI by the turtle parser. The exception is thrown due to the space inbetween.
In my test, I could isolate the problematic ontology (no further imports, so the mistake is certainly from there): http://spinrdf.org/sp

HTTP Code for testing (insert domain address)

POST /models?model=http://example.com/test HTTP/1.1
Host: {my own domain}
Content-Type: text/turtle

@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<http://www.example.com/test#> rdf:type owl:Ontology ;
                                owl:imports <http://spinrdf.org/sp> .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions