How to load data in Virtuoso?

Loading DBpedia in Virtuoso. A complete guide!

Photo by Charles Deluvio on Unsplash

I assume that you have already setup Virtuoso locally. Now, if you need to load turtle/owl data files to Virtuoso, then follow these steps where I have loaded DBpedia ontology TBOX and ABOX instance to Virtuoso:

  • Open the console and run the following command: cd /usr/local/virtuoso-opensource/share/virtuoso/vad
  • Next, run the following command to download the ontology:
    sudo wget
  • Then, unzip the downloaded file with the following file:
    sudo bzip2 -d dbpedia_2014.owl.bz2
  • Next, create the .graph file necessary for the batch load to Virtuoso with the following command:
    sudo touch dbpedia_2014.owl.graph
  • Next, open the file and add http://localhost:8890/dbpedia. This can be performed with the following command:
    sudo nano dbpedia_2014.owl.graph
    (In case you are not familiar with the nano text editor on Linux, after running the nano command, you should add the specified line, press the buttons ‘Ctrl’ and ‘x’ at the same time, then press ‘y’, and finally press ‘enter’.)

In the same way, you need to load some ABOX instances (Note that as this involves a large file, some commands might take several minutes to execute). The commands are:

Now, open the browser and go to http://localhost:8890 and login with the credentials ‘dba’ ‘dba’. To load the downloaded files, go to the tab Database / Interactive SQL and run the following commands (Note that some commands might take several minutes to execute):

ld_dir (‘/usr/local/virtuoso-opensource/share/virtuoso/vad’, ‘*.nt’, ‘http://localhost:8890/dbpedia') ; rdf_loader_run();

Finally, you may go to the tab Linked Data / Graphs and check if there is a graph with the name http://localhost:8890/dbpedia. If so, go to the tab Linked Data/SPARQL and put http://localhost:8890/dbpedia as the graph name and try to load the following query:

The Virtuoso SPARQL endpoint can also be accessed directly at http://localhost:8890/sparql.

Note: You need to replace owl with ttl in the above instructions to load turtle files.

I am a data science PhD researcher who loves to write!