mustrd 0.1.2__tar.gz → 0.1.4__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.
- {mustrd-0.1.2 → mustrd-0.1.4}/PKG-INFO +1 -1
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/TestResult.py +4 -1
- mustrd-0.1.4/mustrd/model/mustrdShapes.ttl +253 -0
- mustrd-0.1.4/mustrd/model/ontology.ttl +493 -0
- mustrd-0.1.4/mustrd/model/test-resources/resources.ttl +60 -0
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/mustrd.py +5 -5
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/mustrdAnzo.py +1 -1
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/mustrdTestPlugin.py +12 -12
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/plugin.py +3 -5
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/run.py +3 -3
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/spec_component.py +3 -4
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/steprunner.py +14 -14
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/utils.py +2 -2
- {mustrd-0.1.2 → mustrd-0.1.4}/pyproject.toml +2 -3
- {mustrd-0.1.2 → mustrd-0.1.4}/LICENSE +0 -0
- {mustrd-0.1.2 → mustrd-0.1.4}/README.adoc +0 -0
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/README.adoc +0 -0
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/__init__.py +0 -0
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/logger_setup.py +0 -0
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/mustrdGraphDb.py +0 -0
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/mustrdRdfLib.py +0 -0
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/namespace.py +0 -0
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/templates/md_ResultList_leaf_template.jinja +0 -0
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/templates/md_ResultList_template.jinja +0 -0
- {mustrd-0.1.2/src → mustrd-0.1.4/mustrd}/templates/md_stats_template.jinja +0 -0
@@ -27,6 +27,9 @@ from itertools import groupby
|
|
27
27
|
from jinja2 import Environment, FileSystemLoader
|
28
28
|
from dataclasses import dataclass
|
29
29
|
from enum import Enum
|
30
|
+
from pathlib import Path
|
31
|
+
import os
|
32
|
+
from mustrd.utils import get_mustrd_root
|
30
33
|
|
31
34
|
|
32
35
|
class testType(Enum):
|
@@ -40,7 +43,7 @@ class testStatus(Enum):
|
|
40
43
|
SKIPPED = "skipped"
|
41
44
|
|
42
45
|
|
43
|
-
TEMPLATE_FOLDER = "
|
46
|
+
TEMPLATE_FOLDER = Path(os.path.join(get_mustrd_root(), "templates/"))
|
44
47
|
|
45
48
|
|
46
49
|
RESULT_LIST_MD_TEMPLATE = "md_ResultList_template.jinja"
|
@@ -0,0 +1,253 @@
|
|
1
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
2
|
+
@prefix sh: <http://www.w3.org/ns/shacl#> .
|
3
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
4
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
5
|
+
@prefix ex: <http://www.example.org/#> .
|
6
|
+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
7
|
+
@prefix must: <https://mustrd.com/model/> .
|
8
|
+
|
9
|
+
must:
|
10
|
+
sh:declare [ sh:prefix "must" ;
|
11
|
+
sh:namespace "https://mustrd.com/model/"^^xsd:anyURI ; ] .
|
12
|
+
|
13
|
+
|
14
|
+
must:TestSpecShape
|
15
|
+
a sh:NodeShape ;
|
16
|
+
sh:targetClass must:TestSpec ;
|
17
|
+
sh:property [ sh:path must:given ;
|
18
|
+
sh:class must:Dataset ;
|
19
|
+
sh:minCount 1 ; ] ;
|
20
|
+
sh:property [ sh:path must:when ;
|
21
|
+
sh:class must:SparqlSource ;
|
22
|
+
sh:minCount 1 ; ] ;
|
23
|
+
sh:property [ sh:path must:then ;
|
24
|
+
sh:class must:Dataset ;
|
25
|
+
sh:minCount 1 ; ] .
|
26
|
+
|
27
|
+
must:TestSpecGivenShape
|
28
|
+
a sh:NodeShape ;
|
29
|
+
sh:targetClass must:TestSpec ;
|
30
|
+
sh:message "Invalid given clause: Table datasets for givens are not currently supported." ;
|
31
|
+
sh:not [ sh:path must:given ;
|
32
|
+
sh:class must:TableDataset ;
|
33
|
+
sh:minCount 1 ; ] .
|
34
|
+
|
35
|
+
must:TestSpecWithInheritedDatasetShape
|
36
|
+
a sh:NodeShape ;
|
37
|
+
sh:target [ a sh:SPARQLTarget ;
|
38
|
+
sh:prefixes must: ;
|
39
|
+
sh:select """
|
40
|
+
SELECT ?this
|
41
|
+
WHERE {
|
42
|
+
?this a must:TestSpec .
|
43
|
+
?this must:given/rdf:type must:InheritedDataset .
|
44
|
+
}
|
45
|
+
""" ; ] ;
|
46
|
+
sh:property [ sh:message "Invalid given clause: Tests using an inherited state can only have a single given clause.";
|
47
|
+
sh:path must:given ;
|
48
|
+
sh:minCount 1 ;
|
49
|
+
sh:maxCount 1 ; ] .
|
50
|
+
|
51
|
+
|
52
|
+
must:UpdateTestSpecThenValidationShape
|
53
|
+
a sh:NodeShape ;
|
54
|
+
sh:target [ a sh:SPARQLTarget ;
|
55
|
+
sh:prefixes must: ;
|
56
|
+
sh:select """
|
57
|
+
SELECT ?this
|
58
|
+
WHERE {
|
59
|
+
?this a must:TestSpec .
|
60
|
+
?this must:when/must:queryType must:UpdateSparql .
|
61
|
+
}
|
62
|
+
""" ; ] ;
|
63
|
+
sh:message "Invalid then clause: A tabular data format has been specified for a SPARQL update test." ;
|
64
|
+
sh:not [
|
65
|
+
sh:path must:then ;
|
66
|
+
sh:or ( [ sh:class must:TableDataset ]
|
67
|
+
[ sh:class must:EmptyTable ] ) ] .
|
68
|
+
|
69
|
+
must:ConstructTestSpecThenValidationShape
|
70
|
+
a sh:NodeShape ;
|
71
|
+
sh:target [ a sh:SPARQLTarget ;
|
72
|
+
sh:prefixes must: ;
|
73
|
+
sh:select """
|
74
|
+
SELECT ?this
|
75
|
+
WHERE {
|
76
|
+
?this a must:TestSpec .
|
77
|
+
?this must:when/must:queryType must:ConstructSparql .
|
78
|
+
}
|
79
|
+
""" ; ] ;
|
80
|
+
sh:message "Invalid then clause: A tabular data format has been specified for a SPARQL construct test." ;
|
81
|
+
sh:not [
|
82
|
+
sh:path must:then ;
|
83
|
+
sh:or ( [ sh:class must:TableDataset ]
|
84
|
+
[ sh:class must:EmptyTable ] ) ] .
|
85
|
+
|
86
|
+
must:UpdateTestSpecGivenValidationShape
|
87
|
+
a sh:NodeShape ;
|
88
|
+
sh:target [ a sh:SPARQLTarget ;
|
89
|
+
sh:prefixes must: ;
|
90
|
+
sh:select """
|
91
|
+
SELECT ?this
|
92
|
+
WHERE {
|
93
|
+
?this a must:TestSpec .
|
94
|
+
?this must:when/must:queryType must:UpdateSparql .
|
95
|
+
}
|
96
|
+
""" ; ] ; ;
|
97
|
+
sh:message "Invalid given clause: An inherited dataset cannot be specified for a SPARQL update test." ;
|
98
|
+
sh:not [ sh:path must:given ;
|
99
|
+
sh:class must:InheritedDataset ; ] .
|
100
|
+
|
101
|
+
must:SelectTestSpecValidationShape
|
102
|
+
a sh:NodeShape ;
|
103
|
+
sh:target [ a sh:SPARQLTarget ;
|
104
|
+
sh:prefixes must: ;
|
105
|
+
sh:select """
|
106
|
+
SELECT ?this
|
107
|
+
WHERE {
|
108
|
+
?this a must:TestSpec .
|
109
|
+
?this must:when/must:queryType must:SelectSparql .
|
110
|
+
}
|
111
|
+
""" ; ] ;
|
112
|
+
sh:property [ sh:message "Invalid then clause: The result format should be tabular for a SPARQL select test." ;
|
113
|
+
sh:path must:then ;
|
114
|
+
sh:or ( [ sh:class must:TableDataset ]
|
115
|
+
[ sh:class must:EmptyTable ]
|
116
|
+
[ sh:class must:FolderDataset ]
|
117
|
+
[ sh:class must:FileDataset ] ) ] .
|
118
|
+
|
119
|
+
must:StatementsDatasetShape
|
120
|
+
a sh:NodeShape ;
|
121
|
+
sh:targetClass must:StatementsDataset ;
|
122
|
+
sh:property [ sh:path must:hasStatement ;
|
123
|
+
sh:node must:StatementShape ;
|
124
|
+
sh:minCount 1 ; ] .
|
125
|
+
|
126
|
+
must:TableDatasetShape
|
127
|
+
a sh:NodeShape ;
|
128
|
+
sh:targetClass must:TableDataset ;
|
129
|
+
sh:property [ sh:path must:hasRow ;
|
130
|
+
sh:node must:RowShape ;
|
131
|
+
sh:minCount 1 ; ] .
|
132
|
+
|
133
|
+
must:OrderedTableDatasetShape
|
134
|
+
a sh:NodeShape ;
|
135
|
+
sh:targetClass must:OrderedTableDataset ;
|
136
|
+
sh:property [ sh:path must:hasRow ;
|
137
|
+
sh:node must:OrderedRowShape ;
|
138
|
+
sh:minCount 2 ; ] .
|
139
|
+
|
140
|
+
must:FileDatasetShape
|
141
|
+
a sh:NodeShape ;
|
142
|
+
sh:targetClass must:FileDataset ;
|
143
|
+
sh:property [ sh:path must:file ;
|
144
|
+
sh:datatype xsd:string ;
|
145
|
+
sh:minCount 1 ;
|
146
|
+
sh:maxCount 1 ; ] .
|
147
|
+
|
148
|
+
must:StatementShape
|
149
|
+
a sh:NodeShape ;
|
150
|
+
sh:targetClass rdf:Statement ;
|
151
|
+
sh:property [ sh:path rdf:subject ;
|
152
|
+
sh:minCount 1 ; ] ;
|
153
|
+
sh:property [ sh:path rdf:predicate ;
|
154
|
+
sh:minCount 1 ; ] ;
|
155
|
+
sh:property [ sh:path rdf:object ;
|
156
|
+
sh:minCount 1 ; ] .
|
157
|
+
|
158
|
+
must:SparqlSourceShape
|
159
|
+
a sh:NodeShape ;
|
160
|
+
sh:targetClass must:SparqlSource ;
|
161
|
+
sh:property [ sh:path must:queryType ;
|
162
|
+
sh:minCount 1 ;
|
163
|
+
sh:maxCount 1 ; ] .
|
164
|
+
|
165
|
+
must:UpdateSparqlShape
|
166
|
+
a sh:NodeShape ;
|
167
|
+
sh:targetClass must:SparqlSource ;
|
168
|
+
sh:property [ sh:path must:queryType ;
|
169
|
+
sh:targetClass must:UpdateSparql ;
|
170
|
+
sh:minCount 1 ;
|
171
|
+
sh:maxCount 1 ; ] .
|
172
|
+
|
173
|
+
must:SelectSparqlShape
|
174
|
+
a sh:NodeShape ;
|
175
|
+
sh:targetClass must:SparqlSource ;
|
176
|
+
sh:property [ sh:path must:queryType ;
|
177
|
+
sh:targetClass must:SelectSparql ;
|
178
|
+
sh:minCount 1 ;
|
179
|
+
sh:maxCount 1 ; ] .
|
180
|
+
|
181
|
+
must:ConstructSparqlShape
|
182
|
+
a sh:NodeShape ;
|
183
|
+
sh:targetClass must:SparqlSource ;
|
184
|
+
sh:property [ sh:path must:queryType ;
|
185
|
+
sh:targetClass must:ConstructSparql ;
|
186
|
+
sh:minCount 1 ;
|
187
|
+
sh:maxCount 1 ; ] .
|
188
|
+
|
189
|
+
must:TextSparqlSourceShape
|
190
|
+
a sh:NodeShape ;
|
191
|
+
sh:targetClass must:TextSparqlSource ;
|
192
|
+
sh:property [ sh:path must:queryText ;
|
193
|
+
sh:minCount 1 ;
|
194
|
+
sh:maxCount 1 ; ] .
|
195
|
+
|
196
|
+
|
197
|
+
must:VariableBindingShape
|
198
|
+
a sh:NodeShape ;
|
199
|
+
sh:targetClass must:Binding ;
|
200
|
+
sh:property [ sh:path must:variable ;
|
201
|
+
sh:minCount 1 ;
|
202
|
+
sh:maxCount 1 ; ] ;
|
203
|
+
sh:property [ sh:path must:boundValue ;
|
204
|
+
sh:minCount 1 ;
|
205
|
+
sh:maxCount 1 ; ] .
|
206
|
+
|
207
|
+
must:RowShape
|
208
|
+
a sh:NodeShape ;
|
209
|
+
sh:targetClass must:Row ;
|
210
|
+
sh:property [ sh:path must:hasBinding ;
|
211
|
+
sh:node must:VariableBindingShape ;
|
212
|
+
sh:minCount 1 ; ] .
|
213
|
+
|
214
|
+
must:OrderedRowShape
|
215
|
+
a sh:NodeShape ;
|
216
|
+
sh:targetClass must:Row ;
|
217
|
+
sh:property [ sh:path sh:order ;
|
218
|
+
sh:minCount 2 ; ] ;
|
219
|
+
sh:property [ sh:path must:hasBinding ;
|
220
|
+
sh:node must:VariableBindingShape ;
|
221
|
+
sh:minCount 2 ; ] .
|
222
|
+
|
223
|
+
must:AnzoGraphmartStepSparqlSourceShape
|
224
|
+
a sh:NodeShape ;
|
225
|
+
sh:targetClass must:AnzoGraphmartStepSparqlSource ;
|
226
|
+
sh:property [ sh:path must:anzoQueryStep ;
|
227
|
+
sh:message "An Anzo graphmart step sparql source must have one query step." ;
|
228
|
+
sh:minCount 1 ;
|
229
|
+
sh:maxCount 1 ; ] .
|
230
|
+
|
231
|
+
must:AnzoGraphmartLayerSparqlSourceShape
|
232
|
+
a sh:NodeShape ;
|
233
|
+
sh:targetClass must:AnzoGraphmartLayerSparqlSource ;
|
234
|
+
sh:property [ sh:path must:anzoGraphmartLayer ;
|
235
|
+
sh:message "An Anzo graphmart layer sparql source must have one graphmart layer." ;
|
236
|
+
sh:minCount 1 ;
|
237
|
+
sh:maxCount 1 ; ] .
|
238
|
+
|
239
|
+
must:AnzoGraphmartQueryDrivenTemplatedStepSparqlSourceShape
|
240
|
+
a sh:NodeShape ;
|
241
|
+
sh:targetClass must:AnzoGraphmartQueryDrivenTemplatedStepSparqlSource ;
|
242
|
+
sh:property
|
243
|
+
[ sh:path must:anzoQueryStep ;
|
244
|
+
sh:message "An Anzo query driven templated step sparql source must have one query step." ;
|
245
|
+
sh:minCount 1 ;
|
246
|
+
sh:maxCount 1 ; ] ,
|
247
|
+
[ sh:path must:queryType ;
|
248
|
+
sh:message "An Anzo query driven templated step sparql source must have a query type of AnzoQueryDrivenUpdateSparql ." ;
|
249
|
+
sh:minCount 1 ;
|
250
|
+
sh:maxCount 1 ; ] .
|
251
|
+
|
252
|
+
|
253
|
+
|
@@ -0,0 +1,493 @@
|
|
1
|
+
@prefix : <https://mustrd.com/model/> .
|
2
|
+
@prefix dc: <http://purl.org/dc/elements/1.1/> .
|
3
|
+
@prefix sh: <http://www.w3.org/ns/shacl#> .
|
4
|
+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
5
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
6
|
+
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
|
7
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
8
|
+
@prefix foaf: <http://xmlns.com/foaf/spec/> .
|
9
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
10
|
+
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
|
11
|
+
@base <https://mustrd.com/model/> .
|
12
|
+
|
13
|
+
<https://mustrd.com/model> rdf:type owl:Ontology ;
|
14
|
+
owl:imports rdf: ,
|
15
|
+
rdfs: ;
|
16
|
+
rdfs:comment "" ;
|
17
|
+
rdfs:label "Mustrd" .
|
18
|
+
|
19
|
+
#################################################################
|
20
|
+
# Object Properties
|
21
|
+
#################################################################
|
22
|
+
|
23
|
+
### https://mustrd.com/model/dataset
|
24
|
+
:dataset rdf:type owl:ObjectProperty ;
|
25
|
+
rdfs:domain [ rdf:type owl:Class ;
|
26
|
+
owl:unionOf ( :Compositedataset
|
27
|
+
:Datasetexpectation
|
28
|
+
:Given
|
29
|
+
:Then
|
30
|
+
)
|
31
|
+
] ;
|
32
|
+
rdfs:range :Dataset ;
|
33
|
+
rdfs:isDefinedBy : ;
|
34
|
+
rdfs:label "dataset" .
|
35
|
+
|
36
|
+
|
37
|
+
### https://mustrd.com/model/expect
|
38
|
+
:expect rdf:type owl:ObjectProperty ;
|
39
|
+
rdfs:domain :Then ;
|
40
|
+
rdfs:range :Expectation ;
|
41
|
+
rdfs:isDefinedBy : ;
|
42
|
+
rdfs:label "expect" .
|
43
|
+
|
44
|
+
|
45
|
+
### https://mustrd.com/model/given
|
46
|
+
:given rdf:type owl:ObjectProperty ;
|
47
|
+
rdfs:domain :TestSpec ;
|
48
|
+
rdfs:range :Given ;
|
49
|
+
rdfs:isDefinedBy : ;
|
50
|
+
rdfs:label "given" .
|
51
|
+
|
52
|
+
|
53
|
+
### https://mustrd.com/model/graph
|
54
|
+
:graph rdf:type owl:ObjectProperty ;
|
55
|
+
rdfs:domain :GraphDataset ;
|
56
|
+
rdfs:range :Graph ;
|
57
|
+
rdfs:isDefinedBy : ;
|
58
|
+
rdfs:label "graph" .
|
59
|
+
|
60
|
+
|
61
|
+
### https://mustrd.com/model/hasBinding
|
62
|
+
:hasBinding rdf:type owl:ObjectProperty ;
|
63
|
+
rdfs:label "hasBinding" .
|
64
|
+
|
65
|
+
|
66
|
+
### https://mustrd.com/model/hasRow
|
67
|
+
:hasRow rdf:type owl:ObjectProperty ;
|
68
|
+
rdfs:label "has row" .
|
69
|
+
|
70
|
+
|
71
|
+
### https://mustrd.com/model/hasSpec
|
72
|
+
:hasSpec rdf:type owl:ObjectProperty .
|
73
|
+
|
74
|
+
|
75
|
+
### https://mustrd.com/model/hasStatement
|
76
|
+
:hasStatement rdf:type owl:ObjectProperty ;
|
77
|
+
rdfs:domain :StatementsDataset ;
|
78
|
+
rdfs:range rdf:Statement .
|
79
|
+
|
80
|
+
|
81
|
+
### https://mustrd.com/model/label_link-6c3eeabf-5c6d-4ea6-b61e-144df1e6a223
|
82
|
+
:label_link-6c3eeabf-5c6d-4ea6-b61e-144df1e6a223 rdf:type owl:ObjectProperty ;
|
83
|
+
rdfs:domain :When ;
|
84
|
+
rdfs:range :SparqlAction ;
|
85
|
+
rdfs:isDefinedBy : ;
|
86
|
+
rdfs:label "label" .
|
87
|
+
|
88
|
+
|
89
|
+
### https://mustrd.com/model/queryType
|
90
|
+
:queryType rdf:type owl:ObjectProperty ;
|
91
|
+
rdfs:label "queryType" .
|
92
|
+
|
93
|
+
|
94
|
+
### https://mustrd.com/model/sparqlsource
|
95
|
+
:sparqlsource rdf:type owl:ObjectProperty ;
|
96
|
+
rdfs:domain :SparqlAction ;
|
97
|
+
rdfs:range :SparqlSource ;
|
98
|
+
rdfs:isDefinedBy : ;
|
99
|
+
rdfs:label "sparqlSource" .
|
100
|
+
|
101
|
+
|
102
|
+
### https://mustrd.com/model/then
|
103
|
+
:then rdf:type owl:ObjectProperty ;
|
104
|
+
rdfs:domain :TestSpec ;
|
105
|
+
rdfs:range :Then ;
|
106
|
+
rdfs:isDefinedBy : ;
|
107
|
+
rdfs:label "then" .
|
108
|
+
|
109
|
+
|
110
|
+
### https://mustrd.com/model/when
|
111
|
+
:when rdf:type owl:ObjectProperty ;
|
112
|
+
rdfs:domain :TestSpec ;
|
113
|
+
rdfs:range :When ;
|
114
|
+
rdfs:isDefinedBy : ;
|
115
|
+
rdfs:label "when" .
|
116
|
+
|
117
|
+
### https://mustrd.com/model/anzoQueryStep
|
118
|
+
:anzoQueryStep rdf:type owl:ObjectProperty ;
|
119
|
+
rdfs:domain :AnzoGraphmartStepSparqlSource ;
|
120
|
+
rdfs:isDefinedBy : ;
|
121
|
+
rdfs:label "anzoQueryStep" .
|
122
|
+
|
123
|
+
### https://mustrd.com/model/anzoGraphmartLayer
|
124
|
+
:anzoGraphmartLayer rdf:type owl:ObjectProperty ;
|
125
|
+
rdfs:domain :AnzoGraphmartLayerSparqlSource ;
|
126
|
+
rdfs:range :When ;
|
127
|
+
rdfs:isDefinedBy : ;
|
128
|
+
rdfs:label "anzoGraphmartLayer" .
|
129
|
+
|
130
|
+
|
131
|
+
#################################################################
|
132
|
+
# Data properties
|
133
|
+
#################################################################
|
134
|
+
|
135
|
+
### http://www.w3.org/ns/shacl#order
|
136
|
+
sh:order rdf:type owl:DatatypeProperty ;
|
137
|
+
rdfs:label "order" .
|
138
|
+
|
139
|
+
|
140
|
+
### https://mustrd.com/model/boundValue
|
141
|
+
:boundValue rdf:type owl:DatatypeProperty ;
|
142
|
+
rdfs:comment "the value bound to a variable" ;
|
143
|
+
rdfs:label "bound value" .
|
144
|
+
|
145
|
+
|
146
|
+
### https://mustrd.com/model/file
|
147
|
+
:file rdf:type owl:DatatypeProperty ;
|
148
|
+
rdfs:comment "Relative or absolute path to local file" ;
|
149
|
+
rdfs:label "file" .
|
150
|
+
|
151
|
+
|
152
|
+
### https://mustrd.com/model/fileName
|
153
|
+
:fileName rdf:type owl:DatatypeProperty ;
|
154
|
+
rdfs:comment "Name of a file excluding its path" ;
|
155
|
+
rdfs:label "fileName" .
|
156
|
+
|
157
|
+
|
158
|
+
### https://mustrd.com/model/fileurl
|
159
|
+
:fileurl rdf:type owl:DatatypeProperty ;
|
160
|
+
rdfs:domain :FileSparqlSource ;
|
161
|
+
rdfs:comment "a full or relatively qualified file:// url. Relative to what? We haven't thought that through, yet." ;
|
162
|
+
rdfs:isDefinedBy : ;
|
163
|
+
rdfs:label "fileUrl" .
|
164
|
+
|
165
|
+
|
166
|
+
### https://mustrd.com/model/flattendatasettotargetgraph
|
167
|
+
:flattendatasettotargetgraph rdf:type owl:DatatypeProperty ;
|
168
|
+
rdfs:domain :Given ;
|
169
|
+
rdfs:isDefinedBy : ;
|
170
|
+
rdfs:label "flattenDataSetToTargetGraph" .
|
171
|
+
|
172
|
+
|
173
|
+
### https://mustrd.com/model/graphmart
|
174
|
+
:graphmart rdf:type owl:DatatypeProperty ;
|
175
|
+
rdfs:domain :AnzoGraphmartDataset ;
|
176
|
+
rdfs:comment "the graphmart url of an Anzo graphmart dataset" ;
|
177
|
+
rdfs:label "graphmart" .
|
178
|
+
|
179
|
+
|
180
|
+
### https://mustrd.com/model/layer
|
181
|
+
:layer rdf:type owl:DatatypeProperty ;
|
182
|
+
rdfs:domain :AnzoGraphmartDataset ;
|
183
|
+
rdfs:comment "the url of the layer within an Anzo graphmart dataset" ;
|
184
|
+
rdfs:label "layer" .
|
185
|
+
|
186
|
+
|
187
|
+
### https://mustrd.com/model/queryText
|
188
|
+
:queryText rdf:type owl:DatatypeProperty ;
|
189
|
+
rdfs:domain :TextSparqlSource ;
|
190
|
+
rdfs:label "QueryText" .
|
191
|
+
|
192
|
+
|
193
|
+
### https://mustrd.com/model/shouldflattengraph
|
194
|
+
:shouldflattengraph rdf:type owl:DatatypeProperty ;
|
195
|
+
rdfs:domain :GraphDataset ;
|
196
|
+
rdfs:isDefinedBy : ;
|
197
|
+
rdfs:label "shouldFlattenGraph" .
|
198
|
+
|
199
|
+
|
200
|
+
### https://mustrd.com/model/sparql
|
201
|
+
:sparql rdf:type owl:DatatypeProperty ;
|
202
|
+
rdfs:domain :SparqlAction ;
|
203
|
+
rdfs:isDefinedBy : ;
|
204
|
+
rdfs:label "sparql" .
|
205
|
+
|
206
|
+
|
207
|
+
### https://mustrd.com/model/targetgraph
|
208
|
+
:targetgraph rdf:type owl:DatatypeProperty ;
|
209
|
+
rdfs:domain [ rdf:type owl:Class ;
|
210
|
+
owl:unionOf ( :GraphDataset
|
211
|
+
:TestSpec
|
212
|
+
)
|
213
|
+
] ;
|
214
|
+
rdfs:comment "optional iri of a target graph to flatten into" ;
|
215
|
+
rdfs:isDefinedBy : ;
|
216
|
+
rdfs:label "targetGraph" .
|
217
|
+
|
218
|
+
|
219
|
+
### https://mustrd.com/model/variable
|
220
|
+
:variable rdf:type owl:DatatypeProperty ;
|
221
|
+
rdfs:comment "variable name in a binding" ;
|
222
|
+
rdfs:label "variable" .
|
223
|
+
|
224
|
+
### https://mustrd.com/model/focus
|
225
|
+
:variable rdf:type owl:DatatypeProperty ;
|
226
|
+
rdfs:comment "Shows whether a test specification is set to be the focus of a test run" ;
|
227
|
+
rdfs:label "focus" ;
|
228
|
+
rdfs:domain :TestSpec ;
|
229
|
+
rdfs:range xsd:boolean ;
|
230
|
+
.
|
231
|
+
|
232
|
+
#################################################################
|
233
|
+
# Classes
|
234
|
+
#################################################################
|
235
|
+
|
236
|
+
### https://mustrd.com/model/AnzoGraphmartDataset
|
237
|
+
:AnzoGraphmartDataset rdf:type owl:Class ;
|
238
|
+
rdfs:subClassOf :Dataset ;
|
239
|
+
rdfs:label "Anzo graphmart dataset" .
|
240
|
+
|
241
|
+
|
242
|
+
### https://mustrd.com/model/Binding
|
243
|
+
:Binding rdf:type owl:Class ;
|
244
|
+
rdfs:label "variable binding" .
|
245
|
+
|
246
|
+
|
247
|
+
### https://mustrd.com/model/Compositedataset
|
248
|
+
:Compositedataset rdf:type owl:Class ;
|
249
|
+
rdfs:subClassOf :Dataset ;
|
250
|
+
rdfs:isDefinedBy : ;
|
251
|
+
rdfs:label "CompositeDataSet" .
|
252
|
+
|
253
|
+
|
254
|
+
### https://mustrd.com/model/ConstructSparql
|
255
|
+
:ConstructSparql rdf:type owl:Class ;
|
256
|
+
rdfs:subClassOf :SparqlAction ;
|
257
|
+
rdfs:isDefinedBy : ;
|
258
|
+
rdfs:label "ConstructSparql" .
|
259
|
+
|
260
|
+
|
261
|
+
### https://mustrd.com/model/Dataset
|
262
|
+
:Dataset rdf:type owl:Class ;
|
263
|
+
rdfs:comment "Some source of triples for comparison in either a Given or Then clause" ;
|
264
|
+
rdfs:isDefinedBy : ;
|
265
|
+
rdfs:label "DataSet" .
|
266
|
+
|
267
|
+
|
268
|
+
### https://mustrd.com/model/Datasetexpectation
|
269
|
+
:Datasetexpectation rdf:type owl:Class ;
|
270
|
+
rdfs:subClassOf :Expectation ;
|
271
|
+
rdfs:comment "A static dataset expectation. All DataSet(s) described by dataset will be composed into a single DataSet" ;
|
272
|
+
rdfs:isDefinedBy : ;
|
273
|
+
rdfs:label "DatasetExpectation" .
|
274
|
+
|
275
|
+
|
276
|
+
### https://mustrd.com/model/EmptyDataset
|
277
|
+
:EmptyDataset rdf:type owl:Class ;
|
278
|
+
rdfs:subClassOf :Dataset ;
|
279
|
+
rdfs:label "Empty dataset" .
|
280
|
+
|
281
|
+
|
282
|
+
### https://mustrd.com/model/EmptyGraph
|
283
|
+
:EmptyGraph rdf:type owl:Class ;
|
284
|
+
rdfs:subClassOf :EmptyDataset ;
|
285
|
+
rdfs:label "EmptyGraph" .
|
286
|
+
|
287
|
+
|
288
|
+
### https://mustrd.com/model/EmptyTable
|
289
|
+
:EmptyTable rdf:type owl:Class ;
|
290
|
+
rdfs:subClassOf :EmptyDataset ;
|
291
|
+
rdfs:label "EmptyTable" .
|
292
|
+
|
293
|
+
|
294
|
+
### https://mustrd.com/model/Expectation
|
295
|
+
:Expectation rdf:type owl:Class ;
|
296
|
+
rdfs:comment "The expected result of the action performed in When, on the DataSet constructed, or composed in the Given. Expectations may be complete static datasets, results of ASKs, or a CONSTRUCT or SELECT and expected DataSet" ;
|
297
|
+
rdfs:isDefinedBy : ;
|
298
|
+
rdfs:label "Expectation" .
|
299
|
+
|
300
|
+
|
301
|
+
### https://mustrd.com/model/FileDataset
|
302
|
+
:FileDataset rdf:type owl:Class ;
|
303
|
+
rdfs:subClassOf :Dataset ;
|
304
|
+
rdfs:isDefinedBy "https://mustrd.com/model/" ;
|
305
|
+
rdfs:label "File dataset" .
|
306
|
+
|
307
|
+
|
308
|
+
### https://mustrd.com/model/FileSparqlSource
|
309
|
+
:FileSparqlSource rdf:type owl:Class ;
|
310
|
+
rdfs:subClassOf :SparqlSource ;
|
311
|
+
rdfs:isDefinedBy : ;
|
312
|
+
rdfs:label "FileSparqlSource" .
|
313
|
+
|
314
|
+
|
315
|
+
### https://mustrd.com/model/FolderDataset
|
316
|
+
:FolderDataset rdf:type owl:Class ;
|
317
|
+
rdfs:subClassOf :Dataset ;
|
318
|
+
rdfs:label "Folder dataset" .
|
319
|
+
|
320
|
+
|
321
|
+
### https://mustrd.com/model/FolderSparqlSource
|
322
|
+
:FolderSparqlSource rdf:type owl:Class ;
|
323
|
+
rdfs:subClassOf :SparqlSource ;
|
324
|
+
rdfs:label "folder sparql source" .
|
325
|
+
|
326
|
+
|
327
|
+
### https://mustrd.com/model/Given
|
328
|
+
:Given rdf:type owl:Class ;
|
329
|
+
rdfs:subClassOf :Testspecsection ;
|
330
|
+
rdfs:comment "references one or more DataSet(s) to construct a precondition for this TestSpec" ;
|
331
|
+
rdfs:isDefinedBy : ;
|
332
|
+
rdfs:label "Given" .
|
333
|
+
|
334
|
+
|
335
|
+
### https://mustrd.com/model/Graph
|
336
|
+
:Graph rdf:type owl:Class ;
|
337
|
+
rdfs:isDefinedBy : ;
|
338
|
+
rdfs:label "Graph" .
|
339
|
+
|
340
|
+
|
341
|
+
### https://mustrd.com/model/GraphDataset
|
342
|
+
:GraphDataset rdf:type owl:Class ;
|
343
|
+
rdfs:subClassOf :Dataset ;
|
344
|
+
rdfs:isDefinedBy : ;
|
345
|
+
rdfs:label "GraphDataset" .
|
346
|
+
|
347
|
+
|
348
|
+
### https://mustrd.com/model/InheritedDataset
|
349
|
+
:InheritedDataset rdf:type owl:Class ;
|
350
|
+
rdfs:subClassOf :Dataset ;
|
351
|
+
rdfs:comment "A dataset inherited from another process e.g. another test where no further action is required before running the when step of a test spec." ;
|
352
|
+
rdfs:label "Inherited Dataset" .
|
353
|
+
|
354
|
+
|
355
|
+
### https://mustrd.com/model/OrderedTableDataset
|
356
|
+
:OrderedTableDataset rdf:type owl:Class ;
|
357
|
+
rdfs:subClassOf :TableDataset ;
|
358
|
+
rdfs:comment "" ;
|
359
|
+
rdfs:label "OrderedTableDataset" .
|
360
|
+
|
361
|
+
|
362
|
+
### https://mustrd.com/model/Row
|
363
|
+
:Row rdf:type owl:Class ;
|
364
|
+
rdfs:comment "A conceptual row of a table expressed as one or more bindings of variables (column names) to values" ;
|
365
|
+
rdfs:label "Row" .
|
366
|
+
|
367
|
+
|
368
|
+
### https://mustrd.com/model/S3SparqlSource
|
369
|
+
:S3SparqlSource rdf:type owl:Class ;
|
370
|
+
rdfs:subClassOf :SparqlSource ;
|
371
|
+
rdfs:isDefinedBy : ;
|
372
|
+
rdfs:label "S3SparqlSource" .
|
373
|
+
|
374
|
+
|
375
|
+
### https://mustrd.com/model/SelectSparql
|
376
|
+
:SelectSparql rdf:type owl:Class ;
|
377
|
+
rdfs:subClassOf :SparqlAction ;
|
378
|
+
rdfs:isDefinedBy : ;
|
379
|
+
rdfs:label "SelectSparql" .
|
380
|
+
|
381
|
+
|
382
|
+
### https://mustrd.com/model/SparqlAction
|
383
|
+
:SparqlAction rdf:type owl:Class ;
|
384
|
+
rdfs:comment "The sparql that is under-test. Either provided directly in the sparql property, or loaded courtesy a Sparql Loader from a disk source, db source, s3 source, etc." ;
|
385
|
+
rdfs:isDefinedBy : ;
|
386
|
+
rdfs:label "SparqlAction" .
|
387
|
+
|
388
|
+
|
389
|
+
### https://mustrd.com/model/SparqlSource
|
390
|
+
:SparqlSource rdf:type owl:Class ;
|
391
|
+
rdfs:comment "A source for the SPARQL action we want to execute in the When of a TestSpec." ;
|
392
|
+
rdfs:isDefinedBy : ;
|
393
|
+
rdfs:label "SparqlSource" .
|
394
|
+
|
395
|
+
|
396
|
+
### https://mustrd.com/model/StatementsDataset
|
397
|
+
:StatementsDataset rdf:type owl:Class ;
|
398
|
+
rdfs:subClassOf :Dataset ;
|
399
|
+
rdfs:comment "has a set of rdf:Statement(s) which will be unrotated/unreified back into the testing graph" ;
|
400
|
+
rdfs:isDefinedBy : ;
|
401
|
+
rdfs:label "StatementsDataset" .
|
402
|
+
|
403
|
+
|
404
|
+
### https://mustrd.com/model/TableDataset
|
405
|
+
:TableDataset rdf:type owl:Class ;
|
406
|
+
rdfs:subClassOf :Dataset ;
|
407
|
+
rdfs:comment "has a set of rows, equivalent to a table or a worksheet" ;
|
408
|
+
rdfs:isDefinedBy : ;
|
409
|
+
rdfs:label "TableDataset" .
|
410
|
+
|
411
|
+
|
412
|
+
### https://mustrd.com/model/TestSpec
|
413
|
+
:TestSpec rdf:type owl:Class ;
|
414
|
+
rdfs:isDefinedBy : ;
|
415
|
+
rdfs:label "TestSpec" .
|
416
|
+
|
417
|
+
|
418
|
+
### https://mustrd.com/model/TestSuite
|
419
|
+
:TestSuite rdf:type owl:Class ;
|
420
|
+
rdfs:isDefinedBy : ;
|
421
|
+
rdfs:label "Test Suite" .
|
422
|
+
|
423
|
+
|
424
|
+
### https://mustrd.com/model/Testspecsection
|
425
|
+
:Testspecsection rdf:type owl:Class ;
|
426
|
+
rdfs:isDefinedBy : ;
|
427
|
+
rdfs:label "TestSpecSection" .
|
428
|
+
|
429
|
+
|
430
|
+
### https://mustrd.com/model/TextSparqlSource
|
431
|
+
:TextSparqlSource rdf:type owl:Class ;
|
432
|
+
rdfs:subClassOf :SparqlSource ;
|
433
|
+
rdfs:isDefinedBy : ;
|
434
|
+
rdfs:label "TextSparqlSource" .
|
435
|
+
|
436
|
+
|
437
|
+
### https://mustrd.com/model/AnzoQueryBuilderSparqlSource
|
438
|
+
:AnzoQueryBuilderSparqlSource rdf:type owl:Class ;
|
439
|
+
rdfs:subClassOf :SparqlSource ;
|
440
|
+
rdfs:isDefinedBy : ;
|
441
|
+
rdfs:label "AnzoQueryBuilderSparqlSource" .
|
442
|
+
|
443
|
+
|
444
|
+
### https://mustrd.com/model/AnzoGraphmartStepSparqlSource
|
445
|
+
:AnzoGraphmartStepSparqlSource rdf:type owl:Class ;
|
446
|
+
rdfs:subClassOf :SparqlSource ;
|
447
|
+
rdfs:isDefinedBy : ;
|
448
|
+
rdfs:label "AnzoGraphmartStepSparqlSource" .
|
449
|
+
|
450
|
+
|
451
|
+
### https://mustrd.com/model/AnzoGraphmartLayerSparqlSource
|
452
|
+
:AnzoGraphmartLayerSparqlSource rdf:type owl:Class ;
|
453
|
+
rdfs:subClassOf :SparqlSource ;
|
454
|
+
rdfs:isDefinedBy : ;
|
455
|
+
rdfs:label "AnzoGraphmartLayerSparqlSource" .
|
456
|
+
|
457
|
+
### https://mustrd.com/model/AnzoGraphmartQueryDrivenTemplatedStepSparqlSource
|
458
|
+
:AnzoGraphmartQueryDrivenTemplatedStepSparqlSource rdf:type owl:Class ;
|
459
|
+
rdfs:subClassOf :SparqlSource ;
|
460
|
+
rdfs:isDefinedBy : ;
|
461
|
+
rdfs:label "AnzoGraphmartQueryDrivenTemplatedStepSparqlSource" .
|
462
|
+
|
463
|
+
|
464
|
+
### https://mustrd.com/model/Then
|
465
|
+
:Then rdf:type owl:Class ;
|
466
|
+
rdfs:subClassOf :Testspecsection ;
|
467
|
+
rdfs:comment "Describes the Expectation(s) of this part of a test." ;
|
468
|
+
rdfs:isDefinedBy : ;
|
469
|
+
rdfs:label "Then" .
|
470
|
+
|
471
|
+
|
472
|
+
### https://mustrd.com/model/UpdateSparql
|
473
|
+
:UpdateSparql rdf:type owl:Class ;
|
474
|
+
rdfs:subClassOf :SparqlAction ;
|
475
|
+
rdfs:isDefinedBy : ;
|
476
|
+
rdfs:label "UpdateSparql" .
|
477
|
+
|
478
|
+
### https://mustrd.com/model/AnzoQueryDrivenUpdateSparql
|
479
|
+
:AnzoQueryDrivenUpdateSparql rdf:type owl:Class ;
|
480
|
+
rdfs:subClassOf :UpdateSparql ;
|
481
|
+
rdfs:isDefinedBy : ;
|
482
|
+
rdfs:label "AnzoQueryDrivenUpdateSparql" .
|
483
|
+
|
484
|
+
|
485
|
+
|
486
|
+
### https://mustrd.com/model/When
|
487
|
+
:When rdf:type owl:Class ;
|
488
|
+
rdfs:subClassOf :Testspecsection ;
|
489
|
+
rdfs:isDefinedBy : ;
|
490
|
+
rdfs:label "When" .
|
491
|
+
|
492
|
+
|
493
|
+
### Generated by the OWL API (version 4.5.25.2023-02-15T19:15:49Z) https://github.com/owlcs/owlapi
|
@@ -0,0 +1,60 @@
|
|
1
|
+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
2
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
3
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
4
|
+
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
|
5
|
+
@prefix must: <https://mustrd.com/model/> .
|
6
|
+
@prefix test-data: <https://semanticpartners.com/data/test/> .
|
7
|
+
|
8
|
+
test-data:
|
9
|
+
rdf:type owl:Ontology ;
|
10
|
+
owl:imports rdf:, rdfs: ;
|
11
|
+
rdfs:comment "" ;
|
12
|
+
rdfs:label "Test Data" .
|
13
|
+
|
14
|
+
test-data:sub
|
15
|
+
a owl:NamedIndividual ;
|
16
|
+
rdfs:label "test subject" .
|
17
|
+
|
18
|
+
test-data:pred
|
19
|
+
a rdf:Property ;
|
20
|
+
rdfs:label "test predicate" .
|
21
|
+
|
22
|
+
test-data:obj
|
23
|
+
a owl:NamedIndividual ;
|
24
|
+
rdfs:label "test object" .
|
25
|
+
|
26
|
+
test-data:subject
|
27
|
+
a owl:NamedIndividual ;
|
28
|
+
rdfs:label "test subject" .
|
29
|
+
|
30
|
+
test-data:predicate
|
31
|
+
a rdf:Property ;
|
32
|
+
rdfs:label "test predicate" .
|
33
|
+
|
34
|
+
test-data:object
|
35
|
+
a owl:NamedIndividual ;
|
36
|
+
rdfs:label "test object 1" .
|
37
|
+
|
38
|
+
test-data:sub1
|
39
|
+
a owl:NamedIndividual ;
|
40
|
+
rdfs:label "test subject 1" .
|
41
|
+
|
42
|
+
test-data:pred1
|
43
|
+
a rdf:Property ;
|
44
|
+
rdfs:label "test predicate 1" .
|
45
|
+
|
46
|
+
test-data:obj1
|
47
|
+
a owl:NamedIndividual ;
|
48
|
+
rdfs:label "test object 1" .
|
49
|
+
|
50
|
+
test-data:sub2
|
51
|
+
a owl:NamedIndividual ;
|
52
|
+
rdfs:label "test subject 2" .
|
53
|
+
|
54
|
+
test-data:pred2
|
55
|
+
a rdf:Property ;
|
56
|
+
rdfs:label "test predicate 2" .
|
57
|
+
|
58
|
+
test-data:obj2
|
59
|
+
a owl:NamedIndividual ;
|
60
|
+
rdfs:label "test object 2" .
|
@@ -28,7 +28,7 @@ from typing import Tuple, List
|
|
28
28
|
import tomli
|
29
29
|
from rdflib.plugins.parsers.notation3 import BadSyntax
|
30
30
|
|
31
|
-
import logger_setup
|
31
|
+
from . import logger_setup
|
32
32
|
from dataclasses import dataclass
|
33
33
|
|
34
34
|
from pyparsing import ParseException
|
@@ -40,20 +40,20 @@ from rdflib import Graph, URIRef, RDF, XSD, SH, Literal
|
|
40
40
|
from rdflib.compare import isomorphic, graph_diff
|
41
41
|
import pandas
|
42
42
|
|
43
|
-
from namespace import MUST
|
43
|
+
from .namespace import MUST
|
44
44
|
import requests
|
45
45
|
import json
|
46
46
|
from pandas import DataFrame
|
47
47
|
|
48
|
-
from spec_component import TableThenSpec, parse_spec_component, WhenSpec, ThenSpec
|
49
|
-
from utils import is_json
|
48
|
+
from .spec_component import TableThenSpec, parse_spec_component, WhenSpec, ThenSpec
|
49
|
+
from .utils import is_json
|
50
50
|
from colorama import Fore, Style
|
51
51
|
from tabulate import tabulate
|
52
52
|
from collections import defaultdict
|
53
53
|
from pyshacl import validate
|
54
54
|
import logging
|
55
55
|
from http.client import HTTPConnection
|
56
|
-
from steprunner import upload_given, run_when
|
56
|
+
from .steprunner import upload_given, run_when
|
57
57
|
|
58
58
|
log = logger_setup.setup_logger(__name__)
|
59
59
|
|
@@ -28,7 +28,7 @@ from rdflib import Graph, ConjunctiveGraph, Literal, URIRef
|
|
28
28
|
from requests import ConnectTimeout, Response, HTTPError, RequestException, ConnectionError
|
29
29
|
from bs4 import BeautifulSoup
|
30
30
|
import logging
|
31
|
-
from namespace import MUST
|
31
|
+
from .namespace import MUST
|
32
32
|
|
33
33
|
|
34
34
|
# https://github.com/Semantic-partners/mustrd/issues/73
|
@@ -23,22 +23,22 @@ SOFTWARE.
|
|
23
23
|
"""
|
24
24
|
|
25
25
|
from dataclasses import dataclass
|
26
|
-
from TestResult import ResultList, TestResult, get_result_list
|
27
26
|
import pytest
|
28
27
|
import os
|
29
28
|
from pathlib import Path
|
30
29
|
from rdflib.namespace import Namespace
|
31
30
|
from rdflib import Graph
|
32
|
-
|
33
|
-
from utils import get_project_root
|
34
|
-
from mustrd import get_triple_store_graph, get_triple_stores, SpecSkipped, validate_specs, get_specs, SpecPassed, run_spec
|
35
|
-
from namespace import MUST
|
36
31
|
from pytest import Session
|
37
32
|
from typing import Dict
|
38
33
|
|
34
|
+
from mustrd.TestResult import ResultList, TestResult, get_result_list
|
35
|
+
from mustrd.utils import get_mustrd_root
|
36
|
+
from mustrd.mustrd import get_triple_store_graph, get_triple_stores, SpecSkipped, validate_specs, get_specs, SpecPassed, run_spec
|
37
|
+
from mustrd.namespace import MUST
|
38
|
+
|
39
39
|
spnamespace = Namespace("https://semanticpartners.com/data/test/")
|
40
40
|
|
41
|
-
|
41
|
+
mustrd_root = get_mustrd_root()
|
42
42
|
|
43
43
|
|
44
44
|
@dataclass
|
@@ -81,8 +81,8 @@ class MustrdTestPlugin:
|
|
81
81
|
SpecSkipped(MUST.TestSpec, triple_store, "No triplestore found"),
|
82
82
|
one_test_config.filter_on_tripleStore))
|
83
83
|
else:
|
84
|
-
unit_tests = self.generate_tests_for_config({"spec_path":
|
85
|
-
"data_path":
|
84
|
+
unit_tests = self.generate_tests_for_config({"spec_path": Path(one_test_config.spec_path),
|
85
|
+
"data_path": Path(one_test_config.data_path)},
|
86
86
|
triple_stores)
|
87
87
|
|
88
88
|
# Create the test in itself
|
@@ -96,8 +96,8 @@ class MustrdTestPlugin:
|
|
96
96
|
# Generate test for each triple store available
|
97
97
|
def generate_tests_for_config(self, config, triple_stores):
|
98
98
|
|
99
|
-
shacl_graph = Graph().parse(Path(os.path.join(
|
100
|
-
ont_graph = Graph().parse(Path(os.path.join(
|
99
|
+
shacl_graph = Graph().parse(Path(os.path.join(mustrd_root, "model/mustrdShapes.ttl")))
|
100
|
+
ont_graph = Graph().parse(Path(os.path.join(mustrd_root, "model/ontology.ttl")))
|
101
101
|
valid_spec_uris, spec_graph, invalid_spec_results = validate_specs(config, triple_stores,
|
102
102
|
shacl_graph, ont_graph)
|
103
103
|
|
@@ -122,9 +122,9 @@ class MustrdTestPlugin:
|
|
122
122
|
def get_triple_stores_from_file(self, test_config):
|
123
123
|
if test_config.triplestore_spec_path:
|
124
124
|
try:
|
125
|
-
triple_stores = get_triple_stores(get_triple_store_graph(
|
125
|
+
triple_stores = get_triple_stores(get_triple_store_graph(Path(test_config.triplestore_spec_path)))
|
126
126
|
except Exception:
|
127
|
-
print(f"""No triple store configuration found at {
|
127
|
+
print(f"""No triple store configuration found at {test_config.triplestore_spec_path}.
|
128
128
|
Fall back: only embedded rdflib will be executed""")
|
129
129
|
triple_stores = [{'type': MUST.RdfLib}]
|
130
130
|
else:
|
@@ -23,13 +23,11 @@ SOFTWARE.
|
|
23
23
|
"""
|
24
24
|
|
25
25
|
from typing import Dict
|
26
|
-
from mustrdTestPlugin import MustrdTestPlugin, TestConfig
|
27
|
-
from utils import get_project_root
|
26
|
+
from .mustrdTestPlugin import MustrdTestPlugin, TestConfig
|
28
27
|
from rdflib import RDF, Graph
|
29
|
-
from namespace import MUST
|
28
|
+
from .namespace import MUST
|
30
29
|
from collections import defaultdict
|
31
30
|
|
32
|
-
project_root = get_project_root()
|
33
31
|
|
34
32
|
|
35
33
|
def pytest_addoption(parser):
|
@@ -58,7 +56,7 @@ def pytest_configure(config) -> None:
|
|
58
56
|
|
59
57
|
# Read configuration file
|
60
58
|
test_configs: Dict[str, TestConfig] = defaultdict(lambda: defaultdict(list))
|
61
|
-
config_graph = Graph().parse(
|
59
|
+
config_graph = Graph().parse(config.getoption("configpath"))
|
62
60
|
for test_config_subject in config_graph.subjects(predicate=RDF.type, object=MUST.TestConfig):
|
63
61
|
test_function = get_config_param(config_graph, test_config_subject, MUST.hasTestFunction, str)
|
64
62
|
spec_path = get_config_param(config_graph, test_config_subject, MUST.hasSpecPath, str)
|
@@ -27,10 +27,10 @@ import logger_setup
|
|
27
27
|
import sys
|
28
28
|
import os
|
29
29
|
from rdflib import Graph
|
30
|
-
from mustrd import get_triple_store_graph, run_specs, get_triple_stores, review_results, validate_specs, get_specs
|
30
|
+
from .mustrd import get_triple_store_graph, run_specs, get_triple_stores, review_results, validate_specs, get_specs
|
31
31
|
from pathlib import Path
|
32
|
-
from namespace import MUST
|
33
|
-
from utils import get_project_root
|
32
|
+
from .namespace import MUST
|
33
|
+
from .utils import get_project_root
|
34
34
|
import logging
|
35
35
|
log = logger_setup.setup_logger(__name__)
|
36
36
|
|
@@ -35,10 +35,9 @@ from rdflib.exceptions import ParserError
|
|
35
35
|
from rdflib.term import Node
|
36
36
|
import logging
|
37
37
|
|
38
|
-
import logger_setup
|
39
|
-
from mustrdAnzo import get_queries_for_layer, get_queries_from_templated_step, get_spec_component_from_graphmart, get_query_from_querybuilder, get_query_from_step
|
40
|
-
from namespace import MUST
|
41
|
-
from utils import get_project_root
|
38
|
+
from . import logger_setup
|
39
|
+
from .mustrdAnzo import get_queries_for_layer, get_queries_from_templated_step, get_spec_component_from_graphmart, get_query_from_querybuilder, get_query_from_step
|
40
|
+
from .namespace import MUST
|
42
41
|
from multimethods import MultiMethod, Default
|
43
42
|
|
44
43
|
log = logger_setup.setup_logger(__name__)
|
@@ -24,22 +24,22 @@ SOFTWARE.
|
|
24
24
|
|
25
25
|
import json
|
26
26
|
|
27
|
-
import logger_setup
|
27
|
+
from . import logger_setup
|
28
28
|
from multimethods import MultiMethod, Default
|
29
|
-
from namespace import MUST
|
29
|
+
from .namespace import MUST
|
30
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
|
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
43
|
|
44
44
|
log = logger_setup.setup_logger(__name__)
|
45
45
|
|
@@ -27,8 +27,8 @@ from pathlib import Path
|
|
27
27
|
|
28
28
|
|
29
29
|
# Keep this function in a file directly under project root / src
|
30
|
-
def
|
31
|
-
return Path(__file__).parent
|
30
|
+
def get_mustrd_root() -> Path:
|
31
|
+
return Path(__file__).parent
|
32
32
|
|
33
33
|
def is_json(myjson: str) -> bool:
|
34
34
|
try:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "mustrd"
|
3
|
-
version = "0.1.
|
3
|
+
version = "0.1.4"
|
4
4
|
description = "A Spec By Example framework for RDF and SPARQL, Inspired by Cucumber."
|
5
5
|
authors = ["John Placek <john.placek@semanticpartners.com>",
|
6
6
|
"Juliane Piñeiro-Winkler <juliane.pineiro-winkler@semanticpartners.com>",
|
@@ -14,7 +14,6 @@ classifiers = [
|
|
14
14
|
"Topic :: Software Development :: Testing",
|
15
15
|
"Topic :: Utilities",
|
16
16
|
]
|
17
|
-
include = ["src/*"]
|
18
17
|
readme = "README.adoc"
|
19
18
|
|
20
19
|
[tool.poetry.dependencies]
|
@@ -49,4 +48,4 @@ requires = ["poetry-core>=1.0.0"]
|
|
49
48
|
build-backend = "poetry.core.masonry.api"
|
50
49
|
|
51
50
|
[tool.poetry.plugins.pytest11]
|
52
|
-
mustrd_plugin = "plugin"
|
51
|
+
mustrd_plugin = "mustrd.plugin"
|
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
|
File without changes
|