Skip to content

Commit

Permalink
Merge 4190f04 into a6f18c4
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleysommer committed Oct 14, 2020
2 parents a6f18c4 + 4190f04 commit 6e607d4
Show file tree
Hide file tree
Showing 49 changed files with 2,841 additions and 259 deletions.
40 changes: 40 additions & 0 deletions FEATURES.md
Expand Up @@ -160,6 +160,39 @@
| `sh:TripleRule` | [][AFTripleRule] | ![status-complete] | |
| `sh:SPARQLRule` | [][AFSPARQLRule] | ![status-complete] | |

# SHACL-JS [spec](https://www.w3.org/TR/shacl-js/)

The SHACL-JS features are implemented behind a Python "extras" feature.
To enable it, you must install PySHACL using PIP with the extras included like `pyshacl[js]`

### [Javascript-based Constraints](https://www.w3.org/TR/shacl-js/#js-constraints)
| Parameter | Link | Status | Comments |
|:---------- |:------: |:-----------------: |:------ |
| `sh:js` | [][JSConstraintValidation] | ![status-complete] | |

### [Javascript-based Constraints-Components](https://www.w3.org/TR/shacl-js/#js-components)
| Parameter | Link | Status | Comments |
|:---------- |:------: |:-----------------: |:------ |
| `sh:validator` | [][JSConstraintComponentValidation] | ![status-complete] | |
| `sh:JSValidator` | [][JSConstraintComponentValidation] | ![status-complete] | |

### [Javascript-based SHACL Functions](https://www.w3.org/TR/shacl-js/#js-functions)
| Parameter | Link | Status | Comments |
|:---------- |:------: |:-----------------: |:------ |
| `sh:JSFunction` | [][JSFunctionsSyntax] | ![status-complete] | |
| `sh:parameter` | [][JSFunctionsSyntax] | ![status-complete] | |

### [Javascript-based SHACL Rules](https://www.w3.org/TR/shacl-js/#rules)
| Parameter | Link | Status | Comments |
|:---------- |:------: |:-----------------: |:------ |
| `sh:JSRule` | [][JSRulesExecution] | ![status-complete] | |

### [Javascript-based Custom Targets](https://www.w3.org/TR/shacl-js/#targets)
| Parameter | Link | Status | Comments |
|:---------- |:------: |:-----------------: |:------ |
| `sh:JSTarget` | [][JSTarget] | ![status-complete] | |
| `sh:JSTargetType` | [][JSTargetType] | ![status-complete] | |


# Implementation Notes

Expand Down Expand Up @@ -240,3 +273,10 @@
[AFEntailment]: https://www.w3.org/TR/shacl-af/#Rules
[AFTripleRule]: https://www.w3.org/TR/shacl-af/#TripleRule
[AFSPARQLRule]: https://www.w3.org/TR/shacl-af/#SPARQLRule

[JSConstraintValidation]: https://www.w3.org/TR/shacl-js/#js-constraints-validation
[JSConstraintComponentValidation]: https://www.w3.org/TR/shacl-js/#validation-of-javascript-based-constraint-components
[JSFunctionsSyntax]: https://www.w3.org/TR/shacl-js/#syntax-and-semantics-of-javascript-based-functions
[JSRulesExecution]: https://www.w3.org/TR/shacl-js/#rules-execution
[JSTarget]: https://www.w3.org/TR/shacl-js/#JSTarget
[JSTargetType]: https://www.w3.org/TR/shacl-js/#JSTargetType
3 changes: 1 addition & 2 deletions MANIFEST.in
Expand Up @@ -6,6 +6,5 @@ include pyshacl/assets/*.pickle
include pyshacl/*.spec
include test/*.py
include test/issues/*.py
recursive-include test/resources *.ttl
recursive-include test/resources *.ttl *.js
recursive-include docs *.txt *.md

9 changes: 6 additions & 3 deletions README.md
Expand Up @@ -34,7 +34,7 @@ $ deactivate
For command line use:
_(these example commandline instructions are for a Linux/Unix based OS)_
```bash
pyshacl -s /path/to/shapesGraph.ttl -m -i rdfs -a -f human /path/to/dataGraph.ttl
pyshacl -s /path/to/shapesGraph.ttl -m -i rdfs -a -j -f human /path/to/dataGraph.ttl
```
Where
- `-s` is an (optional) path to the shapes graph to use
Expand All @@ -43,6 +43,7 @@ Where
- `-f` is the ValidationReport output format (`human` = human-readable validation report)
- `-m` enable the meta-shacl feature
- `-a` enable SHACL Advanced Features
- `-j` enable SHACL-JS Features (if `pyhsacl[js]` is installed)

System exit codes are:
`0` = DataGraph is Conformant
Expand All @@ -53,7 +54,7 @@ System exit codes are:
Full CLI Usage options:
```bash
usage: pyshacl [-h] [-s [SHACL]] [-e [ONT]] [-i {none,rdfs,owlrl,both}] [-m]
[--imports] [--abort] [-a] [-d] [-f {human,turtle,xml,json-ld,nt,n3}]
[--imports] [--abort] [-a] [-j] [-d] [-f {human,turtle,xml,json-ld,nt,n3}]
[-df {auto,turtle,xml,json-ld,nt,n3}]
[-sf {auto,turtle,xml,json-ld,nt,n3}]
[-ef {auto,turtle,xml,json-ld,nt,n3}] [-V] [-o [OUTPUT]]
Expand All @@ -80,6 +81,7 @@ optional arguments:
--imports Allow import of sub-graphs defined in statements with
owl:imports.
-a, --advanced Enable support for SHACL Advanced Features.
-j, --js Enable support for SHACL-JS Features.
--abort Abort on first error.
-d, --debug Output additional runtime messages, including violations that didn\'t
lead to non-conformance.
Expand All @@ -104,7 +106,7 @@ For basic use of this module, you can just call the `validate` function of the `
```
from pyshacl import validate
r = validate(data_graph, shacl_graph=sg, ont_graph=og, inference='rdfs', abort_on_error=False, meta_shacl=False, advanced=False, debug=False)
r = validate(data_graph, shacl_graph=sg, ont_graph=og, inference='rdfs', abort_on_error=False, meta_shacl=False, advanced=False, js=False, debug=False)
conforms, results_graph, results_text = r
```
Expand All @@ -117,6 +119,7 @@ Options are 'rdfs', 'owlrl', 'both', or 'none'. The default is 'none'.
* `abort_on_error` (optional) a Python `bool` value to indicate whether or not the program should abort after encountering a validation error or to continue. Default is to continue.
* `meta_shacl` (optional) a Python `bool` value to indicate whether or not the program should enable the Meta-SHACL feature. Default is False.
* `advanced`: (optional) a Python `bool` value to enable SHACL Advanced Features
* `js`: (optional) a Python `bool` value to enable SHACL-JS Features (if `pyshacl[js]` is installed)
* `debug` (optional) a Python `bool` value to indicate whether or not the program should emit debugging output text, including violations that didn't lead to non-conformance overall. So when debug is True don't judge conformance by absense of violation messages. Default is False.
Some other optional keyword variables available available on the `validate` function:
Expand Down

0 comments on commit 6e607d4

Please sign in to comment.