-
Notifications
You must be signed in to change notification settings - Fork 2
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
cube package #202
Merged
cube package #202
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
582865a
feat: cube package with validation pipeline
giacomociti 957e8c6
add manifest
giacomociti b7df2d8
feat: SHACL report step
giacomociti 1506a10
fix stdout
giacomociti ae3e262
fix shacl report
giacomociti ace571f
use external sorting to avoid db timeout
giacomociti ecd68d4
query observations with construct
giacomociti 4582bea
doc: cube pipelines with package specific commans
giacomociti 1a264ac
Merge branch 'master' into cube-validation-sort
giacomociti 7c9871b
test cube validation pipeline
giacomociti 101949b
Merge branch 'master' into cube-validation-sort
giacomociti 68c034a
move cube operations from rdf package
giacomociti ec27cc8
fix lint
giacomociti c3feb14
fix: use pattern for command name
giacomociti 7cf0d65
Update packages/cube/package.json
giacomociti bfb6bda
Apply suggestions from code review
giacomociti de52160
fix syntax
giacomociti bb3b99b
more code review suggestions
giacomociti bf7af42
Update packages/cube/pipeline/cube-validation.ttl
giacomociti a32425d
split pipelines in multiple files
giacomociti 8287ed6
rename pipelines
giacomociti e0bab1a
Remove ENV dependency from Cube (#205)
tpluscode e69448b
fix: env in sort step
giacomociti 6c60476
refactor: no stdout
tpluscode c7e328a
refactor: reword
tpluscode bfb2f04
fix: pipelines must be readable
tpluscode f1c6548
fix: stdout and finalization on error
giacomociti e17114b
fix test
giacomociti e17e98f
fix test
giacomociti 47d5631
test pipeline options
giacomociti 7c59fe3
update reference
giacomociti c4277ee
test: avoid elvis, prepare tests
tpluscode 1dbb51f
refactor: default to 0 shape violations, don't fail pipeline when max…
tpluscode 66d1262
revert: fail at any number of errors
tpluscode 925e0e9
feat: handle `this.error` in sub-pipelines without overwriting first …
tpluscode 4c48eb4
Update clean-owls-think.md
tpluscode bbc237d
Merge pull request #207 from zazuko/report-improve
tpluscode File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"barnard59-core": minor | ||
--- | ||
|
||
Add support for "late errors" where step authors can call `context.error()` to avoid immediately breaking the pipeline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"barnard59-sparql": patch | ||
--- | ||
|
||
fix code link in manifest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
"barnard59-cube": major | ||
"barnard59-rdf": major | ||
--- | ||
|
||
Move cube operations from package `barnard59-rdf` to the new package `barnard59-cube`. | ||
|
||
|
||
```diff | ||
<#toObservation> a p:Step; | ||
code:implementedBy [ a code:EcmaScriptModule; | ||
- code:link <node:barnard59-rdf/cube.js#toObservation> | ||
+ code:link <node:barnard59-cube/cube.js#toObservation> | ||
]. | ||
|
||
<#buildCubeShape> a p:Step; | ||
code:implementedBy [ a code:EcmaScriptModule; | ||
- code:link <node:barnard59-rdf/cube.js#buildCubeShape> | ||
+ code:link <node:barnard59-code/cube.js#buildCubeShape> | ||
]. | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"barnard59-env": minor | ||
--- | ||
|
||
Added `cube` and `meta` namespaces |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"barnard59": patch | ||
--- | ||
|
||
include peer dependencies in manifest discovery |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ jobs: | |
package: | ||
- base | ||
- core | ||
- cube | ||
- csvw | ||
- formats | ||
- ftp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# barnard59-cube | ||
|
||
This package provides operations and commands for RDF cubes in Barnard59 Linked Data pipelines. | ||
The `manifest.ttl` file contains a full list of all operations included in this package. | ||
|
||
## Operations | ||
|
||
### `cube/buildCubeShape` | ||
|
||
TBD | ||
|
||
### `cube/toObservation` | ||
|
||
TBD | ||
|
||
|
||
## Commands | ||
|
||
## Cube validation | ||
|
||
The following pipelines retrieve and validate cube observations and their constraints. | ||
|
||
### fetch constraint | ||
|
||
Pipeline `fetch-constraint` queries a given SPARQL endpoint to retrieve | ||
a [concise bounded description](https://docs.stardog.com/query-stardog/#describe-queries) of the `cube:Constraint` part of a given cube. | ||
|
||
```bash | ||
npx barnard59 cube fetch-constraint \ | ||
--cube https://agriculture.ld.admin.ch/agroscope/PRIFm8t15/2 \ | ||
--endpoint https://int.lindas.admin.ch/query | ||
``` | ||
|
||
|
||
This pipeline is useful mainly for cubes published with [cube creator](https://github.com/zazuko/cube-creator) (if the cube definition is manually crafted, likely it's already available as a local file). | ||
|
||
|
||
### check constraint | ||
|
||
Pipeline `check-constraint` validates the input constraint against the shapes provided with the `profile` variable (the default profile is https://cube.link/latest/shape/standalone-constraint-constraint). | ||
|
||
The pipeline reads the constraint from `stdin`, allowing input from a local file (as in the following example) as well as from the output of the `fetch-constraint` pipeline (in most cases it's useful to have the constraint in a local file because it's needed also for the `check-observations` pipeline). | ||
|
||
```bash | ||
cat myConstraint.ttl \ | ||
| npx barnard59 cube check-constraint \ | ||
--profile https://cube.link/v0.1.0/shape/standalone-constraint-constraint | ||
``` | ||
SHACL reports for violations are written to `stdout`. | ||
|
||
|
||
### fetch observations | ||
|
||
Pipeline `fetch-observations` queries a given SPARQL endpoint to retrieve the observations of a given cube. | ||
|
||
```bash | ||
npx barnard59 cube fetch-observations \ | ||
--cube https://agriculture.ld.admin.ch/agroscope/PRIFm8t15/2 \ | ||
--endpoint https://int.lindas.admin.ch/query | ||
``` | ||
Results are written to `stdout`. | ||
|
||
### check observations | ||
|
||
Pipeline `check-observations` validates the input observations against the shapes provided with the `constraint` variable. | ||
|
||
The pipeline reads the observations from `stdin`, allowing input from a local file (as in the following example) as well as from the output of the `fetch-observations` pipeline. | ||
|
||
```bash | ||
cat myObservations.ttl \ | ||
| npx barnard59 cube check-observations \ | ||
--constraint myConstraint.ttl | ||
``` | ||
|
||
To enable validation, the pipeline adds to the constraint a `sh:targetClass` property with value `cube:Observation`, requiring that each observation has an explicit `rdf:type`. | ||
|
||
To leverage streaming, input is split and validated in little batches of adjustable size (the default is 50 and likely it's appropriate in most cases). This allows the validation of very big cubes because observations are not loaded in memory all at once. To ensure triples for the same observation are adjacent (hence processed in the same batch), the input is sorted by subject (and in case the input is large the sorting step relies on temporary local files). | ||
|
||
SHACL reports for violations are written to `stdout`. | ||
|
||
To limit the output size, there is also a `maxViolations` option to stop validation when the given number of violations is reached. | ||
|
||
### Known issues | ||
|
||
Command `check-constraint` may fail if there are `sh:in` constraints with too many values. |
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should add a changeset to update the CLI version
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.
done