mustrd 0.3.1a5__tar.gz → 0.3.1a6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/PKG-INFO +86 -18
  2. mustrd-0.3.1a6/README.md +117 -0
  3. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/mustrdAnzo.py +15 -6
  4. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/spec_component.py +2 -4
  5. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/steprunner.py +0 -5
  6. mustrd-0.3.1a6/pyproject.toml +55 -0
  7. mustrd-0.3.1a5/README.md +0 -54
  8. mustrd-0.3.1a5/pyproject.toml +0 -55
  9. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/LICENSE +0 -0
  10. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/README.adoc +0 -0
  11. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/README.md +0 -0
  12. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/TestResult.py +0 -0
  13. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/__init__.py +0 -0
  14. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/anzo_utils.py +0 -0
  15. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/logger_setup.py +0 -0
  16. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/model/catalog-v001.xml +0 -0
  17. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/model/mustrdShapes.ttl +0 -0
  18. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/model/mustrdTestOntology.ttl +0 -0
  19. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/model/mustrdTestShapes.ttl +0 -0
  20. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/model/ontology.ttl +0 -0
  21. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/model/test-resources/resources.ttl +0 -0
  22. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/model/triplestoreOntology.ttl +0 -0
  23. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/model/triplestoreshapes.ttl +0 -0
  24. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/mustrd.py +0 -0
  25. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/mustrdGraphDb.py +0 -0
  26. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/mustrdRdfLib.py +0 -0
  27. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/mustrdTestPlugin.py +0 -0
  28. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/namespace.py +0 -0
  29. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/run.py +0 -0
  30. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/templates/md_ResultList_leaf_template.jinja +0 -0
  31. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/templates/md_ResultList_template.jinja +0 -0
  32. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/templates/md_stats_template.jinja +0 -0
  33. {mustrd-0.3.1a5 → mustrd-0.3.1a6}/mustrd/utils.py +0 -0
@@ -1,14 +1,19 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mustrd
3
- Version: 0.3.1a5
3
+ Version: 0.3.1a6
4
4
  Summary: A Spec By Example framework for RDF and SPARQL, Inspired by Cucumber.
5
5
  License: MIT
6
6
  Author: John Placek
7
7
  Author-email: john.placek@semanticpartners.com
8
- Requires-Python: >=3.10,<4.0
9
- Classifier: Programming Language :: Python
8
+ Requires-Python: >=3.11,<4.0
10
9
  Classifier: Framework :: Pytest
10
+ Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Natural Language :: English
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
12
17
  Classifier: Topic :: Software Development :: Quality Assurance
13
18
  Classifier: Topic :: Software Development :: Testing
14
19
  Classifier: Topic :: Utilities
@@ -34,13 +39,13 @@ Requires-Dist: urllib3 (==1.26.19)
34
39
  Project-URL: Repository, https://github.com/Semantic-partners/mustrd
35
40
  Description-Content-Type: text/markdown
36
41
 
37
- # mustrd
42
+ # MustRD
38
43
 
39
44
  **"MustRD: Validate your SPARQL queries and transformations with precision and confidence, using BDD and Given-When-Then principles."**
40
45
 
41
- [<img src="https://github.com/Semantic-partners/mustrd/raw/python-coverage-comment-action-data/badge.svg?sanitize=true" alt="coverage badge">](https://github.com/Semantic-partners/mustrd/tree/python-coverage-comment-action-data)
46
+ [![Coverage Badge](https://github.com/Semantic-partners/mustrd/raw/python-coverage-comment-action-data/badge.svg?sanitize=true)](https://github.com/Semantic-partners/mustrd/tree/python-coverage-comment-action-data)
42
47
 
43
- ### Why?
48
+ ## Why?
44
49
 
45
50
  SPARQL is a powerful query language for RDF data, but how can you ensure your queries and transformations are doing what you intend? Whether you're working on a pipeline or a standalone query, certainty is key.
46
51
 
@@ -48,11 +53,11 @@ While RDF and SPARQL offer great flexibility, we noticed a gap in tooling to val
48
53
 
49
54
  With MustRD, you can:
50
55
 
51
- * Define data scenarios and verify that queries produce the expected results.
52
- * Test edge cases to ensure your queries remain reliable.
53
- * Isolate small SPARQL enrichment or transformation steps and confirm you're only inserting what you intend.
56
+ - Define data scenarios and verify that queries produce the expected results.
57
+ - Test edge cases to ensure your queries remain reliable.
58
+ - Isolate small SPARQL enrichment or transformation steps and confirm you're only inserting what you intend.
54
59
 
55
- ### What?
60
+ ## What?
56
61
 
57
62
  MustRD is a Spec-By-Example ontology with a reference Python implementation, inspired by tools like Cucumber. It uses the Given-When-Then approach to define and validate SPARQL queries and transformations.
58
63
 
@@ -62,23 +67,85 @@ MustRD is designed to be triplestore/SPARQL engine agnostic, leveraging open sta
62
67
 
63
68
  MustRD is not an alternative to SHACL. While SHACL validates data structures, MustRD focuses on validating data transformations and query results.
64
69
 
65
- ### How?
70
+ ## How?
66
71
 
67
72
  You define your specs in Turtle (`.ttl`) or TriG (`.trig`) files using the Given-When-Then approach:
68
73
 
69
- * **Given**: Define the starting dataset.
70
- * **When**: Specify the action (e.g., a SPARQL query).
71
- * **Then**: Outline the expected results.
74
+ - **Given**: Define the starting dataset.
75
+ - **When**: Specify the action (e.g., a SPARQL query).
76
+ - **Then**: Outline the expected results.
72
77
 
73
78
  Depending on the type of SPARQL query (CONSTRUCT, SELECT, INSERT/DELETE), MustRD runs the query and compares the results against the expectations defined in the spec.
74
79
 
75
80
  Expectations can also be defined as:
76
81
 
77
- * INSERT queries.
78
- * SELECT queries.
79
- * Higher-order expectation languages, similar to those used in various platforms.
82
+ - INSERT queries.
83
+ - SELECT queries.
84
+ - Higher-order expectation languages, similar to those used in various platforms.
85
+
86
+ ## Example
87
+
88
+ ### Configuration File
89
+
90
+ You'll have a configuration `.ttl` file, which acts as a suite of tests. It tells MustRD where to look for test specifications and any triplestore configurations you might have:
91
+
92
+ ```ttl
93
+ :test_example a :MustrdTest;
94
+ :hasSpecPath "test/specs/";
95
+ :hasDataPath "test/data/";
96
+ :hasPytestPath "example";
97
+ :triplestoreSpecPath "test/triplestore_config/triplestores.ttl";
98
+ :filterOnTripleStore triplestore:example_test .
99
+ ```
100
+
101
+ ### Test Specification
102
+
103
+ In the directory specified by `:hasSpecPath`, you'll have one or more `.mustrd.ttl` files. These can be organized in a directory structure. MustRD collects them and reports results to your test runner.
104
+
105
+ ```ttl
106
+ :test_example :given [ a :FileDataset ;
107
+ :file "test/data/given.ttl" ] ;
108
+ :when [ a :TextSparqlSource ;
109
+ :queryText "SELECT ?s ?p ?o WHERE { ?s ?p ?o }" ;
110
+ :queryType :SelectSparql ] ;
111
+ :then [ a :OrderedTableDataset ;
112
+ :hasRow [ :variable "s" ; :boundValue "example:subject" ;
113
+ :variable "p" ; :boundValue "example:predicate" ;
114
+ :variable "o" ; :boundValue "example:object" ] ].
115
+ ```
80
116
 
81
- ### When?
117
+ And you will have a `'test/data/given.ttl'` which contains the given ttl.
118
+
119
+ ```ttl
120
+ example:subject example:predicate example:object .
121
+ ```
122
+
123
+ ### Running Tests
124
+
125
+ Run the test using the MustRD Pytest plugin:
126
+
127
+ ```bash
128
+ poetry run pytest --mustrd --config=test/mustrd_configuration.ttl --md=render/github_job_summary.md
129
+ ```
130
+
131
+ This will validate your SPARQL queries against the defined dataset and expected results, ensuring your transformations behave as intended.
132
+
133
+ You can refer to SPARQL inline, in files, or in Anzo Graphmarts, Steps, or Layers. See `GETSTARTED.adoc` for more details.
134
+
135
+ #### Integrating with Visual Studio Code (vscode)
136
+ We have a pytest plugin.
137
+ 1. Choose a python interpreter (probably a venv)
138
+ 2. `pip install mustrd ` in it.
139
+ 3. add to your settings.json
140
+ ```json
141
+ "python.testing.pytestArgs": [
142
+ "--mustrd", "--md=junit/github_job_summary.md", "--config=test/test_config_local.ttl"
143
+ ],
144
+ ```
145
+ 4. VS Code should auto discover your tests and they'll show up in the flask icon 'tab'.
146
+ ![alt text](image.png)
147
+
148
+ ## When?
82
149
 
83
150
  MustRD is a work in progress, built to meet the needs of our projects across multiple clients and vendor stacks. While we find it useful, it may not meet your needs out of the box.
84
151
 
@@ -89,3 +156,4 @@ We invite you to try it, raise issues, or contribute via pull requests. If you n
89
156
  Semantic Partners is a specialist consultancy in Semantic Technology. If you need more support, contact us at info@semanticpartners.com or mustrd@semanticpartners.com.
90
157
 
91
158
 
159
+
@@ -0,0 +1,117 @@
1
+ # MustRD
2
+
3
+ **"MustRD: Validate your SPARQL queries and transformations with precision and confidence, using BDD and Given-When-Then principles."**
4
+
5
+ [![Coverage Badge](https://github.com/Semantic-partners/mustrd/raw/python-coverage-comment-action-data/badge.svg?sanitize=true)](https://github.com/Semantic-partners/mustrd/tree/python-coverage-comment-action-data)
6
+
7
+ ## Why?
8
+
9
+ SPARQL is a powerful query language for RDF data, but how can you ensure your queries and transformations are doing what you intend? Whether you're working on a pipeline or a standalone query, certainty is key.
10
+
11
+ While RDF and SPARQL offer great flexibility, we noticed a gap in tooling to validate their behavior. We missed the robust testing frameworks available in imperative programming languages that help ensure your code works as expected.
12
+
13
+ With MustRD, you can:
14
+
15
+ - Define data scenarios and verify that queries produce the expected results.
16
+ - Test edge cases to ensure your queries remain reliable.
17
+ - Isolate small SPARQL enrichment or transformation steps and confirm you're only inserting what you intend.
18
+
19
+ ## What?
20
+
21
+ MustRD is a Spec-By-Example ontology with a reference Python implementation, inspired by tools like Cucumber. It uses the Given-When-Then approach to define and validate SPARQL queries and transformations.
22
+
23
+ MustRD is designed to be triplestore/SPARQL engine agnostic, leveraging open standards to ensure compatibility across different platforms.
24
+
25
+ ### What it is NOT
26
+
27
+ MustRD is not an alternative to SHACL. While SHACL validates data structures, MustRD focuses on validating data transformations and query results.
28
+
29
+ ## How?
30
+
31
+ You define your specs in Turtle (`.ttl`) or TriG (`.trig`) files using the Given-When-Then approach:
32
+
33
+ - **Given**: Define the starting dataset.
34
+ - **When**: Specify the action (e.g., a SPARQL query).
35
+ - **Then**: Outline the expected results.
36
+
37
+ Depending on the type of SPARQL query (CONSTRUCT, SELECT, INSERT/DELETE), MustRD runs the query and compares the results against the expectations defined in the spec.
38
+
39
+ Expectations can also be defined as:
40
+
41
+ - INSERT queries.
42
+ - SELECT queries.
43
+ - Higher-order expectation languages, similar to those used in various platforms.
44
+
45
+ ## Example
46
+
47
+ ### Configuration File
48
+
49
+ You'll have a configuration `.ttl` file, which acts as a suite of tests. It tells MustRD where to look for test specifications and any triplestore configurations you might have:
50
+
51
+ ```ttl
52
+ :test_example a :MustrdTest;
53
+ :hasSpecPath "test/specs/";
54
+ :hasDataPath "test/data/";
55
+ :hasPytestPath "example";
56
+ :triplestoreSpecPath "test/triplestore_config/triplestores.ttl";
57
+ :filterOnTripleStore triplestore:example_test .
58
+ ```
59
+
60
+ ### Test Specification
61
+
62
+ In the directory specified by `:hasSpecPath`, you'll have one or more `.mustrd.ttl` files. These can be organized in a directory structure. MustRD collects them and reports results to your test runner.
63
+
64
+ ```ttl
65
+ :test_example :given [ a :FileDataset ;
66
+ :file "test/data/given.ttl" ] ;
67
+ :when [ a :TextSparqlSource ;
68
+ :queryText "SELECT ?s ?p ?o WHERE { ?s ?p ?o }" ;
69
+ :queryType :SelectSparql ] ;
70
+ :then [ a :OrderedTableDataset ;
71
+ :hasRow [ :variable "s" ; :boundValue "example:subject" ;
72
+ :variable "p" ; :boundValue "example:predicate" ;
73
+ :variable "o" ; :boundValue "example:object" ] ].
74
+ ```
75
+
76
+ And you will have a `'test/data/given.ttl'` which contains the given ttl.
77
+
78
+ ```ttl
79
+ example:subject example:predicate example:object .
80
+ ```
81
+
82
+ ### Running Tests
83
+
84
+ Run the test using the MustRD Pytest plugin:
85
+
86
+ ```bash
87
+ poetry run pytest --mustrd --config=test/mustrd_configuration.ttl --md=render/github_job_summary.md
88
+ ```
89
+
90
+ This will validate your SPARQL queries against the defined dataset and expected results, ensuring your transformations behave as intended.
91
+
92
+ You can refer to SPARQL inline, in files, or in Anzo Graphmarts, Steps, or Layers. See `GETSTARTED.adoc` for more details.
93
+
94
+ #### Integrating with Visual Studio Code (vscode)
95
+ We have a pytest plugin.
96
+ 1. Choose a python interpreter (probably a venv)
97
+ 2. `pip install mustrd ` in it.
98
+ 3. add to your settings.json
99
+ ```json
100
+ "python.testing.pytestArgs": [
101
+ "--mustrd", "--md=junit/github_job_summary.md", "--config=test/test_config_local.ttl"
102
+ ],
103
+ ```
104
+ 4. VS Code should auto discover your tests and they'll show up in the flask icon 'tab'.
105
+ ![alt text](image.png)
106
+
107
+ ## When?
108
+
109
+ MustRD is a work in progress, built to meet the needs of our projects across multiple clients and vendor stacks. While we find it useful, it may not meet your needs out of the box.
110
+
111
+ We invite you to try it, raise issues, or contribute via pull requests. If you need custom features, contact us for consultancy rates, and we may prioritize your request.
112
+
113
+ ## Support
114
+
115
+ Semantic Partners is a specialist consultancy in Semantic Technology. If you need more support, contact us at info@semanticpartners.com or mustrd@semanticpartners.com.
116
+
117
+
@@ -122,8 +122,11 @@ def get_query_from_step(triple_store: dict, query_step_uri: URIRef) -> str:
122
122
  ?stepUri a <http://cambridgesemantics.com/ontologies/Graphmarts#Step>;
123
123
  <http://cambridgesemantics.com/ontologies/Graphmarts#transformQuery> ?query
124
124
  }}"""
125
- return json_to_dictlist(query_configuration(anzo_config=triple_store, query=query))[0]['query']
126
-
125
+ result = json_to_dictlist(query_configuration(anzo_config=triple_store, query=query))
126
+ if len(result) == 0:
127
+ raise FileNotFoundError(
128
+ f"Querynot found for step {query_step_uri}")
129
+ return result[0].get("query")
127
130
 
128
131
  def get_queries_from_templated_step(triple_store: dict, query_step_uri: URIRef) -> dict:
129
132
  query = f"""SELECT ?param_query ?query_template WHERE {{
@@ -133,8 +136,11 @@ def get_queries_from_templated_step(triple_store: dict, query_step_uri: URIRef)
133
136
  <http://cambridgesemantics.com/ontologies/Graphmarts#template> ?query_template .
134
137
  }}
135
138
  """
136
- return json_to_dictlist(query_configuration(anzo_config=triple_store, query=query))[0]
137
-
139
+ result = json_to_dictlist(query_configuration(anzo_config=triple_store, query=query))
140
+ if len(result) == 0:
141
+ raise FileNotFoundError(
142
+ f"Templated query not found for {query_step_uri}")
143
+ return result[0]
138
144
 
139
145
  def get_queries_for_layer(triple_store: dict, graphmart_layer_uri: URIRef):
140
146
  query = f"""PREFIX graphmarts: <http://cambridgesemantics.com/ontologies/Graphmarts#>
@@ -153,8 +159,11 @@ SELECT ?query ?param_query ?query_template
153
159
  . }}
154
160
  }}
155
161
  ORDER BY ?index"""
156
- return json_to_dictlist(query_configuration(anzo_config=triple_store, query=query))
157
-
162
+ result = json_to_dictlist(query_configuration(anzo_config=triple_store, query=query))
163
+ if len(result) == 0:
164
+ raise FileNotFoundError(
165
+ f"Queries not found for graphmart layer {graphmart_layer_uri}")
166
+ return result
158
167
 
159
168
  def upload_given(triple_store: dict, given: Graph):
160
169
  logging.debug(f"upload_given {triple_store} {given}")
@@ -848,9 +848,7 @@ def _get_spec_component_spade_edn_group_source_when(spec_component_details: Spec
848
848
 
849
849
  if step_type == Keyword("sparql-file"):
850
850
  try:
851
- # Resolve the file path relative to the EDN file's location
852
- resolved_step_file = Path(absolute_file_path).parent / step_file
853
- with open(resolved_step_file, 'r') as sparql_file:
851
+ with open(step_file, 'r') as sparql_file:
854
852
  sparql_query = sparql_file.read()
855
853
 
856
854
  # Assume the individuals are ConstructSparql queries
@@ -862,7 +860,7 @@ def _get_spec_component_spade_edn_group_source_when(spec_component_details: Spec
862
860
  )
863
861
  when_specs.append(when_spec)
864
862
  except FileNotFoundError:
865
- raise ValueError(f"SPARQL file not found: {resolved_step_file}")
863
+ raise ValueError(f"SPARQL file not found: {step_file}")
866
864
 
867
865
  spec_component.file = str(absolute_file_path)
868
866
  spec_component.groupId = group_id
@@ -185,17 +185,12 @@ def _spade_edn_group_source(spec_uri: URIRef, triple_store: dict, when: SpadeEdn
185
185
  def _spade_edn_group_source(spec_uri: URIRef, triple_store: dict, when: SpadeEdnGroupSourceWhenSpec):
186
186
  log.info(f"Running SpadeEdnGroupSource for {spec_uri} using {triple_store}")
187
187
 
188
- edn_file_dir = os.path.dirname(when.file) # Get the directory of the EDN file
189
188
  merged_graph = Graph()
190
189
 
191
190
  # Iterate over the list of WhenSpec objects in `when.value`
192
191
  for step_when_spec in when.value:
193
192
  try:
194
193
  if step_when_spec.queryType == MUST.UpdateSparql:
195
- # Resolve file paths relative to the EDN file
196
- if hasattr(step_when_spec, 'filepath'):
197
- step_when_spec.filepath = os.path.join(edn_file_dir, step_when_spec.filepath)
198
-
199
194
  log.info(f"Dispatching run_when for UpdateSparql step: {step_when_spec}")
200
195
  query_result = run_when_impl(spec_uri, triple_store, step_when_spec)
201
196
  log.info(f"Executed SPARQL query: {query_result}")
@@ -0,0 +1,55 @@
1
+ [tool.poetry]
2
+ name = "mustrd"
3
+ version = "0.3.1a6"
4
+ description = "A Spec By Example framework for RDF and SPARQL, Inspired by Cucumber."
5
+ authors = ["John Placek <john.placek@semanticpartners.com>",
6
+ "Juliane Piñeiro-Winkler <juliane.pineiro-winkler@semanticpartners.com>",
7
+ "Aymeric Picou <aymeric.picou@semanticpartners.com>",
8
+ "Lance Paine <lance.paine@semanticpartners.com>",
9
+ "Andrew Large <andy.large@semanticpartners.com>", ]
10
+ classifiers = [
11
+ "Programming Language :: Python",
12
+ "Framework :: Pytest",
13
+ "Natural Language :: English",
14
+ "Topic :: Software Development :: Quality Assurance",
15
+ "Topic :: Software Development :: Testing",
16
+ "Topic :: Utilities",
17
+ ]
18
+ readme = "README.md"
19
+ license = "MIT License"
20
+ repository = "https://github.com/Semantic-partners/mustrd"
21
+
22
+ [tool.poetry.dependencies]
23
+ python = "^3.11"
24
+ rdflib = "^7.1.3"
25
+ pytest = "^7.2.0"
26
+ pandas = "^2.0"
27
+ numpy = "~1.26.0"
28
+ multimethods-py = "^0.5.3"
29
+ colorlog = "^6.7.0"
30
+ requests = "^2.28.2"
31
+ tabulate = "^0.9.0"
32
+ beautifulsoup4 = "^4.11.1"
33
+ openpyxl = "^3.1.2"
34
+ toml = "^0.10.2"
35
+ pyshacl="^0.30.0"
36
+ tomli = "^2.0.1"
37
+ urllib3 = "1.26.19"
38
+ flake8 = "7.0.0"
39
+ coverage = "7.4.3"
40
+ colorama = "0.4.6"
41
+ Jinja2 = "3.1.5"
42
+ edn-format = "^0.7.5"
43
+
44
+
45
+ [tool.poetry.dev-dependencies]
46
+
47
+ [tool.poetry.group.dev.dependencies]
48
+ autopep8 = "^2.0.2"
49
+
50
+ [build-system]
51
+ requires = ["poetry-core>=1.0.0"]
52
+ build-backend = "poetry.core.masonry.api"
53
+
54
+ [tool.poetry.plugins.pytest11]
55
+ mustrd_plugin = "mustrd.mustrdTestPlugin"
mustrd-0.3.1a5/README.md DELETED
@@ -1,54 +0,0 @@
1
- # mustrd
2
-
3
- **"MustRD: Validate your SPARQL queries and transformations with precision and confidence, using BDD and Given-When-Then principles."**
4
-
5
- [<img src="https://github.com/Semantic-partners/mustrd/raw/python-coverage-comment-action-data/badge.svg?sanitize=true" alt="coverage badge">](https://github.com/Semantic-partners/mustrd/tree/python-coverage-comment-action-data)
6
-
7
- ### Why?
8
-
9
- SPARQL is a powerful query language for RDF data, but how can you ensure your queries and transformations are doing what you intend? Whether you're working on a pipeline or a standalone query, certainty is key.
10
-
11
- While RDF and SPARQL offer great flexibility, we noticed a gap in tooling to validate their behavior. We missed the robust testing frameworks available in imperative programming languages that help ensure your code works as expected.
12
-
13
- With MustRD, you can:
14
-
15
- * Define data scenarios and verify that queries produce the expected results.
16
- * Test edge cases to ensure your queries remain reliable.
17
- * Isolate small SPARQL enrichment or transformation steps and confirm you're only inserting what you intend.
18
-
19
- ### What?
20
-
21
- MustRD is a Spec-By-Example ontology with a reference Python implementation, inspired by tools like Cucumber. It uses the Given-When-Then approach to define and validate SPARQL queries and transformations.
22
-
23
- MustRD is designed to be triplestore/SPARQL engine agnostic, leveraging open standards to ensure compatibility across different platforms.
24
-
25
- ### What it is NOT
26
-
27
- MustRD is not an alternative to SHACL. While SHACL validates data structures, MustRD focuses on validating data transformations and query results.
28
-
29
- ### How?
30
-
31
- You define your specs in Turtle (`.ttl`) or TriG (`.trig`) files using the Given-When-Then approach:
32
-
33
- * **Given**: Define the starting dataset.
34
- * **When**: Specify the action (e.g., a SPARQL query).
35
- * **Then**: Outline the expected results.
36
-
37
- Depending on the type of SPARQL query (CONSTRUCT, SELECT, INSERT/DELETE), MustRD runs the query and compares the results against the expectations defined in the spec.
38
-
39
- Expectations can also be defined as:
40
-
41
- * INSERT queries.
42
- * SELECT queries.
43
- * Higher-order expectation languages, similar to those used in various platforms.
44
-
45
- ### When?
46
-
47
- MustRD is a work in progress, built to meet the needs of our projects across multiple clients and vendor stacks. While we find it useful, it may not meet your needs out of the box.
48
-
49
- We invite you to try it, raise issues, or contribute via pull requests. If you need custom features, contact us for consultancy rates, and we may prioritize your request.
50
-
51
- ## Support
52
-
53
- Semantic Partners is a specialist consultancy in Semantic Technology. If you need more support, contact us at info@semanticpartners.com or mustrd@semanticpartners.com.
54
-
@@ -1,55 +0,0 @@
1
- [project]
2
- name = "mustrd"
3
- version = "0.3.1a5"
4
- description = "A Spec By Example framework for RDF and SPARQL, Inspired by Cucumber."
5
- authors = [
6
- { name = "John Placek", email = "john.placek@semanticpartners.com" },
7
- { name = "Juliane Piñeiro-Winkler", email = "juliane.pineiro-winkler@semanticpartners.com" },
8
- { name = "Aymeric Picou", email = "aymeric.picou@semanticpartners.com" },
9
- { name = "Lance Paine", email = "lance.paine@semanticpartners.com" },
10
- { name = "Andrew Large", email = "andy.large@semanticpartners.com" },
11
- ]
12
- classifiers = [
13
- "Programming Language :: Python",
14
- "Framework :: Pytest",
15
- "Natural Language :: English",
16
- "Topic :: Software Development :: Quality Assurance",
17
- "Topic :: Software Development :: Testing",
18
- "Topic :: Utilities",
19
- ]
20
- readme = "README.md"
21
- license = "MIT License"
22
- urls = {"repository" = "https://github.com/Semantic-partners/mustrd"}
23
- entry-points = {"pytest11" = {"mustrd_plugin" = "mustrd.mustrdTestPlugin"}}
24
-
25
- [tool.poetry.dependencies]
26
- python = ">=3.10,<4.0"
27
- rdflib = "^7.1.3"
28
- pytest = "^7.2.0"
29
- pandas = "^2.0"
30
- numpy = "~1.26.0"
31
- multimethods-py = "^0.5.3"
32
- colorlog = "^6.7.0"
33
- requests = "^2.28.2"
34
- tabulate = "^0.9.0"
35
- beautifulsoup4 = "^4.11.1"
36
- openpyxl = "^3.1.2"
37
- toml = "^0.10.2"
38
- pyshacl="^0.30.0"
39
- tomli = "^2.0.1"
40
- urllib3 = "1.26.19"
41
- flake8 = "7.0.0"
42
- coverage = "7.4.3"
43
- colorama = "0.4.6"
44
- Jinja2 = "3.1.5"
45
- edn-format = "^0.7.5"
46
-
47
-
48
- [tool.poetry.dev-dependencies]
49
-
50
- [tool.poetry.group.dev.dependencies]
51
- autopep8 = "^2.0.2"
52
-
53
- [build-system]
54
- requires = ["poetry-core>=1.0.0"]
55
- build-backend = "poetry.core.masonry.api"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes