-
Notifications
You must be signed in to change notification settings - Fork 11
API v0.0.1 alpha2 and below
- Why use KBox?
- What is possible to do with it?
- How can I use KBox?
- How can I execute KBox in command Line?
- How can I use KBox in my project?
- How can I query a published knowledge graph?
- How can I query multi-graphs?
- Using KBox with Docker
- How can I publish my own dataset?
Systems usually deal with resources and knowledge that are often duplicated among several instances. For instance, when using the Stanford NLP library the resources and knowledge inside the library are duplicated among different applications. The idea is to have a common repository where users can share resources without duplication. In order to do that, we bring the RDF concept to bridge the gap among reource publishig, storing and locating.
With KBox you can share resources and knowledge among several applications, but not just that. In order to allow an easier knowledge dissemination, we have implemented Kibe library. The Kibe library allows applications to virtually install and query RDF knowledge graphs. It takes around ~50 minutes to start quering DBpedia on your computer to avoid server overheads and faults.
You can use KBox either as a command-line program or a library in your application. It is easy to plug and use it.
-
Download the library here.
-
Type the following:
java -jar 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.
* -sparql <query> -graph <graph> - Query a given graph.
* -kns-list - List all availables KNS services.
* -kns-install <kns-URL> - Install a given KNS service.
* -kns-remove <kns-URL> - Remove a given KNS service.
* -r-install <URL> - Install a given resource in KBox.
* -kb-install <kb-URL> - Install a given knowledge base using the available KNS services to resolve it.
* -kb-install <kb-URL> -index <indexFile> - Install a given index in a given knowledge base URL.
* -kb-install <kb-URL> -kns-server <kns-server-URL> - Install a knowledge base from a a given KNS server.
* -kb-list - List all available KNS services and knowledge bases.
* -r-dir <resourceDir> - Change the current path of the KBox resource directory.
* -version - display KBox version.
- KBox is distributed over Maven.
- You can add KBox to your project by importing the desired library:
- Add the following dependency on your project:
<dependency>
<groupId>org.aksw.kbox</groupId>
<artifactId>kbox.core</artifactId>
<version>0.0.1-alpha1</version>
</dependency>
- Add the internal AKSW repository to your pom file:
<repositories>
<repository>
<id>maven.aksw.internal</id>
<name>University Leipzig, AKSW Maven2 Repository</name>
<url>http://maven.aksw.org/archiva/repository/internal</url>
</repository>
...
</repositories>
- Rock it.. ;-)
Weeeelll... it's quite easy.
Remember the commands listed on 'How can I execute KBox in command Line'.
It's just about executing the command line below. Remember to add -install
, so the knowledge graph is automatically dereferenced.
java -jar kbox-v0.0.1-alpha2.jar -sparql "Select (count(distinct ?s) as ?n) where {?s ?p ?o}" -graph "https://www.w3.org/2000/01/rdf-schema" -install
------
| n |
======
| 32 |
------
Or using the java API...
KBox.query("Select (count(distinct ?s) as ?n) where {?s ?p ?o}", true, new URL("https://www.w3.org/2000/01/rdf-schema"));
You might want to setup the model before starting to execute multiple queries on it:
Model model = KBox.createModel(new URL("https://www.w3.org/2000/01/rdf-schema"));
KBox.query("Select (count(distinct ?s) as ?n) where {?s ?p ?o}", model);
It's very easy, as you just need to add the knowledge graph you want to query separated by commas as the command below:
In the given example, we query two knowledge graphs, https://www.w3.org/2000/01/rdf-schema and http://xmlns.com/foaf/0.1.
java -jar kbox-v0.0.1-alpha2.jar -sparql "Select (count(distinct ?s) as ?n) where {?s ?p ?o}" -graph "https://www.w3.org/2000/01/rdf-schema,http://xmlns.com/foaf/0.1" -install
-------
| n |
=======
| 123 |
-------
Or using the java API...
KBox.query("Select (count(distinct ?s) as ?n) where {?s ?p ?o}",
true, new URL("https://www.w3.org/2000/01/rdf-schema"),
new URL("http://xmlns.com/foaf/0.1"));
You might want to setup the model before starting to execute multiple queries on it:
Model model = KBox.createModel(new URL("https://www.w3.org/2000/01/rdf-schema"),
new URL("http://xmlns.com/foaf/0.1"));
KBox.query("Select (count(distinct ?s) as ?n) where {?s ?p ?o}", model);
You can also use KBox Docker container by following the steps below:
- Install Docker in your machine (Consult the guide for more details).
sudo apt-get update
sudo apt-get -y install docker-engine
- Pull KBox from AKSW hub repository.
docker aksw/kbox pull
- Run it...
docker run aksw/kbox -sparql "Select (count(distinct ?s) as ?n) where {?s ?p ?o}" -graph "https://www.w3.org/2000/01/rdf-schema" -install
------
| n |
======
| 32 |
------
Although you can create your own KNS service and publish your datasets, currently KBox does not allow you to directly publish content to make them available to other users. In order to do that, you must contact us.
Contact: [email protected]
Information needed:
- Dataset Label;
- Dataset Version;
- The Publisher: Your or your organization's email/URL;
- The Creator: Who has created the Knowledge base, e.g. DBpedia -> http://dbpedia.org;
- The License: the dataset license;
- The URL where the knwoledge graph file can be dereferenced (please create the file using KBox
-createIndex
command); - The Dataset URI name: the URI name that will be used by users to dereference your dataset;
- The Dataset description: Give us a few words to help others to know what your dataset is about;
- Tell us one reason why KBox is awesome. :-)