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

Database source - mapping with column labels instead of column names #92

Closed giorgialodi closed 3 years ago

giorgialodi commented 3 years ago

Hi @bjdmeest I am using RML mapper also for transforming in RDF some data included in a mysql database.

I noticed that the mapper does not take column labels but column names. This causes some issues in the case of multilingual tables in multilingual databases. I would suggest using column labels instead (this is possible BTW by R2RML to the best of my knowledge), changing the code as follows

In RDBAccess.java, column names in the result set are retrieved with the getColumnName method of ResultSetMetaData. This does not allow, in the mappings, using "alias" column names that in the SQL queries are defined with as. This also causes issues when the result of a query would produce different columns with the same (unaliased) name.

Using the getColumnLabel method instead of getColumnName would allow using aliased column names and solve the issues reported above.

Currently I am using a local revised version of the mapper with this change but I believe it would be better to include it in the main repo here, if you all agree on the above proposal.

bjdmeest commented 3 years ago

Hi @giorgialodi, thanks for this! On first inspection, this does indeed look like the right way to go (I guess the R2RML spec was a bit unclear in this regard, only using the term 'column name' throughout the spec even though they also rely on column labels, eg https://www.w3.org/2001/sw/rdb2rdf/test-cases/#R2RMLTC0002d).

We'll review this with the team (making sure we don't break anything existing/don't unintentionally diverge from the R2RML spec) and get back to you!

thomas-delva commented 3 years ago

This recommended change was part of the latest release: v4.9.2!

Please let us know in the case you have further related issues

no-response[bot] commented 3 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.