-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dereferencer #11
Dereferencer #11
Changes from all commits
3ce6908
08ab97c
af750b2
3afba5d
342d63e
3a3c169
8d6bc1a
d39c314
1215308
c2d53c5
97586d3
e0eefa2
30bd04f
a9b85af
417766c
c71976b
d9f8ce1
edeb104
b897e68
2f90b6b
0983c1d
846ec54
c31846c
892abd6
907d87d
523df6e
7eb3d96
8b93eb1
4378715
e41d322
e66d915
6a83d3e
4731fe7
866c1b8
36d73e4
8fa637b
ee74345
fd4879d
9f8cfdc
c916ec5
5f67142
f486db3
103b51c
3eed9b7
a2c6cf8
c1af6c7
d982426
c6246c8
9375895
3fa7ada
ccc7e87
04803d5
b4fcec9
29417c6
f070d16
1b5963d
9188dcc
0f5714a
dec05f6
cc35c2b
5478e3a
ebcffc0
f5b682f
7ed1987
bfe2e18
76d12df
766d0dd
ca54add
40286bf
4ac6e93
d64b645
89fdb19
c02ca4b
f97e4cc
1521c54
442bbc4
72f8110
4b43371
efc1ca2
0bc1001
eb83248
f1bdc46
8941c10
8c40cc2
663838e
8defd84
92f1f9b
8003a97
3080711
077d79b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker/**/*.sh text eol=lf |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Python Linting | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'docker/lwua-ingest/**/*.py' | ||
- 'docker/lwua-dereferencer/**/*.py' | ||
pull_request: | ||
paths: | ||
- 'docker/lwua-ingest/**/*.py' | ||
- 'docker/lwua-dereferencer/**/*.py' | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out source repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.10.6 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install black autopep8 | ||
|
||
- name: Run Black | ||
run: | | ||
black docker/lwua-ingest/ | ||
black docker/lwua-dereferencer/ | ||
|
||
- name: Run autopep8 | ||
run: | | ||
autopep8 --in-place --aggressive --aggressive --max-line-length 79 --recursive docker/lwua-ingest/ | ||
autopep8 --in-place --aggressive --aggressive --max-line-length 79 --recursive docker/lwua-dereferencer/ | ||
|
||
- name: Commit and push changes | ||
run: | | ||
git config --global user.name 'cedricdcc' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git add -A | ||
git commit -m "Automated python code formatting" || exit 0 | ||
git push |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Python Tests | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'docker/lwua-ingest/lwua-py/**/*.py' | ||
pull_request: | ||
paths: | ||
- 'docker/lwua-ingest/lwua-py/**/*.py' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out source repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.10.6 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry | ||
cd docker/lwua-ingest/lwua-py | ||
poetry install | ||
|
||
- name: Run pytest | ||
run: | | ||
cd docker/lwua-ingest/lwua-py | ||
poetry run pytest ./tests/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.env | ||
data/ | ||
__pycache__ | ||
*.log | ||
__pycache__ | ||
.ipynb_checkpoints/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
subjects: | ||
SPARQL: > | ||
PREFIX schema: <https://schema.org/> | ||
SELECT ?s ?p ?o | ||
WHERE { | ||
?s ?p schema:Dataset . | ||
} | ||
assert-paths: | ||
cache_lifetime: 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please remind me what this does? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
subjects: | ||
SPARQL: > | ||
PREFIX schema: <https://schema.org/> | ||
SELECT ?s ?p ?o | ||
WHERE { | ||
?s ?p schema:Project . | ||
} | ||
assert-paths: | ||
- <https://schema.org/Dataset> | ||
cache_lifetime: 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
subjects: | ||
literal: | ||
- http://marineregions.org/mrgid/63523 | ||
- http://marineregions.org/mrgid/2540 | ||
- http://marineregions.org/mrgid/12548 | ||
prefixes: | ||
ex: <https://example.org/whatever/> | ||
mr: <http://marineregions.org/ns/ontology#> | ||
assert-paths: | ||
- "mr:hasGeometry" | ||
#- "mr:isPartOf / mr:hasGeometry" | ||
- "mr:isPartOf / <https://schema.org/geo> / <https://schema.org/latitude>" | ||
- "mr:isPartOf/ <https://schema.org/geo>/<https://schema.org/longitude>" | ||
#- "mr:isPartOf/mr:hasGeometry / <https://schema.org/latitude> /<https://schema.org/longitude>" | ||
cache_lifetime: 180 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
subjects: | ||
SPARQL: > | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX schema: <https://schema.org/> | ||
SELECT ?s | ||
WHERE { | ||
?s rdf:type schema:Person . | ||
} | ||
assert-paths: | ||
cache_lifetime: 180 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
### Examples | ||
|
||
#### Example 1 | ||
|
||
```yaml | ||
subjects: | ||
literal: | ||
- http://marineregions.org/mrgid/63523 | ||
- http://marineregions.org/mrgid/2540 | ||
- http://marineregions.org/mrgid/12548 | ||
prefixes: | ||
ex: <https://example.org/whatever/> | ||
mr: <http://marineregions.org/ns/ontology#> | ||
assert-paths: | ||
- "mr:hasGeometry" | ||
- "mr:isPartOf / mr:hasGeometry" | ||
- "mr:isPartOf / <https://schema.org/geo> / <https://schema.org/latitude>" | ||
- "mr:isPartOf/ <https://schema.org/geo>/<https://schema.org/longitude>" | ||
- "mr:isPartOf/mr:hasGeometry / <https://schema.org/latitude> /<https://schema.org/longitude>" | ||
cache_lifetime: 18000 | ||
``` | ||
|
||
In this example, the subjects are the literal values of the URIs. The `assert-paths` are the property paths to follow in the results. The `cache_lifetime` is the lifetime of the cache in minutes. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. still does not explain what is being cached, and thus does not help me to consider what should drive my decision as a user to set, increase, decrease this thingy? |
||
|
||
#### Example 2 | ||
|
||
```yaml | ||
subjects: | ||
SPARQL: > | ||
select DISTINCT ?s where { | ||
?s ?p ?o . | ||
FILTER regex(str(?s), "^http://marineregions.org/mrgid/[0-9]{1,5}$") | ||
} | ||
assert-paths: | ||
- <https://schema.org/Dataset> | ||
cache_lifetime: 5 | ||
``` | ||
|
||
In this example, the subjects are the results of the SPARQL query. The `assert-paths` are the property paths to follow in the results. The `cache_lifetime` is the lifetime of the cache in minutes. | ||
|
||
### Explanation | ||
|
||
Key | Value | Required | ||
--- | --- | ||
`subjects` | The subjects to dereference this can be a list of literal values or a SPARQL query | Yes | ||
`prefixes` | The prefixes to use in the `assert-paths` | No | ||
`assert-paths` | The property paths to test the results against. | Yes | ||
`cache_lifetime` | The lifetime of the cache in minutes | No |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if this is a |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
@prefix tree: <https://w3id.org/tree#> . | ||
@prefix ldes: <https://w3id.org/ldes#> . | ||
@prefix dc: <http://purl.org/dc/terms/> . | ||
@prefix sh: <http://www.w3.org/ns/shacl#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix skos: <http://www.w3.org/2004/02/skos/core#> . | ||
@prefix gsp: <http://www.opengis.net/ont/geosparql#> . | ||
@prefix dcat: <http://www.w3.org/ns/dcat#> . | ||
@prefix mr: <http://marineregions.org/ns/ontology#> . | ||
@prefix schema: <https://schema.org/> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
|
||
<http://marineregions.org/feed?page=2023-11-28T10%3A00%3A00Z%2F2023-11-28T11%3A00%3A00Z> | ||
a tree:Node ; | ||
tree:relation [ tree:node <http://marineregions.org/feed?page=2023-11-23T14%3A00%3A00Z%2F2023-11-23T15%3A00%3A00Z> ] ; | ||
ldes:retentionPolicy [ | ||
a ldes:LatestVersionSubset ; | ||
ldes:amount 1 ; | ||
ldes:versionKey ( dc:isVersionOf ) | ||
] . | ||
|
||
<http://marineregions.org/feed> | ||
a ldes:EventStream ; | ||
tree:shape [ | ||
a sh:NodeShape ; | ||
sh:nodeKind sh:IRI ; | ||
sh:property [ | ||
sh:datatype xsd:dateTime ; | ||
sh:minCount 1 ; | ||
sh:path dc:modified | ||
], [ | ||
sh:minCount 1 ; | ||
sh:nodeKind sh:IRI ; | ||
sh:path dc:isVersionOf | ||
], [ sh:path skos:note ], [ sh:path skos:historyNote ], [ | ||
sh:datatype gsp:wktLiteral ; | ||
sh:maxCount 1 ; | ||
sh:minCount 1 ; | ||
sh:path dcat:centroid | ||
], [ | ||
sh:datatype gsp:wktLiteral ; | ||
sh:maxCount 1 ; | ||
sh:minCount 0 ; | ||
sh:path dcat:bbox | ||
], [ | ||
sh:minCount 0 ; | ||
sh:nodekind sh:IRI ; | ||
sh:path mr:hasGeometry | ||
], [ | ||
sh:minCount 0 ; | ||
sh:node [ | ||
a sh:NodeShape ; | ||
sh:nodeKind sh:IRI ; | ||
sh:property [ | ||
sh:class schema:PropertyValue ; | ||
sh:maxCount 1 ; | ||
sh:minCount 1 ; | ||
sh:path schema:identifier | ||
], [ | ||
sh:maxCount 1 ; | ||
sh:minCount 1 ; | ||
sh:nodeKind sh:IRI ; | ||
sh:path schema:url | ||
] | ||
] ; | ||
sh:path skos:exactMatch | ||
], [ | ||
sh:datatype rdf:langString ; | ||
sh:minCount 1 ; | ||
sh:path skos:prefLabel | ||
], [ | ||
sh:datatype rdf:langString ; | ||
sh:minCount 0 ; | ||
sh:path skos:altLabel | ||
], [ | ||
sh:class mr:MRGeoObject ; | ||
sh:minCount 0 ; | ||
sh:nodeKind sh:IRI ; | ||
sh:path mr:isRelatedTo | ||
] ; | ||
sh:targetClass mr:MRGeoObject | ||
] ; | ||
tree:view <http://marineregions.org/feed?page=2023-11-28T10%3A00%3A00Z%2F2023-11-28T11%3A00%3A00Z> ; | ||
tree:member <http://marineregions.org/mrgid/63523?t=1701165742> . | ||
|
||
<http://marineregions.org/mrgid/63523?t=1701165742> | ||
dc:isVersionOf <http://marineregions.org/mrgid/63523> ; | ||
dc:modified "2023-11-28T10:02:22Z"^^xsd:dateTime . | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally hate foldernames with suffix-s
./config/ will do nicely
motivation: there is only one folder with that name (so it is singular :) -- , and all folders are meant to possibly contain multiple files ... so what gives?