8000 Cleanup / Loading imported models: when "importURI" does have an effect? · Issue #380 · textX/textX · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Cleanup / Loading imported models: when "importURI" does have an effect? #380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
goto40 opened this issue Apr 1, 2022 · 1 comment
Open

Comments

@goto40
Copy link
Member
goto40 commented Apr 1, 2022

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:

  • 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 a ModelLoader 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...

@goto40 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
@igordejanovic
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0