RDF Tutorial#
The metadata is converted to an RDF data file and can be queried using the SPARQL query language.
Loading the data#
We will load the dataset into GraphDB. To install Graphdb, go to https://www.ontotext.com/products/graphdb/graphdb-free/ and register for an installation (registration is free and required!).
After successful installation you should be able to access the application at http://localhost:7200. To load the data into a database do the following:
Click on repositories
Create new repository
GraphDB Repository
Give it a name in the Repository ID*
Leave everything else as default
Top right choose repository change to the one you just created
Import
Import the RDF file
Click import
Leave everything at default and Click import again
The data should be loaded within a second
When you go back to the home screen (click GraphDB) you should see your local active repostiroy having a total of 1,143 statements.
Enable autocomplete#
To make life easier we will enable autocomplete for the SPARQL queries. To do this do the following:
Click on the repository you just created
Click on settings
Click on autocomplete
Click on enable autocomplete
Explore the data#
Now we have the data loaded we can start exploring the data. To do this we will use the Explore option first. To do this do the following:
Click on the repository you just created
Click on explore
Visual graph
In the Easy Graph bar type “Project” and select the “http://jermontology.org/ontology/JERMOntology#Project” URL.
Click on the “prj_HIV-Ghana” node
Follow the “hasPart” links to other nodes
Do you see the connections between the nodes and the excel sheet?
Click on one of the Observation Units (e.g., obs_XDRS176892)
A sidebar should appear
What properties are used and do you see different namespaces?
Query the data#
Now we have explored the data we can start querying the data. To do this we will use the SPARQL query language. To do this do the following:
Click on the repository you just created
Click on SPARQL
In the query box type the following query:
To obtain all observation units
PREFIX jerm: <http://jermontology.org/ontology/JERMOntology#>
PREFIX ppeo: <http://purl.org/ppeo/PPEO.owl#>
SELECT *
WHERE {
?ou a ppeo:observation_unit .
}
To obtain all observation units that are female
PREFIX jerm: <http://jermontology.org/ontology/JERMOntology#>
SELECT *
WHERE {
?ou a ppeo:observation_unit .
?ou mixs:0000811 'female' .
}
** To obtain all observation units that are female and a trader**
PREFIX jerm: <http://jermontology.org/ontology/JERMOntology#>
SELECT *
WHERE {
?ou a ppeo:observation_unit .
?ou mixs:0000811 'female' .
?ou fair:occupation 'Trader' .
}
As you might see the SPARQL query language is for variables case sensitive and making it crucial to have proper standardisation methods in place. For example there are no ‘traders’ in the dataset but there are ‘Traders’.
Shex visualization#
It is also possible to visualize the content using shape expressions. This is however beyond the scope of this tutorial.
A visual representation of the demo dataset