Skip to main content



      Home
Home » Modeling » TMF (Xtext) » How to add information about relations between entities to the index
How to add information about relations between entities to the index [message #1800123] Thu, 20 December 2018 04:37 Go to next message
Eclipse UserFriend
Hi,

I designed a DSL that consists of Entities and Relations between them. Both Entities and Relations are top-level elements and each instance of them resides in their own file. Relations store the information to which entities they are connected, entities do not.

Example:
File1.dsl:
Entity MyEntityA {
...
}

File2.dsl:
Entity MyEntityB {
...
}

File3.dsl:
Relation MyRelationC {
from MyEntityA to MyEntityB
}


In order to build dependecy graphs between the Entities I have to traverse the Relations. However currently, I would have to traverse the complete index in order to find all Relations that are connected to a specific Entity (say MyEntityA). How can I make this more efficient?

What I tried:
- Adding userData to each Entity, containing the connected Relations. However, this information would need to be refreshed whenever a *Relation* changes, which does not seem to be possible.
- IReferenceDescriptions do not accept user data.
- Building an own secondary "index" for this pupose. It is able to invalidate any entries whenever a Listener fires (currently I am adding listeners to the IResourceDescroptions, i.e., the index) and provides O(1) access time for getting the relations that are active for a listener. However, it does not save its state to the disk (which makes in kinda useless, as whenever you start eclipse (without a complete rebuild) it is empty and provides the wrong information) and it does not manage dirty states properly.
- I considered changing the metamodel, so that each entity defines the Relations it is connected to. I do not like this approach though, as the information is redundant bloat. Of course, one could add QuickFixes and Validations to ease this approach, but I would prefer another solution, if possible.

So, before I rebuild the complete Xtext-Index: There is surely a better way to do it?
Re: How to add information about relations between entities to the index [message #1800154 is a reply to message #1800123] Thu, 20 December 2018 09:15 Go to previous messageGo to next message
Eclipse UserFriend
cant you simply use the listener approach and participate in EMFBasedPersister load/save?
Re: How to add information about relations between entities to the index [message #1800228 is a reply to message #1800154] Fri, 21 December 2018 09:41 Go to previous messageGo to next message
Eclipse UserFriend
Ok, never heared of that class.

It is responsible for persisting EMF based files, so I could hook into it and store / load my secondary with the rest of the workspace - that's what you are saying, right? Is there some kind of documentation to this?

In your opinion, what is the best way to deal with the problem I face when designing a DSL? It should be a common problem, as most models introduce some kind of relationships that have to be checked for cyclic dependencies (e.g. interface inheritance). I supose, in most models you would define this kind of relationships directly in the entity-file. Is this maybe the best practise?

Thanks in advance!

Re: How to add information about relations between entities to the index [message #1800233 is a reply to message #1800228] Fri, 21 December 2018 10:42 Go to previous messageGo to next message
Eclipse UserFriend
No it saves And loads the Xtext index

[Updated on: Fri, 21 December 2018 10:42] by Moderator

Re: How to add information about relations between entities to the index [message #1800234 is a reply to message #1800233] Fri, 21 December 2018 10:43 Go to previous message
Eclipse UserFriend
It depends. Supertype would be usually done inplace. Same for relationships
Previous Topic:Configure single Language Server with multiple grammars (IResourceServiceProvider)
Next Topic:Build Problems with Xtend Maven Plugin (signer information)
Goto Forum:
  


Current Time: Thu Jul 10 09:00:09 EDT 2025

Powered by FUDForum. Page generated in 0.20301 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top