Cleanup / Loading imported models: when "importURI" does have an effect? · Issue #380 · textX/textX · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Until now (textx 3.0), we have the ImportURI scope provider base class which allows to use the special attribute "importURI" to load imported models: e.g., see this example.
Specializations of ImportURI (scope providers allowing to import models):
when loading a model, prior to reference resolution, all imported models are loaded. This happens in model.py by checking if the scope provider ìs aModelLoader instance: here and here.
The ImportURI has a specific way to detect imports. It scans the model for attributes named importURI to load models (this could be implemented in a different way, e.g., by using other attributes, but we do not do this any unittest).
The ImportURI has a specific way to load models. They are stored in some special `_tx"-atttributes of the model (or the metamodel). This "special way" of loading models is used by our multi model scope providers or tool functions (see, e.g, http://textx.github.io/textX/3.0/scoping/#included-model-retrieval) but could be implemented differently.
I would like to start a discussion if we should narrow the possibilities to load models into the model (here and here.):
instead to call all ModelLoader scope provider separately (which redundantly tries to load and reload all imported models if more than one such scope provider is registered)
we could just once find all importURIattributes (fixed logic) and load all imported models (like we do it now in the ImportURI scope provider).
All scope providers have then to be analyzed if they should lookup cross-model references by default or always (e.g. +m in RREL strings or the FQN-scope provider).
This a BIC in any case! We should carefully think about it some time... But I think, if done correctly, this BIC should have no (or nearly no) impact for "normal users".
I am looking forward to discuss this topic with the users of textx! We can also move it to the discussion section, but since I expect some actions following this discussion I started it as issue... @igordejanovic feel free to move this issue...
The text was updated successfully, but these errors were encountered:
goto40
changed the title
Loading imported models: when "importURI" does have an effect?
Cleanup / Loading imported models: when "importURI" does have an effect?
Apr 1, 2022
@goto40 Thanks for the thorough analysis of the problem. I agree with you. I vote for moving the logic of importURI model loading out of scope providers. It makes sense to have importURI referenced models loaded always. This should go nicely with removing of +m in RRELs and making that logic the default as we discussed before. I guess the reference resolving should take into account loaded models always.
I agree that this discussion will lead to code changes so let's leave it as an issue instead of a discussion.
Until now (textx 3.0), we have the
ImportURI
scope provider base class which allows to use the special attribute "importURI" to load imported models: e.g., see this example.Specializations of
ImportURI
(scope providers allowing to import models):How does the base class
ImportURI
work:model.py
by checking if the scope providerìs a
ModelLoader
instance: here and here.ImportURI
has a specific way to detect imports. It scans the model for attributes namedimportURI
to load models (this could be implemented in a different way, e.g., by using other attributes, but we do not do this any unittest).ImportURI
has a specific way to load models. They are stored in some special `_tx"-atttributes of the model (or the metamodel). This "special way" of loading models is used by our multi model scope providers or tool functions (see, e.g, http://textx.github.io/textX/3.0/scoping/#included-model-retrieval) but could be implemented differently.I would like to start a discussion if we should narrow the possibilities to load models into the model (here and here.):
ModelLoader
scope provider separately (which redundantly tries to load and reload all imported models if more than one such scope provider is registered)importURI
attributes (fixed logic) and load all imported models (like we do it now in theImportURI
scope provider).+m
in RREL strings or theFQN
-scope provider).This a BIC in any case! We should carefully think about it some time... But I think, if done correctly, this BIC should have no (or nearly no) impact for "normal users".
I am looking forward to discuss this topic with the users of
textx
! We can also move it to the discussion section, but since I expect some actions following this discussion I started it as issue... @igordejanovic feel free to move this issue...The text was updated successfully, but these errors were encountered: