I was doing some research about how to use OpenLink Virtuoso in my own project. First I want to try something basic, so I start with Triple-store and SPARQL query. This article is about how to transform Non-RDF file to RDF, insert RDF into Virtuoso Triple-store, and then search the result by using SPARQL.
Brief introduction
Transform Non-RDF to RDF
There are a lot of tools can be used to transform Non-RDF to RDF. I will use the GRefine RDF Extension. Here is a tutorial video.
What is Virtuoso
OpenLink Virtuoso is an ambitious software, it provides Web, File, and Database server functionality alongside Native XML Storage, and Universal Data Access Middleware. And, yes, it has implementation of Triple-store to store RDFs.
Let's focus on the Virtuoso triple-store.
Virtuoso triple-store is built atop of traditional RDBMS( See implementation here ). Triples are stored in a table called RDF_QUAD(See table below). Every RDF is composed by triples which will be inserted into RDF_QUAD table.
Triple-store uses Graph to group triples. There is a IRI, similar to URI, to identify every Graph. So when you try to insert data into triple-store, you should specify the IRI of the Graph.
To search triples in a Graph, you should first give the IRI of the Graph, then use Virtuoso SPARQL (which is implemented atop of SQL by Virtuoso) to query the triple-store.
My experiment
My goal is to combine air quality data with disease data using Virtuoso triple-store engine. I found the data source on the AirNow and CDC Database.
Step1: Convert Non-RDF to RDF
First I imported data into GRefine RDF Extension. Of course, you should trim some irrelevant date before importing. After this step, you should see the similar results below.
Then I started to create RDF skeleton, select RDF->Edit RDF Skeleton. If you don't know how to do this, watch the tutorial video above.
You can see the RDF skeleton graph below.
The result should be like this:
Next is to export the RDF file, choose Export->RDF as XML or Export->RDF as Turtle. Done!
Step 2: Insert RDF into Virtuoso Triple-store
Before start, you should install the Virtuoso, I recommend you to use Virtuoso Open-source Edition. Try to build from source code to get the most stable version(which was 6.1.8 when wrote this blog).
Then connect Virtuoso by using command line tool: isql. The default isql location should be at /usr/local/bin/isql .
If you want to insert TTL(TURTLE file), use command below:
ps #show process ps -l #Display information associated with the following keywords: uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan, state=S, paddr=ADDR, tty, time, and command=CMD ps aux | grep <keyword> #show details of process
Kill
kill [signal] PID #kill specified process using pid, most used is '-9' to kill process.
kill -l #display all the [signal]s kill `ps | grep <keyword> | awk '{print $1}'` #kill process by <keyword>
TOP
top #display all process
top -user <user> #display <user>'s process
top -pid <pid> #display process by given <pid>
service
service <service-name> status #show service status(running or stopped)
useradd -G <group-name> <username> #add user to non-existed group useradd -g <group-name> <username> #add user to primary group usermod -a -G <group-name> <username> #add a existing user to existing group usermod -g <group-name> <username> #change user's primary group to <group-name> passwd <username> #setup password for user id <username> #show user information
# wget http://mirror.symnds.com/software/Apache/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz # tar -zxvf apache-maven-3.1.1-bin.tar.gz # mkdir -p /usr/lib/maven # mv apache-maven-3.1.1 /usr/lib/maven # vi ~/.bash_profile Add Scripts before export PATH: PATH=$PATH:/usr/lib/maven/bin
13. Get a copy of the repository for Storm on YARN from GitHub