Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 43 additions & 8 deletions csvw/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ var respecConfig = {
companyURL: "https://skemu.com"
},
{
name: "Dylan Van Assche",
name: "Sitt Min Oo",
company: "Ghent University – imec – IDLab",
url: "https://dylanvanassche.be",
orcid: "0000-0002-7195-9935",
url: "https://data.knows.idlab.ugent.be/person/minoo/#me",
orcid: "0000-0001-9157-7507",
companyURL: "https://knows.idlab.ugent.be/"
},
}
],
edDraftURI: "https://w3id.org/rml/io-registry/csvw/spec",
editors: [
Expand All @@ -62,19 +62,54 @@ var respecConfig = {
orcid: "0009-0000-2598-1894",
companyURL: "https://skemu.com"
},
{
name: "Sitt Min Oo",
company: "Ghent University – imec – IDLab",
url: "https://data.knows.idlab.ugent.be/person/minoo/#me",
orcid: "0000-0001-9157-7507",
companyURL: "https://knows.idlab.ugent.be/"
}
],
formerEditors: [
{
name: "Dylan Van Assche",
company: "Ghent University – imec – IDLab",
url: "https://dylanvanassche.be",
orcid: "0000-0002-7195-9935",
companyURL: "https://knows.idlab.ugent.be/"
},
],
formerEditors: [
}
],
github: "https://github.com/kg-construct/rml-io-registry",
license: "w3c-software-doc",
localBiblio: {
"Metadata-Tabular":{
title: "Metadata Vocabulary for Tabular Data",
href: "https://www.w3.org/TR/tabular-metadata/",
status: "W3C Recommendation",
publisher: "W3C",
date: "17 December 2015",
},
"Turtle": {
title: "RDF 1.1 Turtle",
href: "https://www.w3.org/TR/turtle/",
status: "W3C Recommendation",
publisher: "W3C",
date: "25 February 2014",
},
"CSVW-Namespace": {
title: "CSVW Namespace Vocabulary Terms",
href: "https://www.w3.org/ns/csvw",
status: "W3C Document",
publisher: "W3C",
date: "06 June 2017",
},
"CSV": {
title: "Common Format and MIME Type for Comma-Separated Values (CSV) Files",
href: "https://www.ietf.org/rfc/rfc4180.txt",
status: "Internet Standard",
publisher: "IETF",
date: "October 2005",
},
"RML-Core": {
title: "RML-Core",
href: "https://w3id.org/rml/core/spec",
Expand All @@ -91,7 +126,7 @@ var respecConfig = {
},
},
otherLinks: [],
shortName: "RML-Ref-JSON-Path",
shortName: "RML-IO-Registry",
specStatus: "CG-DRAFT",
// W3C config
copyrightStart: "2024",
Expand Down
97 changes: 63 additions & 34 deletions csvw/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,25 @@
<script src="https://www.w3.org/Tools/respec/respec-w3c" class="remove" defer></script>
<style type="text/css">
/* Adapted from R2RML */
aside.ex-input,
aside.ex-mapping,
aside.ex-output {
word-wrap:normal;
pre {
word-wrap:normal
}
pre.ex-input,
pre.ex-mapping,
pre.ex-output,
pre.ex-target,
pre.ex-source,
pre.ex-access {
margin-top: 1.5em;
padding: 1em;
font-size: 80%;
padding: 1em;
font-size: 75%;
}
aside.ex-input:before,
aside.ex-mapping:before,
aside.ex-output:before {
pre.ex-input:before,
pre.ex-mapping:before,
pre.ex-output:before,
pre.ex-target:before,
pre.ex-source:before,
pre.ex-access:before {
background: white;
display: block;
font-family: sans-serif;
Expand All @@ -27,53 +35,72 @@
width: 18em;
}
/* Input data example */
aside.ex-input {
pre.ex-input {
background: #cee;
}
aside.ex-input,
aside.ex-input:before {
pre.ex-input,
pre.ex-input:before {
border: 1px solid #acc;
overflow: auto;
}
aside.ex-input:before {
pre.ex-input:before {
content: "Example input data";
}
/* RML mapping example */
aside.ex-mapping {
pre.ex-mapping {
background: #eeb;
}
aside.ex-mapping,
aside.ex-mapping:before {
pre.ex-mapping,
pre.ex-mapping:before {
border: 1px solid #cc9;
overflow: auto;
}
aside.ex-mapping:before {
pre.ex-mapping:before {
content: "Example RML mapping";
}
/* Output RDF example */
aside.ex-output {
pre.ex-output {
background: #cfc;
}
aside.ex-output,
aside.ex-output:before {
pre.ex-output,
pre.ex-output:before {
border: 1px solid #aca;
overflow: auto;
}
aside.ex-output:before {
content: "Example output data";
pre.ex-output:before {
content: "Example output RDF";
}
/* Source's description example */
pre.ex-source {
background: #ffc8d4;
}
pre.ex-source,
pre.ex-source:before {
border: 1px solid #bbb;
}
pre.ex-source:before {
content: "Example Source description";
}
/* Target's description example */
pre.ex-target {
background: #ffc8d4;
}
table, th, td {
background: white;
border-collapse: collapse;
border: 1px solid;
pre.ex-target,
pre.ex-target:before {
border: 1px solid #bbb;
}
th, td {
padding: 5px;
text-align: left;
pre.ex-target:before {
content: "Example Target description";
}
th {
font-weight: bold;
/* Data access description example */
pre.ex-access {
background: #d4dddd;
}
pre.ex-access,
pre.ex-access:before {
border: 1px solid #cca;
}
pre.ex-access:before {
content: "Example data access description";
}

</style>
<script src = config.js class="remove">
</script>
Expand All @@ -87,6 +114,8 @@

<section id="sotd"></section>
<section id="conformance"></section>
<section id="overview" data-include="section/overview.md" data-include-format= "markdown"> </section>


<section id="reference-formulation" data-include="section/reference-formulation.md" data-include-format="markdown"></section>

Expand Down
10 changes: 7 additions & 3 deletions csvw/section/abstract.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Abstract

This document provides an overview of the CSVW reference formulation and its natural RDF mappings. The CSVW reference formulation describes how to access and reference data within CSV data sources by column name. The natural RDF mappings define the process of converting CSV data types into their corresponding RDF literals, ensuring compatibility and interoperability with RDF standards.
This document provides an overview of the CSVW reference formulation,
the vocabulary used to define it, and its natural RDF mappings.
The CSVW reference formulation utilizes CSVW metadata
to describes how to access and reference data within CSV data sources.
The natural RDF mappings define the process of converting CSV data types
into their corresponding RDF literals,
ensuring compatibility and interoperability with RDF standards.
12 changes: 6 additions & 6 deletions csvw/section/natural-rdf-mapping.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Natural RDF mapping of CSV values

CSV does not provide any native data types, therefore there is no natural RDF mapping of CSV values upon XSD data types.
CSVW allows to specify for each column the data type in a `csvw:Table`:
CSVW allows specifying the data type for each column in a `csvw:Table` using
`csvw:tableSchema` :

```
<CSVWTable> a csvw:Table;
<pre class="ex-mapping">
&lt;CSVWTable&gt; a csvw:Table;
csvw:tableSchema [
csvw:columns [
csvw:name "Column";
csvw:datatype xsd:integer;
];
];
.
```
].
</pre>

The `csvw:datatype` must be used for the natural mapping of datatypes in RDF from CSV values.

Expand Down
21 changes: 21 additions & 0 deletions csvw/section/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Document Conventions {#document-convention}

The following namespace prefixes are used throughout the rest of the document unless otherwise stated.

| Prefix | Namespace |
| ------- | --------------------------------- |
| `rml:` | http://w3id.org/rml/ |
| `csvw:` | https://www.w3.org/ns/csvw# |
| `xsd:` | http://www.w3.org/2001/XMLSchema# |
| `ex:` | http://example.org/ |
| `:` | http://example.org/ |

The examples are contained in color-coded boxes. We use the Turtle syntax [[Turtle]] to write RDF.

<pre class="ex-input">
# This box contains an example input data
</pre>

<pre class="ex-mapping">
# This box contains an example mapping
</pre>
84 changes: 73 additions & 11 deletions csvw/section/reference-formulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ A <dfn>CSVW reference formulation</dfn> (`rml:CSVWReferenceFormulation`) is a <a

The default CSVW Reference Formulation is a <a data-cite="RML-Core#dfn-reference-formulation">reference formulation</a> identified with the IRI `rml:CSVW`. It has no specific properties.


## Iterator

The <a data-cite="RML-Core#dfn-iterator">iterator</a> for a <a data-cite="RML-Core#dfn-logical-source">logical source</a> with the [=CSVW reference formulation=] is always row-based over a table.
Expand All @@ -15,20 +16,81 @@ The [=CSV row=] that is the result of evaluating the <a data-cite="RML-Core#dfn-

## Expressions

An <a data-cite="RML-Core#dfn-expression">expression</a> for <a data-cite="RML-Core#dfn-expression-map">expression maps</a> associated with a <a data-cite="RML-Core#dfn-logical-source">logical source</a> with the [=CSV reference formulation=] SHOULD be expressed as [=CSV column=] names of a [=CSV row=].
An <a data-cite="RML-Core#dfn-expression">expression</a> for <a data-cite="RML-Core#dfn-expression-map">expression maps</a> associated with a <a data-cite="RML-Core#dfn-logical-source">logical source</a> with the CSV reference formulation SHOULD be expressed as [=CSV column=] names of a [=CSV row=].

An <a data-cite="RML-Core#dfn-expression">expression</a> is evaluated against a <a data-cite="RML-Core#dfn-logical-iteration">logical iteration</a> which is a [=CSV value=].
The result of evaluating the <a data-cite="RML-Core#dfn-expression">expression</a> is a [=CSV row=], which MUST be transformed to a list of [=CSV values=] that forms the <a data-cite="RML-Core#dfn-expression-evaluation-result">expression evaluation result</a>. The order of the [=CSV row=] MUST be preserved in the <a data-cite="RML-Core#dfn-expression-evaluation-result">expression evaluation result</a>.

## CSV derivates

CSVW allows to specify how a CSV should be parsed and read in terms of NULL values, separator, encoding, etc.
These CSVW properties must be used by the engine to correctly read the CSV file.
## CSVW metadata
CSVW provides metadata which helps in parsing the CSV in terms of NULL values, separator, encoding, etc.
These CSVW metadata must be used by the engine to correctly parse the CSV file.
[[CSVW-Namespace]] vocabulary is used by this spec to define the metadata that
helps with parsing the CSV file.


### No headers
CSVW enables parsing CSV files without a header row.
Parsing CSV files with `1..N` columns with `csv:header` set to `false` will
produce a table with the column names "1" to "N" respectively.


Provided with the following input CSV file with 4 columns:
<pre class="ex-input">
647,434244.172304,428652.920455
646,434546.276382,428380.451633
6212,434644.819095,428412.411432
651,434758.675879,428527.599874
650,434821.652431,428439.025039
...
</pre>

and the following RML mapping containing the CSVW reference formulation definitions for
the aforementioned CSV file:
<pre class="ex-mapping">
&lt;CSVWTable&gt; a csvw:Table;
csvw:null "";
csvw:separator ";";
csvw:dialect [
csvw:header "false"^^xsd:boolean;
];
</pre>


It is the same as working with the following CSV table where the headers are
named <b>"1", "2", "3", and "4"</b>:
<pre class="ex-input">
1,2,3,4 #numbered header row
647,434244.172304,428652.920455
646,434546.276382,428380.451633
6212,434644.819095,428412.411432
651,434758.675879,428527.599874
650,434821.652431,428439.025039
...
</pre>



### Default properties
While the default reference formulation identifier (`rml:CSVW`) specifies the
use of the CSVW reference formulation, it does not by itself describe how to
parse a given CSV file.

Thus, a default set of CSVW properties and corresponding values is defined
to ensure consistent behaviour across implementations.
These defaults provide a minimal, functional CSVW configuration suitable for
parsing standard CSV files in the absence of explicit definition of
CSVW properties.


See https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#dialect-descriptions
for the actual default values for CSVW dialect metadata.

```
<CSVWTable> a csvw:Table;
csvw:separator ";";
csvw:null "";
csvw:encoding "utf-16";
.
```
<pre class="ex-mapping">
&lt;CSVWTable&gt; a csvw:Table;
csvw:null "";
csvw:separator ";";
csvw:dialect [
# Default CSVW dialect options
];
</pre>