mustrd 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl
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.
- mustrd/README.adoc +210 -210
- mustrd/TestResult.py +136 -136
- mustrd/logger_setup.py +48 -48
- mustrd/model/catalog-v001.xml +5 -5
- mustrd/model/mustrdShapes.ttl +253 -253
- mustrd/model/mustrdTestShapes.ttl +24 -24
- mustrd/model/ontology.ttl +494 -494
- mustrd/model/test-resources/resources.ttl +60 -60
- mustrd/model/triplestoreOntology.ttl +174 -174
- mustrd/model/triplestoreshapes.ttl +41 -41
- mustrd/mustrd.py +787 -787
- mustrd/mustrdAnzo.py +236 -220
- mustrd/mustrdGraphDb.py +125 -125
- mustrd/mustrdRdfLib.py +56 -56
- mustrd/mustrdTestPlugin.py +327 -328
- mustrd/namespace.py +125 -125
- mustrd/run.py +106 -106
- mustrd/spec_component.py +690 -690
- mustrd/steprunner.py +166 -166
- mustrd/templates/md_ResultList_leaf_template.jinja +18 -18
- mustrd/templates/md_ResultList_template.jinja +8 -8
- mustrd/templates/md_stats_template.jinja +2 -2
- mustrd/test/test_mustrd.py +4 -4
- mustrd/utils.py +38 -38
- {mustrd-0.2.0.dist-info → mustrd-0.2.1.dist-info}/LICENSE +21 -21
- {mustrd-0.2.0.dist-info → mustrd-0.2.1.dist-info}/METADATA +4 -2
- mustrd-0.2.1.dist-info/RECORD +31 -0
- mustrd/mustrdQueryProcessor.py +0 -136
- mustrd-0.2.0.dist-info/RECORD +0 -32
- {mustrd-0.2.0.dist-info → mustrd-0.2.1.dist-info}/WHEEL +0 -0
- {mustrd-0.2.0.dist-info → mustrd-0.2.1.dist-info}/entry_points.txt +0 -0
mustrd/steprunner.py
CHANGED
@@ -1,166 +1,166 @@
|
|
1
|
-
"""
|
2
|
-
MIT License
|
3
|
-
|
4
|
-
Copyright (c) 2023 Semantic Partners Ltd
|
5
|
-
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
8
|
-
in the Software without restriction, including without limitation the rights
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
11
|
-
furnished to do so, subject to the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
14
|
-
copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
-
SOFTWARE.
|
23
|
-
"""
|
24
|
-
|
25
|
-
import json
|
26
|
-
|
27
|
-
from . import logger_setup
|
28
|
-
from multimethods import MultiMethod, Default
|
29
|
-
from .namespace import MUST, TRIPLESTORE
|
30
|
-
from rdflib import Graph, URIRef
|
31
|
-
from .mustrdRdfLib import execute_select as execute_select_rdflib
|
32
|
-
from .mustrdRdfLib import execute_construct as execute_construct_rdflib
|
33
|
-
from .mustrdRdfLib import execute_update as execute_update_rdflib
|
34
|
-
from .mustrdAnzo import upload_given as upload_given_anzo
|
35
|
-
from .mustrdAnzo import execute_update as execute_update_anzo
|
36
|
-
from .mustrdAnzo import execute_construct as execute_construct_anzo
|
37
|
-
from .mustrdAnzo import execute_select as execute_select_anzo
|
38
|
-
from .mustrdGraphDb import upload_given as upload_given_graphdb
|
39
|
-
from .mustrdGraphDb import execute_update as execute_update_graphdb
|
40
|
-
from .mustrdGraphDb import execute_construct as execute_construct_graphdb
|
41
|
-
from .mustrdGraphDb import execute_select as execute_select_graphdb
|
42
|
-
from .spec_component import AnzoWhenSpec, WhenSpec
|
43
|
-
|
44
|
-
log = logger_setup.setup_logger(__name__)
|
45
|
-
|
46
|
-
|
47
|
-
def dispatch_upload_given(triple_store: dict, given: Graph):
|
48
|
-
ts = triple_store['type']
|
49
|
-
log.info(f"dispatch_upload_given to {ts}")
|
50
|
-
return ts
|
51
|
-
|
52
|
-
|
53
|
-
upload_given = MultiMethod('upload_given', dispatch_upload_given)
|
54
|
-
|
55
|
-
|
56
|
-
@upload_given.method(TRIPLESTORE.RdfLib)
|
57
|
-
def _upload_given_rdflib(triple_store: dict, given: Graph):
|
58
|
-
triple_store["given"] = given
|
59
|
-
|
60
|
-
|
61
|
-
@upload_given.method(TRIPLESTORE.GraphDb)
|
62
|
-
def _upload_given_graphdb(triple_store: dict, given: Graph):
|
63
|
-
upload_given_graphdb(triple_store, given)
|
64
|
-
|
65
|
-
|
66
|
-
@upload_given.method(TRIPLESTORE.Anzo)
|
67
|
-
def _upload_given_anzo(triple_store: dict, given: Graph):
|
68
|
-
upload_given_anzo(triple_store, given)
|
69
|
-
|
70
|
-
|
71
|
-
def dispatch_run_when(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
72
|
-
ts = triple_store['type']
|
73
|
-
query_type = when.queryType
|
74
|
-
log.info(f"dispatch_run_when to SPARQL type {query_type} to {ts}")
|
75
|
-
return ts, query_type
|
76
|
-
|
77
|
-
|
78
|
-
run_when = MultiMethod('run_when', dispatch_run_when)
|
79
|
-
|
80
|
-
|
81
|
-
@run_when.method((TRIPLESTORE.Anzo, MUST.UpdateSparql))
|
82
|
-
def _anzo_run_when_update(spec_uri: URIRef, triple_store: dict, when: AnzoWhenSpec):
|
83
|
-
return execute_update_anzo(triple_store, when.value, when.bindings)
|
84
|
-
|
85
|
-
|
86
|
-
@run_when.method((TRIPLESTORE.Anzo, MUST.ConstructSparql))
|
87
|
-
def _anzo_run_when_construct(spec_uri: URIRef, triple_store: dict, when: AnzoWhenSpec):
|
88
|
-
return execute_construct_anzo(triple_store, when.value, when.bindings)
|
89
|
-
|
90
|
-
|
91
|
-
@run_when.method((TRIPLESTORE.Anzo, MUST.SelectSparql))
|
92
|
-
def _anzo_run_when_select(spec_uri: URIRef, triple_store: dict, when: AnzoWhenSpec):
|
93
|
-
return execute_select_anzo(triple_store, when.value, when.bindings)
|
94
|
-
|
95
|
-
|
96
|
-
@run_when.method((TRIPLESTORE.GraphDb, MUST.UpdateSparql))
|
97
|
-
def _graphdb_run_when_update(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
98
|
-
return execute_update_graphdb(triple_store, when.value, when.bindings)
|
99
|
-
|
100
|
-
|
101
|
-
@run_when.method((TRIPLESTORE.GraphDb, MUST.ConstructSparql))
|
102
|
-
def _graphdb_run_when_construct(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
103
|
-
return execute_construct_graphdb(triple_store, when.value, when.bindings)
|
104
|
-
|
105
|
-
|
106
|
-
@run_when.method((TRIPLESTORE.GraphDb, MUST.SelectSparql))
|
107
|
-
def _graphdb_run_when_select(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
108
|
-
return execute_select_graphdb(triple_store, when.value, when.bindings)
|
109
|
-
|
110
|
-
|
111
|
-
@run_when.method((TRIPLESTORE.RdfLib, MUST.UpdateSparql))
|
112
|
-
def _rdflib_run_when_update(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
113
|
-
return execute_update_rdflib(triple_store, triple_store["given"], when.value, when.bindings)
|
114
|
-
|
115
|
-
|
116
|
-
@run_when.method((TRIPLESTORE.RdfLib, MUST.ConstructSparql))
|
117
|
-
def _rdflib_run_when_construct(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
118
|
-
return execute_construct_rdflib(triple_store, triple_store["given"], when.value, when.bindings)
|
119
|
-
|
120
|
-
|
121
|
-
@run_when.method((TRIPLESTORE.RdfLib, MUST.SelectSparql))
|
122
|
-
def _rdflib_run_when_select(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
123
|
-
return execute_select_rdflib(triple_store, triple_store["given"], when.value, when.bindings)
|
124
|
-
|
125
|
-
|
126
|
-
@run_when.method((TRIPLESTORE.Anzo, MUST.AnzoQueryDrivenUpdateSparql))
|
127
|
-
def _multi_run_when_anzo_query_driven_update(spec_uri: URIRef, triple_store: dict, when: AnzoWhenSpec):
|
128
|
-
# run the parameters query to obtain the values for the template step and put them into a dictionary
|
129
|
-
query_parameters = json.loads(execute_select_anzo(triple_store, when.paramQuery, None))
|
130
|
-
if len(query_parameters['results']['bindings']) > 0:
|
131
|
-
# replace the anzo query placeholders with the input and output graphs
|
132
|
-
when_template = when.queryTemplate.replace(
|
133
|
-
"${usingSources}",
|
134
|
-
f"USING <{triple_store['input_graph']}> \nUSING <{triple_store['output_graph']}>").replace(
|
135
|
-
"${targetGraph}", f"<{triple_store['output_graph']}>")
|
136
|
-
|
137
|
-
# for each set of parameters insert their values into the template an run it
|
138
|
-
for params in query_parameters['results']['bindings']:
|
139
|
-
when_query = when_template
|
140
|
-
for param in params:
|
141
|
-
if params[param].get('datatype'):
|
142
|
-
value = params[param]['value']
|
143
|
-
else:
|
144
|
-
if params[param]['type'] == 'uri':
|
145
|
-
value = '<' + params[param]['value'] + '>'
|
146
|
-
else:
|
147
|
-
value = '"' + params[param]['value'] + '"'
|
148
|
-
when_query = when_query.replace("${" + param + "}", value)
|
149
|
-
result = execute_update_anzo(triple_store, when_query, None)
|
150
|
-
return result
|
151
|
-
|
152
|
-
|
153
|
-
@run_when.method(Default)
|
154
|
-
def _multi_run_when_default(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
155
|
-
if when.queryType == MUST.AskSparql:
|
156
|
-
log.warning(f"Skipping {spec_uri}, SPARQL ASK not implemented.")
|
157
|
-
msg = "SPARQL ASK not implemented."
|
158
|
-
elif when.queryType == MUST.DescribeSparql:
|
159
|
-
log.warning(f"Skipping {spec_uri}, SPARQL DESCRIBE not implemented.")
|
160
|
-
msg = "SPARQL DESCRIBE not implemented."
|
161
|
-
elif triple_store['type'] not in [TRIPLESTORE.Anzo, TRIPLESTORE.GraphDb, TRIPLESTORE.RdfLib]:
|
162
|
-
msg = f"{when.queryType} not implemented for {triple_store['type']}"
|
163
|
-
else:
|
164
|
-
log.warning(f"Skipping {spec_uri}, {when.queryType} is not a valid SPARQL query type.")
|
165
|
-
msg = f"{when.queryType} is not a valid SPARQL query type."
|
166
|
-
raise NotImplementedError(msg)
|
1
|
+
"""
|
2
|
+
MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2023 Semantic Partners Ltd
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
14
|
+
copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
SOFTWARE.
|
23
|
+
"""
|
24
|
+
|
25
|
+
import json
|
26
|
+
|
27
|
+
from . import logger_setup
|
28
|
+
from multimethods import MultiMethod, Default
|
29
|
+
from .namespace import MUST, TRIPLESTORE
|
30
|
+
from rdflib import Graph, URIRef
|
31
|
+
from .mustrdRdfLib import execute_select as execute_select_rdflib
|
32
|
+
from .mustrdRdfLib import execute_construct as execute_construct_rdflib
|
33
|
+
from .mustrdRdfLib import execute_update as execute_update_rdflib
|
34
|
+
from .mustrdAnzo import upload_given as upload_given_anzo
|
35
|
+
from .mustrdAnzo import execute_update as execute_update_anzo
|
36
|
+
from .mustrdAnzo import execute_construct as execute_construct_anzo
|
37
|
+
from .mustrdAnzo import execute_select as execute_select_anzo
|
38
|
+
from .mustrdGraphDb import upload_given as upload_given_graphdb
|
39
|
+
from .mustrdGraphDb import execute_update as execute_update_graphdb
|
40
|
+
from .mustrdGraphDb import execute_construct as execute_construct_graphdb
|
41
|
+
from .mustrdGraphDb import execute_select as execute_select_graphdb
|
42
|
+
from .spec_component import AnzoWhenSpec, WhenSpec
|
43
|
+
|
44
|
+
log = logger_setup.setup_logger(__name__)
|
45
|
+
|
46
|
+
|
47
|
+
def dispatch_upload_given(triple_store: dict, given: Graph):
|
48
|
+
ts = triple_store['type']
|
49
|
+
log.info(f"dispatch_upload_given to {ts}")
|
50
|
+
return ts
|
51
|
+
|
52
|
+
|
53
|
+
upload_given = MultiMethod('upload_given', dispatch_upload_given)
|
54
|
+
|
55
|
+
|
56
|
+
@upload_given.method(TRIPLESTORE.RdfLib)
|
57
|
+
def _upload_given_rdflib(triple_store: dict, given: Graph):
|
58
|
+
triple_store["given"] = given
|
59
|
+
|
60
|
+
|
61
|
+
@upload_given.method(TRIPLESTORE.GraphDb)
|
62
|
+
def _upload_given_graphdb(triple_store: dict, given: Graph):
|
63
|
+
upload_given_graphdb(triple_store, given)
|
64
|
+
|
65
|
+
|
66
|
+
@upload_given.method(TRIPLESTORE.Anzo)
|
67
|
+
def _upload_given_anzo(triple_store: dict, given: Graph):
|
68
|
+
upload_given_anzo(triple_store, given)
|
69
|
+
|
70
|
+
|
71
|
+
def dispatch_run_when(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
72
|
+
ts = triple_store['type']
|
73
|
+
query_type = when.queryType
|
74
|
+
log.info(f"dispatch_run_when to SPARQL type {query_type} to {ts}")
|
75
|
+
return ts, query_type
|
76
|
+
|
77
|
+
|
78
|
+
run_when = MultiMethod('run_when', dispatch_run_when)
|
79
|
+
|
80
|
+
|
81
|
+
@run_when.method((TRIPLESTORE.Anzo, MUST.UpdateSparql))
|
82
|
+
def _anzo_run_when_update(spec_uri: URIRef, triple_store: dict, when: AnzoWhenSpec):
|
83
|
+
return execute_update_anzo(triple_store, when.value, when.bindings)
|
84
|
+
|
85
|
+
|
86
|
+
@run_when.method((TRIPLESTORE.Anzo, MUST.ConstructSparql))
|
87
|
+
def _anzo_run_when_construct(spec_uri: URIRef, triple_store: dict, when: AnzoWhenSpec):
|
88
|
+
return execute_construct_anzo(triple_store, when.value, when.bindings)
|
89
|
+
|
90
|
+
|
91
|
+
@run_when.method((TRIPLESTORE.Anzo, MUST.SelectSparql))
|
92
|
+
def _anzo_run_when_select(spec_uri: URIRef, triple_store: dict, when: AnzoWhenSpec):
|
93
|
+
return execute_select_anzo(triple_store, when.value, when.bindings)
|
94
|
+
|
95
|
+
|
96
|
+
@run_when.method((TRIPLESTORE.GraphDb, MUST.UpdateSparql))
|
97
|
+
def _graphdb_run_when_update(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
98
|
+
return execute_update_graphdb(triple_store, when.value, when.bindings)
|
99
|
+
|
100
|
+
|
101
|
+
@run_when.method((TRIPLESTORE.GraphDb, MUST.ConstructSparql))
|
102
|
+
def _graphdb_run_when_construct(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
103
|
+
return execute_construct_graphdb(triple_store, when.value, when.bindings)
|
104
|
+
|
105
|
+
|
106
|
+
@run_when.method((TRIPLESTORE.GraphDb, MUST.SelectSparql))
|
107
|
+
def _graphdb_run_when_select(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
108
|
+
return execute_select_graphdb(triple_store, when.value, when.bindings)
|
109
|
+
|
110
|
+
|
111
|
+
@run_when.method((TRIPLESTORE.RdfLib, MUST.UpdateSparql))
|
112
|
+
def _rdflib_run_when_update(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
113
|
+
return execute_update_rdflib(triple_store, triple_store["given"], when.value, when.bindings)
|
114
|
+
|
115
|
+
|
116
|
+
@run_when.method((TRIPLESTORE.RdfLib, MUST.ConstructSparql))
|
117
|
+
def _rdflib_run_when_construct(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
118
|
+
return execute_construct_rdflib(triple_store, triple_store["given"], when.value, when.bindings)
|
119
|
+
|
120
|
+
|
121
|
+
@run_when.method((TRIPLESTORE.RdfLib, MUST.SelectSparql))
|
122
|
+
def _rdflib_run_when_select(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
123
|
+
return execute_select_rdflib(triple_store, triple_store["given"], when.value, when.bindings)
|
124
|
+
|
125
|
+
|
126
|
+
@run_when.method((TRIPLESTORE.Anzo, MUST.AnzoQueryDrivenUpdateSparql))
|
127
|
+
def _multi_run_when_anzo_query_driven_update(spec_uri: URIRef, triple_store: dict, when: AnzoWhenSpec):
|
128
|
+
# run the parameters query to obtain the values for the template step and put them into a dictionary
|
129
|
+
query_parameters = json.loads(execute_select_anzo(triple_store, when.paramQuery, None))
|
130
|
+
if len(query_parameters['results']['bindings']) > 0:
|
131
|
+
# replace the anzo query placeholders with the input and output graphs
|
132
|
+
when_template = when.queryTemplate.replace(
|
133
|
+
"${usingSources}",
|
134
|
+
f"USING <{triple_store['input_graph']}> \nUSING <{triple_store['output_graph']}>").replace(
|
135
|
+
"${targetGraph}", f"<{triple_store['output_graph']}>")
|
136
|
+
|
137
|
+
# for each set of parameters insert their values into the template an run it
|
138
|
+
for params in query_parameters['results']['bindings']:
|
139
|
+
when_query = when_template
|
140
|
+
for param in params:
|
141
|
+
if params[param].get('datatype'):
|
142
|
+
value = params[param]['value']
|
143
|
+
else:
|
144
|
+
if params[param]['type'] == 'uri':
|
145
|
+
value = '<' + params[param]['value'] + '>'
|
146
|
+
else:
|
147
|
+
value = '"' + params[param]['value'] + '"'
|
148
|
+
when_query = when_query.replace("${" + param + "}", value)
|
149
|
+
result = execute_update_anzo(triple_store, when_query, None)
|
150
|
+
return result
|
151
|
+
|
152
|
+
|
153
|
+
@run_when.method(Default)
|
154
|
+
def _multi_run_when_default(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
|
155
|
+
if when.queryType == MUST.AskSparql:
|
156
|
+
log.warning(f"Skipping {spec_uri}, SPARQL ASK not implemented.")
|
157
|
+
msg = "SPARQL ASK not implemented."
|
158
|
+
elif when.queryType == MUST.DescribeSparql:
|
159
|
+
log.warning(f"Skipping {spec_uri}, SPARQL DESCRIBE not implemented.")
|
160
|
+
msg = "SPARQL DESCRIBE not implemented."
|
161
|
+
elif triple_store['type'] not in [TRIPLESTORE.Anzo, TRIPLESTORE.GraphDb, TRIPLESTORE.RdfLib]:
|
162
|
+
msg = f"{when.queryType} not implemented for {triple_store['type']}"
|
163
|
+
else:
|
164
|
+
log.warning(f"Skipping {spec_uri}, {when.queryType} is not a valid SPARQL query type.")
|
165
|
+
msg = f"{when.queryType} is not a valid SPARQL query type."
|
166
|
+
raise NotImplementedError(msg)
|
@@ -1,19 +1,19 @@
|
|
1
|
-
<table class="table">
|
2
|
-
<thead>
|
3
|
-
<tr>
|
4
|
-
<th scope="col">module</th>
|
5
|
-
<th scope="col">class</th>
|
6
|
-
<th scope="col">test</th>
|
7
|
-
<th scope="col">status</th>
|
8
|
-
<tr>
|
9
|
-
</thead>
|
10
|
-
<tbody>
|
11
|
-
{% for result in result_list -%}
|
12
|
-
<tr>
|
13
|
-
<td>{{result.module_name}}</td>
|
14
|
-
<td>{{result.class_name}}</td>
|
15
|
-
<td>{{result.test_name}}</td>
|
16
|
-
<td>{{result.status}}</td>
|
17
|
-
</tr>
|
18
|
-
{% endfor %}</tbody>
|
1
|
+
<table class="table">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th scope="col">module</th>
|
5
|
+
<th scope="col">class</th>
|
6
|
+
<th scope="col">test</th>
|
7
|
+
<th scope="col">status</th>
|
8
|
+
<tr>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
{% for result in result_list -%}
|
12
|
+
<tr>
|
13
|
+
<td>{{result.module_name}}</td>
|
14
|
+
<td>{{result.class_name}}</td>
|
15
|
+
<td>{{result.test_name}}</td>
|
16
|
+
<td>{{result.status}}</td>
|
17
|
+
</tr>
|
18
|
+
{% endfor %}</tbody>
|
19
19
|
</table>
|
@@ -1,9 +1,9 @@
|
|
1
|
-
|
2
|
-
{% for result in result_list %}
|
3
|
-
<details>
|
4
|
-
{{environment.get_template("md_stats_template.jinja").render(name = result.name, stats = result.stats)}}
|
5
|
-
<ul>
|
6
|
-
{{result.render()}}
|
7
|
-
</ul>
|
8
|
-
</details>
|
1
|
+
|
2
|
+
{% for result in result_list %}
|
3
|
+
<details>
|
4
|
+
{{environment.get_template("md_stats_template.jinja").render(name = result.name, stats = result.stats)}}
|
5
|
+
<ul>
|
6
|
+
{{result.render()}}
|
7
|
+
</ul>
|
8
|
+
</details>
|
9
9
|
{% endfor %}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<summary>
|
2
|
-
{{name}}: <br/> total: {{stats.count}}, success: {{stats.success_count}}, fail: {{stats.fail_count}}, skipped: {{stats.skipped_count}}
|
1
|
+
<summary>
|
2
|
+
{{name}}: <br/> total: {{stats.count}}, success: {{stats.success_count}}, fail: {{stats.fail_count}}, skipped: {{stats.skipped_count}}
|
3
3
|
</summary>
|
mustrd/test/test_mustrd.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
from mustrd.mustrdTestPlugin import run_test_spec
|
2
|
-
|
3
|
-
|
4
|
-
def test_unit(unit_tests):
|
1
|
+
from mustrd.mustrdTestPlugin import run_test_spec
|
2
|
+
|
3
|
+
|
4
|
+
def test_unit(unit_tests):
|
5
5
|
assert run_test_spec(unit_tests.unit_test)
|
mustrd/utils.py
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
"""
|
2
|
-
MIT License
|
3
|
-
|
4
|
-
Copyright (c) 2023 Semantic Partners Ltd
|
5
|
-
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
8
|
-
in the Software without restriction, including without limitation the rights
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
11
|
-
furnished to do so, subject to the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
14
|
-
copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
-
SOFTWARE.
|
23
|
-
"""
|
24
|
-
|
25
|
-
import json
|
26
|
-
from pathlib import Path
|
27
|
-
|
28
|
-
|
29
|
-
# Keep this function in a file directly under project root / src
|
30
|
-
def get_mustrd_root() -> Path:
|
31
|
-
return Path(__file__).parent
|
32
|
-
|
33
|
-
def is_json(myjson: str) -> bool:
|
34
|
-
try:
|
35
|
-
json.loads(myjson)
|
36
|
-
except ValueError:
|
37
|
-
return False
|
38
|
-
return True
|
1
|
+
"""
|
2
|
+
MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2023 Semantic Partners Ltd
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
14
|
+
copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
SOFTWARE.
|
23
|
+
"""
|
24
|
+
|
25
|
+
import json
|
26
|
+
from pathlib import Path
|
27
|
+
|
28
|
+
|
29
|
+
# Keep this function in a file directly under project root / src
|
30
|
+
def get_mustrd_root() -> Path:
|
31
|
+
return Path(__file__).parent
|
32
|
+
|
33
|
+
def is_json(myjson: str) -> bool:
|
34
|
+
try:
|
35
|
+
json.loads(myjson)
|
36
|
+
except ValueError:
|
37
|
+
return False
|
38
|
+
return True
|
@@ -1,21 +1,21 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2023 Semantic Partners Ltd
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 Semantic Partners Ltd
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -1,17 +1,18 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: mustrd
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.1
|
4
4
|
Summary: A Spec By Example framework for RDF and SPARQL, Inspired by Cucumber.
|
5
5
|
Home-page: https://github.com/Semantic-partners/mustrd
|
6
6
|
License: MIT
|
7
7
|
Author: John Placek
|
8
8
|
Author-email: john.placek@semanticpartners.com
|
9
|
-
Requires-Python:
|
9
|
+
Requires-Python: >=3.11.7,<4.0.0
|
10
10
|
Classifier: Framework :: Pytest
|
11
11
|
Classifier: License :: OSI Approved :: MIT License
|
12
12
|
Classifier: Natural Language :: English
|
13
13
|
Classifier: Programming Language :: Python
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
15
16
|
Classifier: Topic :: Software Development :: Quality Assurance
|
16
17
|
Classifier: Topic :: Software Development :: Testing
|
17
18
|
Classifier: Topic :: Utilities
|
@@ -22,6 +23,7 @@ Requires-Dist: colorlog (>=6.7.0,<7.0.0)
|
|
22
23
|
Requires-Dist: coverage (==7.4.3)
|
23
24
|
Requires-Dist: flake8 (==7.0.0)
|
24
25
|
Requires-Dist: multimethods-py (>=0.5.3,<0.6.0)
|
26
|
+
Requires-Dist: numpy (>=1.26.0,<2.0.0)
|
25
27
|
Requires-Dist: openpyxl (>=3.1.2,<4.0.0)
|
26
28
|
Requires-Dist: pandas (>=1.5.2,<2.0.0)
|
27
29
|
Requires-Dist: pyanzo (>=3.3.10,<4.0.0)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
mustrd/README.adoc,sha256=kj1oGeOo4lkPP1VWSBIdG_A3BH10MA32zbKWZRRobiQ,12410
|
2
|
+
mustrd/TestResult.py,sha256=MdDrPgdpXbLUmRXDaA4-mkklxOxJ0_mCSWIumvHsMdw,4850
|
3
|
+
mustrd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
+
mustrd/logger_setup.py,sha256=pNtG5egdd7OiFdn-Qx-tlf5JITka1yitbzYBpHzrP_4,1582
|
5
|
+
mustrd/model/catalog-v001.xml,sha256=IEtaw3FK4KGQWKancEe1HqzUQTrKdk89vNxnoLKGF4o,381
|
6
|
+
mustrd/model/mustrdShapes.ttl,sha256=6-W8onQBWOwAvsIYLRGOk2FePSp4SPFfWd7dSuNC5ho,9456
|
7
|
+
mustrd/model/mustrdTestOntology.ttl,sha256=W7IRbPKrhpYFweZvc9QH8gdjBiuZMHKETIuHBepLnYw,2034
|
8
|
+
mustrd/model/mustrdTestShapes.ttl,sha256=5PUpU9AzPSeLpF_UzNBVnACLOhs3hfoQpiz-ybsrbj8,818
|
9
|
+
mustrd/model/ontology.ttl,sha256=AK27qyT8GW_SwJDwTFvtfxndBPEfYT6Y1jiW26Hyjg0,16809
|
10
|
+
mustrd/model/test-resources/resources.ttl,sha256=1Dsp1nuNxauj9bxeX-HShQsiO-CVy5Irwm2y2x0cdjI,1498
|
11
|
+
mustrd/model/triplestoreOntology.ttl,sha256=jK9zJOInlJ8uXzbAsQarBBrZgGrMrMXbrsuXGMbp020,6025
|
12
|
+
mustrd/model/triplestoreshapes.ttl,sha256=VqdItpI9qFQSj4leZuwbIoAjWJehhR8bao0EPvtGMR0,1835
|
13
|
+
mustrd/mustrd.py,sha256=VqKfceNXWoBBQ4PCspWA_3kpNoz1o1T7Gzj2R3RZvmo,34294
|
14
|
+
mustrd/mustrdAnzo.py,sha256=1YyuAOlNecfoWRWgPIl9K5-gscE4ni4wNiTyU7gzxAM,11586
|
15
|
+
mustrd/mustrdGraphDb.py,sha256=ySYYGvKUgXIS8QLLS7FEcppLlSb0qZ3lLlYzPf_Sr3Y,5474
|
16
|
+
mustrd/mustrdRdfLib.py,sha256=CvrzEl1-lEPugYVe3y_Ip8JMzUxv6IeWauLOa_WA-XI,2073
|
17
|
+
mustrd/mustrdTestPlugin.py,sha256=zA3iu59Hq-0fnYqAzfmUAEEPKEb50BGoJPrCjHMlmpA,14644
|
18
|
+
mustrd/namespace.py,sha256=wM4yOJ_ftFghUXURruSovGos5dKvwQLFqr6whsXzItU,3640
|
19
|
+
mustrd/run.py,sha256=sudrg26k5CKxwW8EkFhK7PLmK0SMk6b0s__GPkwYPqs,4274
|
20
|
+
mustrd/spec_component.py,sha256=Jv1_jYEnRgqeCGCeU36euuuqSZL5ZLd9Cjb8mRbQ4UI,32614
|
21
|
+
mustrd/steprunner.py,sha256=YKrMSYhethWCAQEI63hK6jXh3ljyoM87w7eHyoRd8rc,7389
|
22
|
+
mustrd/templates/md_ResultList_leaf_template.jinja,sha256=IzwZjliCx7-viipATDQK6MQg_5q1kLMKdeNSZg1sXXY,508
|
23
|
+
mustrd/templates/md_ResultList_template.jinja,sha256=_8joJ7vtw_qoqxv3HhUtBgRfhOeqmgfaRFwEo4MROvQ,203
|
24
|
+
mustrd/templates/md_stats_template.jinja,sha256=96W62cMWu9UGLNv65ZQ8RYLjkxKHhJy-FlUtXgud6XY,155
|
25
|
+
mustrd/test/test_mustrd.py,sha256=ImGwG6rBIgRo7v6js5rtt26pF5K1pBZgD_vAYgiNOps,125
|
26
|
+
mustrd/utils.py,sha256=VLp8r7FtgFqKZdRSAhIHAawtWraBMn1BuYdtBRnGqaQ,1386
|
27
|
+
mustrd-0.2.1.dist-info/LICENSE,sha256=r8nmh5fUct9h2w8_RDl13EIscvmwCLoarPr1kg35MnA,1078
|
28
|
+
mustrd-0.2.1.dist-info/METADATA,sha256=aoswqG7pcGx1rk8RZJX7V4pklsoQO4laHIcw0T3yNj4,4227
|
29
|
+
mustrd-0.2.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
30
|
+
mustrd-0.2.1.dist-info/entry_points.txt,sha256=v7V7sN0_L1aB4Ug_9io5axlQSeJ1C0tNrQWwdXdV58s,50
|
31
|
+
mustrd-0.2.1.dist-info/RECORD,,
|