LibreMecaDesign.core package¶
Submodules¶
core.container module¶
core.query module¶
Provide the base-level search class (layer 0) to fetch values from the database and store them into a class
| example: | a = search(‘S_ut > 500 MPa AND S_y < 400 MPa AND normalized OR temper | MED:S_y’) print(a.unique_result[‘S_ut’]) |
|---|---|
| return: | a list of relevant results. Each result is a dictionary containing the properties. If an optimization keyword was given, the object self.unique_result return the best matching result of the list. |
Usage :
- the syntax is similar to Google search
- text parameters are fetched in all text properties (name, category, etc.)
- to retrieve numeric values for properties, use a SQL syntax such as PROPERTY =<> value
- give every value with its unit
- if you want only one result, give an optimization keyword with the property to optimizelike : | KEYWORD : parameter.
-
class
core.query.search(query_string)[source]¶ Handle the queries
-
clean_query(queries)[source]¶ Shortcut to loop remove_unit element by element in the terms list or nested list
-
escape_optimization(query_string)[source]¶ Search for an optimization keyword and store the condition
-
prepare_query(query_string)[source]¶ Split a query string into keywords and interpretate boolean operators
Parameters: query_string – unformatted string Returns: nested list of lists of terms to search alternatively - the top level list contains the OR arguments
- the nested lists contain the AND argument
-