{"action":"created","issue":{"url":"https://api.github.com/repos/CvO-Theory/apt/issues/5","repository_url":"https://api.github.com/repos/CvO-Theory/apt","labels_url":"https://api.github.com/repos/CvO-Theory/apt/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/CvO-Theory/apt/issues/5/comments","events_url":"https://api.github.com/repos/CvO-Theory/apt/issues/5/events","html_url":"https://github.com/CvO-Theory/apt/issues/5","id":184642635,"number":5,"title":"Is there any document where all the module usages/descriptions are listed? AND Do you provide JSON/XML output?","user":{"login":"tamarit","id":1270962,"avatar_url":"https://avatars.githubusercontent.com/u/1270962?v=3","gravatar_id":"","url":"https://api.github.com/users/tamarit","html_url":"https://github.com/tamarit","followers_url":"https://api.github.com/users/tamarit/followers","following_url":"https://api.github.com/users/tamarit/following{/other_user}","gists_url":"https://api.github.com/users/tamarit/gists{/gist_id}","starred_url":"https://api.github.com/users/tamarit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamarit/subscriptions","organizations_url":"https://api.github.com/users/tamarit/orgs","repos_url":"https://api.github.com/users/tamarit/repos","events_url":"https://api.github.com/users/tamarit/events{/privacy}","received_events_url":"https://api.github.com/users/tamarit/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-22T17:21:46Z","updated_at":"2016-10-23T06:59:14Z","closed_at":null,"body":"Hi,\r\n\r\nfirst of all, my sincere congratulations for the development of this tool. It's complete and really easy to use. I want to use your tool to perform several analyses on PNs. I'd like to know more information about each module, but I've only found a way to do it, by writing in the shell commands like this:\r\n\r\n` java -jar apt.jar check_all_cycle_prop`\r\n\r\nHowever, it's an annoying way to get all the module descriptions one by one. I've been looking for the complete list of all the modules with their respective descriptions, but I haven't found it. One promising document was [APT.pdf](https://github.com/CvO-Theory/apt/blob/master/doc/APT.pdf), but unfortunately it doesn't list them in the way I'd find useful (besides it is in german). Another alternative that I've explored is to look for this info into the source code files. I've found that most of this info is in the function `String getLongDescription()` of some classes which are (most of them) in the directory `/Users/tama/Documents/git/apt/src/module/uniol/apt/analysis/`, e.g. `/Users/tama/Documents/git/apt/src/module/uniol/apt/analysis/trapsAndSiphons/TrapsModule.java`. Although I think that I could be able to create a document automatically using the information in all these modules, I wonder whether you have already done it and I could save some time :) \r\n\r\nI have another question, now related with output formats. I didn't found information about this. I wonder whether you are providing an alternative way to report the result of the analyses, like JSON, XML, or another easy-parsing format. For instance LoLa provides output using JSON, and it'd be very convenient to have something similar to ease the parsing of the results. \r\n\r\nThanks in advance, and again congrats for your great work.\r\nSalva"},"comment":{"url":"https://api.github.com/repos/CvO-Theory/apt/issues/comments/255573040","html_url":"https://github.com/CvO-Theory/apt/issues/5#issuecomment-255573040","issue_url":"https://api.github.com/repos/CvO-Theory/apt/issues/5","id":255573040,"user":{"login":"psychon","id":89482,"avatar_url":"https://avatars.githubusercontent.com/u/89482?v=3","gravatar_id":"","url":"https://api.github.com/users/psychon","html_url":"https://github.com/psychon","followers_url":"https://api.github.com/users/psychon/followers","following_url":"https://api.github.com/users/psychon/following{/other_user}","gists_url":"https://api.github.com/users/psychon/gists{/gist_id}","starred_url":"https://api.github.com/users/psychon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psychon/subscriptions","organizations_url":"https://api.github.com/users/psychon/orgs","repos_url":"https://api.github.com/users/psychon/repos","events_url":"https://api.github.com/users/psychon/events{/privacy}","received_events_url":"https://api.github.com/users/psychon/received_events","type":"User","site_admin":false},"created_at":"2016-10-23T06:59:14Z","updated_at":"2016-10-23T06:59:14Z","body":"If I understand you correctly, you just want the `help`-output of all modules in a looooong list. For this, save the following code as `ListAllModules.java` and run `javac -cp apt.jar ListAllModules.java  && java -cp apt.jar:. ListAllModules` (on unix-ish operating systems; adapt suitably for Windows):\r\n```java\r\nimport uniol.apt.module.AptModuleRegistry;\r\nimport uniol.apt.module.Module;\r\nimport uniol.apt.ui.impl.AptParametersTransformer;\r\nimport uniol.apt.ui.impl.UIUtils;\r\n\r\nclass ListAllModules {\r\n\tstatic public void main(String[] args) throws Exception {\r\n\t\tboolean first = true;\r\n\t\tfor (Module module : AptModuleRegistry.INSTANCE.getModules()) {\r\n\t\t\tif (!first) {\r\n\t\t\t\tSystem.out.println(\"\");\r\n\t\t\t\tSystem.out.println(\"-----------\");\r\n\t\t\t\tSystem.out.println(\"\");\r\n\t\t\t}\r\n\t\t\tSystem.out.println(UIUtils.getModuleUsage(module, AptParametersTransformer.INSTANCE));\r\n\t\t\tfirst = false;\r\n\t\t}\r\n\t}\r\n}\r\n```\r\nThe result will be something like this: https://gist.github.com/psychon/828d4db68db790bcda117dd17815f602\r\n\r\nFor output formats: No, currently we don't have anything else. Are you just looking at APT in general, or are you looking for some specific use? My (personal) preferred approach is to write everything in Java and to call the modules directly, but that's of course not general.\r\nSomething like the following quick hack would produce something which might possibly count as JSON:\r\n```diff\r\ndiff --git a/src/main/uniol/apt/APT.java b/src/main/uniol/apt/APT.java\r\nindex 19fa795..7a39c70 100644\r\n--- a/src/main/uniol/apt/APT.java\r\n+++ b/src/main/uniol/apt/APT.java\r\n@@ -316,20 +316,24 @@ public class APT {\r\n                        }\r\n \r\n                        // Print all return values for which the module produced values\r\n+                       System.out.println(\"{\");\r\n                        for (int i = 0; i < values.size(); i++) {\r\n                                PrintStream out = outputs.get(i);\r\n                                if (out == null)\r\n                                        continue;\r\n \r\n-                               if (outputWithName[i])\r\n-                                       out.print(returnValues.get(i).getName() + \": \");\r\n+                               out.print(\"\\\"\" + returnValues.get(i).getName() + \"\\\": \\\"\");\r\n \r\n                                OutputStreamWriter writer = new OutputStreamWriter(out, \"UTF-8\");\r\n+                               // TODO: This could produce invalid JSON (no escaping is applied)\r\n                                RETURN_VALUES_TRANSFORMER.transform(writer,\r\n                                                values.get(i), returnValues.get(i).getKlass());\r\n                                writer.flush();\r\n-                               out.println();\r\n+                               out.println(\"\\\"\");\r\n+                               if (i+1 < values.size())\r\n+                                       out.println(\",\");\r\n                        }\r\n+                       System.out.println(\"}\");\r\n                }\r\n                catch (IOException e) {\r\n                        ERR_PRINTER.println(\"Error writing to file: \" + e.getMessage());\r\n```\r\nDoing this properly would of course be better.\r\n\r\nSide note: I think most modules in APT produce yes/no results (possible with a witness for a counter-example). If you are just interested in e.g. \"is this Petri net plain\", APT's exit code should provide this information.\r\n\r\nI hope this helps. If you have some good ideas how to integrate this better, I'd like to hear about it.\r\nAlso, I'm curious about your use case. Are you just looking at APT in general or do you have some specific \"itch to scratch\"?\r\n\r\nCheers,\r\nUli"}}
{"actor":{"display_login":"psychon"}}