RMLio / yarrrml-parser

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

Chaining multiple functions to process input and return a single output #205

Open jaxley opened 10 months ago

jaxley commented 10 months ago

Issue type: :question: Question

When you use functions with conditions, you can use multiple functions and there are logical functions that can take the outputs of those functions and use them to compute the ultimate result.

However, it doesn't seem like there's a way to chain or pipe multiple functions together when using them to generate an object or subject. For example, I want to use grel:string_replace more than once on the same string to replace different inputs with different outputs - but I want them to accumulate and apply to the output of the previous function - not the raw input value again, like $(someinput)

I've tried naively just nesting a function in place of a constant in predicate/object mappings but that doesn't work as expected.

The FNO specification has what sound like these concepts - composition - where you could map outputs of one function to inputs of others. https://fno.io/spec/#composition. I have not seen examples of using this in either plain RML or yarrrml.

Are there ways of doing this? If not, it's seeming more likely that just writing code to do the mappings will be the most expressive and simplist way to get these kinds of transformations done as part of the mappings.