Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » ATL transformation to XSD Schema
ATL transformation to XSD Schema [message #993426] Mon, 24 December 2012 10:51 Go to next message
Leonid Ripeynih is currently offline Leonid RipeynihFriend
Messages: 150
Registered: February 2012
Senior Member
Hi!

Is it possible to have an XSD model as target model?
This simple code is giving an error:

rule Formular2Schema {
  from
    f : GF!FGUmlLinked(
      f.refImmediateComposite() = OclUndefined
    )
  to 
    s : XSD!XSDSchema (
      targetNamespace <- 'test',
      contents <- f.child --creating top level types
    )
}

rule Fieldset2ComplexType {
  from
    fs : GF!FGUmlLinked(
      fs.refImmediateComposite() <> OclUndefined
    )
  to 
    x : XSD!XSDComplexTypeDefinition()
}


error:
org.eclipse.m2m.atl.engine.emfvm.VMException
  at __applyFormular2Schema#19(GenFormular2XSD.atl[20:4-20:23])
    local variables: self=GenFormular2XSD : ASMModule, link=TransientLink {rule = Formular2Schema, sourceElements = {f = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@128c9ac5 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@7ddcb1ae (name: FGUmlLinked) (instanceClassName: null) (abstract: false, interface: false))}, targetElements = {s = org.eclipse.xsd.impl.XSDSchemaImpl@3112ca98 (element: null) (document: null, schemaLocation: null, targetNamespace: test, attributeFormDefault: <unset>, elementFormDefault: <unset>, finalDefault: null, blockDefault: null, version: null)}, variables = {}}, f=IN!Государственный контракт, s=OUT!<unnamed>
  at __exec__#8(GenFormular2XSD.atl)
    local variables: self=GenFormular2XSD : ASMModule, e=TransientLink {rule = Formular2Schema, sourceElements = {f = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@128c9ac5 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@7ddcb1ae (name: FGUmlLinked) (instanceClassName: null) (abstract: false, interface: false))}, targetElements = {s = org.eclipse.xsd.impl.XSDSchemaImpl@3112ca98 (element: null) (document: null, schemaLocation: null, targetNamespace: test, attributeFormDefault: <unset>, elementFormDefault: <unset>, finalDefault: null, blockDefault: null, version: null)}, variables = {}}
  at main#27(GenFormular2XSD.atl)
    local variables: self=GenFormular2XSD : ASMModule
Java Stack:
org.eclipse.m2m.atl.engine.emfvm.VMException
  at org.eclipse.m2m.atl.engine.emfvm.adapter.EMFModelAdapter.set(EMFModelAdapter.java:684)
  at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:474)
  at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:388)
  at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:388)
  at org.eclipse.m2m.atl.engine.emfvm.ASM.run(ASM.java:208)
  at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.internalLaunch(EMFVMLauncher.java:170)
  at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMUILauncher.launch(EMFVMUILauncher.java:46)
  at org.eclipse.m2m.atl.core.service.LauncherService.launch(LauncherService.java:136)
  at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launchOrDebug(AtlLaunchConfigurationDelegate.java:300)
  at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:237)
  at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
  at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
  at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:937)
  at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1141)
  at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.NullPointerException
  at org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl.handleNewBaseTypeDefinition(XSDComplexTypeDefinitionImpl.java:2123)
  at org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl.patch(XSDComplexTypeDefinitionImpl.java:1061)
  at org.eclipse.xsd.impl.XSDConcreteComponentImpl.patch(XSDConcreteComponentImpl.java:535)
  at org.eclipse.xsd.impl.XSDSchemaImpl.patch(XSDSchemaImpl.java:1602)
  at org.eclipse.xsd.impl.XSDSchemaImpl.traverseToRootForPatching(XSDSchemaImpl.java:1529)
  at org.eclipse.xsd.impl.XSDSchemaImpl.adoptContent(XSDSchemaImpl.java:1924)
  at org.eclipse.xsd.impl.XSDConcreteComponentImpl.eNotify(XSDConcreteComponentImpl.java:1074)
  at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:255)
  at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:300)
  at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:307)
  at org.eclipse.m2m.atl.engine.emfvm.adapter.EMFModelAdapter.set(EMFModelAdapter.java:611)
  ... 14 more


I've looked into the source and it's the following fragment which gives me an error:
newBaseTypeDefinition = xsdSchema.getSchemaForSchema().resolveComplexTypeDefinition("anyType");


It can not get SchemaForSchema. I've looked into this method, and it's implemented as:
public XSDSchema getSchemaForSchema()
{
  return getSchemaForSchema(getSchemaForSchemaNamespace());
}


I've found no way to specify namespece in XSD model using ATL. Is there any fix/workaround for it, or, maybe, i'm doing it competely wrong?
Re: ATL transformation to XSD Schema [message #997429 is a reply to message #993426] Mon, 07 January 2013 13:34 Go to previous message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
Registered: July 2009
Senior Member
Hello,

ATL works on any EMF models (i.e. EMF resources).
So if your XSD file has been previously loaded as a proper EMF resource in memory, ATL will be able to access it and transform it.

However, if you are directly loading your models from files when running your transformation, I recommend you to use models (and corresponding metamodels) serialized in XMI.

Hugo


--------------------------------------------------------
Hugo Bruneliere, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Previous Topic:New EMFTVM snapshot available
Next Topic:how to match href element in uml diagram
Goto Forum:
  


Current Time: Thu Apr 25 06:52:52 GMT 2024

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

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

Back to the top