RMLio / yarrrml-parser

A YARRRML parser library and CLI in Javascript
MIT License
41 stars 17 forks source link

YARRRML and Jinja #114

Open mospring opened 3 years ago

mospring commented 3 years ago

Issue type: :question: Question

I am mapping a csv table using yarrrml where I want to divide values in two columns to create a third value. As RML does not support basic maths operations, do you think the Jinja template engine [1] could be an option? Is it possible to use it or to extent yarrrml in this regard?

[1] https://jinja.palletsprojects.com/en/2.11.x/

bjdmeest commented 3 years ago

Dear @mospring , indeed RML's templating (based on R2RML) does not supporting basic math operations. However, I think it would be feasible to create a FnO Function that does exactly this, so you could create a FnO library similar to https://github.com/FnOio/grel-functions-java, include it, and then you would be able to create YARRRML mappings like the following

mappings:
  person:
    predicateobjects:
     - predicates: ex:divisionValue
       objects:
        - function: ex:myTemplatingFunction
          parameters: [ex:myTemplateInput, "$(firstValue) / $(secondValue)"]