Skip to content

3 Running the webservice

Ricardo Usbeck edited this page Oct 8, 2018 · 23 revisions

Run your own webservice

  1. Download AGDISTIS
git clone https://github.com/AKSW/AGDISTIS.git
  1. The important data for running AGDISTIS on DBpedia is stored in a Lucene 4.4 Index. You should download one of the following indices (some languages can be enhanced by also downloading and using the context index) into you AGDISTIS clone. Note, Chinese index could not be created because there are missing files from DBpedia dump.
cd AGDISTIS
wget http://hobbitdata.informatik.uni-leipzig.de/agdistis/dbpedia_index_2016-04/en/indexdbpedia_en_2016.zip
wget http://hobbitdata.informatik.uni-leipzig.de/agdistis/dbpedia_index_2016-04/en/index_bycontext.zip

wget http://hobbitdata.informatik.uni-leipzig.de/agdistis/dbpedia_index_2016-04/de/indexdbpedia_de_2016.zip
wget http://hobbitdata.informatik.uni-leipzig.de/agdistis/dbpedia_index_2016-04/de/index_bycontext.zip

wget http://hobbitdata.informatik.uni-leipzig.de/agdistis/dbpedia_index_2016-04/fr/indexdbpedia_fr_2016.zip
wget http://hobbitdata.informatik.uni-leipzig.de/agdistis/dbpedia_index_2016-04/es/indexdbpedia_es_2016.zip
wget http://hobbitdata.informatik.uni-leipzig.de/agdistis/dbpedia_index_2016-04/it/indexdbpedia_it_2016.zip
wget http://hobbitdata.informatik.uni-leipzig.de/agdistis/dbpedia_index_2016-04/ja/indexdbpedia_ja_2016.zip
wget http://hobbitdata.informatik.uni-leipzig.de/agdistis/dbpedia_index_2016-04/nl/indexdbpedia_nl_2016.zip

wget http://titan.informatik.uni-leipzig.de/rusbeck/agdistis/zh/indexdbpedia_zh_2014.7z
  1. Edit the src/main/resources/config/agdistis.properties file according to your settings.

  2. For running AGDISTIS on your machine go to the root directory of AGDISTIS and execute

mvn tomcat:run 

Now a webservice is running on localhost:8080

Running with Docker

  1. Pull image from docker hub using docker pull aksw/agdistis (https://hub.docker.com/r/aksw/agdistis/)
  2. Download (see above) or build an index and rename it if needed to index
  3. Run AGDISTIS while attaching an index as volume using
  4. Adapt your language/knowledgebase settings for using it

English example:

docker run -d \
  --name agdistis \
  -v `pwd`/indexdbpedia_en_2016:/usr/local/tomcat/index \
  -v `pwd`/index_bycontext:/usr/local/tomcat/index_bycontext \
  -p 8113:8080 \
  -e AGDISTIS_NODE_TYPE=http://dbpedia.org/resource/ \
  -e AGDISTIS_EDGE_TYPE=http://dbpedia.org/ontology/ \
  -e AGDISTIS_BASE_URI=http://dbpedia.org \
  -m 8G \
  --restart always\
  aksw/agdistis:latest

German example:

docker run -d \
  --name agdistis \
  -v `pwd`/indexdbpedia_de_2016:/usr/local/tomcat/index \
  -v `pwd`/index_bycontext:/usr/local/tomcat/index_bycontext \
  -p 8080:8080 \
  -e AGDISTIS_NODE_TYPE=http://de.dbpedia.org/resource/ \
  -e AGDISTIS_EDGE_TYPE=http://dbpedia.org/ontology/ \
  -e AGDISTIS_BASE_URI=http://dbpedia.org \
  aksw/agdistis:latest

If you have a context index (index_bycontent, like in this example) add -e AGDISTIS_CONTEXT=True

Create your own docker image

  1. Clone this repo
  2. Build application war by running mvn package -Dmaven.test.skip=true
  3. Build docker image by running docker build -t aksw/agdistis .

Running from source in Java

The easiest way of running AGDISTIS from source is to have a look at the Java Class AGDISTISTest.java.

Create your own index

To create your own index you have to git clone AGDISTIS and additionally files for your ontology comprising rdf:type, rdfs:label and meaning full object properties.

For example, download all files for a DBpedia 2014 index with this script

wget http://downloads.dbpedia.org/2016-10/core-i18n/en/instance_types_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/mappingbased_literals_en.ttl.bz2    
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/mappingbased_objects_en.ttl.bz2   
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/persondata_en.ttl.bz2 
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/specific_mappingbased_properties_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/disambiguations_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/labels_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/redirects_transitive_en.ttl.bz2

The Chinese DBpedia version 2014 is incomplete as of 09/16/2014. Therefore, we provide the needed files on our server and some on the central DBpedia server. (disambiguations_zh.ttl is missing at all):

wget http://titan.informatik.uni-leipzig.de/rusbeck/agdistis/zh/zh_resources_files_for_index_v2014.zip.zip

Run the TripleIndexCreator class.

Create your own context index

All files from a given Knowledge Base should be downloaded and the user has to create a folder called context inside the same folder from the other main index (explained above). But, the user also needs to separate the file which contains labels from the others. Then, the user creates a subfolder called "update" containing the other files. For example:

folderWithTTLFiles=</Path/to/folder/context>

Use case: DBpedia has natural language URIs. We are able to extract labels from them. But, Wikidata and other such as BabelNet just contain codes. Thus, we need to set an endpoint and perform a SPARQL query for gathering their rdfs:label. The endpoint is set in agdistis.properties file e.g endpoint=https://query.wikidata.org/sparql

Afterwards you need to configure the agdistis.properties file according to your preferred knowledge base. Especially, configure those two lines:

folderWithTTLFiles=</Path/to/folder>
surfaceFormTSV=</Path/to/folder/surfaceforms/tsv/OPTIONAL>

and then run:

mvn exec:java -Dexec.mainClass="org.aksw.agdistis.util.TripleIndexCreator"

Surface forms are available from here: http://hobbitdata.informatik.uni-leipzig.de/homes/rusbeck/agdistis/surfaceforms/en_surface_forms.tsv.7z

These files were created by D. Gerber (http://aksw.org/Projects/BOA.html)

If you have any issues, please let us know!