Skip to content

YarrrML parser drops closing “)” in contains() XPath inside $(...), generating invalid RML #217

@ziodave

Description

@ziodave

Summary

When a YarrrML mapping includes XPath contains(., "…") inside a $(...) expression, the generated RML is invalid. The parser drops the closing ) from contains(...), which causes RMLMapper to fail with
expected ")" found "<eof>".

Environment

  • OS: macOS (darwin)
  • Node: v22.21.0
  • yarrrml-parser: @rmlio/yarrrml-parser@1.12.1
  • RMLMapper: v8.1.0

YarrrML input (minimal)

prefixes:
  schema: 'http://schema.org/'
mappings:
  review:
    sources:
      - [__XHTML__~xpath, '/']
    s: ex:review~iri
    po:
      - [schema:positiveNotes, '$(/html/body//h3[contains(., "Pros")]/following::ul[1]/li/span)']

Actual RML output (snippet)

  :om_008 a rr:ObjectMap;
      rr:template "{/html/body//h3[contains(., \"Pros\"}]/following::ul[1]/li/span)";
      rr:termType rr:Literal.

Note the missing closing ) in contains(...).

Expected RML output

  :om_008 a rr:ObjectMap;
      rr:template "{/html/body//h3[contains(., \"Pros\")]/following::ul[1]/li/span)";
      rr:termType rr:Literal.

Impact

RMLMapper fails on the generated RML with:

  java.lang.IllegalArgumentException: expected ")", found "<eof>"

and no output is produced.

Repro steps

  1. Run:
  npx @rmlio/yarrrml-parser -i mapping.yarrrml -o mapping.ttl
  1. Inspect mapping.ttl for malformed contains(...).
  2. Run RMLMapper:
  java -jar rmlmapper.jar -m mapping.ttl -o out.nq

-> fails with the error above.

Additional notes

The issue reproduces with other contains(., "…") expressions and appears only inside $(...) XPath expressions.

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