file XSD module

6 years 6 months ago #1428 by cde
Hi Braddillman,

The XSD module has been migrated to MAVEN, you can get it here :

forge.modelio.org/svn/xsd-development/

Best regards,

Please Log in or Create an account to join the conversation.

6 years 6 months ago #1429 by braddillman
Thanks, I'll try to check into it some night this week (looking forward to it actually). I was able to reverse some of the XSD files, but so far not the top one. Wish list: a progress dialog showing what the XSD is up to.

Please Log in or Create an account to join the conversation.

6 years 6 months ago #1430 by braddillman
OK, I got set up to do source debugging of the XSD module (w/maven).

The XSD module gets caught in a loop because:

schemas.opengis.net/gml/3.2.1/gml.xsd
include schemaLocation="dynamicFeature.xsd"

and

schemas.opengis.net/gml/3.2.1/dynamicFeature.xsd
include schemaLocation="gml.xsd"

I don't own these schemas, and I'd rather not make local copies. Is there a way to alter the XSD module so that it doesn't begin loading a module it's already loading? I haven't gotten into the XSD module code in much depth yet, but it looks like it passes the part where it's loaded as an EMF model (so it would appear EMF can handle the mutual reference).

The bit of code I'm looking at is:

XSDRepository.loadDependsSchemats(ModelRepository owner, IModelTree objing_root) {
...

for(XSDSchema includeSchema : root.getIncludesSchema()){
ModelRepository includeModel = models.get(includeSchema.getTargetNamespace());
if(includeModel == null){
EcoreRepository ecore_repository = new EcoreRepository(includeSchema);
ObjingRepository objing_repository = new ObjingRepository(objing_root,ecore_repository.getName());
includeModel = new ModelRepository(ecore_repository,objing_repository);
models.put(includeModel, includeModel);
loadDependsSchemats(includeModel,objing_root);
}
owner.addIncludes(includeModel);
}
...

Is there a simple way to end the recursion if we're already loading a model?

Please Log in or Create an account to join the conversation.

6 years 6 months ago #1431 by braddillman
It looks like:

ModelRepository includeModel = models.get(includeSchema.getTargetNamespace());

always returns null. Is this because models.key is a ModelRepository but includeSchema.getTargetNamespace() returns a String? ModelRepository doesn't have any equals() (or even a toString()) defined, and models is just a regular HashMap. How could they ever match?

Please Log in or Create an account to join the conversation.

6 years 6 months ago - 6 years 6 months ago #1432 by aab
Hi,

I think there is a big problem here indeed. The initial idea of the models HashMap should be to manage the cases like this.

There are two things to change in my opinion :
  • The models HashMap should allow to associate an XSD Model to a TargetNamespace.This is the only use that I can see for this map
private HashMap<String, ModelRepository> models;
models.put(root_model.getTargetNamespace(), root_model);

  • The second point concerns the registration of pre-existing XSD Models in this HashMap at startup. It would be necessary to add all existing XSD Models of current project to XSDRepository.This kind of code added on XSDRepository constructor should solve that.

  • public void registerExistingSchema(){
            // Find ObjingRoot Stereotype
            IStereotype objingRootStereotype =  (IStereotype) Modelio.getInstance().getModelingSession().findElementById("Stereotype", "00601e10-0000-1498-0000-000000000000");
           
            // Find UML element stereotype by objingRootStereotype
            for(IModelElement objingRoot : objingRootStereotype.getExtendedElement()){
                // Load model to XSDRepository
                
                EcoreRepository ecore_repository = new EcoreRepository((IClass)objingRoot);           
                ObjingRepository objing_repository = new ObjingRepository((IClass)objingRoot); 
                objing_repository.setIsLoaded(true);
                root_model = new ModelRepository(ecore_repository,objing_repository);
                models.put(root_model.getTargetNamespace(), root_model);
            }  
        }

    [/ul]

    Antonin Abhervé

    Please Log in or Create an account to join the conversation.

    6 years 6 months ago #1433 by aab
    I will look the impact of these changes on other parts of the import process.

    Please Log in or Create an account to join the conversation.

    Moderators: tmachmaab
    Time to create page: 0.040 seconds
    ^ Back to Top