Getting started using Virtuoso as a triplestore
The open source edition.
Just about all the RDF triplestores I’ve been trying were designed from the ground up to store RDF triples. OpenLink Software’s Virtuoso is a database server that can also store (and, as part of its original specialty, serve as an efficient interface to databases of) relational data and XML, so some of my setup and usage steps required learning a few other aspects of it first. For example, the actual loading of RDF is done using Virtuoso’s WebDAV support, so I had to learn a bit about that. At first this seemed like another obstacle along the way to my goal of loading RDF and then issuing SPARQL queries against it, but I reminded myself that in a fast, free database server that supports a variety of data models, WebDAV support is most certainly a feature, not a bug.
The possibility of a single server that can store both XML content and RDF triples of metadata about that content could be very interesting for publishers.
After downloading and unzipping the open source edition of Virtuoso for Windows, I found the virtuoso-t.exe server program in the virtuoso-opensource\bin directory. Running this with --help
as a parameter showed me the various options for starting it up, including the commands to create a Virtuoso Windows service and to then start up that service.
Once I had this service running, sending a browser to http://localhost:8890/ displayed the product’s Welcome page, and the first choice on the menu on the left side of this screen took me to the Virtuoso Conductor. The Conductor requires you to log in before getting anything done, and the Default Passwords section of the Quick Start & Tours documentation included “dba” in its list of default IDs, so I logged in as the dba.
An HTTP request to load data must specify the ID of the user loading the data, so as the dba I created a new user by picking the System Admin tab, User Accounts, and then “Create New Account” to create a joeuser account. I had some initial trouble configuring this user’s account to let it do all the things it needed to do, but with some help on the virtuoso-users mailing list I learned that I had to check “User Enabled” and “Allow SQL/ODBC Logins”, add the roles SPARQL_SELECT and SPARQL_UPDATE for the user, check “Allow DAV logins”, set a DAV home path of /DAV/home/joeuser/ for this user, and check the DAV folder name’s Create box before clicking the Save button to actually create this user account and WebDAV folder.
For a given user, you can create any WebDAV folder you want, upload RDF data to it, and then load that data to the triplestore (a quad store, actually, to track each triple’s graph) from that folder, but Virtuoso includes a special folder with each WebDAV-enabled account called rdf_sink to automate this process so that once you load an RDF file there its triples get sent right to the quad store.
Once I had created the joeuser account with a password of jupw, the following cURL command loaded the fakeAddrBookPt1.rdf file into the graph named http://localhost:8890/DAV/home/joeuser/rdf_sink (all curl command lines shown here include extra carriage returns for readability):
curl -i -T fakeAddrBookPt1.rdf
http://localhost:8890/DAV/home/joeuser/rdf_sink/fakeAddrBookPt1.rdf
-u joeuser:jupw
(Later, substituting “fakeAddrBookPt2.rdf” for “fakeAddrBookPt1.rdf” in that command loaded this other file into the same graph.) After loading fakeAddrBookPt1.rdf, I went to the SPARQL query form at http://localhost:8890/sparql (the RDF tab of the Virtuoso conductor displays a similar one), entered http://localhost:8890/DAV/home/joeuser/rdf_sink/ as the Default Graph URI to query, and entered my favorite first SPARQL query of “SELECT DISTINCT ?p WHERE {?s ?p ?o}” in the Query text field. Clicking the Run Query button then retrieved a list of predicates from the data that I had loaded into that graph, just as I’d asked for.
Because issuing a SPARQL query with curl reassures me that I really understand a server’s HTTP interface, I also entered the following command to perform the same query and got the same result:
curl -F "query=SELECT DISTINCT ?p FROM
<http://localhost:8890/DAV/home/joeuser/rdf_sink/>
WHERE {?s ?p ?o}" http://localhost:8890/sparql
Throughout my process of setting this up and trying Virtuoso, I must admit that I did a lot of hunting in the documentation, although as I mentioned I got very good help on the mailing list. There is a documentation PDF file that looks pretty complete—at 15 megs and 2202 pages, it better be!
For my next step with Virtuoso, the RDF Inference in Virtuoso page describes some RDFS and OWL support, but shows that the RDFS and OWL properties must be loaded using special functions instead of just including them as more triples with the data. I’ll probably try it, but I’m also very curious about Virtuoso’s XQuery support—the possibility of a single server that can store both XML content and RDF triples of metadata about that content could be very interesting for publishers.
4 Comments
By Kingsley Idehen on February 16, 2009 4:37 PM
Bob,
Here are some links to posts I made in the past re. Inference rules.
1. http://www.mail-archive.com/public-lod@w3.org/msg00870.html - UMBEL & DBpedia
2. http://www.mail-archive.com/dbpedia-discussion@lists.sourceforge.net/msg00263.html - YAGO & DBpedia
Steps:
1. You load the class hierarchies in question (typically an OWL ontology)
2. You associate an named rule with the named graph hosting the ontology in step 1
3. You execute SPARQL with the inference rule pragma which allows you to select which rules to use for reasoning.
By Mario Kofler on July 1, 2010 11:18 AM
Hello,
I created a new user by picking the System Admin tab, User
Accounts, and then “Create New Account” to create a joeuser
can you please tell me where the button or the link “Create New Account” is located?
i went with the user “dba” to system-admin->user-accounts but i can just watch the users that are already in the system, but do not find a way to create a new account.
i am using Virtuoso 6.1.1
thank you for your help,
greetings,
Mario Kofler
By Bob on July 1, 2010 11:52 AM
It may have changed since February of last year. I would ask on a Virtuoso mailing list.
By Jamshaid Ashraf on September 17, 2010 7:29 AM
Mario,
" > I created a new user by picking the System Admin tab, User\
Accounts, and then “Create New Account” to create a joeuser
can you please tell me where the button or the link “Create New Account” is located? "
You can find “Create New Account” as a link on the column heading of last column of user table. Though it looks like a link for sorting but in fact it is a link to ‘create new user’ (implicitly explicit feature)
reg
Jamshaid
Share this post