Skip to content

Commit

Permalink
update docs for #244
Browse files Browse the repository at this point in the history
  • Loading branch information
ceteri committed Mar 23, 2022
1 parent 8811876 commit b781fdb
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 22 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions docs/ack.md
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
72 changes: 50 additions & 22 deletions examples/ex2_1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -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)"
]
},
{
Expand All @@ -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",
"```"
]
Expand All @@ -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",
Expand Down Expand Up @@ -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`."
]
},
{
Expand All @@ -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"
]
}
],
Expand Down Expand Up @@ -209,7 +237,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 4,
"metadata": {
"scrolled": true
},
Expand All @@ -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"
]
}
],
Expand All @@ -247,7 +275,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -261,7 +289,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.10"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down

0 comments on commit b781fdb

Please sign in to comment.