Skip to content

Commit

Permalink
use list instead of set to define the result of expression and define…
Browse files Browse the repository at this point in the history
… empty value handling (#121 & #16) (#128)

* clarified NULL values, cartesian product for templates and term types of term maps

* added a first draft for base IRIs

* cleaning

* constant-valued term maps

* all clarifications wrt empty and multiple values related to #13 and #16 should be clarified for the expression and term map.

* added clarification for LS cardinality and exception according to #57

* use list instead of set to define the result of expression (#121)

* fixes after merge of  branch

* improve example styling

* fix template example

* apply example styling on all examples and some small fixes

* spelling fix

* fix draft link

---------

Co-authored-by: Anastasia Dimou <anastasia.dimou@kuleuven.be>
  • Loading branch information
pmaria and andimou authored Jul 18, 2024
1 parent 4fd1780 commit 2bd0ec3
Show file tree
Hide file tree
Showing 8 changed files with 510 additions and 253 deletions.
91 changes: 91 additions & 0 deletions spec/docs/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
async function loadTurtle() {
//this is the function you call in 'preProcess', to load the highlighter
const worker = await new Promise(resolve => {
require(["core/worker"], ({ worker }) => resolve(worker));
});
const action = "highlight-load-lang";
const langURL =
"https://cdn.jsdelivr.net/gh/redmer/highlightjs-turtle/src/languages/turtle.js";
const propName = "hljsDefineTurtle"; // This funtion is defined in the highlighter being loaded
const lang = "turtle"; // this is the class you use to identify the language
worker.postMessage({ action, langURL, propName, lang });
return new Promise(resolve => {
worker.addEventListener("message", function listener({ data }) {
const { action: responseAction, lang: responseLang } = data;
if (responseAction === action && responseLang === lang) {
worker.removeEventListener("message", listener);
resolve();
}
});
});
}

var respecConfig = {
// check https://respec.org/docs/ for the meaning of these keys
preProcess: [loadTurtle],
authors: [
{
name: "Pano Maria",
company: "Skemu",
url: "https://skemu.com",
orcid: "0009-0000-2598-1894",
companyURL: "https://skemu.com"
},
{
name: "Anastasia Dimou",
mailto: "anastasia.dimou@kuleuven.be",
company: "KU Leuven",
orcid: "0000-0003-2138-7972",
companyURL: "https://dtai.cs.kuleuven.be/"
},
],
edDraftURI: "https://w3id.org/rml/core/spec",
editors: [
{
name: "Pano Maria",
company: "Skemu",
url: "https://skemu.com",
orcid: "0009-0000-2598-1894",
companyURL: "https://skemu.com"
},
{
name: "Anastasia Dimou",
mailto: "anastasia.dimou@kuleuven.be",
company: "KU Leuven",
orcid: "0000-0003-2138-7972",
companyURL: "https://dtai.cs.kuleuven.be/"
},
],
formerEditors: [
],
github: "https://github.com/kg-construct/rml-core",
license: "w3c-software-doc",
localBiblio: {
RML: {
title: "RDF Mapping Language (RML)",
href: "https://rml.io/specs/rml/",
status: "Unofficial Draft",
publisher: "",
date: "",
},
},
otherLinks: [
{
key: "Website",
data: [{
value: "https://rml.io",
href: "https://rml.io"
},
{
value: "https://fno.io",
href: "https://fno.io"
}]
},
],
shortName: "RML-Core",
specStatus: "CG-DRAFT",
// W3C config
copyrightStart: "2021",
doJsonLd: true,
group: "kg-construct",
};
22 changes: 12 additions & 10 deletions spec/docs/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,33 @@

## Expression map (`rml:ExpressionMap`)

An <dfn>expression map</dfn> (`rml:ExpressionMap`) is an abstract class, that is specialized by other RML classes. An [=expression map=] MAY have one the following properties:
An <dfn>expression map</dfn> (`rml:ExpressionMap`) is an abstract class, that is specialized by other RML classes. An [=expression map=] MUST have one the following properties:
* 0 or 1 `rml:constant`, or
* 0 or 1 `rml:reference`, or
* 0 or 1 `rml:template`.
* 0 or 1 `rml:template`, or
* another property, or properties, defined by a subclass of `rml:ExpressionMap`.

Each of these properties specifies an [=expression=] which, upon evaluation, results in a set of values.
Each of these properties specifies an [=expression=] which, upon evaluation, results in an ordered list of values.

The <dfn>reference expression set</dfn> of an [=expression map=] ar the set of expressions which are evaluated on a [=logical iteration=].
The <dfn>reference expression set</dfn> of an [=expression map=] is the set of expressions which are evaluated on a [=logical iteration=].

### Constant expression (`rml:constant`)

A <dfn>constant-valued expression map</dfn> is an [=expression map=] that always generates the same expression value. A constant-valued expression map is represented by a resource that has exactly one `rml:constant` property, the value of which is called a <dfn>constant expression</dfn>.
A <dfn>constant-valued expression map</dfn> is an [=expression map=] that always generates the same value. A constant-valued expression map is represented by a resource that has exactly one `rml:constant` property, the value of which is called a <dfn>constant expression</dfn>.

The <dfn>constant value</dfn> is a singleton set containing the [=constant expression=].
The <dfn>constant value</dfn> is a singleton list containing the [=constant expression=].

The [=reference expressions=] of a [constant-valued expression map=] is the empty set.
The [=reference expressions=] of a [constant-valued expression map=] is an empty list.

### Reference (`rml:reference`)
A <dfn>reference-valued expression map</dfn> is an [=expression map=] that is represented by a resource that has exactly one `rml:reference` property, the value of which is called a <dfn>reference expression</dfn>.

The [=reference expression=] MUST be a valid [=expression=] according to the defined [=reference formulation=] in the [=logical source=].

The [=reference expression set=] of a [reference-valued expression map=] is the singleton set containing the [=reference expression=].
The [=reference expression set=] of a [=reference-valued expression map=] is the singleton set containing the [=reference expression=].

The <dfn>reference value</dfn> is a set of values obtained by evaluating the [=reference expression=] against a given [=logical iteration=].
The <dfn>reference value</dfn> is an ordered list of values obtained by evaluating the [=reference expression=] against a given [=logical iteration=].
For each value in the ordered list, an expression is created.

### Template (`rml:template`)
A <dfn>template-valued expression map</dfn> is an [=expression map=] that is represented by a resource that has exactly one `rml:template` property, the value of which is called a <dfn>template expression</dfn>. The [=template expression=] MUST be a valid [=string template=].
Expand All @@ -48,7 +50,7 @@ The <dfn>template value</dfn> when evaluating a [=string template=] for a given
1. Let `result` be the [=reference expression set=] of the [=string template=]
2. For each [=reference expression=] in `result`:
1. Let `values` be the [=reference value=] of the [=reference expression=] that is enclosed in the curly braces
2. If `values` is an empty set, then return `NULL`
2. If `values` is an empty list, then return `NULL`
3. For each `value` in `values`:
1. Let `value` be the [=natural RDF lexical form=] corresponding to `value`
3. Let `result` be the [=n-ary Cartesian product=] of `result`
Expand Down
140 changes: 72 additions & 68 deletions spec/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,74 +5,78 @@
<title>RML-Core</title>
<meta charset="utf-8">
<script src="https://www.w3.org/Tools/respec/respec-w3c" class="remove" defer></script>
<script class="remove">
var respecConfig = {
// check https://respec.org/docs/ for the meaning of these keys
authors: [
{
name: "Pano Maria",
company: "Skemu",
url: "https://panomaria.com",
companyURL: "https://skemu.com"
},
{
name: "Anastasia Dimou",
mailto: "anastasia.dimou@kuleuven.be",
company: "KU Leuven",
orcid: "0000-0003-2138-7972",
companyURL: "https://dtai.cs.kuleuven.be/"
},
],
edDraftURI: "https://w3id.org/rml/spec",
editors: [
{
name: "Pano Maria",
company: "Skemu",
url: "https://panomaria.com",
companyURL: "https://skemu.com"
},
{
name: "Anastasia Dimou",
mailto: "anastasia.dimou@kuleuven.be",
company: "KU Leuven",
orcid: "0000-0003-2138-7972",
companyURL: "https://dtai.cs.kuleuven.be/"
},
],
formerEditors: [
],
github: "https://github.com/kg-construct/rml-core",
license: "w3c-software-doc",
localBiblio: {
RML: {
title: "RDF Mapping Language (RML)",
href: "https://rml.io/specs/rml/",
status: "Unofficial Draft",
publisher: "",
date: "",
},
},
otherLinks: [
{
key: "Website",
data: [{
value: "https://rml.io",
href: "https://rml.io"
},
{
value: "https://fno.io",
href: "https://fno.io"
}]
},
],
shortName: "RML-Core",
specStatus: "CG-DRAFT",
// W3C config
copyrightStart: "2021",
doJsonLd: true,
group: "kg-construct",
};
</script>
<style type="text/css">
/* Adapted from R2RML */
aside.ex-input,
aside.ex-mapping,
aside.ex-output {
word-wrap:normal;
margin-top: 1.5em;
padding: 1em;
font-size: 80%;
}
aside.ex-input:before,
aside.ex-mapping:before,
aside.ex-output:before {
background: white;
display: block;
font-family: sans-serif;
font-size: 90%;
margin: -1.5em 0 0.5em 0;
padding: 0.4em 0.4em;
width: 18em;
}
/* Input data example */
aside.ex-input {
background: #cee;
}
aside.ex-input,
aside.ex-input:before {
border: 1px solid #acc;
overflow: auto;
}
aside.ex-input:before {
content: "Example input data";
}
/* RML mapping example */
aside.ex-mapping {
background: #eeb;
}
aside.ex-mapping,
aside.ex-mapping:before {
border: 1px solid #cc9;
overflow: auto;
}
aside.ex-mapping:before {
content: "Example RML mapping";
}
/* Output RDF example */
aside.ex-output {
background: #cfc;
}
aside.ex-output,
aside.ex-output:before {
border: 1px solid #aca;
overflow: auto;
}
aside.ex-output:before {
content: "Example output data";
}
table, th, td {
background: white;
border-collapse: collapse;
border: 1px solid;
}
th, td {
padding: 5px;
text-align: left;
}
th {
font-weight: bold;
}
</style>
<script src = config.js class="remove">
</script>
</head>

<body>
Expand Down
22 changes: 21 additions & 1 deletion spec/docs/introduction.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Base IRIs
The base IRI of the [=mapping document=] is used to resolve relative IRIs in the RML document following the specification of the Turtle serialisaiton.

## Base IRI for mapping rules

## Base IRI for vocabulary
The [=base IRI=] of the [=Triples Map=] is used in resolving relative IRIs produced by the [=RML mapping=].


<pre class="ex-mapping nohighlight">
# Triples Map that has a declared base IRI
<#TriplesMap>
a rml:TriplesMap;
rml:baseIri <http://example.com/> .
</pre>

The [=base IRI=] MUST be a valid IRI. It SHOULD NOT contain question mark (“?”) or hash (“#”) characters and SHOULD end in a slash (“/”) character.

To obtain an absolute IRI from a relative IRI, the term generation rules of RML use simple string concatenation, rather than the more complex algorithm for resolution of relative URIs defined in Section 5.2 of [RFC3986]. This ensures that the original database value can be reconstructed from the generated absolute IRI. Both algorithms are equivalent if all of the following are true:

1. The base IRI does not contain question marks or hashes,
2. the base IRI ends in a slash,
3. the relative IRI does not start with a slash, and
4. the relative IRI does not contain any “.” or “..” path segments.


Loading

0 comments on commit 2bd0ec3

Please sign in to comment.