mustrd 0.1.7__py3-none-any.whl → 0.2.0__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/namespace.py CHANGED
@@ -25,18 +25,10 @@ SOFTWARE.
25
25
  from rdflib import URIRef
26
26
  from rdflib.namespace import DefinedNamespace, Namespace
27
27
 
28
-
28
+ # Namespace for the test specifications
29
29
  class MUST(DefinedNamespace):
30
30
  _NS = Namespace("https://mustrd.com/model/")
31
-
32
- # test configuration
33
- TestConfig: URIRef
34
- hasTestFunction: URIRef
35
- hasSpecPath: URIRef
36
- hasDataPath: URIRef
37
- triplestoreSpecPath: URIRef
38
- filterOnTripleStore: URIRef
39
-
31
+
40
32
  # Specification classes
41
33
  TestSpec: URIRef
42
34
  SelectSparql: URIRef
@@ -50,8 +42,6 @@ class MUST(DefinedNamespace):
50
42
  given: URIRef
51
43
  when: URIRef
52
44
  then: URIRef
53
- inputGraph: URIRef
54
- outputGraph: URIRef # anzo specials?
55
45
  dataSource: URIRef
56
46
  file: URIRef
57
47
  fileName: URIRef
@@ -84,22 +74,10 @@ class MUST(DefinedNamespace):
84
74
  fileSource: URIRef
85
75
  loadedFromFile: URIRef
86
76
  specSourceFile: URIRef
77
+ specFileName: URIRef
87
78
 
88
79
  # Triple store config parameters
89
- url: URIRef
90
- port: URIRef
91
- username: URIRef
92
- password: URIRef
93
- inputGraph: URIRef
94
- repository: URIRef
95
-
96
- # RDFLib
97
- RdfLib: URIRef
98
- RdfLibConfig: URIRef
99
-
100
80
  # Anzo
101
- Anzo: URIRef
102
- AnzoConfig: URIRef
103
81
  AnzoGraphmartDataset: URIRef
104
82
  AnzoQueryBuilderSparqlSource: URIRef
105
83
  AnzoGraphmartStepSparqlSource: URIRef
@@ -107,12 +85,41 @@ class MUST(DefinedNamespace):
107
85
  AnzoGraphmartQueryDrivenTemplatedStepSparqlSource: URIRef
108
86
  anzoQueryStep: URIRef
109
87
  anzoGraphmartLayer: URIRef
110
-
111
88
 
112
89
  graphmart: URIRef
113
90
  layer: URIRef
114
- gqeURI: URIRef
115
91
 
116
- # GraphDb
92
+
93
+ # FIXME: There is nothing to do that by default?
94
+ @classmethod
95
+ def get_local_name(cls, uri: URIRef):
96
+ return str(uri).split(cls._NS)[1]
97
+
98
+ # Namespace for triplestores
99
+ class TRIPLESTORE(DefinedNamespace):
100
+ _NS = Namespace("https://mustrd.com/triplestore/")
101
+ RdfLib: URIRef
117
102
  GraphDb: URIRef
118
- GraphDbConfig: URIRef
103
+ Anzo: URIRef
104
+ ExternalTripleStore: URIRef
105
+ InternalTripleStore: URIRef
106
+
107
+ gqeURI: URIRef
108
+ inputGraph: URIRef
109
+ outputGraph: URIRef # anzo specials? # Triple store config parameters
110
+ url: URIRef
111
+ port: URIRef
112
+ username: URIRef
113
+ password: URIRef
114
+ repository: URIRef
115
+
116
+ # namespace for pytest_mustrd config
117
+ class MUSTRDTEST(DefinedNamespace):
118
+ _NS = Namespace("https://mustrd.com/mustrdTest/")
119
+ MustrdTest: URIRef
120
+ hasSpecPath: URIRef
121
+ hasDataPath: URIRef
122
+ triplestoreSpecPath: URIRef
123
+ hasPytestPath: URIRef
124
+ filterOnTripleStore: URIRef
125
+
mustrd/run.py CHANGED
@@ -29,7 +29,7 @@ import os
29
29
  from rdflib import Graph
30
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
32
+ from .namespace import TRIPLESTORE
33
33
  from .utils import get_project_root
34
34
  import logging
35
35
  log = logger_setup.setup_logger(__name__)
@@ -68,7 +68,7 @@ def main(argv):
68
68
  triple_stores = get_triple_stores(get_triple_store_graph(triplestore_spec_path))
69
69
  else:
70
70
  log.info(f"No triple store configuration added, running default configuration")
71
- triple_stores = [{'type': MUST.RdfLib}]
71
+ triple_stores = [{'type': TRIPLESTORE.RdfLib}]
72
72
  log.info("Triple Stores: " + str(triple_stores))
73
73
  if args.data:
74
74
  run_config["data_path"] = Path(args.data)
mustrd/spec_component.py CHANGED
@@ -24,7 +24,6 @@ SOFTWARE.
24
24
 
25
25
  import os
26
26
  from dataclasses import dataclass, field
27
- from itertools import groupby
28
27
  from pathlib import Path
29
28
  from typing import Tuple, List, Type
30
29
 
@@ -37,8 +36,9 @@ import logging
37
36
 
38
37
  from . import logger_setup
39
38
  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
39
+ from .namespace import MUST, TRIPLESTORE
41
40
  from multimethods import MultiMethod, Default
41
+ from .utils import get_mustrd_root
42
42
 
43
43
  log = logger_setup.setup_logger(__name__)
44
44
 
@@ -84,18 +84,14 @@ class SpecComponentDetails:
84
84
  spec_component_node: Node
85
85
  data_source_type: Node
86
86
  run_config: dict
87
+ root_paths: list
87
88
 
88
- def get_path(path_type: str, run_config: dict) -> Path:
89
- try:
90
- if str(run_config[path_type]).startswith("/"):
91
- return run_config[path_type]
92
- else:
93
- return Path(os.path.join(run_config['spec_path'], run_config[path_type]))
94
- except(KeyError):
95
- if str(run_config['data_path']).startswith("/"):
96
- return run_config['data_path']
97
- else:
98
- return Path(os.path.join(run_config['spec_path'], run_config['data_path']))
89
+ def get_path(path_type: str, file_name, spec_component_details: SpecComponentDetails) -> Path:
90
+ if path_type in spec_component_details.run_config:
91
+ relative_path = os.path.join(spec_component_details.run_config[path_type], file_name)
92
+ else:
93
+ relative_path = file_name
94
+ return get_file_absolute_path(spec_component_details, relative_path)
99
95
 
100
96
 
101
97
  def parse_spec_component(subject: URIRef,
@@ -117,7 +113,8 @@ def parse_spec_component(subject: URIRef,
117
113
  mustrd_triple_store=mustrd_triple_store,
118
114
  spec_component_node=spec_component_node,
119
115
  data_source_type=data_source_type,
120
- run_config=run_config)
116
+ run_config=run_config,
117
+ root_paths=get_components_roots(spec_graph, subject, run_config))
121
118
  spec_component = get_spec_component(spec_component_details)
122
119
  if type(spec_component) == list:
123
120
  spec_components += spec_component
@@ -130,6 +127,39 @@ def parse_spec_component(subject: URIRef,
130
127
  # print(f"calling multimethod with {spec_components}")
131
128
  return combine_specs(spec_components)
132
129
 
130
+ # Here we retrieve all the possible root paths for a specification component.
131
+ # This defines the order of priority between root paths which is:
132
+ # 1) Path where the spec is located
133
+ # 2) spec_path defined in mustrd test configuration files or cmd line argument
134
+ # 3) data_path defined in mustrd test configuration files or cmd line argument
135
+ # 4) Mustrd source folder: In case of default resources packaged with mustrd source (will be in venv when mustrd is called as library)
136
+ # We intentionally don't try for absolute files, but you should feel free to argue that we should do
137
+ def get_components_roots(spec_graph: Graph, subject: URIRef, run_config: dict):
138
+ where_did_i_load_this_spec_from = spec_graph.value(subject=subject,
139
+ predicate=MUST.specSourceFile)
140
+ roots = []
141
+ if (where_did_i_load_this_spec_from == None):
142
+ log.error(f"{where_did_i_load_this_spec_from=} was None for test_spec={subject}, we didn't set the test specifications specSourceFile when loading, spec_graph={spec_graph}")
143
+ else:
144
+ roots.append(Path(os.path.dirname(where_did_i_load_this_spec_from)))
145
+ if run_config and'spec_path' in run_config:
146
+ roots.append(Path(run_config['spec_path']))
147
+ if run_config and 'data_path' in run_config:
148
+ roots.append(run_config['data_path'])
149
+ roots.append(get_mustrd_root())
150
+
151
+ return roots
152
+
153
+
154
+ # From the list of component potential roots, return the first path that exists
155
+ def get_file_absolute_path(spec_component_details: SpecComponentDetails, relative_file_path: str):
156
+ if not relative_file_path:
157
+ raise ValueError("Cannot get absolute path of None")
158
+ absolute_file_paths = list(map(lambda root_path: Path(os.path.join(root_path, relative_file_path)), spec_component_details.root_paths))
159
+ for absolute_file_path in absolute_file_paths:
160
+ if (os.path.exists(absolute_file_path)):
161
+ return absolute_file_path
162
+ raise FileNotFoundError(f"Could not find file {relative_file_path=} in any of the {absolute_file_paths=}")
133
163
 
134
164
  def get_spec_component_type(spec_components: List[SpecComponent]) -> Type[SpecComponent]:
135
165
  # Get the type of the first object in the list
@@ -224,7 +254,7 @@ def _get_spec_component_folderdatasource_given(spec_component_details: SpecCompo
224
254
  file_name = spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
225
255
  predicate=MUST.fileName)
226
256
 
227
- path = Path(os.path.join(str(get_path('given_path',spec_component_details.run_config)), str(file_name)))
257
+ path = get_path('given_path', file_name,spec_component_details)
228
258
  try:
229
259
  spec_component.value = Graph().parse(data=get_spec_component_from_file(path))
230
260
  except ParserError as e:
@@ -240,7 +270,7 @@ def _get_spec_component_foldersparqlsource_when(spec_component_details: SpecComp
240
270
  file_name = spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
241
271
  predicate=MUST.fileName)
242
272
 
243
- path = Path(os.path.join(str(get_path('when_path',spec_component_details.run_config)), str(file_name)))
273
+ path = get_path('when_path', file_name,spec_component_details)
244
274
  spec_component.value = get_spec_component_from_file(path)
245
275
  spec_component.queryType = spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
246
276
  predicate=MUST.queryType)
@@ -253,7 +283,7 @@ def _get_spec_component_folderdatasource_then(spec_component_details: SpecCompon
253
283
 
254
284
  file_name = spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
255
285
  predicate=MUST.fileName)
256
- path = Path(os.path.join(str(get_path('then_path',spec_component_details.run_config)), str(file_name)))
286
+ path = get_path('then_path', file_name,spec_component_details)
257
287
 
258
288
  return load_dataset_from_file(path, spec_component)
259
289
 
@@ -264,27 +294,9 @@ def _get_spec_component_filedatasource(spec_component_details: SpecComponentDeta
264
294
  return load_spec_component(spec_component_details, spec_component)
265
295
 
266
296
  def load_spec_component(spec_component_details, spec_component):
267
- where_did_i_load_this_spec_from = spec_component_details.spec_graph.value(subject=spec_component_details.subject,
268
- predicate=MUST.specSourceFile)
269
- if (where_did_i_load_this_spec_from == None):
270
- log.error(f"{where_did_i_load_this_spec_from=} was None for test_spec={spec_component_details.subject}, we didn't set the test specifications specSourceFile when loading, spec_graph={spec_component_details.spec_graph}")
271
297
  file_path = Path(str(spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
272
298
  predicate=MUST.file)))
273
-
274
- test_spec_file_path = os.path.dirname(where_did_i_load_this_spec_from)
275
-
276
- # first we try local relative to the test_spec_file_path, then we try relative to the path under test
277
- # we intentionally don't try for absolute files, but you should feel free to argue that we should do.
278
- paths = [
279
- Path(test_spec_file_path, file_path),
280
- Path(os.path.join(spec_component_details.run_config['spec_path'], file_path))
281
- ]
282
-
283
- for path in paths:
284
- if (os.path.exists(path)):
285
- return load_dataset_from_file(path, spec_component)
286
-
287
- raise FileNotFoundError(f"Could not find file {file_path=} in any of the {paths=}")
299
+ return load_dataset_from_file(get_file_absolute_path(spec_component_details, file_path), spec_component)
288
300
 
289
301
 
290
302
  def load_dataset_from_file(path: Path, spec_component: ThenSpec) -> ThenSpec:
@@ -320,12 +332,8 @@ def _get_spec_component_filedatasource_when(spec_component_details: SpecComponen
320
332
  spec_component = init_spec_component(spec_component_details.predicate)
321
333
 
322
334
  file_path = Path(str(spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
323
- predicate=MUST.file)))
324
- if str(file_path).startswith("/"): # absolute path
325
- path = file_path
326
- else: #relative path
327
- path = Path(os.path.join(spec_component_details.run_config['spec_path'], file_path))
328
- spec_component.value = get_spec_component_from_file(path)
335
+ predicate=MUST.file)))
336
+ spec_component.value = get_spec_component_from_file(get_file_absolute_path(spec_component_details, file_path))
329
337
 
330
338
  spec_component.queryType = spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
331
339
  predicate=MUST.queryType)
@@ -417,7 +425,7 @@ def _get_spec_component_StatementsDataset(spec_component_details: SpecComponentD
417
425
  def _get_spec_component_AnzoGraphmartDataset(spec_component_details: SpecComponentDetails) -> SpecComponent:
418
426
  spec_component = init_spec_component(spec_component_details.predicate)
419
427
 
420
- if spec_component_details.mustrd_triple_store["type"] == MUST.Anzo:
428
+ if spec_component_details.mustrd_triple_store["type"] == TRIPLESTORE.Anzo:
421
429
  # Get GIVEN or THEN from anzo graphmart
422
430
  graphmart = spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
423
431
  predicate=MUST.graphmart)
@@ -428,7 +436,7 @@ def _get_spec_component_AnzoGraphmartDataset(spec_component_details: SpecCompone
428
436
  graphmart=graphmart,
429
437
  layer=layer)
430
438
  else:
431
- raise ValueError(f"You must define {MUST.AnzoConfig} to use {MUST.AnzoGraphmartDataset}")
439
+ raise ValueError(f"You must define {TRIPLESTORE.Anzo} to use {MUST.AnzoGraphmartDataset}")
432
440
 
433
441
  return spec_component
434
442
 
@@ -438,7 +446,7 @@ def _get_spec_component_AnzoQueryBuilderSparqlSource(spec_component_details: Spe
438
446
  spec_component = init_spec_component(spec_component_details.predicate)
439
447
 
440
448
  # Get WHEN specComponent from query builder
441
- if spec_component_details.mustrd_triple_store["type"] == MUST.Anzo:
449
+ if spec_component_details.mustrd_triple_store["type"] == TRIPLESTORE.Anzo:
442
450
  query_folder = spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
443
451
  predicate=MUST.queryFolder)
444
452
  query_name = spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
@@ -448,7 +456,7 @@ def _get_spec_component_AnzoQueryBuilderSparqlSource(spec_component_details: Spe
448
456
  query_name=query_name)
449
457
  # If anzo specific function is called but no anzo defined
450
458
  else:
451
- raise ValueError(f"You must define {MUST.AnzoConfig} to use {MUST.AnzoQueryBuilderSparqlSource}")
459
+ raise ValueError(f"You must define {TRIPLESTORE.Anzo} to use {MUST.AnzoQueryBuilderSparqlSource}")
452
460
 
453
461
  spec_component.queryType = spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
454
462
  predicate=MUST.queryType)
@@ -460,14 +468,14 @@ def _get_spec_component_AnzoGraphmartStepSparqlSource(spec_component_details: Sp
460
468
  spec_component = init_spec_component(spec_component_details.predicate)
461
469
 
462
470
  # Get WHEN specComponent from query builder
463
- if spec_component_details.mustrd_triple_store["type"] == MUST.Anzo:
471
+ if spec_component_details.mustrd_triple_store["type"] == TRIPLESTORE.Anzo:
464
472
  query_step_uri = spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
465
473
  predicate=MUST.anzoQueryStep)
466
474
  spec_component.value = get_query_from_step(triple_store=spec_component_details.mustrd_triple_store,
467
475
  query_step_uri=query_step_uri)
468
476
  # If anzo specific function is called but no anzo defined
469
477
  else:
470
- raise ValueError(f"You must define {MUST.AnzoConfig} to use {MUST.AnzoGraphmartStepSparqlSource}")
478
+ raise ValueError(f"You must define {TRIPLESTORE.Anzo} to use {MUST.AnzoGraphmartStepSparqlSource}")
471
479
 
472
480
  spec_component.queryType = spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
473
481
  predicate=MUST.queryType)
@@ -478,7 +486,7 @@ def _get_spec_component_AnzoGraphmartQueryDrivenTemplatedStepSparqlSource(spec_c
478
486
  spec_component = init_spec_component(spec_component_details.predicate, spec_component_details.mustrd_triple_store["type"] )
479
487
 
480
488
  # Get WHEN specComponent from query builder
481
- if spec_component_details.mustrd_triple_store["type"] == MUST.Anzo:
489
+ if spec_component_details.mustrd_triple_store["type"] == TRIPLESTORE.Anzo:
482
490
  query_step_uri = spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
483
491
  predicate=MUST.anzoQueryStep)
484
492
  queries = get_queries_from_templated_step(triple_store=spec_component_details.mustrd_triple_store,
@@ -487,7 +495,7 @@ def _get_spec_component_AnzoGraphmartQueryDrivenTemplatedStepSparqlSource(spec_c
487
495
  spec_component.queryTemplate = queries["query_template"]
488
496
  # If anzo specific function is called but no anzo defined
489
497
  else:
490
- raise ValueError(f"You must define {MUST.AnzoConfig} to use {MUST.AnzoGraphmartQueryDrivenTemplatedStepSparqlSource}")
498
+ raise ValueError(f"You must define {TRIPLESTORE.Anzo} to use {MUST.AnzoGraphmartQueryDrivenTemplatedStepSparqlSource}")
491
499
 
492
500
  spec_component.queryType = spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
493
501
  predicate=MUST.queryType)
@@ -497,7 +505,7 @@ def _get_spec_component_AnzoGraphmartQueryDrivenTemplatedStepSparqlSource(spec_c
497
505
  def _get_spec_component_AnzoGraphmartLayerSparqlSource(spec_component_details: SpecComponentDetails) -> list:
498
506
  spec_components = []
499
507
  # Get the ordered WHEN specComponents which is the transform and query driven template queries for the Layer
500
- if spec_component_details.mustrd_triple_store["type"] == MUST.Anzo:
508
+ if spec_component_details.mustrd_triple_store["type"] == TRIPLESTORE.Anzo:
501
509
  graphmart_layer_uri = spec_component_details.spec_graph.value(subject=spec_component_details.spec_component_node,
502
510
  predicate=MUST.anzoGraphmartLayer)
503
511
  queries = get_queries_for_layer(triple_store=spec_component_details.mustrd_triple_store,
@@ -529,7 +537,7 @@ def init_spec_component(predicate: URIRef, triple_store_type: URIRef = None ) ->
529
537
  if predicate == MUST.given:
530
538
  spec_component = GivenSpec()
531
539
  elif predicate == MUST.when:
532
- if triple_store_type == MUST.Anzo:
540
+ if triple_store_type == TRIPLESTORE.Anzo:
533
541
  spec_component = AnzoWhenSpec()
534
542
  else:
535
543
  spec_component = WhenSpec()
mustrd/steprunner.py CHANGED
@@ -26,7 +26,7 @@ import json
26
26
 
27
27
  from . import logger_setup
28
28
  from multimethods import MultiMethod, Default
29
- from .namespace import MUST
29
+ from .namespace import MUST, TRIPLESTORE
30
30
  from rdflib import Graph, URIRef
31
31
  from .mustrdRdfLib import execute_select as execute_select_rdflib
32
32
  from .mustrdRdfLib import execute_construct as execute_construct_rdflib
@@ -53,17 +53,17 @@ def dispatch_upload_given(triple_store: dict, given: Graph):
53
53
  upload_given = MultiMethod('upload_given', dispatch_upload_given)
54
54
 
55
55
 
56
- @upload_given.method(MUST.RdfLib)
56
+ @upload_given.method(TRIPLESTORE.RdfLib)
57
57
  def _upload_given_rdflib(triple_store: dict, given: Graph):
58
58
  triple_store["given"] = given
59
59
 
60
60
 
61
- @upload_given.method(MUST.GraphDb)
61
+ @upload_given.method(TRIPLESTORE.GraphDb)
62
62
  def _upload_given_graphdb(triple_store: dict, given: Graph):
63
63
  upload_given_graphdb(triple_store, given)
64
64
 
65
65
 
66
- @upload_given.method(MUST.Anzo)
66
+ @upload_given.method(TRIPLESTORE.Anzo)
67
67
  def _upload_given_anzo(triple_store: dict, given: Graph):
68
68
  upload_given_anzo(triple_store, given)
69
69
 
@@ -78,52 +78,52 @@ def dispatch_run_when(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
78
78
  run_when = MultiMethod('run_when', dispatch_run_when)
79
79
 
80
80
 
81
- @run_when.method((MUST.Anzo, MUST.UpdateSparql))
81
+ @run_when.method((TRIPLESTORE.Anzo, MUST.UpdateSparql))
82
82
  def _anzo_run_when_update(spec_uri: URIRef, triple_store: dict, when: AnzoWhenSpec):
83
83
  return execute_update_anzo(triple_store, when.value, when.bindings)
84
84
 
85
85
 
86
- @run_when.method((MUST.Anzo, MUST.ConstructSparql))
86
+ @run_when.method((TRIPLESTORE.Anzo, MUST.ConstructSparql))
87
87
  def _anzo_run_when_construct(spec_uri: URIRef, triple_store: dict, when: AnzoWhenSpec):
88
88
  return execute_construct_anzo(triple_store, when.value, when.bindings)
89
89
 
90
90
 
91
- @run_when.method((MUST.Anzo, MUST.SelectSparql))
91
+ @run_when.method((TRIPLESTORE.Anzo, MUST.SelectSparql))
92
92
  def _anzo_run_when_select(spec_uri: URIRef, triple_store: dict, when: AnzoWhenSpec):
93
93
  return execute_select_anzo(triple_store, when.value, when.bindings)
94
94
 
95
95
 
96
- @run_when.method((MUST.GraphDb, MUST.UpdateSparql))
96
+ @run_when.method((TRIPLESTORE.GraphDb, MUST.UpdateSparql))
97
97
  def _graphdb_run_when_update(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
98
98
  return execute_update_graphdb(triple_store, when.value, when.bindings)
99
99
 
100
100
 
101
- @run_when.method((MUST.GraphDb, MUST.ConstructSparql))
101
+ @run_when.method((TRIPLESTORE.GraphDb, MUST.ConstructSparql))
102
102
  def _graphdb_run_when_construct(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
103
103
  return execute_construct_graphdb(triple_store, when.value, when.bindings)
104
104
 
105
105
 
106
- @run_when.method((MUST.GraphDb, MUST.SelectSparql))
106
+ @run_when.method((TRIPLESTORE.GraphDb, MUST.SelectSparql))
107
107
  def _graphdb_run_when_select(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
108
108
  return execute_select_graphdb(triple_store, when.value, when.bindings)
109
109
 
110
110
 
111
- @run_when.method((MUST.RdfLib, MUST.UpdateSparql))
111
+ @run_when.method((TRIPLESTORE.RdfLib, MUST.UpdateSparql))
112
112
  def _rdflib_run_when_update(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
113
113
  return execute_update_rdflib(triple_store, triple_store["given"], when.value, when.bindings)
114
114
 
115
115
 
116
- @run_when.method((MUST.RdfLib, MUST.ConstructSparql))
116
+ @run_when.method((TRIPLESTORE.RdfLib, MUST.ConstructSparql))
117
117
  def _rdflib_run_when_construct(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
118
118
  return execute_construct_rdflib(triple_store, triple_store["given"], when.value, when.bindings)
119
119
 
120
120
 
121
- @run_when.method((MUST.RdfLib, MUST.SelectSparql))
121
+ @run_when.method((TRIPLESTORE.RdfLib, MUST.SelectSparql))
122
122
  def _rdflib_run_when_select(spec_uri: URIRef, triple_store: dict, when: WhenSpec):
123
123
  return execute_select_rdflib(triple_store, triple_store["given"], when.value, when.bindings)
124
124
 
125
125
 
126
- @run_when.method((MUST.Anzo, MUST.AnzoQueryDrivenUpdateSparql))
126
+ @run_when.method((TRIPLESTORE.Anzo, MUST.AnzoQueryDrivenUpdateSparql))
127
127
  def _multi_run_when_anzo_query_driven_update(spec_uri: URIRef, triple_store: dict, when: AnzoWhenSpec):
128
128
  # run the parameters query to obtain the values for the template step and put them into a dictionary
129
129
  query_parameters = json.loads(execute_select_anzo(triple_store, when.paramQuery, None))
@@ -158,7 +158,7 @@ def _multi_run_when_default(spec_uri: URIRef, triple_store: dict, when: WhenSpec
158
158
  elif when.queryType == MUST.DescribeSparql:
159
159
  log.warning(f"Skipping {spec_uri}, SPARQL DESCRIBE not implemented.")
160
160
  msg = "SPARQL DESCRIBE not implemented."
161
- elif triple_store['type'] not in [MUST.Anzo, MUST.GraphDb, MUST.RdfLib]:
161
+ elif triple_store['type'] not in [TRIPLESTORE.Anzo, TRIPLESTORE.GraphDb, TRIPLESTORE.RdfLib]:
162
162
  msg = f"{when.queryType} not implemented for {triple_store['type']}"
163
163
  else:
164
164
  log.warning(f"Skipping {spec_uri}, {when.queryType} is not a valid SPARQL query type.")
@@ -0,0 +1,5 @@
1
+ from mustrd.mustrdTestPlugin import run_test_spec
2
+
3
+
4
+ def test_unit(unit_tests):
5
+ assert run_test_spec(unit_tests.unit_test)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mustrd
3
- Version: 0.1.7
3
+ Version: 0.2.0
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
@@ -0,0 +1,32 @@
1
+ mustrd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ mustrd/logger_setup.py,sha256=AXTXiiyQ4E_SyqNaKlLsZlkkKr_YJfJZ0N4PEoN7d7E,1630
3
+ mustrd/model/catalog-v001.xml,sha256=jgD6VOxR6A8izzr3ZmL4AzaTZ5cVwsvt618MTuRlGBk,386
4
+ mustrd/model/mustrdShapes.ttl,sha256=BR-9fAwGpQt6glfPpDB0Xx3vFXMt_UTQwi469o6aWUo,9709
5
+ mustrd/model/mustrdTestOntology.ttl,sha256=W7IRbPKrhpYFweZvc9QH8gdjBiuZMHKETIuHBepLnYw,2034
6
+ mustrd/model/mustrdTestShapes.ttl,sha256=Bcof6p7MtzO2L6H1DWB1hibLSix7Dxo-z6HlFcG31M8,842
7
+ mustrd/model/ontology.ttl,sha256=JF6LG5-T7tbi3QfmJcEFQcFo-rQT0CTYGg7PEmuzINY,17303
8
+ mustrd/model/test-resources/resources.ttl,sha256=7z1P4qJwuqRdmHzKd_mhnUIs-aQoSQxas7yDCwKYarc,1558
9
+ mustrd/model/triplestoreOntology.ttl,sha256=87leTcKot45AgcCGfJLEwbY9rsuRGHbYbnTFeijrzOk,6199
10
+ mustrd/model/triplestoreshapes.ttl,sha256=qiLzbclGDzueH5GCKANEwMM9VxOmswu42FiSnITATeQ,1876
11
+ mustrd/mustrd.py,sha256=H-j5s3qQmcmJ9g39Q9z5z075HJ5iMapM8OcY8HgcwJs,35081
12
+ mustrd/mustrdAnzo.py,sha256=yGoNf93n9MeKMqef8H0qm-1HKvnKm1PO-spekATL6XM,10632
13
+ mustrd/mustrdGraphDb.py,sha256=KNXXYyZjYm_IZaeuuxlPBP-XyX9hZ5UvrdxshKnZhwo,5599
14
+ mustrd/mustrdQueryProcessor.py,sha256=fpEzD0R7rGy2ktOBSiUpNGevxMSVJxKfxnR3BAg4yRk,6357
15
+ mustrd/mustrdRdfLib.py,sha256=LeS-uArlxQwsM-7lrJyp8O8m-6VgxsR1BlpxsOCNePs,2129
16
+ mustrd/mustrdTestPlugin.py,sha256=SsTkwrs0n1lvHvuiyQs-z4dsXnjB7p3d6aFWR8_jLV8,15035
17
+ mustrd/namespace.py,sha256=3zJbdWEji_2SkhasHK3J2UO3am_phNKDwAFk2htXRYM,3765
18
+ mustrd/README.adoc,sha256=y6tY7YDFB6f-vICYJyPN8n615BKLm49lRqqWFWiqrzg,12620
19
+ mustrd/run.py,sha256=r3FS_iAuXYpENbbrLfgymGUP4dx-ZGJ_Y2ZvnZdL9dg,4380
20
+ mustrd/spec_component.py,sha256=bmfHGE_8uy9yIcbvflWnhEeCW9SCbw86k0E22GQAelk,33304
21
+ mustrd/steprunner.py,sha256=n3k4O2SjsLUEG5QOxLG8Z8D3iH9PJzzR63dIV2KHcBE,7555
22
+ mustrd/templates/md_ResultList_leaf_template.jinja,sha256=un1XMeNO9xLcry-DmTQ2QoWoTM5Q5CkVUV_LS4O7sHM,526
23
+ mustrd/templates/md_ResultList_template.jinja,sha256=RrTaPN1obsTEpG5BjQp7BV9iBFzZOXHwslgvyC0hDKY,211
24
+ mustrd/templates/md_stats_template.jinja,sha256=DlNfH9eoEFVHQmvp6QNbQv36cqRLyBkqG1ITOHb_Yu8,157
25
+ mustrd/test/test_mustrd.py,sha256=Q2qTTY--I0wfhgHW7hnkIoV3t_sUTXm8xMmirJaFc7o,129
26
+ mustrd/TestResult.py,sha256=q5BnvRxhfCEEY062rHasnA61AeKR4oXXs5z8lASvx1o,4986
27
+ mustrd/utils.py,sha256=fuvdLE20MdkJtY5atBiU8-u7sVcq1mzIYF0gTcw1UMk,1424
28
+ mustrd-0.2.0.dist-info/entry_points.txt,sha256=v7V7sN0_L1aB4Ug_9io5axlQSeJ1C0tNrQWwdXdV58s,50
29
+ mustrd-0.2.0.dist-info/LICENSE,sha256=OwjAcbL4HsENdMen1iYR23HH7OEn899oCt100xUo0Zo,1099
30
+ mustrd-0.2.0.dist-info/METADATA,sha256=0_uSxV7kB9BlUOd14aTILn9waE18kPWVueSPzjFp8-I,4130
31
+ mustrd-0.2.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
32
+ mustrd-0.2.0.dist-info/RECORD,,
@@ -1,25 +0,0 @@
1
- mustrd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- mustrd/logger_setup.py,sha256=AXTXiiyQ4E_SyqNaKlLsZlkkKr_YJfJZ0N4PEoN7d7E,1630
3
- mustrd/model/mustrdShapes.ttl,sha256=BR-9fAwGpQt6glfPpDB0Xx3vFXMt_UTQwi469o6aWUo,9709
4
- mustrd/model/ontology.ttl,sha256=6xhmOF02gjP4nlOh6rnF5EWCaxWOdexQFn8YndGebck,17226
5
- mustrd/model/test-resources/resources.ttl,sha256=7z1P4qJwuqRdmHzKd_mhnUIs-aQoSQxas7yDCwKYarc,1558
6
- mustrd/mustrd.py,sha256=kAudCpk7NLoS2Y555l5Q2jhKbxR-D_sSPLa0Z3yP42w,34109
7
- mustrd/mustrdAnzo.py,sha256=bQ-IHCnsEK7paJ31GgS9IH3hGd4o_5zeNrpn0Sb8WIk,11822
8
- mustrd/mustrdGraphDb.py,sha256=KNXXYyZjYm_IZaeuuxlPBP-XyX9hZ5UvrdxshKnZhwo,5599
9
- mustrd/mustrdRdfLib.py,sha256=LeS-uArlxQwsM-7lrJyp8O8m-6VgxsR1BlpxsOCNePs,2129
10
- mustrd/mustrdTestPlugin.py,sha256=k7osmdgMIoHbVryrKxBqeDXYsE84Q_D5E2HEGhcOaSs,11784
11
- mustrd/namespace.py,sha256=pCvLXkD_n_tS23oIizO52ylVwXGC1xFP8cHx4Mml0Ro,3326
12
- mustrd/README.adoc,sha256=DwXeoMy2yMgAoLvyjZHp3HQW8NBIn8wCSaNo1ixHvFo,11803
13
- mustrd/run.py,sha256=Ez00qZrl0Qb7P374miD8hEVucRKt_PYWdr4aorigltg,4366
14
- mustrd/spec_component.py,sha256=l2CP8dszFENDkUsMIC065KNMeU8tNPPMMfCyQ4a1gHc,32487
15
- mustrd/steprunner.py,sha256=bpa0K_WCapsH-3tbdzQkCYNQI3NnfTXy71w8Pl0-8aA,7430
16
- mustrd/templates/md_ResultList_leaf_template.jinja,sha256=un1XMeNO9xLcry-DmTQ2QoWoTM5Q5CkVUV_LS4O7sHM,526
17
- mustrd/templates/md_ResultList_template.jinja,sha256=RrTaPN1obsTEpG5BjQp7BV9iBFzZOXHwslgvyC0hDKY,211
18
- mustrd/templates/md_stats_template.jinja,sha256=DlNfH9eoEFVHQmvp6QNbQv36cqRLyBkqG1ITOHb_Yu8,157
19
- mustrd/TestResult.py,sha256=q5BnvRxhfCEEY062rHasnA61AeKR4oXXs5z8lASvx1o,4986
20
- mustrd/utils.py,sha256=fuvdLE20MdkJtY5atBiU8-u7sVcq1mzIYF0gTcw1UMk,1424
21
- mustrd-0.1.7.dist-info/entry_points.txt,sha256=v7V7sN0_L1aB4Ug_9io5axlQSeJ1C0tNrQWwdXdV58s,50
22
- mustrd-0.1.7.dist-info/LICENSE,sha256=OwjAcbL4HsENdMen1iYR23HH7OEn899oCt100xUo0Zo,1099
23
- mustrd-0.1.7.dist-info/METADATA,sha256=wHFv9uJO64la0-lEtXel4KusPEvXTDPqLyQdHtLX5vk,4130
24
- mustrd-0.1.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
25
- mustrd-0.1.7.dist-info/RECORD,,
File without changes