Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
45ffe56
Initial commit to branch use_pyld
jesper-friis Mar 30, 2025
306276c
Use PyLD for context handling
jesper-friis Mar 30, 2025
ea2c36b
Started solveng eiisues with keywords
francescalb Apr 3, 2025
351e0bd
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Apr 3, 2025
9760246
Merge branch 'master' into keyword_bugs
francescalb Apr 3, 2025
e9ba8fc
Merge branch 'master' into keyword_bugs
jesper-friis Apr 3, 2025
dc1e4f6
Merge branch 'keyword_bugs' of github.com:EMMC-ASBL/tripper into keyw…
jesper-friis Apr 3, 2025
683c012
Allow to use the same keyword in several resource types
jesper-friis Apr 3, 2025
c0b744b
Defined missing prefix - needed by fuseki and GraphDB
jesper-friis Apr 3, 2025
54ea327
Added iana prefix
francescalb Apr 3, 2025
6d71895
Added --debug option to command-line tool
jesper-friis Apr 3, 2025
691b101
Updated clitool and added custum csv sniffer
jesper-friis Apr 4, 2025
78c827e
Added test for new keyword in recursive_update()
jesper-friis Apr 4, 2025
416d391
Added test for scvsniff()
jesper-friis Apr 4, 2025
2f5f8b4
Added more tests for recursive_update()
jesper-friis Apr 4, 2025
6d4cf02
Added Context class
jesper-friis Apr 4, 2025
a595e5d
Updated context and keywords modules such that the test passes
jesper-friis Apr 4, 2025
77d57aa
Updated docstring
jesper-friis Apr 4, 2025
ecd5411
Commented out validate
jesper-friis Apr 4, 2025
e67d07f
Updated test for recursive_update()
jesper-friis Apr 4, 2025
656c070
Merge branch 'keyword_bugs' into context-module
jesper-friis Apr 4, 2025
9eeb2a5
Started to use context - removed many bugs
jesper-friis Apr 5, 2025
f13aa47
Skip blank nodes by default in find_iris()
jesper-friis Apr 5, 2025
7520d31
Merge branch 'master' into use_pyld
jesper-friis Apr 19, 2025
e13bf60
Merge branch 'master' into matchmaker-demo
jesper-friis Apr 19, 2025
147e0db
Merge branch 'master' into context-module
jesper-friis Apr 19, 2025
29f73d6
Fixed issue introduced by merge
jesper-friis Apr 19, 2025
69c0f96
Corrected link in readme file
jesper-friis Apr 19, 2025
c6aa559
Merge branch 'matchmaker-demo' into dev
jesper-friis Apr 19, 2025
6db4e97
Re-enabled validation
jesper-friis Apr 19, 2025
d11fb37
Merge branch 'fix-readme-link' into dev
jesper-friis Apr 19, 2025
c832b65
Merge branch 'use_pyld' into dev
jesper-friis Apr 19, 2025
1ce022f
Fixed markdown_doctest test
jesper-friis Apr 19, 2025
d9524d7
Tabledoc.save() should now be much faster. Should be tested...
jesper-friis Apr 21, 2025
af3c7db
cleanup
jesper-friis Apr 21, 2025
4c8eab1
Greately improved speed of saving csv tables to the a triplestore
jesper-friis Apr 21, 2025
f9cb794
Merge branch 'master' into keyword_bugs
francescalb Apr 22, 2025
9ca3851
Fixed documentation issues
jesper-friis Apr 22, 2025
e8f655b
try safety directly
francescalb Apr 22, 2025
eab590e
Typo in ci-tests
francescalb Apr 22, 2025
8f9e18d
typo
francescalb Apr 22, 2025
71b0b9d
try adding .safety-config
francescalb Apr 22, 2025
ca055b7
removed safety-config.yml
francescalb Apr 22, 2025
eca957c
Removed safety info that is no longer relevant
francescalb Apr 22, 2025
d5b3453
Merge branch 'keyword_bugs' into dev
jesper-friis Apr 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,7 @@ jobs:
--rcfile=pyproject.toml --disable=import-outside-toplevel,redefined-outer-name tests

# safety-specific settings
run_safety: true
# 48547: RDFLib vulnerability: https://pyup.io/vulnerabilities/PVE-2022-48547/48547/
# 44715-44717: NumPy vulnerabilities:
# https://pyup.io/vulnerabilities/CVE-2021-41495/44715/
# https://pyup.io/vulnerabilities/CVE-2021-41496/44716/
# https://pyup.io/vulnerabilities/CVE-2021-34141/44717/
# 70612: Jinja2 vulnerability. Only used as subdependency for mkdocs++ in tripper.
# https://data.safetycli.com/v/70612/97c/
# https://data.safetycli.com/v/72715/97c/ # update to mkdocs>=9.5.32
safety_options: |
--ignore=48547
--ignore=44715
--ignore=44716
--ignore=44717
--ignore=70612
--ignore=72715
run_safety: false

## Build package
run_build_package: true
Expand All @@ -63,6 +48,16 @@ jobs:
update_docs_landing_page: true
package_dirs: tripper

safety:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Run Safety CLI to check for vulnerabilities
uses: pyupio/safety-action@v1
with:
api-key: ${{ secrets.SAFETY_API_KEY }}
args: --detailed-output # To always see detailed output from this action

pytest:
runs-on: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ We gratefully acknowledge the following projects for supporting the development
[Discovery of custom backends]: https://emmc-asbl.github.io/tripper/latest/backend_discovery/
[tripper.datadoc]: https://emmc-asbl.github.io/tripper/latest/datadoc/introduction/
[tripper.mappings]: https://emmc-asbl.github.io/tripper/latest/api_reference/mappings/mappings/
[tripper.units]: https://emmc-asbl.github.io/tripper/latest/api_reference/units/units/
[tripper.units]: https://emmc-asbl.github.io/tripper/latest/units/units/
[tripper.convert]: https://emmc-asbl.github.io/tripper/latest/api_reference/convert/convert/
[Known issues]: https://emmc-asbl.github.io/tripper/latest/known-issues/
[MIT license]: https://emmc-asbl.github.io/tripper/latest/LICENSE/
Expand Down
3 changes: 3 additions & 0 deletions docs/api_reference/datadoc/context.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# context

::: tripper.datadoc.context
4 changes: 2 additions & 2 deletions docs/datadoc/customisation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Tripper already include a default list of [predefined prefixes].
Additional prefixed can be provided in two ways.

### With the `prefixes` argument
Several functions in the API (like [save_dict()], [as_jsonld()] and [TableDoc.parse_csv()]) takes a `prefixes` argument with which additional namespace prefixes can provided.
Several functions in the API (like [save_dict()], [told()] and [TableDoc.parse_csv()]) takes a `prefixes` argument with which additional namespace prefixes can provided.

This may be handy when used from the Python API.

Expand Down Expand Up @@ -243,7 +243,7 @@ Instead, the list of available resource types should be stored and retrieved fro
[predefined keywords]: keywords.md
[default context]: https://raw.githubusercontent.com/EMMC-ASBL/tripper/refs/heads/master/tripper/context/0.2/context.json
[save_dict()]: ../api_reference/datadoc/dataset.md#tripper.datadoc.dataset.save_dict
[as_jsonld()]: ../api_reference/datadoc/dataset.md#tripper.datadoc.dataset.as_jsonld
[told()]: ../api_reference/datadoc/dataset.md#tripper.datadoc.dataset.told
[save_datadoc()]: ../api_reference/datadoc/dataset.md#tripper.datadoc.dataset.save_datadoc
[TableDoc]: ../api_reference/datadoc/tabledoc.md/#tripper.datadoc.tabledoc.TableDoc
[TableDoc.parse_csv()]: ../api_reference/datadoc/tabledoc.md/#tripper.datadoc.tabledoc.TableDoc.parse_csv
Expand Down
10 changes: 5 additions & 5 deletions docs/datadoc/documenting-a-resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ We therefore have to define them explicitly
!!! note "Side note"

This dict is actually a [JSON-LD] document with an implicit context.
You can use [as_jsonld()] to create a valid JSON-LD document from it.
You can use [told()] to create a valid JSON-LD document from it.
In addition to add a `@context` field, this function also adds some implicit `@type` declarations.

```python
>>> import json
>>> from tripper.datadoc import as_jsonld
>>> d = as_jsonld(dataset, prefixes=prefixes)
>>> from tripper.datadoc import told
>>> d = told(dataset, prefixes=prefixes)
>>> print(json.dumps(d, indent=4)) # doctest: +SKIP
```

Expand Down Expand Up @@ -89,7 +89,7 @@ Since the prefixes "sem" and "kb" are not included in the [Predefined prefixes],
```

The returned `AttrDict` instance is an updated copy of `dataset` (casted to a dict subclass with attribute access).
It correspond to a valid JSON-LD document and is the same as returned by [as_jsonld()].
It correspond to a valid JSON-LD document and is the same as returned by [told()].

You can use `ts.serialize()` to list the content of the triplestore (defaults to turtle):

Expand Down Expand Up @@ -216,7 +216,7 @@ The below example shows how to save all datasets listed in the CSV file [semdata
[oteio:Generator]: https://w3id.org/emmo/domain/oteio/Generator
[oteio:Parser]: https://w3id.org/emmo/domain/oteio/Parser
[save_dict()]: ../api_reference/datadoc/dataset.md/#tripper.datadoc.dataset.save_dict
[as_jsonld()]: ../api_reference/datadoc/dataset.md/#tripper.datadoc.dataset.as_jsonld
[told()]: ../api_reference/datadoc/dataset.md/#tripper.datadoc.dataset.told
[save_datadoc()]:
../api_reference/datadoc/dataset.md/#tripper.datadoc.dataset.save_datadoc
[TableDoc]: ../api_reference/datadoc/tabledoc.md/#tripper.datadoc.tabledoc.TableDoc
Expand Down
16 changes: 14 additions & 2 deletions docs/datadoc/keywords.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- Do not edit! This file is generated with Tripper. Edit the keywords.yaml file instead. -->

# Keywords for default
# Keywords for domain: default
The tables below lists the keywords the domain default.

The meaning of the columns are as follows:
Expand Down Expand Up @@ -55,7 +55,7 @@ Resource published or curated by an agent.
## Properties on [Dataset]
A collection of data, published or curated by an agent, and available for access or download in one or more representations.

- subClassOf: [dcat:Resource]
- subClassOf: [dcat:Resource], [emmo:EMMO_194e367c_9783_4bf5_96d0_9ad597d48d9a]

| Keyword | Range | Conformance | Definition | Usage note |
| ---------------------- | ------------------------------------------------ | ----------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -125,6 +125,8 @@ A generator that can serialise an instance of a datamodel into a distribution.
## Properties on [Agent]
Any entity carrying out actions with respect to the entities Catalogue and the Catalogued Resources.

- subClassOf: [emmo:EMMO_2480b72b_db8d_460f_9a5f_c2912f979046]

| Keyword | Range | Conformance | Definition | Usage note |
| ------------ | ------------------------------ | ----------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| [name] | [rdfs:Literal]<br>(xsd:string) | mandatory | A name of the agent. | |
Expand Down Expand Up @@ -169,6 +171,7 @@ A collection of operations that provides access to one or more datasets or data
| [endpointURL] | [rdfs:Literal]<br>(xsd:anyURI) | mandatory | The root location or primary endpoint of the service (an IRI). | |
| [endpointDescription] | [rdfs:Resource] | recommended | A description of the services available via the end-points, including their operations, parameters etc. | |
| [servesDataset] | [dcat:Dataset] | recommended | This property refers to a collection of data that this data service can distribute. | |
| [parser] | [oteio:Parser] | | A parser that can parse the distribution. | |


## Properties on [DatasetSeries]
Expand Down Expand Up @@ -257,6 +260,10 @@ A standard or other specification to which a resource conforms.
A media type, e.g. the format of a computer file.


## Properties on [GenericResource]
A generic resource.




[Resource]: http://www.w3.org/ns/dcat#Resource
Expand Down Expand Up @@ -327,6 +334,7 @@ A media type, e.g. the format of a computer file.
[statements]: https://w3id.org/emmo/domain/oteio#statement
[rdfs:Literal]: http://www.w3.org/2000/01/rdf-schema#Literal
[dcat:Resource]: http://www.w3.org/ns/dcat#Resource
[emmo:EMMO_194e367c_9783_4bf5_96d0_9ad597d48d9a]: https://w3id.org/emmo#EMMO_194e367c_9783_4bf5_96d0_9ad597d48d9a
[Dataset]: http://www.w3.org/ns/dcat#Dataset
[distribution]: http://www.w3.org/ns/dcat#distribution
[dcat:Distribution]: http://www.w3.org/ns/dcat#Distribution
Expand Down Expand Up @@ -405,6 +413,7 @@ A media type, e.g. the format of a computer file.
[Generator]: https://w3id.org/emmo/domain/oteio#Generator
[generatorType]: https://w3id.org/emmo/domain/oteio#generatorType
[rdfs:Literal]: http://www.w3.org/2000/01/rdf-schema#Literal
[emmo:EMMO_2480b72b_db8d_460f_9a5f_c2912f979046]: https://w3id.org/emmo#EMMO_2480b72b_db8d_460f_9a5f_c2912f979046
[Agent]: http://xmlns.com/foaf/0.1/Agent
[name]: http://xmlns.com/foaf/0.1/name
[rdfs:Literal]: http://www.w3.org/2000/01/rdf-schema#Literal
Expand All @@ -431,6 +440,8 @@ A media type, e.g. the format of a computer file.
[rdfs:Literal]: http://www.w3.org/2000/01/rdf-schema#Literal
[servesDataset]: http://www.w3.org/ns/dcat#servesDataset
[dcat:Dataset]: http://www.w3.org/ns/dcat#Dataset
[parser]: https://w3id.org/emmo/domain/oteio#parser
[oteio:Parser]: https://w3id.org/emmo/domain/oteio#Parser
[dcat:Dataset]: http://www.w3.org/ns/dcat#Dataset
[DatasetSeries]: http://www.w3.org/ns/dcat#DatasetSeries
[Geometry]: http://www.w3.org/ns/locn#Geometry
Expand Down Expand Up @@ -506,3 +517,4 @@ A media type, e.g. the format of a computer file.
[LegalResource]: http://data.europa.eu/eli/ontology#LegalResource
[Standard]: http://purl.org/dc/terms/Standard
[MediaType]: http://purl.org/dc/terms/MediaType
[GenericResource]: http://www.w3.org/2000/01/rdf-schema#Resource
3 changes: 2 additions & 1 deletion docs/datadoc/prefixes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ See [User-defined prefixes] for how to extend this list with additional namespac
| dctype | http://purl.org/dc/dcmitype/ |
| eli | http://data.europa.eu/eli/ontology# |
| foaf | http://xmlns.com/foaf/0.1/ |
| iana | https://www.iana.org/assignments/media-types/ |
| locn | http://www.w3.org/ns/locn# |
| odrl | http://www.w3.org/ns/odrl/2/ |
| owl | http://www.w3.org/2002/07/owl# |
| prov | http://www.w3.org/ns/prov# |
| rdf | http://www.w3.org/1999/02/22-rdf-syntax-ns# |
| rdfs | http://www.w3.org/2000/01/rdf-schema# |
| schema | http://schema.org/ |
| schema | https://schema.org/ |
| skos | http://www.w3.org/2004/02/skos/core# |
| spdx | http://spdx.org/rdf/terms# |
| vcard | http://www.w3.org/2006/vcard/ns# |
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ We gratefully acknowledge the following projects for supporting the development
[Discovery of custom backends]: https://emmc-asbl.github.io/tripper/latest/backend_discovery/
[tripper.datadoc]: https://emmc-asbl.github.io/tripper/latest/datadoc/introduction/
[tripper.mappings]: https://emmc-asbl.github.io/tripper/latest/api_reference/mappings/mappings/
[tripper.units]: https://emmc-asbl.github.io/tripper/latest/api_reference/units/units/
[tripper.units]: https://emmc-asbl.github.io/tripper/latest/units/units/
[tripper.convert]: https://emmc-asbl.github.io/tripper/latest/api_reference/convert/convert/
[Known issues]: https://emmc-asbl.github.io/tripper/latest/known-issues/
[MIT license]: https://emmc-asbl.github.io/tripper/latest/LICENSE/
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ nav:
- Units and quantities: units/units.md
- Session: session.md
- ... | api_reference/**
- Known issues: known-issues.md
- For developers: developers.md
- Known issues: known-issues.md
- Changelog: CHANGELOG.md
- License: LICENSE.md

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ mappings = [
]
datadoc = [
"tripper[mappings]",
"PyLD>=2.0.0,<2.0.5",
"PyYaml>=3.0.0,<6.0.3", # todo: check lower version
"requests>=2.0.0,<3.4.1", # todo: check lower version
]
Expand Down Expand Up @@ -104,6 +105,8 @@ scripts_are_modules = true
warn_unused_configs = true
show_error_codes = true
allow_redefinition = true
#explicit-package-bases = true


[tool.pylint]
max-line-length = 80
Expand Down
52 changes: 6 additions & 46 deletions tests/backends/test_sparqlwrapper_graphdb_fuseki.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,13 @@
https://emmc-asbl.github.io/tripper/latest/developers/.
"""

import time

import pytest
import requests

# URL to check if GraphDB is running.
GRAPHDB_CHECK_URL = "http://localhost:7200/repositories"
FUSEKI_CHECK_URL = "http://localhost:3030"


def graphdb_available():
"""
Help function that checks if the GraphDB instance is available.
If it is not, the tests that depend on it will be skipped.
"""
timeout = 10 # seconds
interval = 1 # seconds
start_time = time.time()
while True:
try:
response = requests.get(GRAPHDB_CHECK_URL, timeout=timeout)
if response.status_code == 200:
return True
except requests.exceptions.RequestException:
pass

if time.time() - start_time > timeout:
return False
time.sleep(interval)


def fuseki_available():
"""
Help function that checks if the Fuseki instance is available
"""
timeout = 10 # seconds
interval = 1 # seconds
start_time = time.time()
while True:
try:
response = requests.get(FUSEKI_CHECK_URL, timeout=timeout)
if response.status_code == 200:
return True
except requests.exceptions.RequestException:
pass

if time.time() - start_time > timeout:
return False
time.sleep(interval)


def get_triplestore(tsname: str) -> "Triplestore":
"""Help function that returns a new triplestore object."""
from tripper import Triplestore
Expand Down Expand Up @@ -240,7 +196,9 @@ def test_graphdb():
Test the sparqlwrapper backend using GraphDB.
"""
# Check if GraphDB is available and write a warning if it is not.
if not graphdb_available():
from tripper.utils import check_service_availability

if not check_service_availability(GRAPHDB_CHECK_URL, timeout=1):
pytest.skip("GraphDB instance not available locally; skipping tests.")

print("Testing graphdb")
Expand All @@ -252,7 +210,9 @@ def test_fuseki():
Test the sparqlwrapper backend using Fuseki.
"""
# Check if Fuseki is available and write a warning if it is not.
if not fuseki_available():
from tripper.utils import check_service_availability

if not check_service_availability(FUSEKI_CHECK_URL, timeout=1):
pytest.skip("Fuseki instance not available locally; skipping tests.")

print("Testing fuseki")
Expand Down
Loading