python-domain-equations
Project description
# python-domain-equations
@copyright: 2018 by Pauli Rikula <pauli.rikula@gmail.com>
@license: MIT <http://www.opensource.org/licenses/mit-license.php>
Represent and generate domain model classes from category-like equations.
>>> g = PropertyGraph() >>> I, O, C = g.I, g.O, g.C
One can represent the need of something with the operator ‘*’ in the following way: To measure speed you have to get interval and distance. To model this you can write:
>>> speed = C('speed') >>> speed C(speed)>>> distance = C('distance') >>> duration = C('duration') >>> g.get_properties_from(speed*(distance+duration)) >>> for i in g.properties: ... print(i) {"naming": {"type": "Distance", "value": "distance"}} {"naming": {"type": "Duration", "value": "duration"}} {"naming": {"type": "Speed", "value": "speed"}, "properties": ["Distance", "Duration"]}
For fines you have to know also:
>>> fine = C('fine') >>> monthly_income = C('monthly_income') >>> speed_limit = C('speed_limit') >>> g.get_properties_from(speed*(distance + duration) + fine*(speed + monthly_income + speed_limit)) >>> for i in g.properties: ... print(i) {"naming": {"type": "Distance", "value": "distance"}} {"naming": {"type": "Duration", "value": "duration"}} {"naming": {"type": "Fine", "value": "fine"}, "properties": ["MonthlyIncome", "Speed", "SpeedLimit"]} {"naming": {"type": "MonthlyIncome", "value": "monthly_income"}} {"naming": {"type": "Speed", "value": "speed"}, "properties": ["Distance", "Duration"]} {"naming": {"type": "SpeedLimit", "value": "speed_limit"}}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for python_domain_equations-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fac7ca89cd6c4cc9c50a7f4e7888535d298650318f7c9d9f02cd60b2ec57f8f |
|
MD5 | 3f616eb12952a76d84313666b9087123 |
|
BLAKE2b-256 | 0f6b25a8e7a265ed988a17cb065ef8c8743f35af8a67f06755c655a94db6dc89 |