diff --git a/.gitignore b/.gitignore index bee8a64..083d732 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ __pycache__ +.idea diff --git a/spec/dev.html b/spec/dev.html new file mode 100644 index 0000000..40d1d0f --- /dev/null +++ b/spec/dev.html @@ -0,0 +1,135 @@ + + + + + RML-FNML + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + + + + + \ No newline at end of file diff --git a/spec/docs/20251109/index.html b/spec/docs/20251109/index.html new file mode 100644 index 0000000..ff5c795 --- /dev/null +++ b/spec/docs/20251109/index.html @@ -0,0 +1,1621 @@ + + + + + + + + +RML-FNML + + + + + + + + + + + + + + + +
+ +

RML-FNML

+

+ Draft Community Group Report + +

+
+ +
Latest published version:
+ none +
+
Latest editor's draft:
https://w3id.org/rml/fnml/spec/
+ + + + +
Editor:
+ Ben De Meester + + + + (Ghent University – imec – IDLab) +
+
+ Former editor: +
+ Anastasia Dimou + + + + +
+
Authors:
+ Ben De Meester +
+ Samaneh Jozashoori +
+ Pano Maria +
+ David Chaves-Fraga +
+ Anastasia Dimou +
+
Feedback:
+ GitHub kg-construct/rml-fnml + (pull requests, + new issue, + open issues) +
+
Website
+ https://rml.io +
+ https://fno.io +
+
+ + +
+
+ + + +

Abstract

RML+FnO is an approach to provide for data transformations when generating knowledge graphs +from (semi-)structured data using the RDF Mapping Language (RML).

+

In RML+FnO, data transformations are defined declaratively, +supporting the Function Ontology (FnO).

+

This approach is not case-specific: +data transformations are independent of their implementation and thus interoperable, +while the functions are decoupled and reusable. +This allows developers to improve the generation framework +independent from the contributors that focus on generating the knowledge graphs.

+
+ +

Status of This Document

+ This specification was published by the + Knowledge Graph Construction Community Group. It is not a W3C Standard nor is it + on the W3C Standards Track. + + Please note that under the + W3C Community Contributor License Agreement (CLA) + there is a limited opt-out and other conditions apply. + + Learn more about + W3C Community and Business Groups. +

+ GitHub Issues are preferred for + discussion of this specification. + + +

+ +

1. Conformance

As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.

+ The key words MAY and MUST in this document + are to be interpreted as described in + BCP 14 + [RFC2119] [RFC8174] + when, and only when, they appear in all + capitals, as shown here. +

+ +

2. The Problem

+

Mapping languages allow us to define how knowledge graphs are generated from (semi-)structured data, +but only if the original data values can be used as-is. +Complex data transformations in mapping languages typically are +either implemented as custom solutions, +or are done by systems separate from the mapping process. +The former data transformations remain case-specific, often coupled with the mapping, +whereas the latter is not reusable across systems.

+

For example, we have a data source where all names are lowercase, +but we want the resulting knowledge to have uppercase values. +The following RML Mapping contains the descriptions to generate a knowledge graph from a data source, +but no data transformations.

+
+ +

3. Definitions

+ + + + +

3.1 Generic

+

[RML]-independent defintions:

+ +

3.2 RML

+

Definitions taken from [RML] or R2RML: RDB to RDF Mapping Language:

+ +

Within this specification, the Expression Map definition is extended by adding new possible properties and thus also a new type of Expression Map. +The change is included below with changes highlighted in bold.

+
+

An Expression Map can have the following properties:

+ +
+

3.3 FNML

+ +
Note

It is currently assumed that a Function-valued Expression Map always returns an RDF term [rdf-concepts]. +How a list of RDF terms is handled, is out of scope of this spec, but discussed at Collections and Containers in RML.

+

+ + + +

5. FNML

+

We use terms defined in the FNML ontology to link [RML] with [FNO].

+

The ontology namespace is http://w3id.org/rml/, +the preferred prefix is rml:. +See below for how FNML introduced terms align with RML Core.

+
+ FNML diagram +
Figure 2 Visual overview of how FNML introduced terms align with RML Core
+
+ +

5.1 Function-valued Expression Map

+

A Function-valued Expression Map is an Expression Map that is represented by a resource that has exactly one rml:functionExecution. +The value of the rml:functionExecution property must be a valid Execution.

+

As a consequence, the default [RML] processing is extended, +specifically concerning the default term type depending on whether the Term Map is an Object Map or not, +namely, the Function-valued Expression Maps default term type is rml:Literal. +The change is included below with changes highlighted in bold.

+
+

If the Term Map does not have a rml:termType property, then its term type is:

+ +
+

A Function-valued Expression Map MUST have exactly one rml:functionExecution relation. +Further, it MAY have following relations specified:

+ +
Issue

A proper term map definition in RML is pending. +For now, we refer to the R2RML spec, but it is assumed these references will be updated based on the evolution of RML. +This also means that all changes to existing definitions such as term type etc. are complementary to this specification.

+

+ +

5.2 rml:ReturnMap

+

See Return map.

+

5.3 rml:FunctionExecution

+

See Function Execution.

+ + +

5.4 rml:FunctionMap

+

See Function map.

+

5.5 rml:Input

+

See Input.

+

5.6 rml:ParameterMap

+

See Parameter map.

+

5.7 rml:functionExecution

+

Links function-valued expression map with Function Execution.

+

Domain: rml:ExpressionMap

+

Range: rml:FunctionExecution

+

5.8 rml:returnMap

+

Links function-valued expression map with Return map.

+

Domain: rml:ExpressionMap

+

Range: rml:ReturnMap

+

5.8.1 rml:return

+

constant expression shortcut property of rml:returnMap.

+

5.9 rml:functionMap

+

Links a Function Execution with Function.

+

Domain: rml:FunctionExecution

+

Range: rml:FunctionMap

+

5.9.1 rml:function

+

constant expression shortcut property of rml:functionMap.

+

5.10 rml:input

+

Links Execution with Inputs

+

5.11 rml:parameterMap

+

Links Input with Parameter map.

+

Domain: rml:Input

+

Range: rml:ParameterMap

+

5.11.1 rml:parameter

+

constant expression shortcut property of rml:parameterMap

+

5.12 rml:inputValueMap

+

Links Input with a term map.

+

Domain: rml:Input

+

Range: rml:TermMap

+

5.12.1 rml:inputValue

+

constant expression shortcut property of rml:inputValueMap

+
Best Practice 1: Joining using data transformations + +

+

When you specifically want to have join conditions, you should use functions within rml:joinCondition, +see, e.g. test case RMLFNOTC0019.

+

+
+ +

6. Advanced usage

+

6.1 Nested functions

+

As the values of a function are represented using Expression Maps, +it is possible to nest functions: you generate a term in a first function, and that term is used as an parameter value in a second function.

+
Issue

For an old example, see RMLFNOTC0018.

+

+ +
Issue 3: Feature: how to nest a joincondition inside a function?

For now, it is unclear how to handle a nested function where that nested Triples Map contains a join condition.

+

+ + + +

6.2 Conditions

+

Conditions are a shortcut to make RML mappings more intuitive, but rely on existing FNML functionality. +It is a shortcut that is applied using the rml:condition: an additional ExpressionMap predicate. +To be able to use this shortcut, conforming mapping engines MUST support following functions:

+ +
Note: Condition function definitions

+ isNotNull and IF are defined below, rest is an excercise for the reader. + The actual FnO definitions are TODO. +

+ +
+ + + + + +

A. References

A.1 Normative references

+ +
[FnO]
+ Function Ontology (FnO). IDLab - imec - Ghent University. 10 November 2021. Unofficial Draft. URL: https://w3id.org/function/spec/ +
[R2RML]
+ R2RML: RDB to RDF Mapping Language. Souripriya Das; Seema Sundara; Richard Cyganiak. W3C. 27 September 2012. W3C Recommendation. URL: https://www.w3.org/TR/r2rml/ +
[RFC2119]
+ Key words for use in RFCs to Indicate Requirement Levels. S. Bradner. IETF. March 1997. Best Current Practice. URL: https://www.rfc-editor.org/rfc/rfc2119 +
[RFC8174]
+ Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words. B. Leiba. IETF. May 2017. Best Current Practice. URL: https://www.rfc-editor.org/rfc/rfc8174 +
[RML]
+ RDF Mapping Language (RML). IDLab - imec - Ghent University. 08 October 2020. Unofficial Draft. URL: https://rml.io/specs/rml/ +
+

A.2 Informative references

+ +
[CollectionsContainers]
+ Collections and Containers in RML. Knowledge Graph Construction W3C Community Group. 16 August 2022. Unofficial Draft. URL: https://w3id.org/kg-construct/collections-containers +
[rdf-concepts]
+ Resource Description Framework (RDF): Concepts and Abstract Syntax. Graham Klyne; Jeremy Carroll. W3C. 10 February 2004. W3C Recommendation. URL: https://www.w3.org/TR/rdf-concepts/ +
+
\ No newline at end of file diff --git a/spec/docs/index.html b/spec/docs/index.html index 7a32e0e..a4a45a3 100644 --- a/spec/docs/index.html +++ b/spec/docs/index.html @@ -1,11 +1,54 @@ - - - - - RML-FNML - - - + + + +RML-FNML + + + + - - + + + - - + + + + + + + + + +
+ +

RML-FNML

+

+ Draft Community Group Report + +

+
+ +
Latest published version:
+ none +
+
Latest editor's draft:
https://w3id.org/rml/fnml/spec/
+ + + + +
Editor:
+ Ben De Meester + + + + (Ghent University – imec – IDLab) +
+
+ Former editor: +
+ Anastasia Dimou + + + + +
+
Authors:
+ Ben De Meester +
+ Samaneh Jozashoori +
+ Pano Maria +
+ David Chaves-Fraga +
+ Anastasia Dimou +
+
Feedback:
+ GitHub kg-construct/rml-fnml + (pull requests, + new issue, + open issues) +
+
Website
+ https://rml.io +
+ https://fno.io +
+
+ + +
+
+ -
+

Abstract

RML+FnO is an approach to provide for data transformations when generating knowledge graphs +from (semi-)structured data using the RDF Mapping Language (RML).

+

In RML+FnO, data transformations are defined declaratively, +supporting the Function Ontology (FnO).

+

This approach is not case-specific: +data transformations are independent of their implementation and thus interoperable, +while the functions are decoupled and reusable. +This allows developers to improve the generation framework +independent from the contributors that focus on generating the knowledge graphs.

+
+ +

Status of This Document

+ This specification was published by the + Knowledge Graph Construction Community Group. It is not a W3C Standard nor is it + on the W3C Standards Track. + + Please note that under the + W3C Community Contributor License Agreement (CLA) + there is a limited opt-out and other conditions apply. + + Learn more about + W3C Community and Business Groups. +

+ GitHub Issues are preferred for + discussion of this specification. + + +

+ +

1. Conformance

As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.

+ The key words MAY and MUST in this document + are to be interpreted as described in + BCP 14 + [RFC2119] [RFC8174] + when, and only when, they appear in all + capitals, as shown here. +

+ +

2. The Problem

+

Mapping languages allow us to define how knowledge graphs are generated from (semi-)structured data, +but only if the original data values can be used as-is. +Complex data transformations in mapping languages typically are +either implemented as custom solutions, +or are done by systems separate from the mapping process. +The former data transformations remain case-specific, often coupled with the mapping, +whereas the latter is not reusable across systems.

+

For example, we have a data source where all names are lowercase, +but we want the resulting knowledge to have uppercase values. +The following RML Mapping contains the descriptions to generate a knowledge graph from a data source, +but no data transformations.

+
+ +

3. Definitions

+ + + + +

3.1 Generic

+

[RML]-independent defintions:

+ +

3.2 RML

+

Definitions taken from [RML] or R2RML: RDB to RDF Mapping Language:

+ +

Within this specification, the Expression Map definition is extended by adding new possible properties and thus also a new type of Expression Map. +The change is included below with changes highlighted in bold.

+
+

An Expression Map can have the following properties:

+ +
+

3.3 FNML

+ +
Note

It is currently assumed that a Function-valued Expression Map always returns an RDF term [rdf-concepts]. +How a list of RDF terms is handled, is out of scope of this spec, but discussed at Collections and Containers in RML.

+

+ + + +

5. FNML

+

We use terms defined in the FNML ontology to link [RML] with [FNO].

+

The ontology namespace is http://w3id.org/rml/, +the preferred prefix is rml:. +See below for how FNML introduced terms align with RML Core.

+
+ FNML diagram +
Figure 2 Visual overview of how FNML introduced terms align with RML Core
+
+ +

5.1 Function-valued Expression Map

+

A Function-valued Expression Map is an Expression Map that is represented by a resource that has exactly one rml:functionExecution. +The value of the rml:functionExecution property must be a valid Execution.

+

As a consequence, the default [RML] processing is extended, +specifically concerning the default term type depending on whether the Term Map is an Object Map or not, +namely, the Function-valued Expression Maps default term type is rml:Literal. +The change is included below with changes highlighted in bold.

+
+

If the Term Map does not have a rml:termType property, then its term type is:

+ +
+

A Function-valued Expression Map MUST have exactly one rml:functionExecution relation. +Further, it MAY have following relations specified:

+ +
Issue

A proper term map definition in RML is pending. +For now, we refer to the R2RML spec, but it is assumed these references will be updated based on the evolution of RML. +This also means that all changes to existing definitions such as term type etc. are complementary to this specification.

+

+ +

5.2 rml:ReturnMap

+

See Return map.

+

5.3 rml:FunctionExecution

+

See Function Execution.

+ + +

5.4 rml:FunctionMap

+

See Function map.

+

5.5 rml:Input

+

See Input.

+

5.6 rml:ParameterMap

+

See Parameter map.

+

5.7 rml:functionExecution

+

Links function-valued expression map with Function Execution.

+

Domain: rml:ExpressionMap

+

Range: rml:FunctionExecution

+

5.8 rml:returnMap

+

Links function-valued expression map with Return map.

+

Domain: rml:ExpressionMap

+

Range: rml:ReturnMap

+

5.8.1 rml:return

+

constant expression shortcut property of rml:returnMap.

+

5.9 rml:functionMap

+

Links a Function Execution with Function.

+

Domain: rml:FunctionExecution

+

Range: rml:FunctionMap

+

5.9.1 rml:function

+

constant expression shortcut property of rml:functionMap.

+

5.10 rml:input

+

Links Execution with Inputs

+

5.11 rml:parameterMap

+

Links Input with Parameter map.

+

Domain: rml:Input

+

Range: rml:ParameterMap

+

5.11.1 rml:parameter

+

constant expression shortcut property of rml:parameterMap

+

5.12 rml:inputValueMap

+

Links Input with a term map.

+

Domain: rml:Input

+

Range: rml:TermMap

+

5.12.1 rml:inputValue

+

constant expression shortcut property of rml:inputValueMap

+
Best Practice 1: Joining using data transformations + +

+

When you specifically want to have join conditions, you should use functions within rml:joinCondition, +see, e.g. test case RMLFNOTC0019.

+

+
+ +

6. Advanced usage

+

6.1 Nested functions

+

As the values of a function are represented using Expression Maps, +it is possible to nest functions: you generate a term in a first function, and that term is used as an parameter value in a second function.

+
Issue

For an old example, see RMLFNOTC0018.

+

+ +
Issue 3: Feature: how to nest a joincondition inside a function?

For now, it is unclear how to handle a nested function where that nested Triples Map contains a join condition.

+

+ + -
+

6.2 Conditions

+

Conditions are a shortcut to make RML mappings more intuitive, but rely on existing FNML functionality. +It is a shortcut that is applied using the rml:condition: an additional ExpressionMap predicate. +To be able to use this shortcut, conforming mapping engines MUST support following functions:

+ +
Note: Condition function definitions

+ isNotNull and IF are defined below, rest is an excercise for the reader. + The actual FnO definitions are TODO. +

-
+
+ + + + + +

A. References

A.1 Normative references

+ +
[FnO]
+ Function Ontology (FnO). IDLab - imec - Ghent University. 10 November 2021. Unofficial Draft. URL: https://w3id.org/function/spec/ +
[R2RML]
+ R2RML: RDB to RDF Mapping Language. Souripriya Das; Seema Sundara; Richard Cyganiak. W3C. 27 September 2012. W3C Recommendation. URL: https://www.w3.org/TR/r2rml/ +
[RFC2119]
+ Key words for use in RFCs to Indicate Requirement Levels. S. Bradner. IETF. March 1997. Best Current Practice. URL: https://www.rfc-editor.org/rfc/rfc2119 +
[RFC8174]
+ Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words. B. Leiba. IETF. May 2017. Best Current Practice. URL: https://www.rfc-editor.org/rfc/rfc8174 +
[RML]
+ RDF Mapping Language (RML). IDLab - imec - Ghent University. 08 October 2020. Unofficial Draft. URL: https://rml.io/specs/rml/ +
+

A.2 Informative references

+ +
[CollectionsContainers]
+ Collections and Containers in RML. Knowledge Graph Construction W3C Community Group. 16 August 2022. Unofficial Draft. URL: https://w3id.org/kg-construct/collections-containers +
[rdf-concepts]
+ Resource Description Framework (RDF): Concepts and Abstract Syntax. Graham Klyne; Jeremy Carroll. W3C. 10 February 2004. W3C Recommendation. URL: https://www.w3.org/TR/rdf-concepts/ +
+
\ No newline at end of file diff --git a/spec/diagrams/diagram.png b/spec/docs/resources/diagram.png similarity index 100% rename from spec/diagrams/diagram.png rename to spec/docs/resources/diagram.png diff --git a/spec/docs/config.js b/spec/resources/config.js similarity index 100% rename from spec/docs/config.js rename to spec/resources/config.js diff --git a/spec/resources/diagram.png b/spec/resources/diagram.png new file mode 100644 index 0000000..9899d3f Binary files /dev/null and b/spec/resources/diagram.png differ diff --git a/spec/diagrams/fnml.md b/spec/resources/fnml.md similarity index 100% rename from spec/diagrams/fnml.md rename to spec/resources/fnml.md diff --git a/spec/docs/abstract.md b/spec/section/abstract.md similarity index 100% rename from spec/docs/abstract.md rename to spec/section/abstract.md diff --git a/spec/docs/advanced.md b/spec/section/advanced.md similarity index 100% rename from spec/docs/advanced.md rename to spec/section/advanced.md diff --git a/spec/docs/definitions.md b/spec/section/definitions.md similarity index 100% rename from spec/docs/definitions.md rename to spec/section/definitions.md diff --git a/spec/docs/ontology.md b/spec/section/ontology.md similarity index 98% rename from spec/docs/ontology.md rename to spec/section/ontology.md index 90f756b..64e9ecc 100644 --- a/spec/docs/ontology.md +++ b/spec/section/ontology.md @@ -7,7 +7,7 @@ the preferred prefix is `rml:`. See below for how FNML introduced terms align with RML Core.
- FNML diagram + FNML diagram
Visual overview of how FNML introduced terms align with RML Core
diff --git a/spec/docs/overview.md b/spec/section/overview.md similarity index 99% rename from spec/docs/overview.md rename to spec/section/overview.md index 5b5c61c..2c93a7f 100644 --- a/spec/docs/overview.md +++ b/spec/section/overview.md @@ -23,7 +23,7 @@ which means that you cannot specify the difference between ### Function Example -We use [Example 1](#example-rml-mapping-without-data-transformations), +We use [Example 1](#example-rml), where we want to perform an uppercase operation to a set of fields. The FnO description of the function [toUppercase](https://github.com/OpenRefine/OpenRefine/wiki/GREL-String-Functions#touppercasestring-s) is as follows: diff --git a/spec/docs/problem.md b/spec/section/problem.md similarity index 100% rename from spec/docs/problem.md rename to spec/section/problem.md