Skip to content

Bug? JSON parsing fails when string value ends with a forward slash '/' #272

@RogierLangeveld

Description

@RogierLangeveld

When in the JSON source file I have data similar to this:

{
  "Test_field_1": null,
  "Test_field_2": 1001,
  "Test_field_3": "text3",
  "Test_field_4": "text4/",
  "Test_field_5": true
}

RML Mapper will fail on Test_field_4 with a message like:

16:49:17.888 [main] ERROR be.ugent.rml.cli.Main               .run(287) - Unable to parse mapping rules as Turtle. Does the file exist and is it valid Turtle?
org.eclipse.rdf4j.rio.RDFParseException: Not a valid (absolute) IRI: /text4/ [line 999]
        at org.eclipse.rdf4j.rio.helpers.RDFParserHelper.reportFatalError(RDFParserHelper.java:380)
        at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.reportFatalError(AbstractRDFParser.java:723)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.reportFatalError(TurtleParser.java:1317)
        at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.createURI(AbstractRDFParser.java:360)
        at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.resolveURI(AbstractRDFParser.java:338)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseURI(TurtleParser.java:944)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parsePrefixID(TurtleParser.java:284)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseDirective(TurtleParser.java:214)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseStatement(TurtleParser.java:195)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parse(TurtleParser.java:165)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parse(TurtleParser.java:128)
        at be.ugent.rml.store.RDF4JStore.read(RDF4JStore.java:145)
        at be.ugent.rml.cli.Main.run(Main.java:284)
        at be.ugent.rml.cli.Main.main(Main.java:49)
Caused by: java.lang.IllegalArgumentException: Not a valid (absolute) IRI: /text4/
        at org.eclipse.rdf4j.model.impl.SimpleIRI.setIRIString(SimpleIRI.java:96)
        at org.eclipse.rdf4j.model.impl.SimpleIRI.<init>(SimpleIRI.java:67)
        at org.eclipse.rdf4j.model.impl.SimpleValueFactory.createIRI(SimpleValueFactory.java:83)
        at org.eclipse.rdf4j.rio.helpers.RDFStarDecodingValueFactory.createIRI(RDFStarDecodingValueFactory.java:46)
        at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.createURI(AbstractRDFParser.java:358)
        ... 10 common frames omitted
java.lang.IllegalArgumentException: Unable to parse mapping rules as Turtle. Does the file exist and is it valid Turtle?
Finished.

I am processing hundreds of JSON files with hundred JSON objects each. It appears to only fail on JSON objects with string values that ends with /...

I seems not even to start processing the data, but seems to already fail on parsing the JSON file. (I use a custom function that should handle the string value, that works fine on all other thousands of objects, but seems not to even be called when the value ends with a slash. Because also if I edit another field to end with a slash, the RML Mapper will fail the same way.)

This seems to me to be a bug in de JSON parser of RML Mapper.

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