Skip to content
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

TypeScript declarations + clownface-shacl-path #121

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/dry-walls-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"rdf-validate-shacl": patch
---

Bundle TypeScript declarations
5 changes: 5 additions & 0 deletions .changeset/eleven-nails-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"rdf-validate-shacl": patch
---

Use [clownface-shacl-path](https://npm.im/clownface-shacl-path) for path traversals
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can have an unknown impact on performance which needs to be checked.

@ludovicm67, do you have an idea for a GH workflow job which would measure the time of a large dataset being validated so that we can compare if a PR does not decrease performance? I found https://github.com/benchmark-action/github-action-benchmark but it's not exactly what I have in mind

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tpluscode no, I don't have any idea yet for this.
If I found something relevant, I will share it with you :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, later yesterday I found a fork which should be more useful for PRs: https://github.com/openpgpjs/github-action-pull-request-benchmark

They simply check out master and PR branches and compare results. WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have any strong opinion on the tool to use for this topic, I would suggest that you go with it, and it in the future we find anything better, we can always do a switch.

Regarding the fork you mention, it seems to be a bit more dedicated for PR and compare with the default branch.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
coverage
.nyc_output
*.d.ts
20 changes: 10 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import ValidationEngine from './src/validation-engine.js'
/**
* Validates RDF data based on a set of RDF shapes.
*
* @param {DatasetCore} shapes - Dataset containing the SHACL shapes for validation
* @param {import('@rdfjs/types').DatasetCore} shapes - Dataset containing the SHACL shapes for validation
* @param {object} options - Validator options
* @param {DataFactory} options.factory - Optional RDFJS data factory
* @param {Number} options.maxErrors - Max number of errors before the engine
* @param {import('./src/defaultEnv.js').Environment} options.factory - Optional RDFJS data factory
* @param {number} options.maxErrors - Max number of errors before the engine
* stops. Defaults to finding all the errors.
*/
class SHACLValidator {
Expand All @@ -30,8 +30,8 @@ class SHACLValidator {
/**
* Validates the provided data graph against the provided shapes graph
*
* @param {DatasetCore} data - Dataset containing the data to validate
* @return {ValidationReport} - Result of the validation
* @param {import('@rdfjs/types').DatasetCore} data - Dataset containing the data to validate
* @return {import('./src/validation-report.js').default} - Result of the validation
*/
validate(data) {
this.$data = clownface({ dataset: data, factory: this.factory })
Expand All @@ -42,10 +42,10 @@ class SHACLValidator {
/**
* Validates the provided focus node against the provided shape
*
* @param {DatasetCore} data - Dataset containing the data to validate
* @param {Term} focusNode - Node to validate
* @param {Term} shapeNode - Shape used to validate the node. It must be present in the shapes graph.
* @returns {ValidationReport} - Result of the validation
* @param {import('@rdfjs/types').DatasetCore} data - Dataset containing the data to validate
* @param {import('@rdfjs/types').Term} focusNode - Node to validate
* @param {import('@rdfjs/types').Term} shapeNode - Shape used to validate the node. It must be present in the shapes graph.
* @returns {import('./src/validation-report.js').default} - Result of the validation
*/
validateNode(data, focusNode, shapeNode) {
this.$data = clownface({ dataset: data, factory: this.factory })
Expand All @@ -56,7 +56,7 @@ class SHACLValidator {
/**
* Load SHACL shapes constraints from dataset.
*
* @param {DatasetCore} shapes - Dataset containing the shapes for validation
* @param {import('@rdfjs/types').DatasetCore} shapes - Dataset containing the shapes for validation
*/
loadShapes(shapes) {
const shaclQuads = shaclVocabularyFactory({ factory: this.factory })
Expand Down
Loading