NMFCode / NMF

This repository contains the entire code for the .NET Modeling Framework
BSD 3-Clause "New" or "Revised" License
36 stars 15 forks source link

Extra Uri entries in MetaRepository.entries? #31

Closed ChrisH07 closed 6 years ago

ChrisH07 commented 6 years ago

Hi Georg,

While stepping through the code, there were more Uri entries in the MetaRepository.entries collection than I expected. The "extra" Uri entries get added in the LoadModel function. Some of these entries appear to have an invalid Uri since the followingAttribute.ModelUri is not associated with the deserialized model. Here is contents of the collection while debugging EcoreInterop: entries In my case, none of the Uri entries ending in .nmf are accessed and could be removed. Could you help me understand why the Uri of the next attribute in the assembly is associated with the current attributes model? For reference you added this as an additional step in 2c875e3d90df7b6447aec90c4de8617cfcbd3b42.

Thank you,

Chris

georghinkel commented 6 years ago

Hi Chris,

the purpose of this change is that if you have an assembly that contains multiple metamodels, these metamodels can reference each other through relative paths, independent of their URI. For example, the models assembly contains NMeta itself but also NMetaChanges.nmf. NMetaChanges references NMeta. However, in order to use relative paths instead of fully qualified references (that are impractical when you create the models), NMF now basically expects the metamodels to be specified in a topological order and then registers the loaded metamodels also under the URI of later loaded metamodels with the corresponding relative file URI. For NMeta and NMetaChanges, this means that NMetaChanges has the URI http://nmf.codeplex.com/changes and NMeta has the relative file URI NMeta.nmeta. Therefore, the repository also stores this model in http://nmf.codeplex.com/NMeta.nmeta in order to resolve references like NMeta.nmeta#//Reference within the NMetaChanges.nmeta.

Cheers,

Georg