SysML-v2-API-Cookbook
SysML-v2-API-Cookbook copied to clipboard
Seed data for example notebooks?
I have the API running locally but the data initialized empty so none of the provided notebooks have the example outputs. Is there a way to seed the database with the example data or another .sysml file? If not, are there examples showing how to correctly create and insert sysml data via the REST API?
I have almost the same issue. Did you solved it? I used the methods of the cookbook notebooks to post the given example on my local server but now I'm a bit confused about sending a .sysml file directly since it is only shown for a JSON format data input ( e.g. "Element_Create_Update_Delete.ipynb"). Inside Jupyter notebook it is all handled by the magic %publish command which post a request with a sysml file and transforms it automatically in the right file format but only to the official test servers (http://sysml2.intercax.com:9000/docs/)
I hope someone can help me.
Hello Folks
These notebooks are showing direct interaction with the Systems Modeling API and Services REST API on a pilot implementation server. This can done using any programming language but Jupyter notebooks with Python are used for their ease.
However, this should not be mixed/confused with the SysML v2 textual notation and use of the SysML v2 language kernel in Jupyter where SysML v2 models can be authored and published to the repository via the same REST API as above.
A simple workflow to get started:
- Create a SysML v2 model using textual notation in Jupyter with the SysML v2 kernel.
- Use the %publish command to publish the model to the REST API pilot implementation server.
- Use example notebooks provided in this repository to fetch data from the server.
- Also, try creating a test project directly from the API. The Project_Commit_Branch_Tag_Recipe.ipynb notebook is a good example. More notebooks to create models directly using the API will be added. The ro
I hope this helps.
Best Regards Manas
Hello Manas,
Thanks for you answer. I already did this workflow and it works very well but I wanted to test that on a local server, which can all be done with the given python code inside the API Cookbook as well. In this case: I can't really send a sysml file directly to the local server (which is done by %publish to the test servers) but I can create, edit a project via json format (as shown in the recipes). Therefore I have to "rewrite" my sysml file so that I have the same json-ld format for sending it on my local server right?
The confusion is that the %publish command in Jupyter Notebook transforms a .sysml file to a JSON format. I was trying to get achieve kinda the same with more automation and custom GUI. Since working with the API directly I cant just send a .sysml file but have to map/translate the sysml file to JSON. Is that the intended way? How can I achieve the same when I just want to upload a .sysml file?
Another point is that for the JSON format (send request) there are no good documentation about how I can send/create a project with more content (in one example: project_data = { "@type":"Project", "name": project_name, "description": "Spacecraft project with multiple commits, branches, and tags" }) Where can I find a documentation about how the JSON has to look like?
Looks like we might be able to use this to configure. I'll post an update if I get it working: https://github.com/Systems-Modeling/SysML-v2-Pilot-Implementation/blob/master/org.omg.sysml.jupyter.kernel/README.adoc#list-of-options
I can verify that %publish works on a local instance of the API if your kernel ISYSML_API_BASE_PATH is set.
Note: for large projects you may need to increase your
sbtmemory (and java swap) size or it will die viaGC Limiterrors