Presentation is loading. Please wait.

Presentation is loading. Please wait.

Configuring and Securing a SPARQL endpoint 2012 VIVO Implementation Fest.

Similar presentations

Presentation on theme: "Configuring and Securing a SPARQL endpoint 2012 VIVO Implementation Fest."— Presentation transcript:

1 Configuring and Securing a SPARQL endpoint 2012 VIVO Implementation Fest

2 Welcome & Who am I? 2 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 its 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 3

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… 5

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

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

8 Data Reuse Example from Cornell Data as it appears in VIVO for: Abruña, Héctor D 8 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 9

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 – es/snapshots/org/apache/jena/jena-fuseki/ incubating-SNAPSHOT/ es/snapshots/org/apache/jena/jena-fuseki/ incubating-SNAPSHOT/ 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 11

12 JAVA 6 JDK Can I use the open-jdk? – 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 installinstall 12

13 Apache Why do I need Apache too? – 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 instructionsinstructions 13

14 Fuseki Download Fuseki (tar/zip) – wget rg/apache/jena/jena-fuseki/0.2.2-incubating-SNAPSHOT/jena- fuseki incubating distribution.tar.gz rg/apache/jena/jena-fuseki/0.2.2-incubating-SNAPSHOT/jena- fuseki 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 14

15 Supporting Libraries Download Jena-ARQ – wget incubating/jena-arq incubating.jar incubating/jena-arq incubating.jar Download Jena-IRI – wget incubating/jena-iri incubating.jar incubating/jena-iri incubating.jar Download Jena-SDB – wget /sdb zip/download /sdb zip/download – cp download sdb zip Download MySQL-Connector-Java – wget connector-java/5.1.19/mysql-connector-java jar connector-java/5.1.19/mysql-connector-java jar 15

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 17

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 Fusekis: – Server Service definitions – RDF Dataset definitions – Graph definitions 18

19 Add namespaces to the file # Licensed under the terms of sdb:. 19 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 ( ). 20 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. 21 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 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 ;. 22 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 rdf:type sdb:DatasetStore ; sdb:store. 23 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 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"; ]. 24 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 25

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 26 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 fi # Execute Java calling the package for Fuseki java $FusekiJVMArgs org.apache.jena.fuseki.FusekiCmd --desc $FusekiConfigFile -- port=$FusekiPort $FusekiServiceName >> $FusekiLogFile 2>&1 & 27 We do some basic checks and then instantiate Fuseki server, passing it the configuration needed.

28 Get Fuseki started 28 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 29 Go to Select Control Panel from the Server Management area Select /VIVO from the dropdown that appears, and click Select Lets 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 31

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 32

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. 33

34 Questions?

Download ppt "Configuring and Securing a SPARQL endpoint 2012 VIVO Implementation Fest."

Similar presentations

Ads by Google