mustrd 0.3.1a6__tar.gz → 0.3.1a8__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.1a6 → mustrd-0.3.1a8}/PKG-INFO +18 -86
  2. mustrd-0.3.1a8/README.md +54 -0
  3. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/mustrdAnzo.py +6 -15
  4. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/spec_component.py +4 -2
  5. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/steprunner.py +5 -0
  6. mustrd-0.3.1a8/pyproject.toml +55 -0
  7. mustrd-0.3.1a6/README.md +0 -117
  8. mustrd-0.3.1a6/pyproject.toml +0 -55
  9. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/LICENSE +0 -0
  10. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/README.adoc +0 -0
  11. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/README.md +0 -0
  12. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/TestResult.py +0 -0
  13. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/__init__.py +0 -0
  14. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/anzo_utils.py +0 -0
  15. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/logger_setup.py +0 -0
  16. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/model/catalog-v001.xml +0 -0
  17. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/model/mustrdShapes.ttl +0 -0
  18. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/model/mustrdTestOntology.ttl +0 -0
  19. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/model/mustrdTestShapes.ttl +0 -0
  20. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/model/ontology.ttl +0 -0
  21. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/model/test-resources/resources.ttl +0 -0
  22. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/model/triplestoreOntology.ttl +0 -0
  23. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/model/triplestoreshapes.ttl +0 -0
  24. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/mustrd.py +0 -0
  25. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/mustrdGraphDb.py +0 -0
  26. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/mustrdRdfLib.py +0 -0
  27. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/mustrdTestPlugin.py +0 -0
  28. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/namespace.py +0 -0
  29. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/run.py +0 -0
  30. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/templates/md_ResultList_leaf_template.jinja +0 -0
  31. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/templates/md_ResultList_template.jinja +0 -0
  32. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/templates/md_stats_template.jinja +0 -0
  33. {mustrd-0.3.1a6 → mustrd-0.3.1a8}/mustrd/utils.py +0 -0
@@ -1,19 +1,14 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mustrd
3
- Version: 0.3.1a6
3
+ Version: 0.3.1a8
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.11,<4.0
8
+ Requires-Python: >=3.10,<4.0
9
+ Classifier: Programming Language :: Python
9
10
  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
17
12
  Classifier: Topic :: Software Development :: Quality Assurance
18
13
  Classifier: Topic :: Software Development :: Testing
19
14
  Classifier: Topic :: Utilities
@@ -39,13 +34,13 @@ Requires-Dist: urllib3 (==1.26.19)
39
34
  Project-URL: Repository, https://github.com/Semantic-partners/mustrd
40
35
  Description-Content-Type: text/markdown
41
36
 
42
- # MustRD
37
+ # mustrd
43
38
 
44
39
  **"MustRD: Validate your SPARQL queries and transformations with precision and confidence, using BDD and Given-When-Then principles."**
45
40
 
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)
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)
47
42
 
48
- ## Why?
43
+ ### Why?
49
44
 
50
45
  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.
51
46
 
@@ -53,11 +48,11 @@ While RDF and SPARQL offer great flexibility, we noticed a gap in tooling to val
53
48
 
54
49
  With MustRD, you can:
55
50
 
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.
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.
59
54
 
60
- ## What?
55
+ ### What?
61
56
 
62
57
  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.
63
58
 
@@ -67,85 +62,23 @@ MustRD is designed to be triplestore/SPARQL engine agnostic, leveraging open sta
67
62
 
68
63
  MustRD is not an alternative to SHACL. While SHACL validates data structures, MustRD focuses on validating data transformations and query results.
69
64
 
70
- ## How?
65
+ ### How?
71
66
 
72
67
  You define your specs in Turtle (`.ttl`) or TriG (`.trig`) files using the Given-When-Then approach:
73
68
 
74
- - **Given**: Define the starting dataset.
75
- - **When**: Specify the action (e.g., a SPARQL query).
76
- - **Then**: Outline the expected results.
69
+ * **Given**: Define the starting dataset.
70
+ * **When**: Specify the action (e.g., a SPARQL query).
71
+ * **Then**: Outline the expected results.
77
72
 
78
73
  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.
79
74
 
80
75
  Expectations can also be defined as:
81
76
 
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
- ```
77
+ * INSERT queries.
78
+ * SELECT queries.
79
+ * Higher-order expectation languages, similar to those used in various platforms.
116
80
 
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?
81
+ ### When?
149
82
 
150
83
  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.
151
84
 
@@ -156,4 +89,3 @@ We invite you to try it, raise issues, or contribute via pull requests. If you n
156
89
  Semantic Partners is a specialist consultancy in Semantic Technology. If you need more support, contact us at info@semanticpartners.com or mustrd@semanticpartners.com.
157
90
 
158
91
 
159
-
@@ -0,0 +1,54 @@
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
+
@@ -122,11 +122,8 @@ 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
- 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")
125
+ return json_to_dictlist(query_configuration(anzo_config=triple_store, query=query))[0]['query']
126
+
130
127
 
131
128
  def get_queries_from_templated_step(triple_store: dict, query_step_uri: URIRef) -> dict:
132
129
  query = f"""SELECT ?param_query ?query_template WHERE {{
@@ -136,11 +133,8 @@ def get_queries_from_templated_step(triple_store: dict, query_step_uri: URIRef)
136
133
  <http://cambridgesemantics.com/ontologies/Graphmarts#template> ?query_template .
137
134
  }}
138
135
  """
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]
136
+ return json_to_dictlist(query_configuration(anzo_config=triple_store, query=query))[0]
137
+
144
138
 
145
139
  def get_queries_for_layer(triple_store: dict, graphmart_layer_uri: URIRef):
146
140
  query = f"""PREFIX graphmarts: <http://cambridgesemantics.com/ontologies/Graphmarts#>
@@ -159,11 +153,8 @@ SELECT ?query ?param_query ?query_template
159
153
  . }}
160
154
  }}
161
155
  ORDER BY ?index"""
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
156
+ return json_to_dictlist(query_configuration(anzo_config=triple_store, query=query))
157
+
167
158
 
168
159
  def upload_given(triple_store: dict, given: Graph):
169
160
  logging.debug(f"upload_given {triple_store} {given}")
@@ -848,7 +848,9 @@ 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
- with open(step_file, 'r') as sparql_file:
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:
852
854
  sparql_query = sparql_file.read()
853
855
 
854
856
  # Assume the individuals are ConstructSparql queries
@@ -860,7 +862,7 @@ def _get_spec_component_spade_edn_group_source_when(spec_component_details: Spec
860
862
  )
861
863
  when_specs.append(when_spec)
862
864
  except FileNotFoundError:
863
- raise ValueError(f"SPARQL file not found: {step_file}")
865
+ raise ValueError(f"SPARQL file not found: {resolved_step_file}")
864
866
 
865
867
  spec_component.file = str(absolute_file_path)
866
868
  spec_component.groupId = group_id
@@ -185,12 +185,17 @@ 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
188
189
  merged_graph = Graph()
189
190
 
190
191
  # Iterate over the list of WhenSpec objects in `when.value`
191
192
  for step_when_spec in when.value:
192
193
  try:
193
194
  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
+
194
199
  log.info(f"Dispatching run_when for UpdateSparql step: {step_when_spec}")
195
200
  query_result = run_when_impl(spec_uri, triple_store, step_when_spec)
196
201
  log.info(f"Executed SPARQL query: {query_result}")
@@ -0,0 +1,55 @@
1
+ [project]
2
+ name = "mustrd"
3
+ version = "0.3.1a8"
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"
mustrd-0.3.1a6/README.md DELETED
@@ -1,117 +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
- [![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
-
@@ -1,55 +0,0 @@
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"
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