Comments (14)
In Python2, you can do:
import opengeode
and then:
ast = opengeode.parse ([set of .pr files])
From there you can find the SDL Process like this:
root_ast = ast[0]
proc = root_ast.processes[0]
All the AST is described in ogAST.py
There are many possibilities - in addition to looking into the model. You can render it in a window and interact, by e.g. highlightning symbols. That's what is done by the SDL simulator prototype.
Let me know if you need help.
from opengeode.
Thanks for the reply. Also, I need to modify the AST (such as add state, input, transition) and write back to the file. Would you please give some direction on How to do this?
from opengeode.
The best is to look at ogAST.py
. You can create new nodes, and add them to the tree..
This is what ogParser.py
is doing when parsing the output of ANTLR
. You can check this one as well.
Then to write back to a .pr, you have to look at the Save function in opengeode.py
.
from opengeode.
Thanks for the direction. By reading ogParser.py
I am trying to know how to add a node. But, failed. Would you please give a trivial example of adding two states and a transition between these states. Something like below -
s0 = ogAST.Start()
s1 = ogAST.State('S1')
inp = ogAST.Input('press')
s2 = ogAST.State('S2')
root_ast.processes[0].add([s0, s1, imp, s2])
opengeode.save()
Big thanks in advance.
from opengeode.
Are you trying to create a model from scratch or add some elements to an existing model ?
from opengeode.
My aim is to create a model from scratch, but easy my work, I am creating a project in TASTE first, then I work in data-view and interface-view to get an almost blank model OpenGEODE. Then I am trying to get the handle on the blank model and edit it (add states, transitions).
from opengeode.
In that case the easiest is to generate the SDL model in text form and to let OG parse it (using the "parse" API). This will be much easier than trying to add nodes using the AST.
from opengeode.
It seems, opengeode module still support only Python 2?
from opengeode.
@dondublon : No, I ported opengeode to Python3. This is the current baseline, the Python2 code is not is the master branch anymore.
from opengeode.
@maxime-esa Thank you for the answer.
Could I ask about the installation process? Maybe, here is not the appropriate branch.
opengeode requires antlr3. I installed antlr4 successfully, but failed antlr3. The error:
File "C:\Users\s2400244\AppData\Local\Temp\pip-install-rx7p4qmy\antlr3-python-runtime\setup.py", line 49
except OSError, exc:
^
SyntaxError: invalid syntax
This is Python2 syntax, that is why I suspected that opendeoge is for Python2.
from opengeode.
The installation of dependencies should be done automatically if you do:
make full-install
(In a Debian-based Linux)
from opengeode.
But I'm on Windows.
from opengeode.
To be honest, I have never tried to run the Python3 version on Windows.
In the past (Python2 version) I made a build for Windows, using dependencies I had found here: https://www.lfd.uci.edu/~gohlke/pythonlibs/
However I can see that the antlr3 runtime for Python3 is not there, neither is Pyside2... I would not know how to find them. Any help welcome. If you find out I will update the documentation.
from opengeode.
The antlr3 proclaimed for Python3 is actually for Python2. I fixed it manually, it was a real quest. Firstly I downloaded .gz from PyPi, and at last I had to replace one file from Github (antlr3 repository).
The last obstacle I've faced is installing pygraphviz. So, I drop this direction and switched to another modelling tool, a experiment, too.
from opengeode.
Related Issues (20)
- A question about SDL process parameters HOT 1
- I use the command 'make full-install' but get an error HOT 7
- ASN.1 compiler not found HOT 9
- Multiple SDL Processes HOT 2
- Composite states HOT 6
- Error - Answers of decision could overlap HOT 2
- Could you please give me a user manual about the opengeode? HOT 7
- the tool can use the command line to operate?? HOT 5
- Some questions about the OpenGEODE HOT 20
- type of channel. HOT 2
- Unexpected error - Answers of decision could overlap HOT 1
- Tagging releases
- Combining the READMEs HOT 1
- ASN.1 compiler failed - [Errno2] No such file or directory: 'dataview-uniq.asn' HOT 8
- Website for OpenGEODE HOT 3
- Having trouble getting started with OpenGEODE via TASTE VM HOT 5
- Surfacing in-line TODOs / FIXMEs as GitHub issues HOT 3
- PyPI opengeode project HOT 2
- Generated Ada code is wrong for decision with grouped answers HOT 2
- More pythonic, less system-heavy ? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opengeode.