Presentation is loading. Please wait.

Presentation is loading. Please wait.

Configuring and Securing a SPARQL endpoint

Similar presentations

Presentation on theme: "Configuring and Securing a SPARQL endpoint"— Presentation transcript:

1 Configuring and Securing a SPARQL endpoint
2012 VIVO Implementation Fest Welcome!

2 Welcome & Who am I? Vincent Sposato, University of Florida Enterprise Software Engineering Primarily focused on VIVO operations and reproducible harvests John Fereira, Cornell University Mann Library Information Technology Services (ITS) Programmer / Analyst / Technology Strategist

3 Goals of this session Provide you with an overview of SPARQL endpoint, and it’s uses Provide you with a process for installing and configuring a SPARQL endpoint (Fuseki specifically) Outline the possibilities for securing such an endpoint Answer questions

4 SPARQL Endpoint Overview

5 What is a SPARQL endpoint?
A SPARQL endpoint enables users to query a knowledge base via the SPARQL language Results returned are normally in a machine readable language, as the primary purpose of the endpoint is information exchange Current Implementations Joseki / Fuseki Virtuoso Many others depending on needs…

6 Why use a SPARQL endpoint?
To provide querying services for your dataset Provide your semantic data to other applications through machine readable interfaces

7 Public SPARQL endpoints
US Government ( University of Florida VIVO ( Bio2RDF PubMed SPARQL (

8 Data Reuse Example from Cornell
Data as it appears in VIVO for: Abruña, Héctor D Data as it appears Cornell Department of Chemistry and Biology for: Abruña, Héctor D

9 Why Fuseki and not Joseki?
Fuseki is the successor to Joseki, and is based upon SPARQL 1.1 Joseki has database connection timeout issues that Fuseki is able to resolve with an additional library Fuseki has true update support, and ability to define specific graphs

10 Fuseki Installation

11 Requirements for Fuseki
Oracle/Sun Java 1.6+ OpenJDK would work Latest Fuseki package Download the distribution package as it is a complete environment Apache Web Server Only if you want to redirect output by way of AJP Ability to remove the :2020 from the end of the URL of the SPARQL endpoint

12 JAVA 6 JDK Can I use the open-jdk? What is Java? Installation
Yes, you can. However, if you are installing it on the same server as your VIVO, you need to make sure it is configured correctly not to interfere with Sun Java and the VIVO application What is Java? “Write once, run anywhere” – popular quote about java Installation Debian/Ubuntu apt-get install sun-java6-jdk apt-get install openjdk-6-jre Centos/Redhat yum install java (need to configure alternatives) yum install java openjdk Windows: download and install

13 Apache Why do I need Apache too? What is Apache? Installation
Allows for AJP for redirecting 2020 to a standard web port (80, 443) What is Apache? “a secure, efficient and extensible server that provides HTTP services in sync with current HTTP standards” – Installation Debian/Ubuntu – apt-get install apache2 Centos/Redhat – yum install httpd Windows: download and follow the instructions

14 Fuseki Download Fuseki (tar/zip) Extract contents of the file
wget incubating distribution.tar.gz Extract contents of the file tar xzvf fuseki incubating distribution.tar.gz Create a Fuseki directory mkdir /usr/local/fuseki Copy extracted contents to new directory cp –R jena-fuseki incubating-SNAPSHOT/* /usr/local/fuseki Make fuseki_server executable chmod 777 fuseki_server

15 Supporting Libraries Download Jena-ARQ-2.9.9 Download Jena-IRI-0.9.0
wget Download Jena-IRI-0.9.0 wget Download Jena-SDB-1.3.4 wget cp download sdb zip Download MySQL-Connector-Java wget

16 Fuseki Configuration

17 Prepare supporting libraries
Make a lib directory under /usr/local/fuseki mkdir /usr/local/fuseki/lib Copy all jar files into new lib directory Make sure that you unzip the SDB file, and extract the jar file from it

18 Create configuration file
Create a new file in the /usr/local/fuseki directory nano /usr/local/fuseki/fuseki-vivo.ttl This file will hold Fuseki’s: Server Service definitions RDF Dataset definitions Graph definitions

19 Add namespaces to the file
# Licensed under the terms of @prefix : <#> . @prefix fuseki: <> . @prefix rdf: <> . @prefix rdfs: <> . @prefix tdb: <> . @prefix ja: <> . @prefix jumble: <> . @prefix sdb: <> . This section defines the namespaces we will be utilizing throughout the configuration file. The Fuseki configuration file is written in N3/Turtle

20 Define the Fuseki server
[] rdf:type fuseki:Server ; # Timeout - server-wide default: milliseconds. # Format 1: "1000" -- 1 second timeout # Format 2: "10000,60000" -- 10s timeout to first result, then 60s timeout to for rest of query. # See java doc for ARQ.queryTimeout ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "10000,60000" ] ; fuseki:services ( <#service_VIVO_read_only> ) . This sections tells the Fuseki server which services defined later should be enabled – if they are not ‘turned on’ here they will be ignored in the file later on.

21 Define the connection libraries
# SDB [] ja:loadClass "net.rootdev.fusekisdbconnect.SDBConnect" . jumble:SDBConnect rdfs:subClassOf ja:RDFDataset . This section specifically defines the connection classes you will be using. The one needed for VIVO 1.2+ will be SDB.

22 Define the service <#service_VIVO_read_only> rdf:type fuseki:Service ; rdfs:label "UF VIVO Service (R)" ; fuseki:name "VIVO" ; fuseki:serviceQuery "query" ; fuseki:serviceQuery "sparql" ; fuseki:serviceUpdate "update" ; fuseki:serviceUpload "upload" ; fuseki:serviceReadWriteGraphStore "data" ; # A separate read-only graph store endpoint: fuseki:serviceReadGraphStore "get" ; fuseki:dataset <#ufvivo_dataset_read> ; . This section defines the name of the service, and the different functionality that this service will provide. It also has a link to the dataset that is backing this service.

23 Define the dataset <#ufvivo_dataset_read> rdf:type sdb:DatasetStore ; sdb:store <#VIVOStore> . Here the dataset that will be served by your services are defined. You can add named graphs if you want to only define a specific graph to be accessed. We also have a link to the actual store that this data resides in.

24 Define the data store <#VIVOStore> rdf:type jumble:SDBConnect; rdfs:label "UF VIVO SDB Store"; sdb:layout "layout2"; jumble:defaultUnionGraph "true" ; sdb:engine "InnoDB"; sdb:connection [ rdf:type sdb:SDBConnection; sdb:sdbHost ”localhost"; sdb:sdbType "mysql"; sdb:sdbName ”vitrodb"; sdb:sdbUser ”vitro"; sdb:sdbPassword ”vitro123"; sdb:driver "com.mysql.jdbc.Driver"; ] . We define the actual database connection information required to allow the service to query the database. Here we are assuming you are using MySQL, other servers may be configured differently.

25 Create Fuseki launch script
Create a new file in the /usr/local/fuseki directory nano /usr/local/fuseki/ This file will : Set some environment variables Execute the Java jar file for Fuseki Output results to a log

26 Define the environment
#!/bin/bash export FusekiInstallDir=/usr/local/fuseki export FusekiPort=3030 export FusekiJVMArgs="-cp $FusekiInstallDir/fuseki-server.jar:$FusekiInstallDir/lib/* -Xmx1200M" export Date=`date +%Y-%m-%d` export FusekiLogFile=$FusekiInstallDir/FusekiLog-$Date.log export FusekiConfigFile=$FusekiInstallDir/fuseki-vivo.ttl export FusekiServiceName=/VIVO These items are needed in order to properly call the remainder of the tasks associated with initiating Fuseki.

27 Initiate Java & Fuseki # Check to see if logfile exists if [ ! -f $FusekiLogFile ]; then touch $FusekiLogFile fi # Check to see if config file exists if [ ! -f $FusekiConfigFile ]; then echo “ERROR – Fuseki failed to start – no configuration file - $FusekiConfigFile” >> $FusekiLogFile exit 1 # Execute Java calling the package for Fuseki java $FusekiJVMArgs org.apache.jena.fuseki.FusekiCmd --desc $FusekiConfigFile --port=$FusekiPort $FusekiServiceName >> $FusekiLogFile 2>&1 & We do some basic checks and then instantiate Fuseki server, passing it the configuration needed.

28 Get Fuseki started Change permissions on to allow for execution chmod 777 Run ./ Tail the log to ensure that all is running correctly tail –f fusekiLog-Date.log Last line should appear as : 17:42:24 INFO Server :: Started 2012/05/08 17:42:24 EDT on port 3030

29 Test your Fuseki Go to
Select Control Panel from the Server Management area Select /VIVO from the dropdown that appears, and click Select Let’s enter a SPARQL query to test: PREFIX rdf:<> PREFIX geo: <> PREFIX core: <> # # This example query gets 50 geographic locations # and (if available) their labels SELECT ?countryName ?iso3 WHERE { ?country rdf:type core:Country OPTIONAL { ?country geo:nameListEN ?countryName } OPTIONAL { ?country geo:codeISO3 ?iso3 } } LIMIT 50 Select Text from the Output dropdown Click Get Results If the result returned 50 lines, then you now have a working endpoint. CONGRATULATIONS!

30 Securing Fuseki

31 Basic - Firewall The easiest method of protecting your SPARQL endpoint would be a firewall You can block access to the specific ports that Fuseki is running on This is more a kin to using a machete, when a scalpel might be better suited Works well if you have no interest in sharing data with the outside world

32 Intermediate – Fuseki Config
If you want people to be able read data, but not update data through your endpoint – Fuseki config file is a good start. If you do not define an update process, no one will be able to update your dataset – PERIOD. Even if you happen to leave in the update configuration, unless you start the Fuseki server with --update it will not allow updates to happen either. Intermediate level of configuration, although still pretty broad controls of on or off

33 Advanced – Fuseki Partitions
Partition 2+ separate Fuseki configs that allow different levels of access and/or to different datasets. Grant access to the different Fuseki servers based upon ports being used. Also possibly add authentication at this point to allow for some sort of external authentication.

34 Questions?

Download ppt "Configuring and Securing a SPARQL endpoint"

Similar presentations

Ads by Google