rdf-tabular icon indicating copy to clipboard operation
rdf-tabular copied to clipboard

Improper handling of lists in columns

Open jakubklimek opened this issue 2 years ago • 0 comments
trafficstars

I think rdf-tabular does not handle lists in columns properly, when mapping to RDF. I have a dataset of applications classified by their themes, and I need a list of themes to be in one column (I have the "normalized" version elsewhere). So the data looks like this:

app,theme
https://app1,http://publications.europa.eu/resource/authority/data-theme/SOCI
https://app2,http://publications.europa.eu/resource/authority/data-theme/INTR http://publications.europa.eu/resource/authority/data-theme/JUST

I utilize the separator feature of CSVW like this:

{
    "@context": "http://www.w3.org/ns/csvw",
    "url": "app.csv",
    "tableSchema": {
        "columns": [
            {
                "name": "app",
                "titles": "app",
                "aboutUrl": "{+app}",
                "propertyUrl": "rdf:type",
                "valueUrl": "dcat:Resource",
                "required": true,
                "datatype": "anyURI"
            }, {
                "name": "theme",
                "titles": "theme",
                "aboutUrl": "{+app}",
                "propertyUrl": "http://www.w3.org/ns/dcat#theme",
                "valueUrl": "{+theme}",
                "required": true,
                "separator": " "
            }
        ],
        "primaryKey": "app"
    }
}

Then I translate this to RDF using rdf serialize --input-format tabular --output-format turtle --minimal app.csv. I get:

@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<https://app1> a dcat:Resource;
  dcat:theme <http://publications.europa.eu/resource/authority/data-theme/SOCI> .

<https://app2> a dcat:Resource;
  dcat:theme <http://publications.europa.eu/resource/authority/data-theme/INTR,http://publications.europa.eu/resource/authority/data-theme/JUST> .

Note the comma in the dcat:theme value. What I would expect is multiple values like this:

@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<https://app1> a dcat:Resource;
  dcat:theme <http://publications.europa.eu/resource/authority/data-theme/SOCI> .

<https://app2> a dcat:Resource;
  dcat:theme <http://publications.europa.eu/resource/authority/data-theme/INTR>, <http://publications.europa.eu/resource/authority/data-theme/JUST> .

jakubklimek avatar Nov 21 '23 11:11 jakubklimek