buildingmotif.template_compilation#
Module Attributes
Notes: - maybe more useful for authoring than for distribution - "compile" into template definitions that then get distributed - standardize the "subject" of the template: 'name' param - have rules generate dependencies rather than introducing additional subjects? - give the rules/macros access to the library and/or the template they are associated with?: - new signature: def foo(library, template, *args, **kwargs) -> rdflib.Graph - don't hardcode template names into these rules/macros --- pass in from user |
Functions
|
Adds template fields for each of the param names in args to ensure they have BACnet references. |
|
Returns the first value of the body argument as the template body. |
|
Compiles a template specification into the body of a template by applying rules defined in this file and others. |
|
_summary_ |
|
_summary_ |
|
_summary_ |
|
_summary_ |
|
_summary_ |
|
This decorator is applied to a function in order to register that function as a rule that can be executed during template compilation. |
- RULES: Dict[str, Callable] = {'bacnet': <function bacnet>, 'body': <function body>, 'downstream': <function feeds>, 'hasPart': <function parts>, 'hasPoint': <function points>, 'type': <function hasType>, 'upstream': <function isFedBy>}#
Notes: - maybe more useful for authoring than for distribution - “compile” into template definitions that then get distributed - standardize the “subject” of the template: ‘name’ param - have rules generate dependencies rather than introducing additional subjects? - give the rules/macros access to the library and/or the template they are associated with?:
don’t hardcode template names into these rules/macros — pass in from user
- rule(name: str)[source]#
This decorator is applied to a function in order to register that function as a rule that can be executed during template compilation.
- Parameters:
name (str) – name
- body(*args, **kwargs) Graph [source]#
Returns the first value of the body argument as the template body.
- Returns:
graph of first value of body argument
- Return type:
rdflib.Graph
- bacnet(*args, **kwargs) Graph [source]#
Adds template fields for each of the param names in args to ensure they have BACnet references.
- Returns:
a graph with BACnet references added
- Return type:
rdflib.Graph
- compile_template_spec(spec: Dict) Dict [source]#
Compiles a template specification into the body of a template by applying rules defined in this file and others.
- Parameters:
spec (Dict) – the Python dictionary that is the result of decoding the YAML structure (usually a dictionary or list) defining the template
- Raises:
ValueError – if unknown rule
- Returns:
the template spec containing the compiled body
- Return type:
Dict