sensotwin.temperature_selection.configuration

  1from .. import read_vtt, write_vtt
  2from ..store_connection import LocalStoreConnection, FusekiConnection, StoreConnection
  3from pyiron_base import HasHDF
  4import pandas as pd
  5
  6class TemperatureGraph:
  7    """Describes temperature behaviour of material curing process."""
  8    def __init__(self, uniq_id: int=None, name: str=None, time_data: list=None, temperature_data: list=None, conn: StoreConnection=None):
  9        """Initialize object.
 10
 11        Args:
 12            uniq_id: id unique to the chosen store for this object class
 13            name: non-unique name of object
 14            time_data: list of float x values for temperature graph (hours)
 15            temperature_data: list of float y values for temperature graph (°C)
 16            conn: Any subclass instance of StoreConnection
 17        """
 18        self._id = uniq_id
 19        self._name = name
 20        self._time_data = time_data
 21        self._temperature_data = temperature_data
 22        self._store_connection = conn
 23
 24    def get_id(self) -> int:
 25        """Return id of object."""
 26        return self._id
 27    
 28    def get_name(self) -> str:
 29        """Return name of object."""
 30        return self._name
 31    
 32    def get_time_data(self) -> list:
 33        """Return time values of object."""
 34        return self._time_data
 35
 36    def get_temperature_data(self) -> list:
 37        """Return temperature values of object."""
 38        return self._temperature_data
 39
 40    @staticmethod
 41    def get_id_from_ontology_iri(label: str) -> int:
 42        """Extract id from full ontology instance iri."""
 43        return int(label.split("_")[-1])
 44
 45    def generate_ontology_label(self) -> str:
 46        """Generate ontology instance iri from object."""
 47        return "__TemperatureGraph_{}".format(self._id)
 48
 49    def save_entry_to_store(self):
 50        """Save object to store connection passed during initialization."""
 51        label = self.generate_ontology_label()
 52        query = """
 53            INSERT {{
 54                senso:__TimeData_{label} a senso:TimeData ;
 55                    co:value "{time}" .
 56                senso:__TemperatureData_{label} a senso:TemperatureData ;
 57                    co:value "{temp}" .
 58                senso:{label} a senso:TemperatureGraph ;
 59                    rdfs:label "{name}" ;
 60                    co:composedOf senso:__TimeData_{label} ;
 61                    co:composedOf senso:__TemperatureData_{label} .
 62            }} WHERE {{
 63                FILTER NOT EXISTS {{
 64                    [] rdfs:label "{name}" ;
 65                }}
 66            }}
 67            """.format(label=label, name=self._name, uniq_id=self._id, time=",".join(map(str,self._time_data)), temp=",".join(map(str,self._temperature_data)))
 68        self._store_connection.update_data(query)
 69
 70    @staticmethod
 71    def get_all_entries_from_store(conn: StoreConnection) -> dict:
 72        """Get all instances of TemperatureGraph from store connection passed during initialization.
 73
 74        Args:
 75            conn: Any subclass instance of StoreConnection
 76        Returns:
 77            dict of int -> TemperatureGraph
 78        """
 79        query = """
 80            SELECT ?x ?name ?time_value ?temp_value
 81            WHERE {
 82                ?x a senso:TemperatureGraph .
 83                ?x rdfs:label ?name .
 84                {
 85                    ?x co:composedOf ?time_component .
 86                    ?time_component rdf:type senso:TimeData .
 87                    ?time_component co:value ?time_value .
 88                }
 89                { 
 90                    ?x co:composedOf ?temp_component .
 91                    ?temp_component rdf:type senso:TemperatureData .
 92                    ?temp_component co:value ?temp_value .
 93                }
 94            }
 95            ORDER BY ?name
 96        """
 97        result = {}
 98        for x in conn.get_data(query):
 99            uniq_id = TemperatureGraph.get_id_from_ontology_iri(x[0])
100            result[uniq_id] = TemperatureGraph(uniq_id=uniq_id, name=x[1], time_data=list(map(float, x[2].split(","))), 
101                                            temperature_data=list(map(float, x[3].split(","))), conn=conn)
102        return result
103
104    def __str__(self):
105        return "TemperatureGraph, ID: {}, Name: {}, Time (h): {}, Temperature (°C): {}, Source: {}".format(
106            self._id, 
107            self._name, 
108            self._time_data, 
109            self._temperature_data, 
110            self._store_connection)
111
112    def __repr__(self):
113        return "TemperatureGraph(uniq_id={uniq_id}, name='{name}', time_data={time_data}, temperature_data={temperature_data}, conn={conn})".format(
114            uniq_id = self._id, 
115            name = self._name, 
116            time_data = self._time_data, 
117            temperature_data = self._temperature_data, 
118            conn = repr(self._store_connection))
119
120
121class FibreVolumeContent:
122    """Describes average fibre volume content of material used for components."""
123    def __init__(self, uniq_id: int=None, value: float=None, conn: StoreConnection=None):
124        """Initialize object.
125
126        Args:
127            uniq_id: id unique to the chosen store for this object class.
128            value: fibre volume content in %.
129            conn: Any subclass instance of StoreConnection.
130        """
131        self._id = uniq_id
132        self._value = value
133        self._store_connection = conn
134
135    def get_id(self) -> int:
136        """Return id of object."""
137        return self._id
138
139    def get_value(self) -> float:
140        """Return % value of object."""
141        return self._value
142
143    def generate_ontology_label(self) -> str:
144        """Generate ontology instance iri from object."""
145        return "__FibreVolumeContent_{}".format(self._id)
146
147    @staticmethod
148    def get_id_from_ontology_iri(label: str) -> int:
149        """Extract id from full ontology instance iri."""
150        return int(label.split("_")[-1])
151
152    def save_entry_to_store(self):
153        """Save object to store connection passed during initialization."""
154        label = self.generate_ontology_label()
155        query = """
156            INSERT {{
157                senso:{label} a senso:FibreVolumeContent ;
158                    co:value {value} .
159                }} WHERE {{
160                    FILTER NOT EXISTS {{
161                        [] co:value {value} ;
162                    }}
163            }}
164            """.format(label=label, value=self._value)
165        self._store_connection.update_data(query)
166
167    @staticmethod
168    def get_all_entries_from_store(conn: StoreConnection) -> dict:
169        """Get all instances of FibreVolumeContent from store connection passed during initialization.
170
171        Args:
172            conn: Any subclass instance of StoreConnection
173        Returns:
174            dict of int -> FibreVolumeContent
175        """
176        query = """
177            SELECT ?x ?value
178            WHERE {
179                ?x a senso:FibreVolumeContent .
180                ?x co:value ?value .
181            }
182            ORDER BY ASC(?value)
183        """
184        result = {}
185        for x in conn.get_data(query):
186            uniq_id = FibreVolumeContent.get_id_from_ontology_iri(x[0])
187            result[uniq_id] = FibreVolumeContent(uniq_id=uniq_id, value=float(x[1]), conn=conn)
188        return result
189
190    def __str__(self):
191        return "FibreVolumeContent, ID: {}, Value (%): {}, Source: {}".format(self._id, self._value, self._store_connection)
192
193    def __repr__(self):
194        return "FibreVolumeContent(uniq_id={uniq_id}, value={value}, conn={conn})".format(
195            uniq_id = self._id, 
196            value = self._value, 
197            conn = repr(self._store_connection))
198
199class MaterialHardeningInputDataSet(HasHDF):
200    """Input data set for future simulation containing material curing parameters.
201
202    Contains temperature timeline for material curing process and average fibre volume
203    content of used material; implements pyiron HasHDF interface for automatic HDF5
204    serialization during job execution for storage
205    """
206    def __init__(self, uniq_id: int=None, temperature_graph: TemperatureGraph=None, fibre_volume_content: FibreVolumeContent=None, conn: StoreConnection=None):
207        """Initialize object.
208        
209        Args:
210            uniq_id: id unique to the chosen store for this object class
211            temperature_graph: TemperatureGraph object
212            fibre_volume_content: FibreVolumeContent object
213            conn: Any subclass instance of StoreConnection
214        """
215        self._id = uniq_id
216        self._temperature_graph = temperature_graph
217        self._fibre_volume_content = fibre_volume_content
218        self._store_connection = conn
219
220    def get_id(self) -> int:
221        """Return id of object."""
222        return self._id
223
224    def get_temperature_graph_id(self) -> int:
225        """Return id of associated TemperateGraph object."""
226        return self._temperature_graph.get_id()
227
228    def get_temperature_graph(self) -> TemperatureGraph:
229        """Return associated TemperateGraph object."""
230        return self._temperature_graph
231
232    def get_fibre_volume_content_id(self) -> int:
233        """Return id of associated FibreVolumeContent object."""
234        return self._fibre_volume_content.get_id()
235
236    def get_fibre_volume_content(self) -> FibreVolumeContent:
237        """Return associated FibreVolumeContent object."""
238        return self._fibre_volume_content
239
240    def generate_input_set_display_label(self) -> str:
241        """Return string display for object in list displays."""
242        return "{}, {}%".format(self._temperature_graph.get_name(), self._fibre_volume_content.get_value())
243
244    @staticmethod
245    def get_id_from_ontology_iri(label: str)-> int:
246        """Extract id from full ontology instance iri."""
247        return int(label.split("_")[-1])
248
249    def generate_ontology_label(self) -> str:
250        """Generate ontology instance iri from object."""
251        return "__CuringSimulationInputSet_{}".format(self._id)
252
253    def save_entry_to_store(self):
254        """Save object to store connection passed during initialization."""
255        label = self.generate_ontology_label()
256        temp_label = self._temperature_graph.generate_ontology_label()
257        fvc_label = self._fibre_volume_content.generate_ontology_label()
258        query = """
259            INSERT {{
260                senso:{label} a senso:CuringSimulationInputSet ;
261                    co:composedOf       senso:{temp_label} ;
262                    co:composedOf		senso:{fvc_label} .
263            }} WHERE {{}}
264            """.format(label=label, temp_label=temp_label, fvc_label=fvc_label)
265        self._store_connection.update_data(query)
266
267    @staticmethod
268    def get_all_entries_from_store(conn: StoreConnection) -> dict:
269        """Get all instances of MaterialHardeningInputSet from store connection passed during initialization.
270
271        Args:
272            conn: Any subclass instance of StoreConnection
273        Returns:
274            dict of int -> MaterialHardeningInputSet
275        """
276        temps = TemperatureGraph.get_all_entries_from_store(conn)
277        fvcs = FibreVolumeContent.get_all_entries_from_store(conn)
278        query = """
279            SELECT ?x ?fvc_component ?temp_component
280            WHERE {
281                ?x a senso:CuringSimulationInputSet .
282                {
283                    ?x co:composedOf ?fvc_component .
284                    ?fvc_component a senso:FibreVolumeContent .
285                }
286                {
287                    ?x co:composedOf ?temp_component .
288                    ?temp_component a senso:TemperatureGraph .
289                }
290            }
291            """
292        result = {}
293        for x in conn.get_data(query):
294            uniq_id = MaterialHardeningInputDataSet.get_id_from_ontology_iri(x[0])
295            temp_id = TemperatureGraph.get_id_from_ontology_iri(x[2])
296            fvc_id = FibreVolumeContent.get_id_from_ontology_iri(x[1])
297            result[uniq_id] = MaterialHardeningInputDataSet(uniq_id=uniq_id, temperature_graph=temps[temp_id], fibre_volume_content=fvcs[fvc_id], conn=conn)
298        return result
299
300    def __str__(self):
301        return "MaterialHardeningInputDataSet, ID: {}, Temperature ID: {}, FVC ID: {}, Source: {}".format(
302            self._id, self._temperature_graph.get_id(), self._fibre_volume_content.get_id(), self._store_connection)
303
304    def __repr__(self):
305        return "MaterialHardeningInputDataSet(uniq_id={uniq_id}, temperature_graph={temperature_graph}, fibre_volume_content={fibre_volume_content}, conn={conn})".format(
306            uniq_id = self._id, 
307            temperature_graph = repr(self._temperature_graph),
308            fibre_volume_content = repr(self._fibre_volume_content), 
309            conn = repr(self._store_connection))
310
311    def _to_hdf(self, hdf=None, group_name=None):
312        with hdf.open("material_hardening_input_data") as hdf_store:
313            hdf_store["_id"] = self._id
314            hdf_store["_temperature_graph"] = repr(self._temperature_graph)
315            hdf_store["_fibre_volume_content"] = repr(self._fibre_volume_content)
316            hdf_store["_store_connection"] = repr(self._store_connection)
317
318    def _from_hdf(self, hdf=None, version=None):
319        pass
320
321    def from_hdf_args(hdf):
322        with hdf.open("material_hardening_input_data") as hdf_store:
323            arg_dict = {
324                "uniq_id": hdf_store["_id"], 
325                "temperature_graph": eval(hdf_store["_temperature_graph"]),
326                "fibre_volume_content": eval(hdf_store["_fibre_volume_content"]),
327                "conn": eval(hdf_store["_store_connection"])
328            }
329        return arg_dict
class TemperatureGraph:
  7class TemperatureGraph:
  8    """Describes temperature behaviour of material curing process."""
  9    def __init__(self, uniq_id: int=None, name: str=None, time_data: list=None, temperature_data: list=None, conn: StoreConnection=None):
 10        """Initialize object.
 11
 12        Args:
 13            uniq_id: id unique to the chosen store for this object class
 14            name: non-unique name of object
 15            time_data: list of float x values for temperature graph (hours)
 16            temperature_data: list of float y values for temperature graph (°C)
 17            conn: Any subclass instance of StoreConnection
 18        """
 19        self._id = uniq_id
 20        self._name = name
 21        self._time_data = time_data
 22        self._temperature_data = temperature_data
 23        self._store_connection = conn
 24
 25    def get_id(self) -> int:
 26        """Return id of object."""
 27        return self._id
 28    
 29    def get_name(self) -> str:
 30        """Return name of object."""
 31        return self._name
 32    
 33    def get_time_data(self) -> list:
 34        """Return time values of object."""
 35        return self._time_data
 36
 37    def get_temperature_data(self) -> list:
 38        """Return temperature values of object."""
 39        return self._temperature_data
 40
 41    @staticmethod
 42    def get_id_from_ontology_iri(label: str) -> int:
 43        """Extract id from full ontology instance iri."""
 44        return int(label.split("_")[-1])
 45
 46    def generate_ontology_label(self) -> str:
 47        """Generate ontology instance iri from object."""
 48        return "__TemperatureGraph_{}".format(self._id)
 49
 50    def save_entry_to_store(self):
 51        """Save object to store connection passed during initialization."""
 52        label = self.generate_ontology_label()
 53        query = """
 54            INSERT {{
 55                senso:__TimeData_{label} a senso:TimeData ;
 56                    co:value "{time}" .
 57                senso:__TemperatureData_{label} a senso:TemperatureData ;
 58                    co:value "{temp}" .
 59                senso:{label} a senso:TemperatureGraph ;
 60                    rdfs:label "{name}" ;
 61                    co:composedOf senso:__TimeData_{label} ;
 62                    co:composedOf senso:__TemperatureData_{label} .
 63            }} WHERE {{
 64                FILTER NOT EXISTS {{
 65                    [] rdfs:label "{name}" ;
 66                }}
 67            }}
 68            """.format(label=label, name=self._name, uniq_id=self._id, time=",".join(map(str,self._time_data)), temp=",".join(map(str,self._temperature_data)))
 69        self._store_connection.update_data(query)
 70
 71    @staticmethod
 72    def get_all_entries_from_store(conn: StoreConnection) -> dict:
 73        """Get all instances of TemperatureGraph from store connection passed during initialization.
 74
 75        Args:
 76            conn: Any subclass instance of StoreConnection
 77        Returns:
 78            dict of int -> TemperatureGraph
 79        """
 80        query = """
 81            SELECT ?x ?name ?time_value ?temp_value
 82            WHERE {
 83                ?x a senso:TemperatureGraph .
 84                ?x rdfs:label ?name .
 85                {
 86                    ?x co:composedOf ?time_component .
 87                    ?time_component rdf:type senso:TimeData .
 88                    ?time_component co:value ?time_value .
 89                }
 90                { 
 91                    ?x co:composedOf ?temp_component .
 92                    ?temp_component rdf:type senso:TemperatureData .
 93                    ?temp_component co:value ?temp_value .
 94                }
 95            }
 96            ORDER BY ?name
 97        """
 98        result = {}
 99        for x in conn.get_data(query):
100            uniq_id = TemperatureGraph.get_id_from_ontology_iri(x[0])
101            result[uniq_id] = TemperatureGraph(uniq_id=uniq_id, name=x[1], time_data=list(map(float, x[2].split(","))), 
102                                            temperature_data=list(map(float, x[3].split(","))), conn=conn)
103        return result
104
105    def __str__(self):
106        return "TemperatureGraph, ID: {}, Name: {}, Time (h): {}, Temperature (°C): {}, Source: {}".format(
107            self._id, 
108            self._name, 
109            self._time_data, 
110            self._temperature_data, 
111            self._store_connection)
112
113    def __repr__(self):
114        return "TemperatureGraph(uniq_id={uniq_id}, name='{name}', time_data={time_data}, temperature_data={temperature_data}, conn={conn})".format(
115            uniq_id = self._id, 
116            name = self._name, 
117            time_data = self._time_data, 
118            temperature_data = self._temperature_data, 
119            conn = repr(self._store_connection))

Describes temperature behaviour of material curing process.

TemperatureGraph( uniq_id: int = None, name: str = None, time_data: list = None, temperature_data: list = None, conn: sensotwin.store_connection.StoreConnection = None)
 9    def __init__(self, uniq_id: int=None, name: str=None, time_data: list=None, temperature_data: list=None, conn: StoreConnection=None):
10        """Initialize object.
11
12        Args:
13            uniq_id: id unique to the chosen store for this object class
14            name: non-unique name of object
15            time_data: list of float x values for temperature graph (hours)
16            temperature_data: list of float y values for temperature graph (°C)
17            conn: Any subclass instance of StoreConnection
18        """
19        self._id = uniq_id
20        self._name = name
21        self._time_data = time_data
22        self._temperature_data = temperature_data
23        self._store_connection = conn

Initialize object.

Args: uniq_id: id unique to the chosen store for this object class name: non-unique name of object time_data: list of float x values for temperature graph (hours) temperature_data: list of float y values for temperature graph (°C) conn: Any subclass instance of StoreConnection

def get_id(self) -> int:
25    def get_id(self) -> int:
26        """Return id of object."""
27        return self._id

Return id of object.

def get_name(self) -> str:
29    def get_name(self) -> str:
30        """Return name of object."""
31        return self._name

Return name of object.

def get_time_data(self) -> list:
33    def get_time_data(self) -> list:
34        """Return time values of object."""
35        return self._time_data

Return time values of object.

def get_temperature_data(self) -> list:
37    def get_temperature_data(self) -> list:
38        """Return temperature values of object."""
39        return self._temperature_data

Return temperature values of object.

@staticmethod
def get_id_from_ontology_iri(label: str) -> int:
41    @staticmethod
42    def get_id_from_ontology_iri(label: str) -> int:
43        """Extract id from full ontology instance iri."""
44        return int(label.split("_")[-1])

Extract id from full ontology instance iri.

def generate_ontology_label(self) -> str:
46    def generate_ontology_label(self) -> str:
47        """Generate ontology instance iri from object."""
48        return "__TemperatureGraph_{}".format(self._id)

Generate ontology instance iri from object.

def save_entry_to_store(self):
50    def save_entry_to_store(self):
51        """Save object to store connection passed during initialization."""
52        label = self.generate_ontology_label()
53        query = """
54            INSERT {{
55                senso:__TimeData_{label} a senso:TimeData ;
56                    co:value "{time}" .
57                senso:__TemperatureData_{label} a senso:TemperatureData ;
58                    co:value "{temp}" .
59                senso:{label} a senso:TemperatureGraph ;
60                    rdfs:label "{name}" ;
61                    co:composedOf senso:__TimeData_{label} ;
62                    co:composedOf senso:__TemperatureData_{label} .
63            }} WHERE {{
64                FILTER NOT EXISTS {{
65                    [] rdfs:label "{name}" ;
66                }}
67            }}
68            """.format(label=label, name=self._name, uniq_id=self._id, time=",".join(map(str,self._time_data)), temp=",".join(map(str,self._temperature_data)))
69        self._store_connection.update_data(query)

Save object to store connection passed during initialization.

@staticmethod
def get_all_entries_from_store(conn: sensotwin.store_connection.StoreConnection) -> dict:
 71    @staticmethod
 72    def get_all_entries_from_store(conn: StoreConnection) -> dict:
 73        """Get all instances of TemperatureGraph from store connection passed during initialization.
 74
 75        Args:
 76            conn: Any subclass instance of StoreConnection
 77        Returns:
 78            dict of int -> TemperatureGraph
 79        """
 80        query = """
 81            SELECT ?x ?name ?time_value ?temp_value
 82            WHERE {
 83                ?x a senso:TemperatureGraph .
 84                ?x rdfs:label ?name .
 85                {
 86                    ?x co:composedOf ?time_component .
 87                    ?time_component rdf:type senso:TimeData .
 88                    ?time_component co:value ?time_value .
 89                }
 90                { 
 91                    ?x co:composedOf ?temp_component .
 92                    ?temp_component rdf:type senso:TemperatureData .
 93                    ?temp_component co:value ?temp_value .
 94                }
 95            }
 96            ORDER BY ?name
 97        """
 98        result = {}
 99        for x in conn.get_data(query):
100            uniq_id = TemperatureGraph.get_id_from_ontology_iri(x[0])
101            result[uniq_id] = TemperatureGraph(uniq_id=uniq_id, name=x[1], time_data=list(map(float, x[2].split(","))), 
102                                            temperature_data=list(map(float, x[3].split(","))), conn=conn)
103        return result

Get all instances of TemperatureGraph from store connection passed during initialization.

Args: conn: Any subclass instance of StoreConnection Returns: dict of int -> TemperatureGraph

class FibreVolumeContent:
122class FibreVolumeContent:
123    """Describes average fibre volume content of material used for components."""
124    def __init__(self, uniq_id: int=None, value: float=None, conn: StoreConnection=None):
125        """Initialize object.
126
127        Args:
128            uniq_id: id unique to the chosen store for this object class.
129            value: fibre volume content in %.
130            conn: Any subclass instance of StoreConnection.
131        """
132        self._id = uniq_id
133        self._value = value
134        self._store_connection = conn
135
136    def get_id(self) -> int:
137        """Return id of object."""
138        return self._id
139
140    def get_value(self) -> float:
141        """Return % value of object."""
142        return self._value
143
144    def generate_ontology_label(self) -> str:
145        """Generate ontology instance iri from object."""
146        return "__FibreVolumeContent_{}".format(self._id)
147
148    @staticmethod
149    def get_id_from_ontology_iri(label: str) -> int:
150        """Extract id from full ontology instance iri."""
151        return int(label.split("_")[-1])
152
153    def save_entry_to_store(self):
154        """Save object to store connection passed during initialization."""
155        label = self.generate_ontology_label()
156        query = """
157            INSERT {{
158                senso:{label} a senso:FibreVolumeContent ;
159                    co:value {value} .
160                }} WHERE {{
161                    FILTER NOT EXISTS {{
162                        [] co:value {value} ;
163                    }}
164            }}
165            """.format(label=label, value=self._value)
166        self._store_connection.update_data(query)
167
168    @staticmethod
169    def get_all_entries_from_store(conn: StoreConnection) -> dict:
170        """Get all instances of FibreVolumeContent from store connection passed during initialization.
171
172        Args:
173            conn: Any subclass instance of StoreConnection
174        Returns:
175            dict of int -> FibreVolumeContent
176        """
177        query = """
178            SELECT ?x ?value
179            WHERE {
180                ?x a senso:FibreVolumeContent .
181                ?x co:value ?value .
182            }
183            ORDER BY ASC(?value)
184        """
185        result = {}
186        for x in conn.get_data(query):
187            uniq_id = FibreVolumeContent.get_id_from_ontology_iri(x[0])
188            result[uniq_id] = FibreVolumeContent(uniq_id=uniq_id, value=float(x[1]), conn=conn)
189        return result
190
191    def __str__(self):
192        return "FibreVolumeContent, ID: {}, Value (%): {}, Source: {}".format(self._id, self._value, self._store_connection)
193
194    def __repr__(self):
195        return "FibreVolumeContent(uniq_id={uniq_id}, value={value}, conn={conn})".format(
196            uniq_id = self._id, 
197            value = self._value, 
198            conn = repr(self._store_connection))

Describes average fibre volume content of material used for components.

FibreVolumeContent( uniq_id: int = None, value: float = None, conn: sensotwin.store_connection.StoreConnection = None)
124    def __init__(self, uniq_id: int=None, value: float=None, conn: StoreConnection=None):
125        """Initialize object.
126
127        Args:
128            uniq_id: id unique to the chosen store for this object class.
129            value: fibre volume content in %.
130            conn: Any subclass instance of StoreConnection.
131        """
132        self._id = uniq_id
133        self._value = value
134        self._store_connection = conn

Initialize object.

Args: uniq_id: id unique to the chosen store for this object class. value: fibre volume content in %. conn: Any subclass instance of StoreConnection.

def get_id(self) -> int:
136    def get_id(self) -> int:
137        """Return id of object."""
138        return self._id

Return id of object.

def get_value(self) -> float:
140    def get_value(self) -> float:
141        """Return % value of object."""
142        return self._value

Return % value of object.

def generate_ontology_label(self) -> str:
144    def generate_ontology_label(self) -> str:
145        """Generate ontology instance iri from object."""
146        return "__FibreVolumeContent_{}".format(self._id)

Generate ontology instance iri from object.

@staticmethod
def get_id_from_ontology_iri(label: str) -> int:
148    @staticmethod
149    def get_id_from_ontology_iri(label: str) -> int:
150        """Extract id from full ontology instance iri."""
151        return int(label.split("_")[-1])

Extract id from full ontology instance iri.

def save_entry_to_store(self):
153    def save_entry_to_store(self):
154        """Save object to store connection passed during initialization."""
155        label = self.generate_ontology_label()
156        query = """
157            INSERT {{
158                senso:{label} a senso:FibreVolumeContent ;
159                    co:value {value} .
160                }} WHERE {{
161                    FILTER NOT EXISTS {{
162                        [] co:value {value} ;
163                    }}
164            }}
165            """.format(label=label, value=self._value)
166        self._store_connection.update_data(query)

Save object to store connection passed during initialization.

@staticmethod
def get_all_entries_from_store(conn: sensotwin.store_connection.StoreConnection) -> dict:
168    @staticmethod
169    def get_all_entries_from_store(conn: StoreConnection) -> dict:
170        """Get all instances of FibreVolumeContent from store connection passed during initialization.
171
172        Args:
173            conn: Any subclass instance of StoreConnection
174        Returns:
175            dict of int -> FibreVolumeContent
176        """
177        query = """
178            SELECT ?x ?value
179            WHERE {
180                ?x a senso:FibreVolumeContent .
181                ?x co:value ?value .
182            }
183            ORDER BY ASC(?value)
184        """
185        result = {}
186        for x in conn.get_data(query):
187            uniq_id = FibreVolumeContent.get_id_from_ontology_iri(x[0])
188            result[uniq_id] = FibreVolumeContent(uniq_id=uniq_id, value=float(x[1]), conn=conn)
189        return result

Get all instances of FibreVolumeContent from store connection passed during initialization.

Args: conn: Any subclass instance of StoreConnection Returns: dict of int -> FibreVolumeContent

class MaterialHardeningInputDataSet(pyiron_base.interfaces.has_hdf.HasHDF):
200class MaterialHardeningInputDataSet(HasHDF):
201    """Input data set for future simulation containing material curing parameters.
202
203    Contains temperature timeline for material curing process and average fibre volume
204    content of used material; implements pyiron HasHDF interface for automatic HDF5
205    serialization during job execution for storage
206    """
207    def __init__(self, uniq_id: int=None, temperature_graph: TemperatureGraph=None, fibre_volume_content: FibreVolumeContent=None, conn: StoreConnection=None):
208        """Initialize object.
209        
210        Args:
211            uniq_id: id unique to the chosen store for this object class
212            temperature_graph: TemperatureGraph object
213            fibre_volume_content: FibreVolumeContent object
214            conn: Any subclass instance of StoreConnection
215        """
216        self._id = uniq_id
217        self._temperature_graph = temperature_graph
218        self._fibre_volume_content = fibre_volume_content
219        self._store_connection = conn
220
221    def get_id(self) -> int:
222        """Return id of object."""
223        return self._id
224
225    def get_temperature_graph_id(self) -> int:
226        """Return id of associated TemperateGraph object."""
227        return self._temperature_graph.get_id()
228
229    def get_temperature_graph(self) -> TemperatureGraph:
230        """Return associated TemperateGraph object."""
231        return self._temperature_graph
232
233    def get_fibre_volume_content_id(self) -> int:
234        """Return id of associated FibreVolumeContent object."""
235        return self._fibre_volume_content.get_id()
236
237    def get_fibre_volume_content(self) -> FibreVolumeContent:
238        """Return associated FibreVolumeContent object."""
239        return self._fibre_volume_content
240
241    def generate_input_set_display_label(self) -> str:
242        """Return string display for object in list displays."""
243        return "{}, {}%".format(self._temperature_graph.get_name(), self._fibre_volume_content.get_value())
244
245    @staticmethod
246    def get_id_from_ontology_iri(label: str)-> int:
247        """Extract id from full ontology instance iri."""
248        return int(label.split("_")[-1])
249
250    def generate_ontology_label(self) -> str:
251        """Generate ontology instance iri from object."""
252        return "__CuringSimulationInputSet_{}".format(self._id)
253
254    def save_entry_to_store(self):
255        """Save object to store connection passed during initialization."""
256        label = self.generate_ontology_label()
257        temp_label = self._temperature_graph.generate_ontology_label()
258        fvc_label = self._fibre_volume_content.generate_ontology_label()
259        query = """
260            INSERT {{
261                senso:{label} a senso:CuringSimulationInputSet ;
262                    co:composedOf       senso:{temp_label} ;
263                    co:composedOf		senso:{fvc_label} .
264            }} WHERE {{}}
265            """.format(label=label, temp_label=temp_label, fvc_label=fvc_label)
266        self._store_connection.update_data(query)
267
268    @staticmethod
269    def get_all_entries_from_store(conn: StoreConnection) -> dict:
270        """Get all instances of MaterialHardeningInputSet from store connection passed during initialization.
271
272        Args:
273            conn: Any subclass instance of StoreConnection
274        Returns:
275            dict of int -> MaterialHardeningInputSet
276        """
277        temps = TemperatureGraph.get_all_entries_from_store(conn)
278        fvcs = FibreVolumeContent.get_all_entries_from_store(conn)
279        query = """
280            SELECT ?x ?fvc_component ?temp_component
281            WHERE {
282                ?x a senso:CuringSimulationInputSet .
283                {
284                    ?x co:composedOf ?fvc_component .
285                    ?fvc_component a senso:FibreVolumeContent .
286                }
287                {
288                    ?x co:composedOf ?temp_component .
289                    ?temp_component a senso:TemperatureGraph .
290                }
291            }
292            """
293        result = {}
294        for x in conn.get_data(query):
295            uniq_id = MaterialHardeningInputDataSet.get_id_from_ontology_iri(x[0])
296            temp_id = TemperatureGraph.get_id_from_ontology_iri(x[2])
297            fvc_id = FibreVolumeContent.get_id_from_ontology_iri(x[1])
298            result[uniq_id] = MaterialHardeningInputDataSet(uniq_id=uniq_id, temperature_graph=temps[temp_id], fibre_volume_content=fvcs[fvc_id], conn=conn)
299        return result
300
301    def __str__(self):
302        return "MaterialHardeningInputDataSet, ID: {}, Temperature ID: {}, FVC ID: {}, Source: {}".format(
303            self._id, self._temperature_graph.get_id(), self._fibre_volume_content.get_id(), self._store_connection)
304
305    def __repr__(self):
306        return "MaterialHardeningInputDataSet(uniq_id={uniq_id}, temperature_graph={temperature_graph}, fibre_volume_content={fibre_volume_content}, conn={conn})".format(
307            uniq_id = self._id, 
308            temperature_graph = repr(self._temperature_graph),
309            fibre_volume_content = repr(self._fibre_volume_content), 
310            conn = repr(self._store_connection))
311
312    def _to_hdf(self, hdf=None, group_name=None):
313        with hdf.open("material_hardening_input_data") as hdf_store:
314            hdf_store["_id"] = self._id
315            hdf_store["_temperature_graph"] = repr(self._temperature_graph)
316            hdf_store["_fibre_volume_content"] = repr(self._fibre_volume_content)
317            hdf_store["_store_connection"] = repr(self._store_connection)
318
319    def _from_hdf(self, hdf=None, version=None):
320        pass
321
322    def from_hdf_args(hdf):
323        with hdf.open("material_hardening_input_data") as hdf_store:
324            arg_dict = {
325                "uniq_id": hdf_store["_id"], 
326                "temperature_graph": eval(hdf_store["_temperature_graph"]),
327                "fibre_volume_content": eval(hdf_store["_fibre_volume_content"]),
328                "conn": eval(hdf_store["_store_connection"])
329            }
330        return arg_dict

Input data set for future simulation containing material curing parameters.

Contains temperature timeline for material curing process and average fibre volume content of used material; implements pyiron HasHDF interface for automatic HDF5 serialization during job execution for storage

MaterialHardeningInputDataSet( uniq_id: int = None, temperature_graph: TemperatureGraph = None, fibre_volume_content: FibreVolumeContent = None, conn: sensotwin.store_connection.StoreConnection = None)
207    def __init__(self, uniq_id: int=None, temperature_graph: TemperatureGraph=None, fibre_volume_content: FibreVolumeContent=None, conn: StoreConnection=None):
208        """Initialize object.
209        
210        Args:
211            uniq_id: id unique to the chosen store for this object class
212            temperature_graph: TemperatureGraph object
213            fibre_volume_content: FibreVolumeContent object
214            conn: Any subclass instance of StoreConnection
215        """
216        self._id = uniq_id
217        self._temperature_graph = temperature_graph
218        self._fibre_volume_content = fibre_volume_content
219        self._store_connection = conn

Initialize object.

Args: uniq_id: id unique to the chosen store for this object class temperature_graph: TemperatureGraph object fibre_volume_content: FibreVolumeContent object conn: Any subclass instance of StoreConnection

def get_id(self) -> int:
221    def get_id(self) -> int:
222        """Return id of object."""
223        return self._id

Return id of object.

def get_temperature_graph_id(self) -> int:
225    def get_temperature_graph_id(self) -> int:
226        """Return id of associated TemperateGraph object."""
227        return self._temperature_graph.get_id()

Return id of associated TemperateGraph object.

def get_temperature_graph(self) -> TemperatureGraph:
229    def get_temperature_graph(self) -> TemperatureGraph:
230        """Return associated TemperateGraph object."""
231        return self._temperature_graph

Return associated TemperateGraph object.

def get_fibre_volume_content_id(self) -> int:
233    def get_fibre_volume_content_id(self) -> int:
234        """Return id of associated FibreVolumeContent object."""
235        return self._fibre_volume_content.get_id()

Return id of associated FibreVolumeContent object.

def get_fibre_volume_content(self) -> FibreVolumeContent:
237    def get_fibre_volume_content(self) -> FibreVolumeContent:
238        """Return associated FibreVolumeContent object."""
239        return self._fibre_volume_content

Return associated FibreVolumeContent object.

def generate_input_set_display_label(self) -> str:
241    def generate_input_set_display_label(self) -> str:
242        """Return string display for object in list displays."""
243        return "{}, {}%".format(self._temperature_graph.get_name(), self._fibre_volume_content.get_value())

Return string display for object in list displays.

@staticmethod
def get_id_from_ontology_iri(label: str) -> int:
245    @staticmethod
246    def get_id_from_ontology_iri(label: str)-> int:
247        """Extract id from full ontology instance iri."""
248        return int(label.split("_")[-1])

Extract id from full ontology instance iri.

def generate_ontology_label(self) -> str:
250    def generate_ontology_label(self) -> str:
251        """Generate ontology instance iri from object."""
252        return "__CuringSimulationInputSet_{}".format(self._id)

Generate ontology instance iri from object.

def save_entry_to_store(self):
254    def save_entry_to_store(self):
255        """Save object to store connection passed during initialization."""
256        label = self.generate_ontology_label()
257        temp_label = self._temperature_graph.generate_ontology_label()
258        fvc_label = self._fibre_volume_content.generate_ontology_label()
259        query = """
260            INSERT {{
261                senso:{label} a senso:CuringSimulationInputSet ;
262                    co:composedOf       senso:{temp_label} ;
263                    co:composedOf		senso:{fvc_label} .
264            }} WHERE {{}}
265            """.format(label=label, temp_label=temp_label, fvc_label=fvc_label)
266        self._store_connection.update_data(query)

Save object to store connection passed during initialization.

@staticmethod
def get_all_entries_from_store(conn: sensotwin.store_connection.StoreConnection) -> dict:
268    @staticmethod
269    def get_all_entries_from_store(conn: StoreConnection) -> dict:
270        """Get all instances of MaterialHardeningInputSet from store connection passed during initialization.
271
272        Args:
273            conn: Any subclass instance of StoreConnection
274        Returns:
275            dict of int -> MaterialHardeningInputSet
276        """
277        temps = TemperatureGraph.get_all_entries_from_store(conn)
278        fvcs = FibreVolumeContent.get_all_entries_from_store(conn)
279        query = """
280            SELECT ?x ?fvc_component ?temp_component
281            WHERE {
282                ?x a senso:CuringSimulationInputSet .
283                {
284                    ?x co:composedOf ?fvc_component .
285                    ?fvc_component a senso:FibreVolumeContent .
286                }
287                {
288                    ?x co:composedOf ?temp_component .
289                    ?temp_component a senso:TemperatureGraph .
290                }
291            }
292            """
293        result = {}
294        for x in conn.get_data(query):
295            uniq_id = MaterialHardeningInputDataSet.get_id_from_ontology_iri(x[0])
296            temp_id = TemperatureGraph.get_id_from_ontology_iri(x[2])
297            fvc_id = FibreVolumeContent.get_id_from_ontology_iri(x[1])
298            result[uniq_id] = MaterialHardeningInputDataSet(uniq_id=uniq_id, temperature_graph=temps[temp_id], fibre_volume_content=fvcs[fvc_id], conn=conn)
299        return result

Get all instances of MaterialHardeningInputSet from store connection passed during initialization.

Args: conn: Any subclass instance of StoreConnection Returns: dict of int -> MaterialHardeningInputSet

def from_hdf_args(hdf):
322    def from_hdf_args(hdf):
323        with hdf.open("material_hardening_input_data") as hdf_store:
324            arg_dict = {
325                "uniq_id": hdf_store["_id"], 
326                "temperature_graph": eval(hdf_store["_temperature_graph"]),
327                "fibre_volume_content": eval(hdf_store["_fibre_volume_content"]),
328                "conn": eval(hdf_store["_store_connection"])
329            }
330        return arg_dict

Read arguments for instance creation from HDF5 file.

Args: hdf (ProjectHDFio): HDF5 group object

Returns: dict: arguments that can be **kwarg-passed to cls().

Inherited Members
pyiron_base.interfaces.has_hdf.HasHDF
from_hdf
to_hdf
rewrite_hdf