RMLio / RMLStreamer

The RMLStreamer executes RML rules to generate high quality Linked Data from multiple originally (semi-)structured data sources in a streaming way.
http://rml.io/
MIT License
48 stars 18 forks source link

issue in object map with functions: malformed IRI #33

Closed giorgialodi closed 3 years ago

giorgialodi commented 3 years ago

Hi guys @bjdmeest @gertjandemulder

I am trying to use the RML streamer but I am encountering a set of issues. One of these issues is the following.

I need to define a triple which is < subject > predicate < object > where object is not a literal but a URI. In order to construct the URI of the object, i need to invoke a function that returns rr:termType rr:IRI. The result is the following: < subject > predicate <"object">; so the URI is between <> and "" which is very strange.

To be more precise, an example is the following:

<#LogicalSourceCSV> a rml:BaseSource ;
      rml:source  "input.csv";
      rml:referenceFormulation ql:CSV .

<#dataMapping> a rr:TriplesMap ;
      rml:logicalSource <#LogicalSourceCSV> ;

      rr:subjectMap [
          rr:template "https://example.org/subject/{field1}";
      ];
      rr:predicateObjectMap [
         rr:predicate <https://example.org/predicate> ;
         rr:objectMap <#functionMapping>
      ] .

<#functionMapping>
     rr:termType rr:IRI ;
     fnml:functionValue [
     rr:predicateObjectMap [
         rr:predicate fno:executes ;
         rr:objectMap [ rr:constant grel:toLowerCase ]
     ];
     rr:predicateObjectMap [
        rr:predicate grel:valueParameter ;
        rr:objectMap [ rr:template "https://example.org/object/{field2}" ; rr:termType rr:IRI ]
     ]
] .

The output is the following: <https://example.org/subject/A> <https://example.org/predicate> <"https://example.org/object/b"> .

The quotes in the output are strange. So it seems that it recognises the URI of the object but it puts the value between quotes.

In the RMLMapper the same code works perfectly.

Could you please help me to fix that URI? Thanks a lot!

giorgialodi commented 3 years ago

I would like to specify that in the example above I call a specific function but the issue seems independent of the type of function: it happens even with others more complex.

gertjandemulder commented 3 years ago

@giorgialodi , we are looking into it, and will come back to you! :) Kind regards, G

giorgialodi commented 3 years ago

@giorgialodi , we are looking into it, and will come back to you! :) Kind regards, G

Hi @gertjandemulder thanks a lot! Not sure if it can help you but it seems to us that the issue is here: https://github.com/RMLio/RMLStreamer/blob/592793b28224512cfffcda3fd3dacc7ff94440e5/src/main/scala/io/rml/framework/engine/statement/ObjectGeneratorAssembler.scala#L47

where

Uri(elem.toString) should be Uri(elem.value)

ghsnd commented 3 years ago

Hi @giorgialodi , that was the issue indeed. The code is pushed to the development branch.

giorgialodi commented 3 years ago

Hi @gertjandemulder thanks a lot!