weaving rule context


i want to generate 1 root-concept for each model and then use the weaving rule, to put subnodes in this context.

I tried to create the root-concept in the output-model using the "conditional root rules" or the "root mapping rules". Thats working.

But when i tried to create nodes in that using the weaving rule I get an error.

I tried genContext.outputModel.roots(TextSymbols).first
and i tried using using labels:

errormessage: bad context for weaving rule: map_TextSymbolsList is generated by 'create root' rule

What is wrong? How to do that?
You have 'Generator -> Strict Mode' option turned on. It was introduced in 1.5 release to enable both parallel and incremental generation. In strict mode your generators should be able to handle model on per-root basis. Weaving between roots is forbidden.

There are two possibilities:

1. Turn off 'strict mode' (though we wouldn't recommend that). Outcome is slower generation of large models.

2. Do not use weavings. Collect required nodes and apply templates in the conditional root (or root mapping rule) template. It is much more straightforward (and clear).

(Weaving are still available between roots which are generated from the same input root)
I already used the 2nd method. Although I thought it is maybe some kind of hack but it seems to be quite nice.

So actually there's no situation where you really MUST use weaving rules?

Please sign in to leave a comment.