From b781fdbb944427c2601bfe497d43f568f80ceb90 Mon Sep 17 00:00:00 2001 From: Paco Nathan Date: Wed, 23 Mar 2022 11:35:03 -0700 Subject: [PATCH] update docs for #244 --- README.md | 1 + changelog.txt | 8 +++++ docs/ack.md | 1 + examples/ex2_1.ipynb | 72 ++++++++++++++++++++++++++++++-------------- 4 files changed, 60 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index b5540b8..4e7fdc7 100644 --- a/README.md +++ b/README.md @@ -203,6 +203,7 @@ and to our contributors: [@louisguitton](https://github.com/louisguitton), [@tomaarsen](https://github.com/tomaarsen), [@Mec-iS](https://github.com/Mec-iS), +[@cutterkom](https://github.com/cutterkom), [@RishiKumarRay](https://github.com/RishiKumarRay), [@ArenasGuerreroJulian](https://github.com/ArenasGuerreroJulian), [@fils](https://github.com/fils), diff --git a/changelog.txt b/changelog.txt index ed41015..3abfd4a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,14 @@ 2022-??-?? + * ??? + + +## 0.6.0 + +2022-03-23 + + * include use of YARRRML in the R2RML tutorial in ex2_1; kudos @cutterkom * support for substituting the binding variables into a SPARQL query * add a NumPy-backed `RDFlib.Store` plugin diff --git a/docs/ack.md b/docs/ack.md index 8134d91..e81c904 100644 --- a/docs/ack.md +++ b/docs/ack.md @@ -11,6 +11,7 @@ and to our contributors: [@louisguitton](https://github.com/louisguitton), [@tomaarsen](https://github.com/tomaarsen), [@Mec-iS](https://github.com/Mec-iS), +[@cutterkom](https://github.com/cutterkom), [@RishiKumarRay](https://github.com/RishiKumarRay), [@ArenasGuerreroJulian](https://github.com/ArenasGuerreroJulian), [@fils](https://github.com/fils), diff --git a/examples/ex2_1.ipynb b/examples/ex2_1.ipynb index e354589..3d3663b 100644 --- a/examples/ex2_1.ipynb +++ b/examples/ex2_1.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 9, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -78,17 +78,33 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "[StudentSportDB]\n", + "mappings=/Users/paco/src/kglab/dat/student_sport.r2rml.ttl\n", + "db_url=sqlite:////Users/paco/src/kglab/dat/student_sport.db\n", + "\n" + ] + } + ], "source": [ "import os\n", "\n", + "cwd = os.path.dirname(os.getcwd())\n", + "\n", "config = f\"\"\"\n", "[StudentSportDB]\n", - "mappings={os.path.dirname(os.getcwd())}/dat/student_sport.r2rml.ttl\n", - "db_url=sqlite:///{os.path.dirname(os.getcwd())}/dat/student_sport.db\n", - " \"\"\"" + "mappings={cwd}/dat/student_sport.r2rml.ttl\n", + "db_url=sqlite:///{cwd}/dat/student_sport.db\n", + "\"\"\"\n", + "\n", + "print(config)" ] }, { @@ -98,7 +114,7 @@ "You can see how to create this config file in the [docs](https://github.com/oeg-upm/Morph-KGC/wiki/Configuration).\n", "\n", "Alternatively, you provide a path to a config file, for example:\n", - "```\n", + "```python\n", "config = \"path/to/config.ini\"\n", "```" ] @@ -107,9 +123,16 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This config references a `R2RML` mapping (`student_sport.r2rml.ttl`) that is applied to the input data. One way to create such a mapping is [YARRRML](https://rml.io/yarrrml/), \"a human-friendly text-based representation of RML rules\". You write the rules in YAML and then transform it with a yarrrml-parser to a `RML` or `R2RML` file. There is a [browser-based version](https://rml.io/yarrrml/matey/#) to get an idea how it works.\n", - "\n", - "The YARRRML file needed for this example can be found in `dat/` to use on the sample database:\n", + "This config references a R2RML mapping (in `student_sport.r2rml.ttl`) which gets applied to the input data.\n", + "One way to create such a mapping is [YARRRML](https://rml.io/yarrrml/), \"a human-friendly text-based representation of RML rules\". You write rules in YAML then transform these with a yarrrml-parser into either a RML or R2RML file.\n", + "See the browser-based version called [Matey](https://rml.io/yarrrml/matey/#) to get an idea of how this works." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The YARRRML file needed for this example can be found in `dat/` which can be used with the sample database:\n", "\n", "```YML\n", "prefixes:\n", @@ -150,7 +173,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "After using the yarrrml-parser with `yarrrml-parser -i student_sport.yml -o student_sport.r2rml.ttl -f R2RML` you get `students_sport.r2rml.ttl`. This is the file you refer in the configuration for `Morph-KGC`." + "Using the yarrrml-parser:\n", + "```bash\n", + "yarrrml-parser -i student_sport.yml -o student_sport.r2rml.ttl -f R2RML\n", + "```\n", + "produces the `students_sport.r2rml.ttl` file.\n", + "This is the file referenced in the configuration for `Morph-KGC`." ] }, { @@ -162,18 +190,18 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "INFO | 2022-03-22 10:14:42,617 | 7 mapping rules retrieved.\n", - "INFO | 2022-03-22 10:14:42,622 | Mapping partition with 1 groups generated.\n", - "INFO | 2022-03-22 10:14:42,622 | Maximum number of rules within mapping group: 7.\n", - "INFO | 2022-03-22 10:14:42,623 | Mappings processed in 0.131 seconds.\n", - "INFO | 2022-03-22 10:14:42,709 | Number of triples generated in total: 22.\n" + "INFO | 2022-03-23 11:32:45,453 | 7 mapping rules retrieved.\n", + "INFO | 2022-03-23 11:32:45,466 | Mapping partition with 1 groups generated.\n", + "INFO | 2022-03-23 11:32:45,467 | Maximum number of rules within mapping group: 7.\n", + "INFO | 2022-03-23 11:32:45,469 | Mappings processed in 0.281 seconds.\n", + "INFO | 2022-03-23 11:32:45,694 | Number of triples generated in total: 22.\n" ] } ], @@ -209,7 +237,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 4, "metadata": { "scrolled": true }, @@ -220,8 +248,8 @@ "text": [ "ic| student_name: 'Fernando', sport_desc: 'Formula1'\n", "ic| student_name: 'Fernando', sport_desc: 'Football'\n", - "ic| student_name: 'David', sport_desc: 'Football'\n", - "ic| student_name: 'Venus', sport_desc: 'Tennis'\n" + "ic| student_name: 'Venus', sport_desc: 'Tennis'\n", + "ic| student_name: 'David', sport_desc: 'Football'\n" ] } ], @@ -247,7 +275,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -261,7 +289,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.10" + "version": "3.8.10" } }, "nbformat": 4,