herminiogg / ShExML

A heterogeneous data mapping language based on Shape Expressions
http://shexml.herminiogarcia.com
MIT License
15 stars 2 forks source link

Transformations with strings #121

Closed SandraAmador closed 2 years ago

SandraAmador commented 2 years ago

Hi!

I would like to know if with ShExML you can perform different transformations on strings, such as a split. From a string like "Patient/1" we want to be able to work separately with both Patient and number 1. Another transformation that we would like to perform is from a date 10-11-2016 to change the format to 10/11/ 2016 00:00:00, for example.

Thank you very much in advance. Greetings

herminiogg commented 2 years ago

Hi Sandra,

Unfortunately this is not supported in ShExML for now. However, this is a functionality that I have been planning to include in the language but I have never decided on the best way to do so. I can think of three main possibilities: using an already existing framework like FnO (https://fno.io/), allow for inline functional functions (that could preserve the usability and readability of the language) or allow to load functions from external files.

Nevertheless, I will be very glad to have feedback on this in order to provide the best solution for users. So all suggestions are welcome. Then I will try to incorporate the functionality in the language as soon as possible.

Thanks for your feedback.

Best regards, Herminio García

SandraAmador commented 2 years ago

Hi Herminio,

The three options you mention seem very interesting. Perhaps the option to use functional functions online would depend a lot on its usability. YARRRML is a language that uses the FnO ontology and allows multiple transformations for mappings.

Thank you very much in advance. Greetings, Sandra

herminiogg commented 2 years ago

Hi Sandra,

I have released the version 0.3.1 of ShExML which now allows for using functions from an external scala file. As an example you can see the following test case (https://github.com/herminiogg/ShExML/blob/master/src/test/scala-2.12/com/herminiogarcia/shexml/ExternalFunctionsTest.scala) which uses an external Scala class to host the functions. Then, they can be applied following a classical function calling syntax. As with sources, you can use files over http and https but also over the file:/// protocol.

I will study the two other discussed function frameworks for future integration. But for now, this solution is the fastest to develop and the most flexible IMO.

I hope you can find this useful for your use cases. Let me know if you have any further doubts or potential use cases.

Best regards, Herminio García