SHACL¶
kurra.shacl ¶
SHACL functions.
validate ¶
validate(data: Path | Graph | list[Path] | list[Graph], shacl: Graph | Path | str | int, hide_warnings: bool = False) -> tuple[bool, Graph, str, Graph]
Validates a data graph using a shapes graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Path | Graph | list[Path] | list[Graph]
|
The path to an RDF data file, a graph, a list of Paths or a list of Graphs to validate. List items will be merged |
required |
shacl
|
Graph | Path | str | int
|
The SHACL shapes to validate with |
required |
Returns:
| Type | Description |
|---|---|
tuple[bool, Graph, str, Graph]
|
Tuple[bool, Graph, str, Graph]: The validation status, results graph, message and summary graph |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the ID of the SHACL validator is invalid |
RuntimeError
|
If the IRI of the SHACL validator cannot be resolved locally or against the Semantic Background's validators |
Source code in kurra/shacl.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
list_local_validators ¶
Lists SHACL validators - IRI & name - stored in the local system's calidator cache.
This function does not connect over the Internet.
Source code in kurra/shacl.py
sync_validators ¶
Checks the Semantic Background's read-only SPARQL Endpoint, currently https://fuseki.dev.kurrawong.ai/semback/sparql, for validators.
It then checks local storage, using list_local_calidators(), to see which, if any, of those validators are stored locally.
For any missing, it pulls down and stores a copy locally.
Source code in kurra/shacl.py
check_validator_known ¶
Checks first locally and then in the Semantic Background to if a validator, identified by IRI, is known
Source code in kurra/shacl.py
infer ¶
Applies rules to the data graph and returns a graph of calculated results
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Graph | Path | str
|
the data to apply the rules to |
required |
rules
|
Graph | Path | str
|
the rules to apply, in SHACL Rules SPARQL syntax |
required |
include_base
|
bool
|
whether to include the data triples in output |
False
|
Returns: