RMLio / rmlmapper-java

The RMLMapper executes RML rules to generate high quality Linked Data from multiple originally (semi-)structured data sources
http://rml.io
MIT License
147 stars 61 forks source link

Parametrization of the RML artefact #97

Closed paulakeen closed 2 years ago

paulakeen commented 3 years ago

Is there a way of parametrizing externally the execution of the rmlmapper (as in XSL-T). For example, could one tell the mapper to use one or another source without having to embed it inside the rml turtle file? I am currently doing this using the data source itself, but that is not always possible when you do not control the source.

Many thanks, I could not find this in the documentation.

thomas-delva commented 3 years ago

Hi, the source should always be present in the RML turtle file. A solution might be to program a script to put the specific source you want in the turtle file.

Perhaps also look at the discussion in #94 how other people solved a similar problem.

thomas-delva commented 3 years ago

Another option would be to use an RML turtle file without rml:source and add that triple as a command line option. All files and strings passed using the option -m will be concatenated and used as mapping file by the mapper.

So for example this mapping.rml.ttl which has no rml:source:

@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
@prefix ql:  <http://semweb.mmlab.be/ns/ql#> .
@prefix rr:  <http://www.w3.org/ns/r2rml#> .
@base        <http://example.org/> .

<#source> a rml:LogicalSource ;
  rml:referenceFormulation ql:CSV .

<#triplesMap> a rr:TriplesMap ;
  rml:logicalSource <#source> ;
  rr:subjectMap [ 
    rr:template "http://example.org/#{name}" ;
    rr:class <#Person> ] .

Could be called with these command line parameters:

java -jar rmlmapper.jar -m mapping.rml.ttl -v -m "<#source> rml:source \"input1.csv\" ."

And in the last option input1.csv could be replaced with the path of any file you would like to use as input.

DylanVanAssche commented 2 years ago

@paulakeen Does Thomas's answer helped you any further? Or do you need another solution?

no-response[bot] commented 2 years ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

tobiasschweizer commented 2 years ago

This works for me! :-)

namedgraph commented 10 months ago

Hi, the source should always be present in the RML turtle file.

@thomas-delva this sounds like a really bad idea, if I'm honest. RML mapping should be a function applied on the input argument(s), just like XSLT as the others already have mentioned. Functions do not hardcode their arguments inside them.

DylanVanAssche commented 10 months ago

@namedgraph

As @thomas-delva showed in the other comment, you can supply multiple mappings and they will be merged. This way, you can even put a complete RML Logical Source separately which can be scripted as you want.

RML mapping should be a function applied on the input argument(s), just like XSLT

RML mappings do not have currently 'arguments'. RML mappings are unrelated to XML and XSLT.

If you want to see such arguments or variables in mappings, I suggest to discuss this in a GitHub issue of the W3C Community Group on Knowledge Graph Construction: https://github.com/kg-construct

namedgraph commented 10 months ago

RML mappings are unrelated to XML and XSLT.

Conceptually they are. You take input data and you apply a transformation function to get output data.