bench_generator.scenario

This module holds the abstract Scenario class which implements all the main interfaces for a benchmark scenario. This class should never be used as a scenario on its own but subclassed to implement a specific scenario.

  1#!/usr/bin/env python3
  2
  3"""
  4This module holds the abstract Scenario class which implements all the main
  5interfaces for a benchmark scenario. This class should never be used as a
  6scenario on its own but subclassed to implement a specific scenario.
  7"""
  8
  9import os
 10import json
 11from rdflib.namespace import RDF
 12from rdflib import Graph, URIRef, BNode, Literal, Namespace
 13from abc import ABC, abstractmethod
 14
 15METADATA_FILE = 'metadata.json'
 16METADATA_INDENT = 4
 17R2RML = Namespace('http://www.w3.org/ns/r2rml#')
 18RML = Namespace('http://semweb.mmlab.be/ns/rml#')
 19QL = Namespace('http://semweb.mmlab.be/ns/ql#')
 20EX = Namespace('http://example.com/')
 21
 22
 23class Scenario(ABC):
 24    def __init__(self, data_format: str, engine: str, main_directory: str,
 25                 verbose: bool):
 26        """Initializes the Scenario class.
 27
 28        Parameters
 29        ----------
 30        data_format : str
 31            Data format to use for generating the data set, for example:
 32            "csv", "json", "xml", "postgresql", "mysql"
 33        engine : str
 34            Engine to use for execution of the generated scenario's instance,
 35            for example: "RMLMapper", "RMLStreamer", "SDMRDFizer", "MorphKGC",
 36            or "OntopMaterialize"
 37        main_directory : str
 38            Root directory to use for generating instances of scenario.
 39        verbose : bool
 40            If verbose logging is enabled.
 41        """
 42        self._data_format: str = data_format
 43        self._engine: str = engine
 44        self._main_directory: str = main_directory
 45        self._verbose: bool = verbose
 46
 47    @abstractmethod
 48    def generate(self) -> bool:
 49        """Generate the scenario.
 50
 51        Generate the scenario input to execute the scenario such as input
 52        data files, mappings, and other metadata.
 53
 54        Returns
 55        -------
 56        success : bool
 57            True if success, otherwise false.
 58        """
 59        pass
 60
 61    @abstractmethod
 62    def path(self) -> str:
 63        """Builds the file path for the instance of a scenario.
 64
 65        Returns
 66        -------
 67        path : str
 68            File path for the scenario's instance
 69        """
 70        pass
 71
 72    def _build_metadata(self, iri: str, name: str, description: str) -> dict:
 73        """Build a metadata structure.
 74        """
 75        return {
 76            '@id': iri,
 77            'name': name,
 78            'description': description,
 79            'steps': []
 80        }
 81
 82    def _build_step(self, iri: str, name: str, resource: str, command: str,
 83                    parameters: dict, expect_failure: bool = False):
 84        """Build a step of the execution pipeline inside a metadata structure.
 85        """
 86        return {
 87            '@id': iri,
 88            'name': name,
 89            'resource': resource,
 90            'command': command,
 91            'parameters': parameters,
 92            'expect_failure': expect_failure
 93        }
 94
 95    def _generate_metadata(self, iri: str, name: str, description: str,
 96                           mapping_file: str, serialization: str = 'ntriples'):
 97        """Generate the metadata for this scenario.
 98
 99        Configures the execution pipeline automatically.
100
101        Parameters
102        ----------
103        iri : str
104            IRI to use for the scenario's metadata.
105        name : str
106            Name of the scenario.
107        description : str
108            Longer description of the scenario.
109        mapping_file : str
110            Name of the mapping file to use.
111        serialization : str
112            Serialization format to use. Default 'ntriples'.
113
114        Returns
115        -------
116        success : bool
117            True if successfull, false otherwise
118        """
119        parameters: dict
120
121        if self._data_format == 'postgresql':
122            metadata = self._build_metadata(iri, name, description)
123
124            # RDB setup
125            parameters = {
126                'csv_file': 'data.csv',
127                'table': 'data'
128            }
129            metadata['steps'].append(self._build_step(f'{iri}#step1',
130                                                      'Load RDB',
131                                                      'PostgreSQL',
132                                                      'load',
133                                                      parameters))
134
135            # Engine execution
136            parameters = {
137                'mapping_file': mapping_file,
138                'output_file': 'out.nt',
139                'serialization': serialization,
140                'rdb_host': 'PostgreSQL',
141                'rdb_port': 5432,
142                'rdb_username': 'root',
143                'rdb_password': 'root',
144                'rdb_type': 'PostgreSQL',
145                'rdb_name': 'db'
146            }
147            metadata['steps'].append(self._build_step(f'{iri}#step2',
148                                                      'Execute RML mapping',
149                                                      self._engine,
150                                                      'execute_mapping',
151                                                      parameters))
152            self._write_metadata(self.path(), metadata)
153        elif self._data_format == 'csv':
154            metadata = self._build_metadata(iri, name, description)
155
156            # Engine execution
157            parameters = {
158                'mapping_file': mapping_file,
159                'output_file': 'out.nt',
160                'serialization': serialization
161            }
162            metadata['steps'].append(self._build_step(f'{iri}#step1',
163                                                      'Execute RML mapping',
164                                                      self._engine,
165                                                      'execute_mapping',
166                                                      parameters))
167            self._write_metadata(self.path(), metadata)
168        else:
169            raise NotImplementedError(f'{self._data_format} not implemented')
170
171        return True
172
173    def _write_metadata(self, path: str, metadata: dict):
174        os.makedirs(os.path.join(path, 'data', 'shared'), exist_ok=True)
175        with open(os.path.join(path, METADATA_FILE), 'w') as f:
176            json.dump(metadata, f, indent=METADATA_INDENT)
177
178    def _add_predicate_object_map(self, mapping: Graph, triplesmap_iri: URIRef,
179                                  predicate_value: URIRef,
180                                  object_value: Literal) -> BNode:
181        """Insert a PredicateObjectMap into a [R2]RML mapping
182
183        Parameters
184        ----------
185        mapping : Graph
186            [R2]RML mapping as an RDFLib Graph.
187        triples_map_iri : URIRef
188            IRI of the Triples Map to insert the PredicateObjectMap in.
189        predicate_value : Literal
190            Predicate IRI value for PredicateObjectMap.
191        object_value : Literal
192            Object value for PredicateObjectMap.
193
194        Returns
195        -------
196        predicate_object_map_iri : BNode
197            Predicate Object Map blank node ID.
198        """
199        predicate_object_map_iri = BNode()
200        predicate_map_iri = BNode()
201        object_map_iri = BNode()
202
203        mapping.add((predicate_map_iri, R2RML.constant, predicate_value))
204        mapping.add((predicate_map_iri, RDF.type, R2RML.PredicateMap))
205        if self._data_format == 'postgresql':
206            mapping.add((object_map_iri, R2RML.column, object_value))
207        else:
208            mapping.add((object_map_iri, RML.reference, object_value))
209        mapping.add((object_map_iri, RDF.type, R2RML.ObjectMap))
210        mapping.add((predicate_object_map_iri, R2RML.predicateMap,
211                     predicate_map_iri))
212        mapping.add((predicate_object_map_iri, R2RML.objectMap,
213                     object_map_iri))
214        mapping.add((predicate_object_map_iri, RDF.type,
215                     R2RML.PredicateObjectMap))
216        mapping.add((triplesmap_iri, R2RML.predicateObjectMap,
217                     predicate_object_map_iri))
218
219        return predicate_object_map_iri
220
221    def _add_join_predicate_object_map(self, mapping: Graph,
222                                       triplesmap_iri: URIRef,
223                                       predicate_value: URIRef,
224                                       object_value: Literal,
225                                       parent_triplesmap_iri: URIRef,
226                                       child_value: Literal,
227                                       parent_value: Literal) -> BNode:
228        """Insert a join with join condition into a [R2]RML mapping
229
230        Parameters
231        ----------
232        mapping : Graph
233            [R2]RML mapping as an RDFLib Graph.
234        triples_map_iri : URIRef
235            IRI of the Triples Map to insert the PredicateObjectMap in.
236        predicate_value : URIRef
237            Predicate IRI value for PredicateObjectMap.
238        object_value : Literal
239            Object value for PredicateObjectMap.
240
241        Returns
242        -------
243        predicat_object_map_with_join_iri : BNode
244            Predicate Object Map with join blank node ID.
245        """
246        predicate_object_map_iri = BNode()
247        predicate_map_iri = BNode()
248        object_map_iri = BNode()
249        join_condition_iri = BNode()
250
251        mapping.add((join_condition_iri, R2RML.child, child_value))
252        mapping.add((join_condition_iri, R2RML.parent, parent_value))
253        mapping.add((join_condition_iri, RDF.type, R2RML.JoinCondition))
254        mapping.add((predicate_map_iri, R2RML.constant, predicate_value))
255        mapping.add((predicate_map_iri, RDF.type, R2RML.PredicateMap))
256        mapping.add((object_map_iri, RDF.type, R2RML.ReferenceObjectMap))
257        mapping.add((object_map_iri, R2RML.parentTriplesMap,
258                     parent_triplesmap_iri))
259        mapping.add((object_map_iri, R2RML.joinCondition, join_condition_iri))
260        mapping.add((predicate_object_map_iri, R2RML.predicateMap,
261                     predicate_map_iri))
262        mapping.add((predicate_object_map_iri, R2RML.objectMap,
263                     object_map_iri))
264        mapping.add((predicate_object_map_iri, RDF.type,
265                     R2RML.PredicateObjectMap))
266        mapping.add((triplesmap_iri, R2RML.predicateObjectMap,
267                     predicate_object_map_iri))
268
269        return join_condition_iri
270
271    def _add_triples_map_source(self, mapping: Graph, subject_value: Literal,
272                                source_path: Literal,
273                                number: int = 1) -> URIRef:
274        """Insert a TriplesMap into a RML mapping with a Logical Source
275
276        Parameters
277        ----------
278        mapping : Graph
279            [R2]RML mapping as an RDFLib Graph.
280        subject_value : Literal
281            Subject IRI template value.
282        source_path : Literal
283            Path to source file.
284        number : int
285            Triples Map number, default 1.
286
287        Returns
288        -------
289        triples_map_iri : URIRef
290            IRI of the Triples Map inserted into the mapping.
291        """
292        triples_map_iri = URIRef(f'{mapping.base}#TriplesMap{number}')
293        subject_map_iri = BNode()
294        logical_source_iri = BNode()
295
296        mapping.add((logical_source_iri, RML.source, source_path))
297        mapping.add((logical_source_iri, RML.referenceFormulation, QL.CSV))
298        mapping.add((logical_source_iri, RDF.type, RML.LogicalSource))
299        mapping.add((triples_map_iri, RML.logicalSource, logical_source_iri))
300        mapping.add((triples_map_iri, R2RML.subjectMap, subject_map_iri))
301        mapping.add((triples_map_iri, RDF.type, R2RML.TriplesMap))
302        mapping.add((subject_map_iri, R2RML.template, subject_value))
303
304        return triples_map_iri
305
306    def _add_triples_map_table(self, mapping: Graph, subject_value: Literal,
307                               table_name: Literal, number: int = 1) -> URIRef:
308        """Insert a TriplesMap into a [R2]RML mapping with a Logical Table
309
310        Parameters
311        ----------
312        mapping : Graph
313            [R2]RML mapping as an RDFLib Graph.
314        subject_value : Literal
315            Subject IRI template value.
316        table_name : Literal
317            SQL table name to add.
318        number : int
319            Triples Map number, default 1.
320
321        Returns
322        -------
323        triples_map_iri : URIRef
324            IRI of the Triples Map inserted into the mapping.
325        """
326        triples_map_iri = URIRef(f'{mapping.base}#TriplesMap{number}')
327        subject_map_iri = BNode()
328        logical_table_iri = BNode()
329
330        mapping.add((logical_table_iri, R2RML.tableName, table_name))
331        mapping.add((logical_table_iri, RDF.type, R2RML.LogicalTable))
332        mapping.add((triples_map_iri, R2RML.logicalTable, logical_table_iri))
333        mapping.add((triples_map_iri, R2RML.subjectMap, subject_map_iri))
334        mapping.add((triples_map_iri, RDF.type, R2RML.TriplesMap))
335        mapping.add((subject_map_iri, R2RML.template, subject_value))
336
337        return triples_map_iri
METADATA_FILE = 'metadata.json'
METADATA_INDENT = 4
R2RML = Namespace('http://www.w3.org/ns/r2rml#')
RML = Namespace('http://semweb.mmlab.be/ns/rml#')
QL = Namespace('http://semweb.mmlab.be/ns/ql#')
EX = Namespace('http://example.com/')
class Scenario(abc.ABC):
 24class Scenario(ABC):
 25    def __init__(self, data_format: str, engine: str, main_directory: str,
 26                 verbose: bool):
 27        """Initializes the Scenario class.
 28
 29        Parameters
 30        ----------
 31        data_format : str
 32            Data format to use for generating the data set, for example:
 33            "csv", "json", "xml", "postgresql", "mysql"
 34        engine : str
 35            Engine to use for execution of the generated scenario's instance,
 36            for example: "RMLMapper", "RMLStreamer", "SDMRDFizer", "MorphKGC",
 37            or "OntopMaterialize"
 38        main_directory : str
 39            Root directory to use for generating instances of scenario.
 40        verbose : bool
 41            If verbose logging is enabled.
 42        """
 43        self._data_format: str = data_format
 44        self._engine: str = engine
 45        self._main_directory: str = main_directory
 46        self._verbose: bool = verbose
 47
 48    @abstractmethod
 49    def generate(self) -> bool:
 50        """Generate the scenario.
 51
 52        Generate the scenario input to execute the scenario such as input
 53        data files, mappings, and other metadata.
 54
 55        Returns
 56        -------
 57        success : bool
 58            True if success, otherwise false.
 59        """
 60        pass
 61
 62    @abstractmethod
 63    def path(self) -> str:
 64        """Builds the file path for the instance of a scenario.
 65
 66        Returns
 67        -------
 68        path : str
 69            File path for the scenario's instance
 70        """
 71        pass
 72
 73    def _build_metadata(self, iri: str, name: str, description: str) -> dict:
 74        """Build a metadata structure.
 75        """
 76        return {
 77            '@id': iri,
 78            'name': name,
 79            'description': description,
 80            'steps': []
 81        }
 82
 83    def _build_step(self, iri: str, name: str, resource: str, command: str,
 84                    parameters: dict, expect_failure: bool = False):
 85        """Build a step of the execution pipeline inside a metadata structure.
 86        """
 87        return {
 88            '@id': iri,
 89            'name': name,
 90            'resource': resource,
 91            'command': command,
 92            'parameters': parameters,
 93            'expect_failure': expect_failure
 94        }
 95
 96    def _generate_metadata(self, iri: str, name: str, description: str,
 97                           mapping_file: str, serialization: str = 'ntriples'):
 98        """Generate the metadata for this scenario.
 99
100        Configures the execution pipeline automatically.
101
102        Parameters
103        ----------
104        iri : str
105            IRI to use for the scenario's metadata.
106        name : str
107            Name of the scenario.
108        description : str
109            Longer description of the scenario.
110        mapping_file : str
111            Name of the mapping file to use.
112        serialization : str
113            Serialization format to use. Default 'ntriples'.
114
115        Returns
116        -------
117        success : bool
118            True if successfull, false otherwise
119        """
120        parameters: dict
121
122        if self._data_format == 'postgresql':
123            metadata = self._build_metadata(iri, name, description)
124
125            # RDB setup
126            parameters = {
127                'csv_file': 'data.csv',
128                'table': 'data'
129            }
130            metadata['steps'].append(self._build_step(f'{iri}#step1',
131                                                      'Load RDB',
132                                                      'PostgreSQL',
133                                                      'load',
134                                                      parameters))
135
136            # Engine execution
137            parameters = {
138                'mapping_file': mapping_file,
139                'output_file': 'out.nt',
140                'serialization': serialization,
141                'rdb_host': 'PostgreSQL',
142                'rdb_port': 5432,
143                'rdb_username': 'root',
144                'rdb_password': 'root',
145                'rdb_type': 'PostgreSQL',
146                'rdb_name': 'db'
147            }
148            metadata['steps'].append(self._build_step(f'{iri}#step2',
149                                                      'Execute RML mapping',
150                                                      self._engine,
151                                                      'execute_mapping',
152                                                      parameters))
153            self._write_metadata(self.path(), metadata)
154        elif self._data_format == 'csv':
155            metadata = self._build_metadata(iri, name, description)
156
157            # Engine execution
158            parameters = {
159                'mapping_file': mapping_file,
160                'output_file': 'out.nt',
161                'serialization': serialization
162            }
163            metadata['steps'].append(self._build_step(f'{iri}#step1',
164                                                      'Execute RML mapping',
165                                                      self._engine,
166                                                      'execute_mapping',
167                                                      parameters))
168            self._write_metadata(self.path(), metadata)
169        else:
170            raise NotImplementedError(f'{self._data_format} not implemented')
171
172        return True
173
174    def _write_metadata(self, path: str, metadata: dict):
175        os.makedirs(os.path.join(path, 'data', 'shared'), exist_ok=True)
176        with open(os.path.join(path, METADATA_FILE), 'w') as f:
177            json.dump(metadata, f, indent=METADATA_INDENT)
178
179    def _add_predicate_object_map(self, mapping: Graph, triplesmap_iri: URIRef,
180                                  predicate_value: URIRef,
181                                  object_value: Literal) -> BNode:
182        """Insert a PredicateObjectMap into a [R2]RML mapping
183
184        Parameters
185        ----------
186        mapping : Graph
187            [R2]RML mapping as an RDFLib Graph.
188        triples_map_iri : URIRef
189            IRI of the Triples Map to insert the PredicateObjectMap in.
190        predicate_value : Literal
191            Predicate IRI value for PredicateObjectMap.
192        object_value : Literal
193            Object value for PredicateObjectMap.
194
195        Returns
196        -------
197        predicate_object_map_iri : BNode
198            Predicate Object Map blank node ID.
199        """
200        predicate_object_map_iri = BNode()
201        predicate_map_iri = BNode()
202        object_map_iri = BNode()
203
204        mapping.add((predicate_map_iri, R2RML.constant, predicate_value))
205        mapping.add((predicate_map_iri, RDF.type, R2RML.PredicateMap))
206        if self._data_format == 'postgresql':
207            mapping.add((object_map_iri, R2RML.column, object_value))
208        else:
209            mapping.add((object_map_iri, RML.reference, object_value))
210        mapping.add((object_map_iri, RDF.type, R2RML.ObjectMap))
211        mapping.add((predicate_object_map_iri, R2RML.predicateMap,
212                     predicate_map_iri))
213        mapping.add((predicate_object_map_iri, R2RML.objectMap,
214                     object_map_iri))
215        mapping.add((predicate_object_map_iri, RDF.type,
216                     R2RML.PredicateObjectMap))
217        mapping.add((triplesmap_iri, R2RML.predicateObjectMap,
218                     predicate_object_map_iri))
219
220        return predicate_object_map_iri
221
222    def _add_join_predicate_object_map(self, mapping: Graph,
223                                       triplesmap_iri: URIRef,
224                                       predicate_value: URIRef,
225                                       object_value: Literal,
226                                       parent_triplesmap_iri: URIRef,
227                                       child_value: Literal,
228                                       parent_value: Literal) -> BNode:
229        """Insert a join with join condition into a [R2]RML mapping
230
231        Parameters
232        ----------
233        mapping : Graph
234            [R2]RML mapping as an RDFLib Graph.
235        triples_map_iri : URIRef
236            IRI of the Triples Map to insert the PredicateObjectMap in.
237        predicate_value : URIRef
238            Predicate IRI value for PredicateObjectMap.
239        object_value : Literal
240            Object value for PredicateObjectMap.
241
242        Returns
243        -------
244        predicat_object_map_with_join_iri : BNode
245            Predicate Object Map with join blank node ID.
246        """
247        predicate_object_map_iri = BNode()
248        predicate_map_iri = BNode()
249        object_map_iri = BNode()
250        join_condition_iri = BNode()
251
252        mapping.add((join_condition_iri, R2RML.child, child_value))
253        mapping.add((join_condition_iri, R2RML.parent, parent_value))
254        mapping.add((join_condition_iri, RDF.type, R2RML.JoinCondition))
255        mapping.add((predicate_map_iri, R2RML.constant, predicate_value))
256        mapping.add((predicate_map_iri, RDF.type, R2RML.PredicateMap))
257        mapping.add((object_map_iri, RDF.type, R2RML.ReferenceObjectMap))
258        mapping.add((object_map_iri, R2RML.parentTriplesMap,
259                     parent_triplesmap_iri))
260        mapping.add((object_map_iri, R2RML.joinCondition, join_condition_iri))
261        mapping.add((predicate_object_map_iri, R2RML.predicateMap,
262                     predicate_map_iri))
263        mapping.add((predicate_object_map_iri, R2RML.objectMap,
264                     object_map_iri))
265        mapping.add((predicate_object_map_iri, RDF.type,
266                     R2RML.PredicateObjectMap))
267        mapping.add((triplesmap_iri, R2RML.predicateObjectMap,
268                     predicate_object_map_iri))
269
270        return join_condition_iri
271
272    def _add_triples_map_source(self, mapping: Graph, subject_value: Literal,
273                                source_path: Literal,
274                                number: int = 1) -> URIRef:
275        """Insert a TriplesMap into a RML mapping with a Logical Source
276
277        Parameters
278        ----------
279        mapping : Graph
280            [R2]RML mapping as an RDFLib Graph.
281        subject_value : Literal
282            Subject IRI template value.
283        source_path : Literal
284            Path to source file.
285        number : int
286            Triples Map number, default 1.
287
288        Returns
289        -------
290        triples_map_iri : URIRef
291            IRI of the Triples Map inserted into the mapping.
292        """
293        triples_map_iri = URIRef(f'{mapping.base}#TriplesMap{number}')
294        subject_map_iri = BNode()
295        logical_source_iri = BNode()
296
297        mapping.add((logical_source_iri, RML.source, source_path))
298        mapping.add((logical_source_iri, RML.referenceFormulation, QL.CSV))
299        mapping.add((logical_source_iri, RDF.type, RML.LogicalSource))
300        mapping.add((triples_map_iri, RML.logicalSource, logical_source_iri))
301        mapping.add((triples_map_iri, R2RML.subjectMap, subject_map_iri))
302        mapping.add((triples_map_iri, RDF.type, R2RML.TriplesMap))
303        mapping.add((subject_map_iri, R2RML.template, subject_value))
304
305        return triples_map_iri
306
307    def _add_triples_map_table(self, mapping: Graph, subject_value: Literal,
308                               table_name: Literal, number: int = 1) -> URIRef:
309        """Insert a TriplesMap into a [R2]RML mapping with a Logical Table
310
311        Parameters
312        ----------
313        mapping : Graph
314            [R2]RML mapping as an RDFLib Graph.
315        subject_value : Literal
316            Subject IRI template value.
317        table_name : Literal
318            SQL table name to add.
319        number : int
320            Triples Map number, default 1.
321
322        Returns
323        -------
324        triples_map_iri : URIRef
325            IRI of the Triples Map inserted into the mapping.
326        """
327        triples_map_iri = URIRef(f'{mapping.base}#TriplesMap{number}')
328        subject_map_iri = BNode()
329        logical_table_iri = BNode()
330
331        mapping.add((logical_table_iri, R2RML.tableName, table_name))
332        mapping.add((logical_table_iri, RDF.type, R2RML.LogicalTable))
333        mapping.add((triples_map_iri, R2RML.logicalTable, logical_table_iri))
334        mapping.add((triples_map_iri, R2RML.subjectMap, subject_map_iri))
335        mapping.add((triples_map_iri, RDF.type, R2RML.TriplesMap))
336        mapping.add((subject_map_iri, R2RML.template, subject_value))
337
338        return triples_map_iri

Helper class that provides a standard way to create an ABC using inheritance.

Scenario(data_format: str, engine: str, main_directory: str, verbose: bool)
25    def __init__(self, data_format: str, engine: str, main_directory: str,
26                 verbose: bool):
27        """Initializes the Scenario class.
28
29        Parameters
30        ----------
31        data_format : str
32            Data format to use for generating the data set, for example:
33            "csv", "json", "xml", "postgresql", "mysql"
34        engine : str
35            Engine to use for execution of the generated scenario's instance,
36            for example: "RMLMapper", "RMLStreamer", "SDMRDFizer", "MorphKGC",
37            or "OntopMaterialize"
38        main_directory : str
39            Root directory to use for generating instances of scenario.
40        verbose : bool
41            If verbose logging is enabled.
42        """
43        self._data_format: str = data_format
44        self._engine: str = engine
45        self._main_directory: str = main_directory
46        self._verbose: bool = verbose

Initializes the Scenario class.

Parameters
  • data_format (str): Data format to use for generating the data set, for example: "csv", "json", "xml", "postgresql", "mysql"
  • engine (str): Engine to use for execution of the generated scenario's instance, for example: "RMLMapper", "RMLStreamer", "SDMRDFizer", "MorphKGC", or "OntopMaterialize"
  • main_directory (str): Root directory to use for generating instances of scenario.
  • verbose (bool): If verbose logging is enabled.
@abstractmethod
def generate(self) -> bool:
48    @abstractmethod
49    def generate(self) -> bool:
50        """Generate the scenario.
51
52        Generate the scenario input to execute the scenario such as input
53        data files, mappings, and other metadata.
54
55        Returns
56        -------
57        success : bool
58            True if success, otherwise false.
59        """
60        pass

Generate the scenario.

Generate the scenario input to execute the scenario such as input data files, mappings, and other metadata.

Returns
  • success (bool): True if success, otherwise false.
@abstractmethod
def path(self) -> str:
62    @abstractmethod
63    def path(self) -> str:
64        """Builds the file path for the instance of a scenario.
65
66        Returns
67        -------
68        path : str
69            File path for the scenario's instance
70        """
71        pass

Builds the file path for the instance of a scenario.

Returns
  • path (str): File path for the scenario's instance