Core Services¶
here you can find the API for services that are related to model creation and model manipulation.
Element Repository (/Factory)¶
- class gaphor.core.modeling.ElementFactory(event_manager: EventManager | None = None, element_dispatcher: ElementDispatcher | None = None)[source]¶
The
ElementFactory
is used as a central repository for a model.New model elements should be created by
create
.Methods like
select
can be used to find elements in the model.- select(expression: Callable[[Base], bool]) Iterator[Base] [source]¶
- select(expression: type[T]) Iterator[T]
- select(expression: None) Iterator[Base]
Iterate elements that comply with expression.
Expressions can be:
None
: return all elements.A type: return all elements of that type, or subtypes.
An expression.
- lselect(expression: Callable[[Base], bool] | type[T] | None = None) list[Base] [source]¶
Like
select
, but return a list, instead of an iterator.
- create(type: type[T]) T [source]¶
Create a new model element of type
type
.This method will only create model elements, not
Presentation
elements: those are created byDiagram
.
Modeling Language¶
Information on how modeling languages are managed can be found Modeling Languages.
Event Manager¶
The Event System takes care of dispatches events throughout Gaphor.