Sample code to demonstrate how to use Lyo Designer to create an OSLC server for the SysML v2 REST API.
Run Fuseki triplestore using Docker:
docker run --rm -p 3030:3030 atomgraph/fuseki --mem /ds
Alternatively, do a manual install:
mvn install
on the project org.oasis.oslcop.sysml.oslc-domain
: mvn -f org.oasis.oslcop.sysml.oslc-domain/pom.xml clean install
mvn jetty:run-war
on the project org.oasis.oslcop.sysml.oslc-server
org.oasis.oslcop.sysml.oslc-server\src\main\resources\jsonServer.properties
)
data\SysML2data.nq
data\SysML2data.nq
data\SysML2data.nq
as the body.Example queries we can execute (if you chose version 11609e2b-a4df-4a64-9e61-a45660c28542
):
oslc.where sysml:identifier="5bc41f66-4d42-41da-b7a3-92af54dab320"
oslc.prefix sysml=<http://omg.org/ns/sysml#>
The domain-classes are based on the ecore file, located under:
The Swagger Docs for the REST server has base: http://sysml2-dev.intercax.com:9000/
The SysML domain classes are generated, based on a Lyo model that is itself transformed from the Sysml EMF model.
There are currently 3 manual steps that need to be handled when re-generating the code.
Before generating the java classes, the generated Lyo model is manually modified to:
oslc_am:Resource
.After generating the domain classes, we need to change the toString()
method on each resource to make it print the resources better.
Tips: Use Notepad++ to search/replace on all *.java
files.
// Start of user code toString_finalize\n // End of user code
// Start of user code toString_finalize\n result = getShortTitle();\n // End of user code
In the generated JSP pages, there are calls to getDctermsType()
, getDctermsIdentifier()
and getDctermsSource()
, but these methods do not exist.
They would have existed if the OSLC AM resources were generated. But because we are including the library as it is previously generated, the methods should be really getType()
, getIdentifier()
and getSource()
This work is licensed under the terms of Apache License 2.0.