Skip to content

Commit 8f891e5

Browse files
authored
Merge pull request #10 from rudof-project/update-pyrudof-api
docs: update pyrudof api, restructure book into parts and add property graph and shacl 1.2 chapters
2 parents 7844621 + e1e0838 commit 8f891e5

43 files changed

Lines changed: 7870 additions & 15778 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ __pycache__/
44
*$py.class
55

66
# Jupyter notebook build files
7-
_build/
7+
_build/
8+
9+
# Diagram intermediates written by the notebooks at run time. Committing these
10+
# is actively harmful: a stale out.png gets displayed when the PlantUML step
11+
# fails, so a broken diagram looks like a working one.
12+
out.puml
13+
out.png
814

915
# C extensions
1016
*.so

‎README.md‎

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,40 @@
11
# rudof tutorials
22

3-
This repository contains the source code of some [Jupiter books](https://rudof-project.github.io/tutorials/intro.html) that can be used as small tutorials of [rudof](https://rudof-project.github.io/).
3+
Source for [**Shaping Knowledge Graphs**](https://rudof-project.github.io/tutorials/intro.html),
4+
a [Jupyter Book](https://jupyterbook.org/) that introduces RDF, SPARQL, ShEx, SHACL, DCTAP
5+
and property graphs through runnable examples built with
6+
[rudof](https://rudof-project.github.io/rudof/).
47

5-
Some links:
6-
* [Jupiter-books reference](https://jupyterbook.org/en/stable/start/overview.html)
8+
Each chapter is a notebook under [`rudof/`](rudof/) and can be run as you read, either
9+
locally or in [Google Colab](https://colab.research.google.com/) via the launch button at
10+
the top of each page.
711

8-
## 🚀 Quick Start
12+
## Chapters
13+
14+
| Notebook | Topic |
15+
| --- | --- |
16+
| [`rudof.ipynb`](rudof/rudof.ipynb) | the `Rudof` session, errors, configuration, prefixes |
17+
| [`rdf.ipynb`](rudof/rdf.ipynb) | the RDF data model, formats, visualization, node neighbourhoods |
18+
| [`sparql.ipynb`](rudof/sparql.ipynb) | querying local graphs and remote endpoints |
19+
| [`shex.ipynb`](rudof/shex.ipynb) | shape expressions, shape maps, validation reports |
20+
| [`shacl.ipynb`](rudof/shacl.ipynb) | shapes as RDF, targets, validation reports |
21+
| [`dctap.ipynb`](rudof/dctap.ipynb) | modelling in a spreadsheet, converting to ShEx |
22+
| [`rdf12.ipynb`](rudof/rdf12.ipynb) | RDF 1.2 triple terms and annotations |
23+
| [`sparql12.ipynb`](rudof/sparql12.ipynb) | querying those annotations with SPARQL 1.2 |
24+
| [`compare.ipynb`](rudof/compare.ipynb) | structural comparison of two schemas |
25+
| [`service_description.ipynb`](rudof/service_description.ipynb) | what a SPARQL endpoint says about itself |
26+
| [`property_graphs.ipynb`](rudof/property_graphs.ipynb) | PG schemas, validation and Cypher |
27+
| [`rudof_generate.ipynb`](rudof/rudof_generate.ipynb) | generating synthetic data from a schema |
28+
29+
## Requirements
30+
31+
The notebooks target [`pyrudof`](https://pypi.org/project/pyrudof/) **0.3.22 or later**,
32+
and need Python 3.10 or newer. Several chapters reach the network: public SPARQL endpoints (Wikidata, DBpedia, UniProt) and the PlantUML server used to render diagrams.
33+
34+
## Quick start
935

1036
### 1. Clone and install
37+
1138
```bash
1239
git clone https://github.com/rudof-project/tutorials.git
1340
cd tutorials
@@ -20,25 +47,29 @@ pip install -r requirements.txt
2047
jupyter-book build rudof
2148
```
2249

50+
Every notebook is re-executed on each build (`execute_notebooks: force` in
51+
[`rudof/_config.yml`](rudof/_config.yml)), so a build failure means a chapter no longer runs
52+
against the current `pyrudof` — which is the point.
2353

24-
### 3. Manually publish books on gh-pages
54+
The result lands in `rudof/_build/html`.
2555

26-
Note, this is no longer necessary because we publish the book through github Actions.
56+
### 3. Publish
2757

28-
```bash
29-
ghp-import -n -p -f rudof/_build/html
30-
```
58+
Publishing happens automatically through the
59+
[`deploy-book` GitHub Action](.github/workflows/deploy.yml) on every push to `main` that
60+
touches `rudof/`.
3161

3262
### Cleaning build files and cache
3363

34-
Sometimes it is necessary to clean the cache when there are new versions of the libraries. To clean the built drectory use:
64+
New versions of the libraries sometimes need a clean build:
3565

3666
```bash
37-
jupyter-book clean rudof
67+
jupyter-book clean rudof # the build directory
68+
jupyter-book clean rudof --all # also the jupyter_cache
3869
```
3970

40-
If you want to clean also the `jupyter_cache`, use:
71+
## Links
4172

42-
```bash
43-
jupyter-book clean rudof --all
44-
```
73+
* [rudof documentation](https://rudof-project.github.io/rudof/)
74+
* [`pyrudof` API reference](https://pyrudof.readthedocs.io/)
75+
* [Jupyter Book reference](https://jupyterbook.org/en/stable/start/overview.html)

‎environment.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ dependencies:
33
- python=3.12
44
- pip
55
- pip:
6-
- jupyter-book
6+
- jupyter-book==1.0.4
77
- ghp-import
88
- jupyter
99
- notebook
10+
- pyrudof>=0.3.22
11+
- plantuml

‎requirements.txt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,10 @@ jupyter-book==1.0.4
22
ghp-import
33
jupyter
44
notebook
5+
6+
# The library the tutorials are about. 0.3.22 is the first release with the
7+
# restructured Python bindings (result objects, RudofError hierarchy, Rudof()).
8+
pyrudof>=0.3.22
9+
10+
# Used by several notebooks to render RDF graphs and schemas as diagrams.
11+
plantuml
-10.9 KB
Binary file not shown.
-25.6 KB
Binary file not shown.
-76.5 KB
Binary file not shown.
-3.87 KB
Binary file not shown.

‎rudof/_build/.doctrees/rdf.doctree‎

-85.8 KB
Binary file not shown.
-43.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)