HEADS-project / training

Training material to get started with the HEADS technologies
10 stars 16 forks source link

How to load and manipulate ThingML models #95

Closed FeltonXuAtECNU closed 8 years ago

FeltonXuAtECNU commented 8 years ago

I'm writing this post to ask you something about ThingML.

My current work is trying to translate ThingML project to the input of some timed automata tool for some academic purpose, so it's necessary for me to know how to save ThingML as a systematic form(LIKE XML) to extract all the information in an ordered way. Is that possible? IF possible, what should I do?

I'm looking forward to your reply and any detailed information will be great help.

ffleurey commented 8 years ago

If I understannd correctly you need to process ThingML models to transform them to a timed automata. Instead of going through a serialization in XML of the ThingML program you can use our parser and directly process the model in JAVA to transform it to whatever representation you need. I have create a sample JAVA project which gives an example of how you can load a ThingML model and then traverse it to generate "something". You can find it at: https://github.com/HEADS-project/training/tree/master/1.ThingML_Basics/7.%20ReadThingMLModel

Let us know if it works for you

Cheers!

FeltonXuAtECNU commented 8 years ago

Thanks for your prompt response and kindness for writing an example to show me how to load a ThingML model and transform it to some kind of new formalism I need. It's too late here(almost 11:00 pm) in China. I will let you know if it works me as soon as I can.

Thanks again!

Cheers!

FeltonXuAtECNU commented 8 years ago

Hello, When I was trying to execute "mvn clean install" on Ubuntu 14.04 LTS, I got some message like this. error messaging.pdf I'm pretty sure my maven is correctly installed because I've used maven before and it works for some other project, so I was wondering if you could help me to figure out how to work that out.

brice-morin commented 8 years ago

It seems you cannot access our Maven repository (maybe because of some firewall). Try accessing this address in a web browser first to see if you can indeed access it.

FeltonXuAtECNU commented 8 years ago

Sure. I can open "http://maven.thingml.org/"

brice-morin commented 8 years ago

Can you try to clone the whole ThingML repository first and mvn clean install it first? If it works, you will have ThingML installed locally and example provided by @ffleurey should then work

ffleurey commented 8 years ago

Ok, for some reason your maven process was not able to access the server when you tried compiling, that is why you got the message "Connection to http://maven.thingml.org refused: Connection refused". You should try again now that you have access to the server and if you get the same message it means that something on your machine is presenting the maven process from reaching the server. The easiest may be try re-install maven or try on another machine.

ffleurey commented 8 years ago

Brice's solution of cloning and building ThingML locally may also work but I believe that it will still require to have access to our repository so you really have to make sure that the maven process can acess the internet and our server. If you can get access to our server with your web browser, it means that it is a problem on your side and not with the server.

FeltonXuAtECNU commented 8 years ago

I'd better turn off on the firewall and get myself a VPN to see if it works.

FeltonXu commented 8 years ago

Hey, I am also interested in doing something work on ThingML. Could any of you send me a new site on how to do that? https://github.com/HEADS-project/training/tree/master/1.ThingML_Basics/7.%20ReadThingMLModel doesn't work any more...

brice-morin commented 8 years ago

https://github.com/HEADS-project/training/tree/79d92e02eaee41a548dd7ee3448ccc6b9642cc6e/1.ThingML_Basics/7.ReadThingMLModel

FeltonXuAtECNU commented 7 years ago

Hi Brice,

When I was running the project provided at https://github.com/HEADS- project/training/tree/79d92e02eaee41a548dd7ee3448ccc 6b9642cc6e/1.ThingML_Basics/7.ReadThingMLModel, I encountered the following problem.

Loading input file: C:\GenerateThingML\models\Basics\Timer\PingPong.thingml... org/antlr/runtime3_4_0/Lexer java.lang.NoClassDefFoundError: org/antlr/runtime3_4_0/Lexer at org.sintef.thingml.resource.thingml.mopp.ThingmlResource.(ThingmlResource.java:166) at org.sintef.thingml.resource.thingml.mopp.ThingmlResourceFactory.createResource(ThingmlResourceFactory.java:25) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createResource(ResourceSetImpl.java:425) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createResource(ResourceSetImpl.java:414) at ReadThingML.main(ReadThingML.java:33) Caused by: java.lang.ClassNotFoundException: org.antlr.runtime3_4_0.Lexer at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 5 more

I didn't use maven here, but I have included all the jar file needed (including org.sintef.thingml.resource.thingml_0.7.0.201612211920.jar and org.sintef.thingml.model_0.7.0.201612211920 .jar in my project).

Do you have any idea how to fix that problem?

Simon

On Tue, Jun 14, 2016 at 1:13 PM, Brice Morin notifications@github.com wrote:

https://github.com/HEADS-project/training/tree/ 79d92e02eaee41a548dd7ee3448ccc6b9642cc6e/1.ThingML_Basics/7. ReadThingMLModel

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/HEADS-project/training/issues/95#issuecomment-225781759, or mute the thread https://github.com/notifications/unsubscribe/AONZJX3orx6JauWqvkwzwR08JWC8N-4Yks5qLjiBgaJpZM4Gp1es .