similar to the approach discussed here ( http://dev.eclipse.org/mhonarc/lists/m2m-dev/msg00265.html ) I want to create an AST of my QVT-O scripts and to store it as an XMI file. I am already able to create the XMI file, however, when trying to open certain elements of the file, I get exceptions of the form "java.net.UnknownHostException: m2m.upb.de".

Oops no attachment. Post a link to e.g. DropBox if the newsgroup is
unhelpful.

Regards

Ed Willink

On 28/07/2012 12:20, Sebastian Lehrig wrote:
> Hello,
>
> similar to the approach discussed here (
> http://dev.eclipse.org/mhonarc/lists/m2m-dev/msg00265.html ) I want to
> create an AST of my QVT-O scripts and to store it as an XMI file. I am
> already able to create the XMI file, however, when trying to open
> certain elements of the file, I get exceptions of the form
> "java.net.UnknownHostException: m2m.upb.de".
>
> Have you any idea why this happens? (see the attached project)
>
> Thank you and best regards
> Sebastian
>
> Files attached: -------------
> - Directly runnable eclipse project including launch configuration
> -> see lsenet.de/QVTo2AST-Test.zip

I _did_ post the attachement. you have to go this URL: lsenet.de/QVTo2AST-Test.zip
(The forum does not allow me to add external links or real attachements, that's why there is no hyperlink/ h t t p for the above URL)

Use org.apache.commons.io so it fails to compile. But only for final
operation so I commented it out.

Using the launch configuration no problem is apparent.

Since you never posted your exception trace, I cannot comment further.

Regards

Ed Willink

On 28/07/2012 16:27, Sebastian Lehrig wrote:
> I _did_ post the attachement. you have to go this URL:
> lsenet.de/QVTo2AST-Test.zip
> (The forum does not allow me to add external links or real
> attachements, that's why there is no hyperlink/ h t t p for the above
> URL)

Try, for instance, to validate the output file "uml2rdbms.qvto.xmi" (respectively "uml2rdbms.qvtox" if you commented out the last command). For me, it gives a lot of exceptions (note that I had to escape www and http with white spaces due to forum restrictions), e.g.:

java.net.UnknownHostException: m2m.upb.de
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.w ww.h ttp.h ttpClient.openServer(h ttpClient.java:388)
at sun.net.w ww.h ttp.h ttpClient.openServer(h ttpClient.java:523)
at sun.net.w ww.h ttp.h ttpClient.<init>(h ttpClient.java:227)
at sun.net.w ww.h ttp.h ttpClient.New(h ttpClient.java:300)
at sun.net.w ww.h ttp.h ttpClient.New(h ttpClient.java:317)
at sun.net.w ww.protocol.h ttp.h ttpURLConnection.getNewh ttpClient(h ttpURLConnection.java:970)
at sun.net.w ww.protocol.h ttp.h ttpURLConnection.plainConnect(h ttpURLConnection.java:911)
at sun.net.w ww.protocol.h ttp.h ttpURLConnection.connect(h ttpURLConnection.java:836)
at sun.net.w ww.protocol.h ttp.h ttpURLConnection.getInputStream(h ttpURLConnection.java:1172)
at org.eclipse.emf.ecore.resource.impl.URIHandlerImpl.createInputStream(URIHandlerImpl.java:178)
at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:350)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1262)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getEObject(ResourceSetImpl.java:216)
at org.eclipse.emf.ecore.util.EcoreUtil.resolve(EcoreUtil.java:203)
at org.eclipse.emf.ecore.util.EcoreUtil.resolve(EcoreUtil.java:263)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eResolveProxy(BasicEObjectImpl.java:1483)
at org.eclipse.ocl.ecore.impl.PropertyCallExpImpl.getReferredProperty(PropertyCallExpImpl.java:90)
at org.eclipse.ocl.ecore.impl.PropertyCallExpImpl.eGet(PropertyCallExpImpl.java:145)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1021)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1013)
at org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImpl.hasNext(EContentsEList.java:409)
at org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImpl.next(EContentsEList.java:565)
at org.eclipse.emf.ecore.util.EObjectValidator.validate_EveryReferenceIsContained(EObjectValidator.java:790)
at org.eclipse.ocl.ecore.util.EcoreValidator.validatePropertyCallExp(EcoreValidator.java:2860)
at org.eclipse.ocl.ecore.util.EcoreValidator.validate(EcoreValidator.java:308)
at org.eclipse.emf.ecore.util.EObjectValidator.validate(EObjectValidator.java:330)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:165)
at org.eclipse.emf.edit.ui.action.ValidateAction$2.validate(ValidateAction.java:287)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:184)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:168)
at org.eclipse.emf.edit.ui.action.ValidateAction$2.validate(ValidateAction.java:287)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:184)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:168)
at org.eclipse.emf.edit.ui.action.ValidateAction$2.validate(ValidateAction.java:287)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:184)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:168)
at org.eclipse.emf.edit.ui.action.ValidateAction$2.validate(ValidateAction.java:287)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:180)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:168)
at org.eclipse.emf.edit.ui.action.ValidateAction$2.validate(ValidateAction.java:287)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:184)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:168)
at org.eclipse.emf.edit.ui.action.ValidateAction$2.validate(ValidateAction.java:287)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:180)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:168)
at org.eclipse.emf.edit.ui.action.ValidateAction$2.validate(ValidateAction.java:287)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:143)
at org.eclipse.emf.edit.ui.action.ValidateAction.validate(ValidateAction.java:258)
at org.eclipse.emf.edit.ui.action.ValidateAction$1.run(ValidateAction.java:177)
at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:69)
at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

I think the problem here gets down to development vs runtime instances
of Eclipse. The problem seems to be that the model referenced by http://m2m.upb.de/SimpleUML/1.0 is obviously not installed into the
Eclipse development environment. So if you try and load the XMI in it
it cannot find the referenced Ecore model in the registry (where as the
Ecore and QVTO models themselves are registered by their installe
dplugins so it finds them fine). When it cannot find the registered
package it treats it as a URL and trys to actually goto the website http://m2m.upb.de/SimpleUML/1.0 and fails as m2m.upb.de is not a
registered domain (interestingly I'm current using airport WiFi that
resolves any invalid URL to their search provider so I get a
FileNotFoundException - i.e. a 404 error - rather than
UnknownHostException)

If you started up a new instance of Eclipse within Eclipse that had
your EPackage registered then it should validate the XMI fine as it
will be able to resolve the EPackage from the URI.

Thanks Alan, you were right; several problems came from this issue and I was able to fix them. I created genmodels for the metamodels and generated the model code. I also exported the respective ModelPackages. After this, the runtime-workspace had access to the metamodel URLs (for instance, they now appear in the metamodel explorer).

However, five exceptions remain when validating the XMI file created by my small program (see exceptions list below). I have therefore some new questions in mind:

1) As the static analysis successfully validates my qvto script, I would expect that the created XMI file is valid, too. Why is this not the case? Respectively, how to fix the remaining Exceptions?

2) The way I fixed the first issues is not optimal because it requires to create genmodels, model code, and to start a runtime-instance of eclipse. Is it possible to
a) reference the models relative to the project (e.g., "../../metamodel/UML2RDBMS/SimpleUML.ecore") within the created XMI file instead of using the NS URIs? How to tell this the "ExeXMISerializer" then?
b) fix the issues without starting a new eclipse instance?

The remaining 5 errors look like 'features'. The two pairs seem benign
corrolaries of extending Ecore; unwanted constraints have been
inherited. The bad collection type may just be a bad message. Raise a
Bugzilla.

Since *.qvtox is not a published API, users use it at their own risk. It
is internal and proprietary and very unlikely to survive any evolution
of QVTo. Only use it for transient purposes.

Thank you Ed, your "tacky solution" did the job for me. I'm just working on a prototype, so accessing the internal APIs is okay for the time being. However, I hope the AST to XMI serialization will make it to the public APIs since it is a nice way to enable higher-order transformations.

On 30/07/2012 09:40, Sebastian Lehrig wrote:
> Thank you Ed, your "tacky solution" did the job for me. I'm just
> working on a prototype, so accessing the internal APIs is okay for the
> time being. However, I hope the AST to XMI serialization will make it
> to the public APIs since it is a nice way to enable higher-order
> transformations.
>
> Regards
> Sebastian