RMLio / yarrrml-parser

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

Handling of conflicting external references from different YARRRML documents? #131

Open SvenLieber opened 3 years ago

SvenLieber commented 3 years ago

Issue type: :question: Question

(This issue is related to the PR https://github.com/RMLio/yarrrml-parser/pull/127 which will add the feature of populating external references from .env files)

I am currently facing the issue of the spec being not clear on a specific feature which is offered by the current version of the yarrrml-parser.

According to the parser documentation several YARRRML documents can be provided:

You can use multiple input files too: yarrrml-parser -i rules-1.yml -i rules-2.yml. They are converted to a single RML document. Note that the keys in prefixes, sources, and mappings have to be unique across all files

Furthermore the documentation says that

When you do not provide a value for an external reference, the reference will not be replaced.

However, how should a case be handled where conflicting external references exist in several provided YARRRML documents?

Partial solution via prioritization

As discussed internally, the prioritized order to replace external references should be

  1. Use provided reference values via the -e argument
  2. Use values provided via the external object inside a YARRRML document
  3. Use values provided via an .env file

Whereas this order specifies how to deal with possibly conflicting external references across command line, YARRRML document and environment (namely by following the provided prioritization), it does not specify how to deal with conflicting external references within each of these approaches.

For 1 and 3 the solution could look the following:

However, how to resolve conflicts for 2, i.e. external references within the external block of different input YARRRML documents?

bjdmeest commented 3 years ago

Personal opinion: last one has priority, consistent across all 'inputs', so: