This application is tailored to handle all requests from WoPeD to generate a PNML-String from a given Text.
URL | Description |
---|---|
https://woped.dhbw-karlsruhe.de/t2p/ | Embedded UI |
https://woped.dhbw-karlsruhe.de/t2p/swagger-ui/ | Swagger UI |
URL | Description |
---|---|
https://github.com/tfreytag/P2T | Process2Text Webservice |
https://github.com/tfreytag/WoPeD | WoPeD-Client |
URL | Description |
---|---|
https://hub.docker.com/r/woped/text2process | Docker Hub |
http://localhost:8081/t2p/swagger-ui.
POST /t2p/generatePNML
endpoint.http://localhost:8081/t2p/
.generate
.https://github.com/tfreytag/WoPeD
).NLP Tools
. Adapt the Text2Process
configuration:
Server host
: localhost
Port
: 8081
URI
: /t2p
Analyse
-> Translate to process model
and execute. The text will now be transformed by your locally started T2P webservice.This repository uses jars that are unavailable on Maven central. Hence, these jar files are stored in this repository in
the folder lib
. The chosen procedure was described in this SO answer.
To check the formatting of all Java files, run mvn spotless:check
.
If formatting are identified, run mvn spotless:apply
to automatically reformat that affected files.
You need to configure an environment variable on your system to make sure the T2P-WebService can find the WordNet dictionary. Therefore we use WORDNET_HOME the same way you are familiar with from JAVA_HOME.
Finally it is time to give it a try. You can find the main file in the source package. The are two ways to start the application. On the one hand you can click on the play button at the upper right connor in your IDE or on the other it is possible to run it by clicking right on the WoPeDText2ProcessApplication-Class.
Maven will automatically compile the source code to a runnable application. After that the SpringBootServer will start and load the configuration given by the application.properties file. After a short time of loading the server will listen to the port and root path you configured.
The first thing you need to know, the api is using a Rosponse-Object (/src/main/java/de/dhbw/text2process/helper/Response.java)
The controller is located here (/src/main/java/de/dhbw/text2process/controller/T2PController.java)
This is converted to a json String. If there are any errors during the NLP processing the exceptions and the stacktrace are stored in this generic Response
Use getResponse() to extract the generated process.
If you want to call the API then use the Swagger-UI mentions above to identify the correct URI. You will get
This is what you have to do in Java to implement the T2P-Interface to your code:
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(connection.getInputStream())
);
StringBuilder responseJson = new StringBuilder();
String responseLine;
// Reading the incoming json line by line and transforming it to a single String
while ((responseLine = bufferedReader.readLine()) != null) {
responseJson.append(responseLine.trim());
}
String processModelXmlString = responseJson.toString();
Now you can do what ever you like with the String in your Java application.