Repository: AKSW/KBox (language: python)

Issue:
-list command not listing Knowledge Bases
**Description:**
*java -jar kbox.jar -list* command not listing down the installed knowledge bases

**OS, other environment details and versions:**  
JDK version: 1.8
OS: Windows  

**Steps to reproduce:**
1. Add a kns via following command *java -jar kbox.jar -install -kns <URL to kns>
2. Then list down all kns to make sure that it was installed. (*java -jar kbox.jar -list -kns*)
3. Then use the following command to list all knowledge bases, *java -jar kbox.jar -list*)
![image](https://user-images.githubusercontent.com/32576163/121725536-04c28a80-cb07-11eb-843a-b4ab1054bcfb.png)




Discussion / hints:

Fix patch:
diff --git a/README.md b/README.md
index c54089b..ab68582 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ KBox is an abbreviation for Knowledge Box. it is a data management framework des
 - [Changing the resource's folder](https://github.com/AKSW/KBox/blob/master/README.md#changing-the-resource-folder)
 - [Using KBox with Docker](https://github.com/AKSW/KBox#using-kbox-with-docker)
 - [How can I publish my own dataset?](https://github.com/AKSW/KBox#how-can-i-publish-my-own-dataset)
-- [How can I create my own custom build(jar) of KBox?](https://github.com/AKSW/KBox#How-can-I-create-my-own-custom-build(.jar)-of-KBox?)
+- [How can I create my own custom build(jar) of KBox?](https://github.com/AKSW/KBox#how-can-i-create-my-own-custom-buildjar-of-kbox)
 - [Check our Wiki for old APIs](https://github.com/AKSW/KBox/wiki)
 
 ### Why use KBox?
@@ -61,38 +61,70 @@ It is easy to plug and use it.
 java -jar kbox.jar <command> [option]
 KBox.jar <command> [option]
 Where [command] is:
-   * -createIndex <directory>    - Create an index with the files in a given directory.
-                                 ps: the directory might contain only RDF compatible file formats.
-   * -serialize <directory>      - Serialize the content of a directory to be served in a KNS system.
-   * -sparql <query> (-kb <KB> | -server <URL>) [-install] [-json]       - Query a given KB (e.g. -sparql "Select ..." -kb "KB1,KB2")
-                                                 - ps: use -install in case you want to enable the auto-dereference.
-   * -server [-port <port> (default 8080)] [-subDomain <subDomain> (default kbox)] -kb <KB> [-install]   - Start an SPARQL enpoint in the given subDomain containing the given KB.
-   * -list       - List all available knowledge base.
-   * -list -kns  - List all availables KNS services.
-   * -install <URL>      - Install a given resource.
-   * -install -kns <kns-URL>     - Install a given KNS service.
-   * -install -kb <kb-URL>       - Install a given knowledge base using the available KNS services to resolve it.
-   * -install -kb <kb-URL> -format <format>      - Install a given knowledge base using the available KNS services to resolve it.
-   * -install -kb <kb-URL> -format <format> -version <version>   - Install a given knowledge base using the available KNS services to resolve it.
-   * -install -kb <kb-URL> -index <indexFile>    - Install a given index in a given knowledge base URL.
-   * -install -kb <kb-URL> -kns <kns-URL>        - Install a knowledge base from a a given KNS service.
-   * -install -kb <kb-URL> -kns <kns-URL> -format <format> -version <version> - Install a knowledge base from a a given KNS service with the specific format and version.
-   * -remove -kns <kns-URL>      - Remove a given KNS service.
-   * -info <kb-URL>      - Gives the information about a specific KB.
-   * -info <kb-URL> -format <format>     - Gives the information about a specific KB.
-   * -info <kb-URL> -format <format> -version <version>  - Gives the information about a specific KB.
-   * -locate <URL>       - returns the local address of the given resource.
-   * -locate -kb <kb-URL>        - returns the local address of the given KB.
-   * -locate -kb <kb-URL> -format <format>       - returns the local address of the given KB.
-   * -locate -kb <kb-URL> -format <format> -version <version>    - returns the local address of the given KB.
-   * -search <kb-URL-pattern>    - Search for all kb-URL containing a given pattern.
-   * -search <kb-URL-pattern> -format <format>   - Search for all kb-URL containing a given pattern.
-   * -search <kb-URL-pattern> -format <format> -version <version>        - Search for all kb-URL containing a given pattern.
-   * -r-dir      - Show the path to the resource folder.
-   * -r-dir <resourceDir>        - Change the path of the resource folder.
-   * -version    - display KBox version.
+   * convert <directory|file> [<destFile>] [kb|zip]	 - convert the content of a directory (default kb).
+             kb	 - into a kb file. ps: the directory might contain only RDF compatible file formats.
+             zip	 - into a zip file.
+   * convert <file> [<destFile>] gzip	 - encode a given file.
+   * sparql <query> (kb <KB> | server <URL>) [install] [-json]	 - Query a given knowledge base (e.g. sparql "Select ..." kb "KB1,KB2")
+                                               	 - ps: use -install in case you want to enable the auto-dereference.
+   * server [port <port> (default 8080)] [subDomain <subDomain> (default kbox)] kb <kb-URL> [install] 	 - Start an SPARQL endpoint in the given subDomain containing the given bases.
+   * server [port <port> (default 8080)] [subDomain <subDomain> (default kbox)] rdf <directories|files> [install [install]]	 - Start an SPARQL endpoint in the given subDomain containing the given RDF files.
+   * server [port <port> (default 8080)] [subDomain <subDomain> (default kbox)] target <target>	 - Start an SPARQL endpoint in the given subDomain containing the target RDF files.
+   * list [/p]	 - List all available KNS services and knowledge bases.
+   * list kns	 - List all available KNS services.
+   * install <URL>	 - Install a given resource.
+   * install kns <kns-URL>	 - Install a given KNS service.
+   * install kb <kb-URL> [version <version>]	 - Install a given knowledge base using the available KNS services to resolve it.
+   * install kb <kb-URL> file <kbFile>	 - Install a given kb file in a given Kb-URL.
+   * install kb <kb-URL> kns <kns-URL> [version <version>]	 - Install a knowledge base from a a given KNS service with the specific version.
+   * install [install] kb <kb-URL> rdf <directories|files> [version <version>]	 - Install a knowledge base from a a given RDF files with the specific version.
+   * install kn <kn-URL> [format [version <version>]]	 - Install a given knowledge base using the available KNS services to resolve it.
+   * remove kns <kns-URL>	 - Remove a given KNS service.
+   * info <URL> format <format> version <version>]]	 - Gives the information about a specific KB.
+   * locate <URL>	 - returns the local address of the given resource.
+   * locate kb <kb-URL> version <version>]	 - returns the local address of the given KB.
+   * locate kn <kn-URL> format version <version>]]	 - returns the local address of the given KB.
+   * search <kn-URL-pattern> [format <format> [version <version>]] [/p]	 - Search for all kb-URL containing a given pattern.
+   * r-dir	 - Show the path to the resource folder.
+   * r-dir <resourceDir>	 - Change the path of the resource folder.
+   * version 	 - display KBox version.
+```
+** Note: If you want to get the results of above commands as a JSON output, you can append `-o json` parameter at the 
+end of each command.
+
+Let's look at the `list` command as an example,
+````
+java -jar kbox.jar list
+
+KBox KNS Resource table list
+##############################
+name,format,version
+##############################
+http://purl.org/pcp-on-web/dbpedia,kibe,c9a618a875c5d46add88de4f00b538962f9359ad
+http://purl.org/pcp-on-web/ontology,kibe,c9a618a875c5d46add88de4f00b538962f9359ad
+````
+When you append `-o json` parameter at the end, the result will be look like this,
+```
+java -jar kbox.jar list -o json
+
+{
+    "status_code": 200,
+    "message": "visited all KNs.",
+    "results": [
+        {
+            "name": "http://purl.org/pcp-on-web/dbpedia",
+            "format": "kibe",
+            "version": "c9a618a875c5d46add88de4f00b538962f9359ad"
+        },
+        {
+            "name": "http://purl.org/pcp-on-web/ontology",
+            "format": "kibe",
+            "version": "c9a618a875c5d46add88de4f00b538962f9359ad"
+        }
+    ]
+}
 ```
-
+This `-o json`sub command is only applicable with `list, install, remove, info, locate, search, r-dir & version` commands.
 ### How can I use KBox in my project?
 
 * KBox is distributed over Maven.
@@ -124,7 +156,7 @@ Where [command] is:
 You can list the available knowledge graphs with list command:
 
 ```
-java -jar kbox-v0.0.1-alpha3-RC16.jar -list
+java -jar kbox-v0.0.1-alpha3-RC16.jar list
 Knowledge base table list
 http://dbpedia.org/3.9/en/full
 http://dbpedia.org/3.9/en
@@ -144,7 +176,7 @@ Remember the commands listed on '[How can I execute KBox in command Line](https:
 It's just about executing the command line below. Remember to add `-install`, so the knowledge base is automatically dereferenced.
 
 ```
-java -jar kbox-v0.0.1-alpha3-RC16.jar -sparql "Select (count(distinct ?s) as ?n) where {?s ?p ?o}" -kb "https://www.w3.org/2000/01/rdf-schema" -install
+java -jar kbox-v0.0.1-alpha3-RC16.jar sparql "Select (count(distinct ?s) as ?n) where {?s ?p ?o}" -kb "https://www.w3.org/2000/01/rdf-schema" -install
 ------
 | n  |
 ======
@@ -171,7 +203,7 @@ It's very easy, as you just need to add the knowledge base you want to query sep
 
 In the given example, we query two knowledge bases, https://www.w3.org/2000/01/rdf-schema and http://xmlns.com/foaf/0.1.
 ```
-java -jar kbox-v0.0.1-alpha3-RC16.jar -sparql "Select (count(distinct ?s) as ?n) where {?s ?p ?o}" -kb "https://www.w3.org/2000/01/rdf-schema,http://xmlns.com/foaf/0.1" -install
+java -jar kbox-v0.0.1-alpha3-RC16.jar sparql "Select (count(distinct ?s) as ?n) where {?s ?p ?o}" kb "https://www.w3.org/2000/01/rdf-schema,http://xmlns.com/foaf/0.1" install
 -------
 | n   |
 =======
@@ -196,7 +228,7 @@ KBox.query("Select (count(distinct ?s) as ?n) where {?s ?p ?o}", model);
 Yes, you can!!
 
 ```
-java -jar kbox-v0.0.1-alpha3-RC16.jar -server -kb "https://www.w3.org/2000/01/rdf-schema,http://xmlns.com/foaf/0.1" -install
+java -jar kbox-v0.0.1-alpha3-RC16.jar server kb "https://www.w3.org/2000/01/rdf-schema,http://xmlns.com/foaf/0.1" install
 Loading Model...
 Publishing service on http://localhost:8080/kbox/query
 Service up and running ;-) ...
@@ -209,7 +241,7 @@ If you successfully instantiate your server, now you can access the web client a
 
 by console
 ```
-java -jar kbox-v0.0.1-alpha3-RC16.jar -server "http://localhost:8080/kbox/query" -sparql "Select (count(distinct ?s) as ?n) where {?s ?p ?o}"
+java -jar kbox-v0.0.1-alpha3-RC16.jar server "http://localhost:8080/kbox/query" sparql "Select (count(distinct ?s) as ?n) where {?s ?p ?o}"
 -------
 | n   |
 =======
@@ -228,17 +260,17 @@ try(ResultSet rs = KBox.query(sparql, serverURL);) { // do not forget to close t
 ### Listing the resource folder
 
 ```
-java -jar kbox-v0.0.1-alpha3-RC16.jar -r-dir
+java -jar kbox-v0.0.1-alpha3-RC16.jar r-dir
 Your current resource directory is: kbox/dir/path
 ```
 
 ### Changing the resource folder
 
-You might get problems with permissions using KBox in shared enviroments.
-Therefore you can change the resource directory of KBox to your desired one.
+You might get problems with permissions using KBox in shared environments.
+Therefore, you can change the resource directory of KBox to your desired one.
 
 ```
-java -jar kbox-v0.0.1-alpha3-RC16.jar -r-dir new/path
+java -jar kbox-v0.0.1-alpha3-RC16.jar r-dir new/path
 ```
 
 ### Using KBox with Docker
@@ -259,7 +291,7 @@ docker pull aksw/kbox
 
 3) Run it...
 ```
-docker run aksw/kbox -sparql "Select (count(distinct ?s) as ?n) where {?s ?p ?o}" -kb "https://www.w3.org/2000/01/rdf-schema" -install
+docker run aksw/kbox sparql "Select (count(distinct ?s) as ?n) where {?s ?p ?o}" kb "https://www.w3.org/2000/01/rdf-schema" install
 ------
 | n  |
 ======
@@ -269,7 +301,7 @@ docker run aksw/kbox -sparql "Select (count(distinct ?s) as ?n) where {?s ?p ?o}
 
 4) Start a server using docker, but do not forget the --name flag:
 ```
-docker run -p 8080:8080 --name myendpoint aksw/kbox -server -kb "https://www.w3.org/2000/01/rdf-schema" -install
+docker run -p 8080:8080 --name myendpoint aksw/kbox server kb "https://www.w3.org/2000/01/rdf-schema" install
 Loading Model...
 Publishing service on http://localhost:8080/kbox/query
 Service up and running ;-) ...
@@ -277,7 +309,7 @@ Service up and running ;-) ...
 
 5) You can also query your endpoint from a KBox docker container, but do not forget to use the --link flag:
 ```
-docker run --link myendpoint aksw/kbox -sparql "Select (count(distinct ?s) as ?n) where {?s ?p ?o}" -server "http://myendpoint:8080/kbox/query"
+docker run --link myendpoint aksw/kbox sparql "Select (count(distinct ?s) as ?n) where {?s ?p ?o}" server "http://myendpoint:8080/kbox/query"
 ------
 | n  |
 ======
@@ -300,7 +332,7 @@ Information needed:
 3. The Publisher: Your or your organization's email/URL;
 4. The Creator: Who has created the Knowledge base, e.g. DBpedia -> http://dbpedia.org;
 5. The License: the dataset license;
-6. The URL where the Knowledge graph file can be dereferenced (please create the file using KBox `-createIndex` command);
+6. The URL where the Knowledge graph file can be dereference (please create the file using KBox `createIndex` command);
 7. The Dataset URI name: the URI name that will be used by users to dereference your dataset;
 8. The Dataset description: Give us a few words to help others to know what your dataset is about;
 9. Tell us one reason why KBox is awesome. :-)
diff --git a/kbox.kibe/src/main/java/org/aksw/kbox/kibe/ConsoleKNSServerListVisitor.java b/kbox.kibe/src/main/java/org/aksw/kbox/kibe/ConsoleKNSServerListVisitor.java
index 5faa95e..6e05494 100644
--- a/kbox.kibe/src/main/java/org/aksw/kbox/kibe/ConsoleKNSServerListVisitor.java
+++ b/kbox.kibe/src/main/java/org/aksw/kbox/kibe/ConsoleKNSServerListVisitor.java
@@ -32,17 +32,21 @@ public ConsoleKNSServerListVisitor(String format, String version, boolean pagina
 	public void print(PrintStream out, KN kn) {
 		AssertionUtils.notNull(new IllegalArgumentException("out"), out);
 		AssertionUtils.notNull(new IllegalArgumentException("kn"), kn);
-		if(lineNumber == 0) {
-			out.println("KBox KNS Resource table list");
-			out.println("##############################");
-			out.println("name,format,version");
-			out.println("##############################");
-		}
-		out.println(kn.getName() + "," + kn.getFormat() + "," + kn.getVersion());
-		lineNumber++;
-		if(pagination && (lineNumber % 40) == 0) {
-			System.console().format("\nPress Enter to continue...");
-			System.console().readLine();
+		if (!JSONSerializer.getInstance().getIsJsonOutput()) {
+			if (lineNumber == 0) {
+				out.println("KBox KNS Resource table list");
+				out.println("##############################");
+				out.println("name,format,version");
+				out.println("##############################");
+			}
+			out.println(kn.getName() + "," + kn.getFormat() + "," + kn.getVersion());
+			lineNumber++;
+			if (pagination && (lineNumber % 40) == 0) {
+				System.console().format("\nPress Enter to continue...");
+				System.console().readLine();
+			}
+		} else {
+			JSONSerializer.getInstance().addVisitedKN(kn.getName() + "," + kn.getFormat() + "," + kn.getVersion());
 		}
 	}
 
diff --git a/kbox.kibe/src/main/java/org/aksw/kbox/kibe/DefaultKNSServerList.java b/kbox.kibe/src/main/java/org/aksw/kbox/kibe/DefaultKNSServerList.java
index 89c5629..f68728d 100644
--- a/kbox.kibe/src/main/java/org/aksw/kbox/kibe/DefaultKNSServerList.java
+++ b/kbox.kibe/src/main/java/org/aksw/kbox/kibe/DefaultKNSServerList.java
@@ -9,8 +9,8 @@
 public class DefaultKNSServerList extends URLKNSServerList {
 	
 	// Default KNS table URL
-	private final static String DEFAULT_KNS_TABLE_URL = "https://raw.github.com/AKSW/kbox/master";
-	
+	private final static String DEFAULT_KNS_TABLE_URL = "https://raw.githubusercontent.com/AKSW/KBox/master/kns/2.0/";
+
 	private CustomKNSServerList customKNSServerList = new CustomKNSServerList();
 	
 	public DefaultKNSServerList() throws MalformedURLException {
diff --git a/kbox.kibe/src/main/java/org/aksw/kbox/kibe/InfoKBKNSVisitor.java b/kbox.kibe/src/main/java/org/aksw/kbox/kibe/InfoKBKNSVisitor.java
index 9ac5e50..91cc5c1 100644
--- a/kbox.kibe/src/main/java/org/aksw/kbox/kibe/InfoKBKNSVisitor.java
+++ b/kbox.kibe/src/main/java/org/aksw/kbox/kibe/InfoKBKNSVisitor.java
@@ -22,8 +22,12 @@ public InfoKBKNSVisitor(String kbName, String format, String version) {
 	@Override
 	public boolean visit(KN kn) {
 		if(kn.equals(kbName, format, version)) {
-			kn.print(System.out);
-			System.out.println("__________________________________________");
+			if (!JSONSerializer.getInstance().getIsJsonOutput()) {
+				kn.print(System.out);
+				System.out.println("__________________________________________");
+			} else {
+				JSONSerializer.getInstance().setVisitedKN(kn);
+			}
 		}
 		return true;
 	}
diff --git a/kbox.kibe/src/main/java/org/aksw/kbox/kibe/JSONSerializer.java b/kbox.kibe/src/main/java/org/aksw/kbox/kibe/JSONSerializer.java
new file mode 100644
index 0000000..57c8af3
--- /dev/null
+++ b/kbox.kibe/src/main/java/org/aksw/kbox/kibe/JSONSerializer.java
@@ -0,0 +1,173 @@
+package org.aksw.kbox.kibe;
+
+import org.aksw.kbox.kns.KN;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class JSONSerializer {
+
+    private static JSONSerializer JSONSerializerInstance;
+    private final static String OUTPUT = "-o";
+    private final static String JSON_OUTPUT_FORMAT = "json";
+    private final static int JSON_INDENTATION = 4;
+
+    // STATUS CODES
+    public final static int OK = 200;
+    public final static int INTERNAL_SERVER_ERROR = 500;
+
+    private boolean isJsonOutput;
+    private final List<String> visitedKNList;
+    private KN visitedKN; // to be used with the -info command
+
+    private JSONSerializer() {
+        visitedKNList = new ArrayList<>();
+    }
+
+    public static JSONSerializer getInstance() {
+        if (JSONSerializerInstance == null) {
+            synchronized (JSONSerializer.class) {
+                if (JSONSerializerInstance == null) {
+                    JSONSerializerInstance = new JSONSerializer();
+                }
+            }
+        }
+        return JSONSerializerInstance;
+    }
+
+    public void containsJsonOutputCommand(Map<String, String[]> commands) {
+        if (commands.containsKey(OUTPUT)) {
+            if (commands.get(OUTPUT)[0] == null) {
+                System.out.println("Output format not specified. Hence showing default outputs.");
+                isJsonOutput = false;
+                return;
+            }
+            boolean result = commands.get(OUTPUT)[0].equalsIgnoreCase(JSON_OUTPUT_FORMAT);
+            commands.remove(OUTPUT); // removing the -o from map, so it won't affect to other if conditions
+            isJsonOutput = result;
+        }
+    }
+
+    public void printOutput(String msg) {
+        if (!isJsonOutput) {
+            System.out.println(msg);
+        }
+    }
+
+    public void addVisitedKN(String kn) {
+        visitedKNList.add(kn);
+    }
+
+    private void printJsonResponse(int status_code, String msg, JSONArray results) {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("status_code", status_code);
+        jsonObject.put("message",  msg);
+        jsonObject.put("results",  results);
+        System.out.println(jsonObject.toString(JSON_INDENTATION));
+    }
+
+    public void printInstallCommandJsonResponse(String message) {
+        if (!isJsonOutput) {
+            return;
+        }
+        JSONArray results = new JSONArray();
+        results.put(true);
+        printJsonResponse(JSONSerializer.OK, message, results);
+    }
+
+    public void printVisitedKNAsJsonResponse(String message) {
+        if (!isJsonOutput) {
+            return;
+        }
+        JSONArray visitedKNs = new JSONArray();
+        for (String kn : visitedKNList) {
+            String[] split = kn.split(",");
+            JSONObject jsonKN = new JSONObject();
+            jsonKN.put("name", split[0]);
+            jsonKN.put("format", split[1]);
+            jsonKN.put("version", split[2]);
+            visitedKNs.put(jsonKN);
+        }
+        printJsonResponse(JSONSerializer.OK, message, visitedKNs);
+        visitedKNList.clear(); // clear all the visited list.
+    }
+
+    public void printKnsListJsonFormat(List<String> knsList, String message) {
+        if (!isJsonOutput) {
+            return;
+        }
+        JSONArray results = new JSONArray();
+        for (String url : knsList) {
+            results.put(url);
+        }
+        printJsonResponse(JSONSerializer.OK, message, results);
+    }
+
+    public void printRemoveCommandJsonResponse(String message) {
+        if(!isJsonOutput) {
+            return;
+        }
+        JSONArray results = new JSONArray();
+        results.put(true);
+        printJsonResponse(JSONSerializer.OK, message, results);
+    }
+
+    public void printResourceDirectoryAsJsonResponse(String message, String path) {
+        if (!isJsonOutput) {
+            return;
+        }
+        JSONArray results = new JSONArray();
+        results.put(path);
+        printJsonResponse(JSONSerializer.OK, message, results);
+    }
+
+    public void printKNInfoAsJsonResponse(String message) {
+        if (!isJsonOutput) {
+            return;
+        }
+        JSONArray results = new JSONArray();
+        if (visitedKN != null) {
+            results.put(visitedKN.getJsonObject());
+        }
+        printJsonResponse(JSONSerializer.OK, message, results);
+    }
+
+    public void printLocateCommandJsonResponse(String message, String path) {
+        if (!isJsonOutput) {
+            return;
+        }
+        JSONArray results = new JSONArray();
+        results.put(path);
+        printJsonResponse(JSONSerializer.OK, message, results);
+    }
+
+    public void printKBoxVersionAsJsonResponse(String message, String version) {
+        JSONArray results = new JSONArray();
+        results.put(version);
+        printJsonResponse(JSONSerializer.OK, message, results);
+    }
+
+    public void printErrorInJsonFormat(String errorMessage, boolean isEmptyResult) {
+        if (!isJsonOutput) {
+            return;
+        }
+        JSONArray results = new JSONArray();
+        if (!isEmptyResult) {
+            results.put(false);
+        }
+        printJsonResponse(INTERNAL_SERVER_ERROR, errorMessage, results);
+    }
+
+    public void setVisitedKN(KN visitedKN) {
+        this.visitedKN = visitedKN;
+    }
+
+    public boolean getIsJsonOutput() {
+        return isJsonOutput;
+    }
+
+
+}
diff --git a/kbox.kibe/src/main/java/org/aksw/kbox/kibe/Main.java b/kbox.kibe/src/main/java/org/aksw/kbox/kibe/Main.java
index 4156d60..0102627 100644
--- a/kbox.kibe/src/main/java/org/aksw/kbox/kibe/Main.java
+++ b/kbox.kibe/src/main/java/org/aksw/kbox/kibe/Main.java
@@ -1,14 +1,5 @@
 package org.aksw.kbox.kibe;
 
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.aksw.kbox.Install;
 import org.aksw.kbox.ZipLocate;
 import org.aksw.kbox.apple.AppInstall;
@@ -20,7 +11,6 @@
 import org.aksw.kbox.kibe.exception.KBNotLocatedException;
 import org.aksw.kbox.kns.CustomKNSServerList;
 import org.aksw.kbox.kns.InstallFactory;
-import org.aksw.kbox.kns.KNSServer;
 import org.aksw.kbox.kns.KNSServerListVisitor;
 import org.aksw.kbox.kns.ServerAddress;
 import org.aksw.kbox.kns.Source;
@@ -32,14 +22,29 @@
 import org.apache.jena.rdf.model.Model;
 import org.apache.jena.sparql.engine.http.QueryExceptionHTTP;
 import org.apache.log4j.Logger;
+import org.json.JSONArray;
+import org.json.JSONObject;
 import org.zeroturnaround.zip.ZipUtil;
 
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
 public class Main {
 
 	private final static Logger logger = Logger.getLogger(Main.class);
 
 	// CONSTANTS
-	private final static String VERSION = "v0.0.2-alpha1";
+	private final static String VERSION = "v0.0.2-beta";
 
 	public final static String KNS_FILE_NAME = "kbox.kibe.kns";
 	public final static String CONTEXT_NAME = "kbox.kibe";
@@ -58,34 +63,36 @@ public class Main {
 	private final static String KB_WEB_CLIENT = "http://kbox.aksw.org/webclient";
 
 	// COMMANDS
-	private final static String INSTALL_COMMAND = "-install";
-	private final static String KB_COMMAND = "-kb";
-	private final static String KN_COMMAND = "-kn";
-	private final static String KNS_COMMAND = "-kns";
-	private final static String REMOVE_COMMAND = "-remove";
-	private final static String SERVER_COMMAND = "-server";
-	private final static String LIST_COMMAND = "-list";
+	private final static String INSTALL_COMMAND = "install";
+	private final static String KB_COMMAND = "kb";
+	private final static String KN_COMMAND = "kn";
+	private final static String KNS_COMMAND = "kns";
+	private final static String REMOVE_COMMAND = "remove";
+	private final static String SERVER_COMMAND = "server";
+	private final static String LIST_COMMAND = "list";
 	private final static String PAGINATION_COMMAND = "/p";
-	private final static String SPARQL_QUERY_COMMAND = "-sparql";
+	private final static String SPARQL_QUERY_COMMAND = "sparql";
 	private final static String SPARQL_QUERY_JSON_OUTPUT_FORMAT_COMMAND = "-json";
-	private final static String FILE_COMMAND = "-file";
-	private final static String INFO_COMMAND = "-info";
-	private final static String SEARCH_COMMAND = "-search";
-	private final static String CONVERT_COMMAND = "-convert";
-	private final static String ZIP_ENCODE_COMMAND = "-zip";
-	private final static String GZIP_ENCODE_COMMAND = "-gzip";
+	private final static String FILE_COMMAND = "file";
+	private final static String INFO_COMMAND = "info";
+	private final static String SEARCH_COMMAND = "search";
+	private final static String CONVERT_COMMAND = "convert";
+	private final static String ZIP_ENCODE_COMMAND = "zip";
+	private final static String GZIP_ENCODE_COMMAND = "gzip";
 	private final static String VERSION_COMMAND = "-version";
-	private final static String RESOURCE_DIR_COMMAND = "-r-dir";
-	private final static String SERVER_COMMAND_PORT = "-port";
-	private final static String LOCATE_COMMAND = "-locate";
-	private final static String SEVER_COMMAND_SUBDOMAIN = "-subDomain";
+	private final static String RESOURCE_DIR_COMMAND = "r-dir";
+	private final static String SERVER_COMMAND_PORT = "port";
+	private final static String LOCATE_COMMAND = "locate";
+	private final static String SEVER_COMMAND_SUBDOMAIN = "subDomain";
 	private final static String FORMAT_COMMAND = "-format";
-	private final static String RDF_COMMAND = "-rdf";
-	private final static String TARGET_COMMAND = "-target";
+	private final static String RDF_COMMAND = "rdf";
+	private final static String TARGET_COMMAND = "target";
 
 	public static void main(String[] args) {
 		Map<String, String[]> commands = parse(args);
 		ConsoleInstallInputStreamFactory inputStreamFactory = new ConsoleInstallInputStreamFactory();
+		JSONSerializer jsonSerializer = JSONSerializer.getInstance();
+		jsonSerializer.containsJsonOutputCommand(commands);
 		if (commands.containsKey(CONVERT_COMMAND) && !commands.containsKey(ZIP_ENCODE_COMMAND)
 				&& !commands.containsKey(GZIP_ENCODE_COMMAND)) {
 			String directoryParam = commands.get(CONVERT_COMMAND)[0];
@@ -162,13 +169,16 @@ public static void main(String[] args) {
 		} else if (commands.containsKey(INSTALL_COMMAND) && commands.size() == 1) {
 			String resource = getSingleParam(commands, INSTALL_COMMAND);
 			try {
-				System.out.println("Installing resource " + resource);
+				jsonSerializer.printOutput("Installing resource " + resource);
 				URL url = new URL(resource);
 				org.aksw.kbox.KBox.install(url);
-				System.out.println("Resource installed.");
+				String msg = "Resource installed.";
+				jsonSerializer.printOutput(msg);
+				jsonSerializer.printInstallCommandJsonResponse( msg);
 			} catch (Exception e) {
 				String message = "Error installing the resource " + resource + ": " + e.getMessage();
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, false);
 				logger.error(message, e);
 			}
 		} else if (commands.containsKey(INSTALL_COMMAND) && commands.containsKey(KB_COMMAND)
@@ -179,12 +189,15 @@ public static void main(String[] args) {
 				String resource = getSingleParam(commands, FILE_COMMAND);
 				File resourceFile = new File(resource);
 				URL file = resourceFile.toURI().toURL();
-				System.out.println("Installing KB " + kb2Install);
+				jsonSerializer.printOutput("Installing KB " + kb2Install);
 				KBox.install(file, kbURL, inputStreamFactory);
-				System.out.println("KB installed.");
+				String msg = "KB installed.";
+				jsonSerializer.printOutput(msg);
+				jsonSerializer.printInstallCommandJsonResponse(msg);
 			} catch (Exception e) {
 				String message = "Error installing the knowledge base " + kb2Install + ": " + e.getMessage();
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, false);
 				logger.error(message, e);
 			}
 		} else if (commands.containsKey(INSTALL_COMMAND) && commands.containsKey(KB_COMMAND)
@@ -193,17 +206,23 @@ public static void main(String[] args) {
 			String kbURL = getSingleParam(commands, KB_COMMAND);
 			String version = getSingleParam(commands, VERSION_COMMAND);
 			try {
-				System.out.println("Installing KB " + kbURL + " from KNS " + knsServer);
+				jsonSerializer.printOutput("Installing KB " + kbURL + " from KNS " + knsServer);
 				KBox.installFromKNSServer(new URL(kbURL), new URL(knsServer), KBox.KIBE_FORMAT, version, inputStreamFactory);
-				System.out.println("KB installed.");
+				String message = "KB installed.";
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printInstallCommandJsonResponse(message);
 			} catch (MalformedURLException e) {
-				System.out.println(e.getMessage());
+				jsonSerializer.printOutput(e.getMessage());
+				jsonSerializer.printErrorInJsonFormat(e.getMessage(), false);
 				logger.error(e);
 			} catch (KBNotLocatedException e) {
-				System.out.println("The knowledge base " + kbURL + " is not available in " + knsServer + ".");
+				String message = "The knowledge base " + kbURL + " is not available in " + knsServer + ".";
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, false);
 			} catch (Exception e) {
 				String message = "Error installing knowledge base " + kbURL + " from " + knsServer + ".";
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, false);
 				logger.error(message, e);
 			}
 		} else if (commands.containsKey(INSTALL_COMMAND) && commands.containsKey(KN_COMMAND)
@@ -213,17 +232,23 @@ public static void main(String[] args) {
 			String format = getSingleParam(commands, FORMAT_COMMAND);
 			String version = getSingleParam(commands, VERSION_COMMAND);
 			try {
-				System.out.println("Installing KN " + knURL + " from KNS " + knsServer);
+				jsonSerializer.printOutput("Installing KN " + knURL + " from KNS " + knsServer);
 				KBox.installFromKNSServer(new URL(knURL), new URL(knsServer), format, version, inputStreamFactory);
-				System.out.println("KN installed.");
+				String message = "KN installed.";
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printInstallCommandJsonResponse(message);
 			} catch (MalformedURLException e) {
-				System.out.println(e.getMessage());
+				jsonSerializer.printOutput(e.getMessage());
+				jsonSerializer.printErrorInJsonFormat(e.getMessage(), false);
 				logger.error(e);
 			} catch (KBNotLocatedException e) {
-				System.out.println("The knowledge name " + knURL + " is not available in " + knsServer + ".");
+				String message = "The knowledge name " + knURL + " is not available in " + knsServer + ".";
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, false);
 			} catch (Exception e) {
 				String message = "Error installing knowledge name " + knURL + " from " + knsServer + ".";
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, false);
 				logger.error(message, e);
 			}
 		} else if (commands.containsKey(INSTALL_COMMAND) && commands.containsKey(RDF_COMMAND)
@@ -251,7 +276,7 @@ public static void main(String[] args) {
 						inputRDFFiles.add(fileURL);
 					}
 				}
-				System.out.println("Installing KB " + kbURL + " from files " + source);
+				jsonSerializer.printOutput("Installing KB " + kbURL + " from files " + source);
 				InstallFactory installFactory = new DefaultInstallFactory();
 				AppInstall installMethod = installFactory.get(install);
 				KBox.install(inputRDFFiles.toArray(new URL[inputRDFFiles.size()]), 
@@ -260,13 +285,18 @@ public static void main(String[] args) {
 						version,
 						installMethod,
 						inputStreamFactory);
-				System.out.println("KN installed.");
+				String message = "KN installed.";
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printInstallCommandJsonResponse(message);
 			} catch (MalformedURLException e) {
-				System.out.println(e.getMessage());
+				String message = e.getMessage();
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, false);
 				logger.error(e);
 			} catch (Exception e) {
 				String message = "Error installing knowledge name " + kbURL + " from files " + source + ".";
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, false);
 				logger.error(message, e);
 			}
 		} else if (!commands.containsKey(SPARQL_QUERY_COMMAND) && !commands.containsKey(SERVER_COMMAND)
@@ -281,38 +311,92 @@ public static void main(String[] args) {
 					try {
 						File kbFile = KBox.getResource(resourceName, KBox.KIBE_FORMAT, version, true);
 						if(kbFile != null) {
-							System.out.println(resourceName + " KB installed.");
+							String message = resourceName + " KB installed.";
+							jsonSerializer.printOutput(message);
+							jsonSerializer.printInstallCommandJsonResponse(message);
 						} else {
-							System.out.println(resourceName + " KB could NOT be installed.");
+							String message = resourceName + " KB could NOT be installed.";
+							jsonSerializer.printOutput(message);
+							jsonSerializer.printErrorInJsonFormat(message, false);
 						}
 					} catch (MalformedURLException e) {
 						String message = e.getMessage();
-						System.out.println(message);
+						jsonSerializer.printOutput(message);
+						jsonSerializer.printErrorInJsonFormat(message, false);
+						logger.error(message, e);
+					} catch (Exception e) {
+						String message = "The knowledge base could not be found: URL:" + resourceName;
+						if (version != null) {
+							message += ", " + "version: " + version;
+						}
+						jsonSerializer.printOutput(message);
+						jsonSerializer.printErrorInJsonFormat(message, false);
+						logger.error(message, e);
+					}
+				}
+			} catch (Exception e) {
+				String message = "An error occurred while parsing the KB Name list \"" + graphNames + "\": "
+						+ e.getMessage();
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, false);
+				logger.error(message, e);
+			}
+		} else if (!commands.containsKey(SPARQL_QUERY_COMMAND) && !commands.containsKey(SERVER_COMMAND)
+				&& commands.containsKey(INSTALL_COMMAND) && commands.containsKey(FORMAT_COMMAND)) {
+			String format = getSingleParam(commands, FORMAT_COMMAND);
+			String version = getSingleParam(commands, VERSION_COMMAND);
+			String graphNames = getSingleParam(commands, INSTALL_COMMAND);
+			URL[] urls;
+			try {
+				urls = URLUtils.stringToURL(graphNames);
+				for (URL resourceName : urls) {
+					try {
+						File kbFile = KBox.getResource(resourceName, format, version, true);
+						String message;
+						if (kbFile != null) {
+							message = resourceName + " KB installed.";
+							jsonSerializer.printOutput(message);
+							jsonSerializer.printInstallCommandJsonResponse(message);
+						} else {
+							message = resourceName + " KB could NOT be installed.";
+							jsonSerializer.printOutput(message);
+							jsonSerializer.printErrorInJsonFormat(message, false);
+						}
+					} catch (MalformedURLException e) {
+						String message = e.getMessage();
+						jsonSerializer.printOutput(message);
+						jsonSerializer.printErrorInJsonFormat(message, false);
 						logger.error(message, e);
 					} catch (Exception e) {
 						String message = "The knowledge base could not be found: URL:" + resourceName;
 						if (version != null) {
 							message += ", " + "vesion: " + version;
 						}
-						System.out.println(message);
+						jsonSerializer.printOutput(message);
+						jsonSerializer.printErrorInJsonFormat(message, false);
 						logger.error(message, e);
 					}
 				}
 			} catch (Exception e) {
 				String message = "An error occurred while parsing the KB Name list \"" + graphNames + "\": "
 						+ e.getMessage();
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, false);
 				logger.error(message, e);
 			}
 		} else if (commands.containsKey(INSTALL_COMMAND) && commands.containsKey(KNS_COMMAND)) {
 			String url = getSingleParam(commands, KNS_COMMAND);
 			try {
 				URL knsURL = new URL(url);
-				System.out.println("Installing KNS " + url);
+				jsonSerializer.printOutput("Installing KNS " + url);
 				KBox.installKNS(knsURL);
-				System.out.println("KNS installed.");
+				String message = "KNS installed.";
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printInstallCommandJsonResponse(message);
 			} catch (MalformedURLException e) {
-				System.out.println(e.getMessage());
+				String message = e.getMessage();
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, false);
 				logger.error(e);
 			}
 		} else if (commands.containsKey(SPARQL_QUERY_COMMAND)
@@ -327,7 +411,7 @@ public static void main(String[] args) {
 					ResultSet rs = KBox.query(sparql, inputStreamFactory, install, urls);
 					out(commands, rs);
 				} catch (Exception e) {
-					String message = "Error exectuting query '" + sparql + "': " + e.getMessage();
+					String message = "Error executing query '" + sparql + "': " + e.getMessage();
 					System.out.println(message);
 					logger.error(message, e);
 				}
@@ -349,20 +433,21 @@ public static void main(String[] args) {
 				}
 			}
 		} else if (commands.containsKey(LIST_COMMAND) && commands.containsKey(KNS_COMMAND)) {
-			System.out.println("KNS table list");
+			jsonSerializer.printOutput("KNS table list");
 			CustomKNSServerList knsServerList = new CustomKNSServerList();
+			List<String> knsList = new ArrayList<>();
 			try {
-				knsServerList.visit(new KNSServerListVisitor() {
-					@Override
-					public boolean visit(KNSServer knsServer) throws Exception {
-						System.out.println("\t - " + knsServer.getURL());
-						return true;
-					}
+				knsServerList.visit((KNSServerListVisitor) knsServer -> {
+					knsList.add(knsServer.getURL().toString());
+					jsonSerializer.printOutput("\t - " + knsServer.getURL());
+					return true;
 				});
+				jsonSerializer.printKnsListJsonFormat(knsList, "KNS table list");
 			} catch (Exception e) {
 				String message = "An error occurred while listing the available knowledge bases: "
 						+ e.getCause().getMessage();
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, true);
 				logger.error(message, e);
 			}
 		} else if (commands.containsKey(LIST_COMMAND) && !commands.containsKey(KNS_COMMAND)) {
@@ -376,24 +461,29 @@ public boolean visit(KNSServer knsServer) throws Exception {
 					listAllVisitor = new ConsoleKNSServerListVisitor(pagination);
 				}
 				KBox.visit(listAllVisitor);
+				jsonSerializer.printVisitedKNAsJsonResponse("visited all KNs.");
 			} catch (UnknownHostException e) {
 				String message = "An error occurred while listing the available resources. Check your connection.";
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
 				logger.error(message, e);
+				jsonSerializer.printErrorInJsonFormat(message, true);
 			} catch (Exception e) {
 				String message = "An error occurred while listing the available resources: " + e.getMessage();
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
 				logger.error(message, e);
+				jsonSerializer.printErrorInJsonFormat(message, true);
 			}
 		} else if (commands.containsKey(REMOVE_COMMAND) && commands.containsKey(KNS_COMMAND)) {
-			String knsURL = getSingleParam(commands, REMOVE_COMMAND);
+			String knsURL = getSingleParam(commands, KNS_COMMAND);
 			try {
-				System.out.println("Removing KNS " + knsURL);
+				jsonSerializer.printOutput("Removing KNS " + knsURL);
 				KBox.removeKNS(new URL(knsURL));
-				System.out.println("KNS removed.");
+				jsonSerializer.printOutput("KNS removed.");
+				jsonSerializer.printRemoveCommandJsonResponse("KNS removed.");
 			} catch (Exception e) {
 				String message = "An error occurred while removing the KNS: " + knsURL + ".";
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, true);
 				logger.error(message, e);
 			}
 		} else if (commands.containsKey(RESOURCE_DIR_COMMAND)) {
@@ -401,15 +491,20 @@ public boolean visit(KNSServer knsServer) throws Exception {
 			if (resourceDir != null) {
 				try {
 					KBox.setResourceFolder(resourceDir);
-					System.out.println("Resource directory redirected to " + resourceDir + ".");
+					String message = "Resource directory redirected to " + resourceDir + ".";
+					jsonSerializer.printOutput(message);
+					jsonSerializer.printResourceDirectoryAsJsonResponse(message, resourceDir);
 				} catch (Exception e) {
-					String message = "Error changing KBox resource repository to " + resourceDir + ".";
-					System.out.println(message);
-					logger.error(message, e);
+					String errorMessage = "Error changing KBox resource repository to " + resourceDir + ".";
+					jsonSerializer.printOutput(errorMessage);
+					jsonSerializer.printErrorInJsonFormat(errorMessage, true);
+					logger.error(errorMessage, e);
 				}
 			} else {
 				resourceDir = KBox.getResourceFolder();
-				System.out.println("Your current resource directory is: " + resourceDir);
+				String message = "Your current resource directory is: " + resourceDir;
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printResourceDirectoryAsJsonResponse(message, resourceDir);
 			}
 		} else if (commands.containsKey(SEARCH_COMMAND)) {
 			String pattern = getSingleParam(commands, SEARCH_COMMAND);
@@ -419,10 +514,12 @@ public boolean visit(KNSServer knsServer) throws Exception {
 					commands.containsKey(PAGINATION_COMMAND));
 			try {
 				KBox.visit(searchVisitor);
+				jsonSerializer.printVisitedKNAsJsonResponse("searching completed.");
 			} catch (Exception e) {
 				String message = "An error occurred while enquiring search using the pattern: " + pattern;
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
 				logger.error(message, e);
+				jsonSerializer.printErrorInJsonFormat(message, true);
 			}
 		} else if (commands.containsKey(INFO_COMMAND)) {
 			String kn = getSingleParam(commands, INFO_COMMAND);
@@ -431,28 +528,51 @@ public boolean visit(KNSServer knsServer) throws Exception {
 			InfoKBKNSVisitor visitor = new InfoKBKNSVisitor(kn, format, version);
 			try {
 				KBox.visit(visitor);
+				jsonSerializer.printKNInfoAsJsonResponse("Information has been fetched.");
 			} catch (Exception e) {
 				String message = "An error occurred while enquiring information from the KN " + kn;
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, true);
 				logger.error(message, e);
 			}
-		} else if (commands.containsKey(LOCATE_COMMAND) && !commands.containsKey(KB_COMMAND)) {
+		} else if (commands.containsKey(LOCATE_COMMAND) && !commands.containsKey(KB_COMMAND)
+				&& !commands.containsKey(FORMAT_COMMAND)) {
 			String resourceURL = getSingleParam(commands, LOCATE_COMMAND);
 			try {
-				System.out.println(org.aksw.kbox.KBox.locate(new URL(resourceURL)));
+				String path = org.aksw.kbox.KBox.locate(new URL(resourceURL)).getAbsolutePath();
+				jsonSerializer.printOutput(path);
+				jsonSerializer.printLocateCommandJsonResponse("Action Completed.",path);
 			} catch (Exception e) {
 				String message = "An error occurred while resolving the resource: " + resourceURL;
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, true);
 				logger.error(message, e);
 			}
 		} else if (commands.containsKey(LOCATE_COMMAND) && commands.containsKey(KB_COMMAND)) {
 			String kbURL = getSingleParam(commands, KB_COMMAND);
 			String version = getSingleParam(commands, VERSION_COMMAND);
 			try {
-				System.out.println(KBox.locate(new URL(kbURL), KBox.KIBE_FORMAT, version));
+				String path = KBox.locate(new URL(kbURL), KBox.KIBE_FORMAT, version).getAbsolutePath();
+				jsonSerializer.printOutput(path);
+				jsonSerializer.printLocateCommandJsonResponse("Action Completed.", path);
 			} catch (Exception e) {
 				String message = "An error occurred while resolving the KB: " + kbURL;
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, true);
+				logger.error(message, e);
+			}
+		} else if (commands.containsKey(LOCATE_COMMAND) && commands.containsKey(FORMAT_COMMAND)) {
+			String kbURL = getSingleParam(commands, LOCATE_COMMAND);
+			String format = getSingleParam(commands, FORMAT_COMMAND);
+			String version = getSingleParam(commands, VERSION_COMMAND);
+			try {
+				String path = KBox.locate(new URL(kbURL), format, version).getAbsolutePath();
+				jsonSerializer.printOutput(path);
+				jsonSerializer.printLocateCommandJsonResponse("Action Completed.", path);
+			} catch (Exception e) {
+				String message = "An error occurred while resolving the KB: " + kbURL;
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, true);
 				logger.error(message, e);
 			}
 		} else if (commands.containsKey(LOCATE_COMMAND) && commands.containsKey(KN_COMMAND)) {
@@ -460,10 +580,13 @@ public boolean visit(KNSServer knsServer) throws Exception {
 			String format = getSingleParam(commands, FORMAT_COMMAND);
 			String version = getSingleParam(commands, VERSION_COMMAND);
 			try {
-				System.out.println(KBox.locate(new URL(kbURL), format, version));
+				String path = KBox.locate(new URL(kbURL), format, version).getAbsolutePath();
+				jsonSerializer.printOutput(path);
+				jsonSerializer.printLocateCommandJsonResponse("Action Completed.", path);
 			} catch (Exception e) {
 				String message = "An error occurred while resolving the KN: " + kbURL;
-				System.out.println(message);
+				jsonSerializer.printOutput(message);
+				jsonSerializer.printErrorInJsonFormat(message, true);
 				logger.error(message, e);
 			}
 		} else if (commands.containsKey(SERVER_COMMAND)) {
@@ -575,53 +698,57 @@ public void started() {
 	}
 
 	public static void printVersion() {
-		System.out.println("KBox version " + VERSION);
+		if (!JSONSerializer.getInstance().getIsJsonOutput()) {
+			System.out.println("KBox version " + VERSION);
+		} else {
+			JSONSerializer.getInstance().printKBoxVersionAsJsonResponse("KBox Version.", VERSION);
+		}
 	}
 
 	public static void printHelp() {
 		System.out.println("KBox.jar <command> [option]");
 		System.out.println("Where [command] is:");
 		System.out.println(
-				"   * -convert <directory|file> [<destFile>] [-kb|-zip]\t - convert the content of a directory (default -kb).");
+				"   * convert <directory|file> [<destFile>] [kb|zip]\t - convert the content of a directory (default kb).");
 		System.out.println(
-				"             -kb\t - into a kb file. ps: the directory might contain only RDF compatible file formats.");
-		System.out.println("             -zip\t - into a zip file.");
-		System.out.println("   * -convert <file> [<destFile>] -gzip\t - encode a given file.");
+				"             kb\t - into a kb file. ps: the directory might contain only RDF compatible file formats.");
+		System.out.println("             zip\t - into a zip file.");
+		System.out.println("   * convert <file> [<destFile>] gzip\t - encode a given file.");
 		System.out.println(
-				"   * -sparql <query> (-kb <KB> | -server <URL>) [-install] [-json]\t - Query a given knowledge base (e.g. -sparql \"Select ...\" -kb \"KB1,KB2\")");
+				"   * sparql <query> (kb <KB> | server <URL>) [install] [-json]\t - Query a given knowledge base (e.g. sparql \"Select ...\" kb \"KB1,KB2\")");
 		System.out.println(
 				"                                               \t - ps: use -install in case you want to enable the auto-dereference.");
 		System.out.println(
-				"   * -server [-port <port> (default 8080)] [-subDomain <subDomain> (default kbox)] -kb <kb-URL> [-install] \t - Start an SPARQL endpoint in the given subDomain containing the given bases.");
+				"   * server [port <port> (default 8080)] [subDomain <subDomain> (default kbox)] kb <kb-URL> [install] \t - Start an SPARQL endpoint in the given subDomain containing the given bases.");
 		System.out.println(
-				"   * -server [-port <port> (default 8080)] [-subDomain <subDomain> (default kbox)] -rdf <directories|files> [-install [install]]\t - Start an SPARQL endpoint in the given subDomain containing the given RDF files.");
+				"   * server [port <port> (default 8080)] [subDomain <subDomain> (default kbox)] rdf <directories|files> [install [install]]\t - Start an SPARQL endpoint in the given subDomain containing the given RDF files.");
 		System.out.println(
-				"   * -server [-port <port> (default 8080)] [-subDomain <subDomain> (default kbox)] -target <target>\t - Start an SPARQL endpoint in the given subDomain containing the target RDF files.");
-		System.out.println("   * -list [/p]\t - List all available KNS services and knowledge bases.");
-		System.out.println("   * -list -kns\t - List all available KNS services.");
-		System.out.println("   * -install <URL>\t - Install a given resource.");
-		System.out.println("   * -install -kns <kns-URL>\t - Install a given KNS service.");
+				"   * server [port <port> (default 8080)] [subDomain <subDomain> (default kbox)] target <target>\t - Start an SPARQL endpoint in the given subDomain containing the target RDF files.");
+		System.out.println("   * list [/p]\t - List all available KNS services and knowledge bases.");
+		System.out.println("   * list kns\t - List all available KNS services.");
+		System.out.println("   * install <URL>\t - Install a given resource.");
+		System.out.println("   * install kns <kns-URL>\t - Install a given KNS service.");
 		System.out.println(
-				"   * -install -kb <kb-URL> [-version <version>]\t - Install a given knowledge base using the available KNS services to resolve it.");
-		System.out.println("   * -install -kb <kb-URL> -file <kbFile>\t - Install a given kb file in a given Kb-URL.");
+				"   * install kb <kb-URL> [-version <version>]\t - Install a given knowledge base using the available KNS services to resolve it.");
+		System.out.println("   * install kb <kb-URL> file <kbFile>\t - Install a given kb file in a given Kb-URL.");
 		System.out.println(
-				"   * -install -kb <kb-URL> -kns <kns-URL> [-version <version>]\t - Install a knowledge base from a a given KNS service with the specific version.");
+				"   * install kb <kb-URL> kns <kns-URL> [-version <version>]\t - Install a knowledge base from a a given KNS service with the specific version.");
 		System.out.println(
-				"   * -install [install] -kb <kb-URL> -rdf <directories|files> [-version <version>]\t - Install a knowledge base from a a given RDF files with the specific version.");
+				"   * install [install] kb <kb-URL> rdf <directories|files> [-version <version>]\t - Install a knowledge base from a a given RDF files with the specific version.");
 		System.out.println(
-				"   * -install -kn <kn-URL> [-format [-version <version>]]\t - Install a given knowledge base using the available KNS services to resolve it.");
-		System.out.println("   * -remove -kns <kns-URL>\t - Remove a given KNS service.");
+				"   * install kn <kn-URL> [-format [-version <version>]]\t - Install a given knowledge base using the available KNS services to resolve it.");
+		System.out.println("   * remove kns <kns-URL>\t - Remove a given KNS service.");
 		System.out.println(
-				"   * -info <URL> [-format <format> [-version <version>]]\t - Gives the information about a specific KB.");
-		System.out.println("   * -locate <URL>\t - returns the local address of the given resource.");
+				"   * info <URL> -format <format> -version <version>]]\t - Gives the information about a specific KB.");
+		System.out.println("   * locate <URL>\t - returns the local address of the given resource.");
 		System.out.println(
-				"   * -locate -kb <kb-URL> [-version <version>]\t - returns the local address of the given KB.");
+				"   * locate kb <kb-URL> -version <version>]\t - returns the local address of the given KB.");
 		System.out.println(
-				"   * -locate -kn <kn-URL> [-format [-version <version>]]\t - returns the local address of the given KB.");
+				"   * locate kn <kn-URL> -format -version <version>]]\t - returns the local address of the given KB.");
 		System.out.println(
-				"   * -search <kn-URL-pattern> [-format <format> [-version <version>]] [/p]\t - Search for all kb-URL containing a given pattern.");
-		System.out.println("   * -r-dir\t - Show the path to the resource folder.");
-		System.out.println("   * -r-dir <resourceDir>\t - Change the path of the resource folder.");
+				"   * search <kn-URL-pattern> [-format <format> [-version <version>]] [/p]\t - Search for all kb-URL containing a given pattern.");
+		System.out.println("   * r-dir\t - Show the path to the resource folder.");
+		System.out.println("   * r-dir <resourceDir>\t - Change the path of the resource folder.");
 		System.out.println("   * -version \t - display KBox version.");
 	}
 
@@ -697,14 +824,16 @@ public static String getParam(Map<String, String[]> commands, String command, in
 	 */
 	public static Map<String, String[]> parse(String[] args) {
 		Map<String, String[]> map = new HashMap<String, String[]>();
+		Set<String> commandList = new HashSet<>();
+		addCommands(commandList);
 		for (int i = 0; i < args.length; i++) {
-			if (args[i].startsWith(COMMAND_PRAGMA) || args[i].startsWith(SUB_COMMAND_PRAGMA)) { // is
+			if (commandList.contains(args[i]) || args[i].startsWith(SUB_COMMAND_PRAGMA)) { // is
 																								// it
 																								// a
 																								// command
 				map.put(args[i], new String[] { null, null });
 				int j = i + 1;
-				while (j < args.length && !args[j].startsWith(COMMAND_PRAGMA)) {
+				while (j < args.length && !commandList.contains(args[j])) {
 					map.get(args[i])[(j - i) - 1] = args[j];
 					j++;
 				}
@@ -712,4 +841,32 @@ public static Map<String, String[]> parse(String[] args) {
 		}
 		return map;
 	}
+
+	private static void addCommands(Set<String> commandList) {
+		commandList.add(INSTALL_COMMAND);
+		commandList.add(KB_COMMAND);
+		commandList.add(KN_COMMAND);
+		commandList.add(KNS_COMMAND);
+		commandList.add(REMOVE_COMMAND);
+		commandList.add(LIST_COMMAND);
+		commandList.add(PAGINATION_COMMAND);
+		commandList.add(SPARQL_QUERY_COMMAND);
+		commandList.add(SPARQL_QUERY_JSON_OUTPUT_FORMAT_COMMAND);
+		commandList.add(FILE_COMMAND);
+		commandList.add(INFO_COMMAND);
+		commandList.add(SEARCH_COMMAND);
+		commandList.add(CONVERT_COMMAND);
+		commandList.add(ZIP_ENCODE_COMMAND);
+		commandList.add(GZIP_ENCODE_COMMAND);
+		commandList.add(VERSION_COMMAND);
+		commandList.add(RESOURCE_DIR_COMMAND);
+		commandList.add(SERVER_COMMAND_PORT);
+		commandList.add(LOCATE_COMMAND);
+		commandList.add(SEVER_COMMAND_SUBDOMAIN);
+		commandList.add(FORMAT_COMMAND);
+		commandList.add(RDF_COMMAND);
+		commandList.add(TARGET_COMMAND);
+		commandList.add("-o");
+	}
+
 }
diff --git a/kbox.kibe/src/main/java/org/aksw/kbox/kibe/console/ConsoleStreamListener.java b/kbox.kibe/src/main/java/org/aksw/kbox/kibe/console/ConsoleStreamListener.java
index 478c2bf..48d356e 100644
--- a/kbox.kibe/src/main/java/org/aksw/kbox/kibe/console/ConsoleStreamListener.java
+++ b/kbox.kibe/src/main/java/org/aksw/kbox/kibe/console/ConsoleStreamListener.java
@@ -3,6 +3,7 @@
 import java.util.Collections;
 import java.util.concurrent.TimeUnit;
 
+import org.aksw.kbox.kibe.JSONSerializer;
 import org.aksw.kbox.kibe.stream.InstallStreamListener;
 import org.apache.commons.lang3.StringUtils;
 
@@ -78,7 +79,9 @@ public void stop() {
 	 * @param read current streamed length.
 	 */
 	private void printProgress(long startTime, long read, long length, int blockSize) {
-	
+		if(JSONSerializer.getInstance().getIsJsonOutput()) {
+			return; // avoid printing ETA time when user is expecting a json output
+		}
 		int percentage = (int)(((double)read / (double)length) * 100);
 		if(percentage > 100) {
 			percentage = 100;
@@ -124,6 +127,9 @@ private void printProgress(long startTime, long read, long length, int blockSize
 	 * @param size the size of the console bar.
 	 */
 	private void printUndefined(long read, int size) {
+		if(JSONSerializer.getInstance().getIsJsonOutput()) {
+			return; // avoid printing ETA time when user is expecting a json output
+		}
 	    StringBuilder string = new StringBuilder(140);
 	    int pos = (int) ((read)/(size*50000)) % size;
 	    string
diff --git a/kbox.kns/pom.xml b/kbox.kns/pom.xml
index d906667..1a2ed4e 100644
--- a/kbox.kns/pom.xml
+++ b/kbox.kns/pom.xml
@@ -26,9 +26,17 @@
 		    <version>0.0.2-alpha</version>
 	  </dependency>
 	  <dependency>
-	    <groupId>com.googlecode.json-simple</groupId>	
-	    <artifactId>json-simple</artifactId>	
+	    <groupId>com.googlecode.json-simple</groupId>
+	    <artifactId>json-simple</artifactId>
 	    <version>1.1</version>
 	  </dependency>
+      <dependency>
+          <groupId>org.json</groupId>
+          <artifactId>json</artifactId>
+          <version>20180813</version>
+      </dependency>
+
+
+
   </dependencies>
 </project>
\ No newline at end of file
diff --git a/kbox.kns/src/main/java/org/aksw/kbox/kns/KN.java b/kbox.kns/src/main/java/org/aksw/kbox/kns/KN.java
index a9ff9bb..19e06ab 100644
--- a/kbox.kns/src/main/java/org/aksw/kbox/kns/KN.java
+++ b/kbox.kns/src/main/java/org/aksw/kbox/kns/KN.java
@@ -277,6 +277,35 @@ public void print(PrintStream out) {
 		println(out, "version Tags:", versionTags);
 	}
 
+	public org.json.JSONObject getJsonObject() {
+		org.json.JSONObject jsonObject = new org.json.JSONObject();
+		jsonObject.put("KNS:", kns);
+		jsonObject.put("KN:", name);
+		if (nameTags != null) {
+			org.json.JSONArray nameTagsArr = new org.json.JSONArray();
+			for (String tag : nameTags) {
+				nameTagsArr.put(tag);
+			}
+			jsonObject.put("Name Tags:", nameTagsArr);
+		}
+		jsonObject.put("label:", label);
+		jsonObject.put("Description:", desc);
+		jsonObject.put("Subsets:", subsets);
+		jsonObject.put("License:", license);
+		jsonObject.put("Publisher:", publisher);
+		jsonObject.put("Owner:", owner);
+		jsonObject.put("Format:", format);
+		jsonObject.put("Version:", version);
+		if (versionTags != null) {
+			org.json.JSONArray versionTagArr = new org.json.JSONArray();
+			for (String versionTag : versionTags) {
+				versionTagArr.put(versionTag);
+			}
+			jsonObject.put("version Tags:", versionTagArr);
+		}
+		return jsonObject;
+	}
+
 	private void println(PrintStream out, String label, Object variable) {
 		if(variable != null) {
 			out.println(label + variable.toString());
diff --git a/kbox.kns/src/main/java/org/aksw/kbox/kns/KNSTable.java b/kbox.kns/src/main/java/org/aksw/kbox/kns/KNSTable.java
index f5436db..d96c7c4 100644
--- a/kbox.kns/src/main/java/org/aksw/kbox/kns/KNSTable.java
+++ b/kbox.kns/src/main/java/org/aksw/kbox/kns/KNSTable.java
@@ -27,7 +27,7 @@ public KNSTable(String knsServer) throws MalformedURLException {
 
 	public boolean visit(KNSVisitor visitor) throws IOException {
 		boolean next = true;
-		try(InputStream is = tableURL.openStream()) {		
+		try(InputStream is = tableURL.openStream()) {
 			try(BufferedReader in = new BufferedReader(new InputStreamReader(is))) {
 				String line = null;
 				while((line = in.readLine()) != null) {
diff --git a/kbox.pip/LICENSE b/kbox.pip/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/kbox.pip/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/kbox.pip/MANIFEST.in b/kbox.pip/MANIFEST.in
new file mode 100644
index 0000000..72aab71
--- /dev/null
+++ b/kbox.pip/MANIFEST.in
@@ -0,0 +1,1 @@
+include src/*.jar
\ No newline at end of file
diff --git a/kbox.pip/README.md b/kbox.pip/README.md
new file mode 100644
index 0000000..ac99074
--- /dev/null
+++ b/kbox.pip/README.md
@@ -0,0 +1,64 @@
+# KBox
+KBox python implementation
+
+This package is created to distribute KBox as a python package.
+
+* View the library from [here](https://pypi.org/project/kbox/)
+
+* Install using pip
+```
+pip install kbox
+```
+
+### Use it in from your terminal
+Once you install the kbox package, you can directly execute the commands from the terminal. You don't need to open 
+up a python environment to use the kbox package.
+
+Open a terminal and execute KBox commands in python with kbox package as below,
+
+````
+kbox -list
+````
+
+````
+KBox KNS Resource table list
+##############################
+name,format,version
+##############################
+https://schema.org/,kibe,0
+http://productcatalogue.org/products/eco/,kibe,0
+http://productcatalogue.org/products/amazon/,kibe,0
+http://company.org,kibe,0
+http://github.org/aksw/NSpM/monument_300_2,kibe,0
+http://github.org/aksw/NSpM/monument_300,NSPM/Model,0
+http://purl.org/dc/dcmitype/,kibe,0
+http://purl.org/dc/dc0/,kibe,0
+...
+...
+
+````
+
+Like the above command, you can use all other KBox commands with kbox python package. You can refer to the document 
+[here](https://github.com/AKSW/KBox#how-can-i-execute-kbox-in-command-line) to get a good understanding of other KBox commands as well. 
+
+### Use it in your python application.
+
+##### execute(command)
+    Description: Execute the provided command in the KBox.jar
+    Args:
+      command: 'string', KBox command which should be exectue in KBox.
+    Returns:
+        Resutls of the provided kbox command as a string
+
+If you want to use the kbox inside your python application, you can follow these instructions,
+1. Import the kbox package (`from kbox import kbox`).
+2. Execute any KBox command with execute() function as follows.
+   
+   ```
+   kbox.execute('KBox_Command')
+   ```
+
+**Note: `execute()` method will return a string output which contains the result of the executed command.
+    
+### Source URLs
+* Find the KBox source code [here](https://github.com/AKSW/KBox)
diff --git a/kbox.pip/kbox/__init__.py b/kbox.pip/kbox/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/kbox.pip/kbox/kbox-v0.0.2-alpha.jar b/kbox.pip/kbox/kbox-v0.0.2-alpha.jar
new file mode 100644
index 0000000..39c14a5
Binary files /dev/null and b/kbox.pip/kbox/kbox-v0.0.2-alpha.jar differ
diff --git a/kbox.pip/kbox/kbox.py b/kbox.pip/kbox/kbox.py
new file mode 100644
index 0000000..eafbff8
--- /dev/null
+++ b/kbox.pip/kbox/kbox.py
@@ -0,0 +1,41 @@
+import os
+import subprocess
+
+import click
+
+DIR_PATH = os.path.dirname(os.path.realpath(__file__))
+JAR_EXECUTE = "java -jar " + DIR_PATH + "/kbox-v0.0.2-alpha.jar"  # kbox-v0.0.2-alpha.jar
+SPACE = " "
+PUSH_COMMAND = 'push'
+COMMAND_LIST = [PUSH_COMMAND]
+
+
+@click.command(context_settings={"ignore_unknown_options": True})
+@click.argument('commands', nargs=-1)
+def execute_kbox_command(commands):
+    args = SPACE
+    for item in commands:
+        args += item + SPACE
+    execute_commands = JAR_EXECUTE + args
+    try:
+        process = subprocess.Popen(execute_commands.split(), stdout=subprocess.PIPE)
+        output, err = process.communicate()
+        output = output.decode("utf-8")
+        click.echo(output)
+    except OSError as e:
+        click.echo(e)
+
+
+def execute(commands):
+    commands = tuple(commands.split())
+    args = SPACE
+    for item in commands:
+        args += item + SPACE
+    execute_commands = JAR_EXECUTE + args
+    try:
+        process = subprocess.Popen(execute_commands.split(), stdout=subprocess.PIPE)
+        output, err = process.communicate()
+        output = output.decode("utf-8")
+        return output
+    except OSError as e:
+        print(e)
diff --git a/kbox.pip/requirements.txt b/kbox.pip/requirements.txt
new file mode 100644
index 0000000..cc189cf
--- /dev/null
+++ b/kbox.pip/requirements.txt
@@ -0,0 +1,3 @@
+requests~=2.25.1
+click~=7.1.2
+setuptools~=44.0.0
\ No newline at end of file
diff --git a/kbox.pip/setup.py b/kbox.pip/setup.py
new file mode 100644
index 0000000..78e4a59
--- /dev/null
+++ b/kbox.pip/setup.py
@@ -0,0 +1,31 @@
+from setuptools import setup
+
+with open("README.md", "r") as fh:
+    long_description = fh.read()
+
+setup(
+    name="KBox",
+    version="0.0.2-alpha",
+    author="Edgard Marx",
+    author_email='edgard.marx@htwk-leipzig.de',
+    url='https://github.com/AKSW/KBox/tree/master/kbox.pip',
+    description="Python distribution of the KBox.",
+    long_description=long_description,
+    long_description_content_type="text/markdown",
+    py_modules=['kbox'],
+    packages=["kbox"],
+    package_data={'': ['*.jar']},
+    include_package_data=True,
+    install_requires=['click>=7.1.2'],
+    entry_points={
+        'console_scripts': [
+            'kbox=kbox.kbox:execute_kbox_command',
+        ],
+    },
+    license='Apache',
+    classifiers=[
+        "License :: OSI Approved :: Apache Software License",
+        'Programming Language :: Python :: 3',
+    ],
+
+)
diff --git a/kns/2.0/table.kns b/kns/2.0/table.kns
index 86d8c28..18da885 100644
--- a/kns/2.0/table.kns
+++ b/kns/2.0/table.kns
@@ -1,3 +1,4 @@
 {"name": "http://purl.org/pcp-on-web/dbpedia", "label":"PCP-on-Web ontology", "target": [[{"rdf2kb":[{"url":"https://gitlab.imn.htwk-leipzig.de/emarx/pcp-on-web/raw/master/dataset/dbpediaExtraction.nt"}]}]], "format":"kibe", "version": {"name":"c9a618a875c5d46add88de4f00b538962f9359ad", "tags":["latest"]}, "desc": "The PCP-on-Web ontology.", "owner":"PCP-on-Web", "publisher":"KBox team", "license":["http://en.wikipedia.org/wiki/Wikipedia:Text_of_the_GNU_Free_Documentation_License", "http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License"]}
 {"name": "http://purl.org/pcp-on-web/ontology", "label":"PCP-on-Web ontology", "target": [[{"rdf2kb":[{"url":"https://raw.githubusercontent.com/pcp-on-web/ontology/master/index.rdf"}]}]], "format":"kibe", "version": {"name":"c9a618a875c5d46add88de4f00b538962f9359ad", "tags":["latest"]}, "desc": "The PCP-on-Web ontology.", "owner":"PCP-on-Web", "publisher":"KBox team", "license":["http://en.wikipedia.org/wiki/Wikipedia:Text_of_the_GNU_Free_Documentation_License", "http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License"]}
-{"name": "http://nspm.org/art", "label":"DBpedia Art Dataset", "target": [[{"zip":[{"url":"????"}]}]], "format":"nspm", "version": {"name":"1.0", "tags":["latest"]}, "desc": "The pre-trained NSPM DBpedia Art Dataset.", "owner":"NSpM", "publisher":"KBox team", "license":["http://en.wikipedia.org/wiki/Wikipedia:Text_of_the_GNU_Free_Documentation_License", "http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License"]. "subsets": ["https://github.com/LiberAI/NSpM/blob/master/data/templates/Annotations_F30_art.csv"]}
+{"name": "http://purl.org/pcp-on-web/dataset", "label":"PCP-on-Web dataset", "target": [[{"rdf2kb":[{"url":"https://gitlab.imn.htwk-leipzig.de/emarx/pcp-on-web/raw/master/dataset/leipzig-helmstedt.ttl"}]}]], "format":"kibe", "version": {"name":"dd240892384222f91255b0a94fd772c5d540f38b", "tags":["latest"]}, "desc": "The PCP-on-Web ontology.", "owner":"PCP-on-Web", "publisher":"KBox team", "license":["http://en.wikipedia.org/wiki/Wikipedia:Text_of_the_GNU_Free_Documentation_License", "http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License"]}
+{"name": "http://nspm.org/art", "label":"DBpedia Art Dataset", "target": [[{"zip":[{"url":"https://www.dropbox.com/s/llx7ruy1bxflhvl/art_30.zip?dl=1"}]}]], "format":"nspm", "version": {"name":"1.0", "tags":["latest"]}, "desc": "The pre-trained NSPM DBpedia Art Dataset.", "owner":"NSpM", "publisher":"KBox team", "license":["http://en.wikipedia.org/wiki/Wikipedia:Text_of_the_GNU_Free_Documentation_License", "http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License"],"subsets": ["https://github.com/LiberAI/NSpM/blob/master/data/templates/Annotations_F30_art.csv"]}
diff --git a/kns/2.0/table.server.kns b/kns/2.0/table.server.kns
index ada235a..c963931 100644
--- a/kns/2.0/table.server.kns
+++ b/kns/2.0/table.server.kns
@@ -1,1 +1,1 @@
-{"url": "https://raw.githubusercontent.com/AKSW/kbox/master/kns/2.0", "publisher": "KBOX Team"}
+{"url": "https://raw.githubusercontent.com/AKSW/KBox/master/kns/2.0", "publisher": "KBOX Team"}


Test patch:
diff --git a/kbox.pip/test/__init__.py b/kbox.pip/test/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/kbox.pip/test/test.py b/kbox.pip/test/test.py
new file mode 100644
index 0000000..cdd32e8
--- /dev/null
+++ b/kbox.pip/test/test.py
@@ -0,0 +1,36 @@
+from kbox import kbox
+import unittest
+
+
+class TestAirML(unittest.TestCase):
+    def test_list(self):
+        output = kbox.execute('-list')
+        self.assertTrue('KBox KNS Resource table list' in output)
+
+    def test_info(self):
+        output = kbox.execute("-info http://purl.org/pcp-on-web/dbpedia")
+        print(output)
+        self.assertTrue('KB:http://purl.org/pcp-on-web/dbpedia' in output)
+
+    def test_search(self):
+        output = kbox.execute('-search ontology')
+        print(output)
+        self.assertTrue('KBox KNS Resource table list' in output)
+
+    def test_dir(self):
+        output = kbox.execute('-r-dir')
+        print(output)
+        self.assertTrue('Your current resource directory is:' in output)
+
+    def test_version(self):
+        output = kbox.execute('-version')
+        print(output)
+        self.assertTrue('KBox version v0.0.2-alpha' in output)
+
+    def test_invalid_command(self):
+        output = kbox.execute('lists')
+        self.assertTrue("KBox.jar <command> [option]" in output)
+
+
+if __name__ == '__main__':
+    unittest.main()