buildingmotif.model_builder#

Classes

TemplateBuilderContext(ns[, store])

A context for building templates.

TemplateWrapper(template, ns)

class TemplateBuilderContext(ns: Namespace, store: Optional[Union[Store, str]] = None)[source]#

A context for building templates. This class allows the user to add templates to the context and then access them by name. The context also allows the user to compile all of the templates in the context into a single graph.

add_template(template: Template)[source]#

Adds a template to the context with all of its dependencies inlined. Allows the user of the context to access the template by name.

Parameters:

template – The template to add to the context

add_templates_from_library(library: Library)[source]#

Adds all of the templates from a library to the context

Parameters:

library – The library to add to the context

compile() Graph[source]#

Compiles all of the template wrappers and concatenates them into a single Graph

Returns:

A graph containing all of the compiled templates

class TemplateWrapper(template: Template, ns: Namespace)[source]#
property parameters#
compile() Graph[source]#

Compiles the template into a graph. If there are still parameters to be bound, then the template will be returned. Otherwise, the template will be filled and the resulting graph will be returned.

Returns:

A graph containing the compiled template

Return type:

Graph