Eclipse RDF4J (formerly known as OpenRDF Sesame) is an open source Java framework for storing, querying and reasoning with RDF and RDF Schema. It can be used as a database for RDF and RDF Schema, or as a Java library for applications that need to work with RDF internally. The RDF4J HTTP and Console repositories serves as a proxy for a RDF store hosted on a remote RDF4J server, enabling the querying of the RDF store using the RDF4J HTTP protocol.
The RDF4J HTTP repository endpoint provides users with the greater flexibility for manipulating the RDF store via a common interface. RDF4J provides you with the necessary tools to parse, interpret, query and store all this information, embedded in your own application if you want, or, if you prefer, in a separate database or even on a remote server.
To create a new RDF4J HTTP repository, the Console needs to create such an RDF document and submit it to the SYSTEM repository. The Console uses so called repository configuration templates to accomplish this. Repository configuration templates are simple Turtle RDF files that describe a repository configuration, where some of the parameters are replaced with variables. The Console parses these templates and asks the user to supply values for the variables. The variables are then substituted with the specified values, which produces the required configuration data. Refer to the RDF4J Server, Workbench, and Console documentation for more details on it usage.
This section details the steps required for configuring and testing a Virtuoso RDF4J or Sesame Repository, both using the HTTP and Console RDF4J or Sesame repositories.
This section details the steps required for configuring and testing a Virtuoso HTTP RDF4J or Sesame Repository.
~/webapps/rdf4j-server/WEB-INF/lib/
and ~/webapps/rdf4j-workbench/WEB-INF/lib/
directories for use by the RDF4J HTTP Repository for accessing the Virtuoso RDF repository.
~/webapps/rdf4j-workbench/transformations/
directory.
Note "create.xsl" replaces the default provided with RDF4J and contains the necessary entries required to reference the new "create-virtuoso.xsl" template file for Virtuoso repository configuration.
~/webapps/openrdf-sesame/WEB-INF/lib/
and ~/webapps/openrdf-workbench/WEB-INF/lib/
directories for use by the Sesame HTTP Repository for accessing the Virtuoso RDF repository.
~/webapps/openrdf-workbench/transformations/
directory.
Note "create.xsl" replaces the default provided with Sesame and contains the necessary entries required to reference the new "create-virtuoso.xsl" template file for Virtuoso repository configuration.
http://localhost:8080/openrdf-sesame http://localhost:8080/openrdf-workbench
This section details the steps required for configuring and testing a Virtuoso RDF4J Console Repository
virt_rdf4j.jar
, virt_sesame2.jar
or virt_sesame4.jar
and virtjdbc4.jar
files to the sesame "lib" directory
$ sh console.sh SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/logback-classic-0.9.18.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/slf4j-jdk14-1.5.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 10:32:38.317 [main] DEBUG info.aduna.platform.PlatformFactory - os.name <http://os.name> <http://os.name> = mac os x 10:32:38.351 [main] DEBUG info.aduna.platform.PlatformFactory - Detected Mac OS X platform Connected to default data directory Commands end with '.' at the end of a line Type 'help.' for help exit.
Windows - C:\Documents and Settings\LocalService\Application Data\Aduna\ Mac OS X - /Users/myuser/Library/Application Support/Aduna/ Linux - $HOME/.aduna/
$ sh console.sh -d /Users/myuser/OpenRDF Sesame console
virtuoso.ttl
file to the ~/OpenRDF Sesame console/templates
folder, to enable the Virtuoso repository default configuration parameters to be located.
$ sh console.sh SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/logback-classic-0.9.18.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/slf4j-jdk14-1.5.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 10:32:38.317 [main] DEBUG info.aduna.platform.PlatformFactory - os.name <http://os.name> <http://os.name> = mac os x 10:32:38.351 [main] DEBUG info.aduna.platform.PlatformFactory - Detected Mac OS X platform Connected to default data directory Commands end with '.' at the end of a line Type 'help.' for help create virtuoso . Please specify values for the following variables: Host list [localhost:1111]: Username [dba]: Password [dba]: Default graph name [sesame:nil]: Enable using batch optimization (false|true) [false]: Use RoundRobin for connection (false|true) [false]: Buffer fetch size [200]: Inference RuleSet name [null]: Repository ID [virtuoso]: myvirt Repository title [Virtuoso repository]: Repository created show r . +---------- |SYSTEM |myvirt ("Virtuoso repository") +---------- open myvirt . Opened repository 'myvirt' myvirt> show n . +---------- |bif bif: |dawgt http://www.w3.org/2001/sw/DataAccess/tests/test-dawg# |dbpedia http://dbpedia.org/resource/ |dbpprop http://dbpedia.org/property/ |dc http://purl.org/dc/elements/1.1/ |foaf http://xmlns.com/foaf/0.1/ |geo http://www.w3.org/2003/01/geo/wgs84_pos# |go http://purl.org/obo/owl/GO# |math http://www.w3.org/2000/10/swap/math# |mesh http://purl.org/commons/record/mesh/ |mf http://www.w3.org/2001/sw/DataAccess/tests/test-manifest# |nci http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl# |obo http://www.geneontology.org/formats/oboInOwl# |owl http://www.w3.org/2002/07/owl# |protseq http://purl.org/science/protein/bysequence/ |rdf http://www.w3.org/1999/02/22-rdf-syntax-ns# |rdfdf http://www.openlinksw.com/virtrdf-data-formats# |rdfs http://www.w3.org/2000/01/rdf-schema# |sc http://purl.org/science/owl/sciencecommons/ |scovo http://purl.org/NET/scovo# |skos http://www.w3.org/2004/02/skos/core# |sql sql: |vcard http://www.w3.org/2001/vcard-rdf/3.0# |virtrdf http://www.openlinksw.com/schemas/virtrdf# |void http://rdfs.org/ns/void# |xf http://www.w3.org/2004/07/xpath-functions |xml http://www.w3.org/XML/1998/namespace |xsd http://www.w3.org/2001/XMLSchema# |xsl10 http://www.w3.org/XSL/Transform/1.0 |xsl1999 http://www.w3.org/1999/XSL/Transform |xslwd http://www.w3.org/TR/WD-xsl |yago http://dbpedia.org/class/yago/ +---------- exit.
The RDF4J or Sesame Console repository can connect to a RDF4J or Sesame HTTP repository and vice-versa, enabling access to remote RDF4J or Sesame HTTP repositories from a local server.
$ sh console.sh SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/logback-classic-0.9.18.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/slf4j-jdk14-1.5.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 10:32:38.317 [main] DEBUG info.aduna.platform.PlatformFactory - os.name <http://os.name> <http://os.name> = mac os x 10:32:38.351 [main] DEBUG info.aduna.platform.PlatformFactory - Detected Mac OS X platform Connected to default data directory Commands end with '.' at the end of a line Type 'help.' for help > connect http://localhost:8080/openrdf-sesame. Connected to http://localhost:8080/openrdf-sesame > show r. +---------- |SYSTEM ("System configuration repository") |VirtSesRep ("Virtuoso Sesame HTTP Repository") +---------- > open VirtSesRep. Opened repository 'VirtSesRep' VirtSesRep> sparql select * from <http://localhost:8890/Northwind> where {?s ?p ?o} Limit 10. Evaluating query... +------------------------+------------------------+------------------------+ | s | p | o | +------------------------+------------------------+------------------------+ | <http://localhost:8890/Northwind/CustomerContact/ALFKI#this>| rdf:type | foaf:Person | | <http://localhost:8890/Northwind/CustomerContact/ALFKI#this>| rdf:type | northwind:CustomerContact| | <http://localhost:8890/Northwind/CustomerContact/ALFKI#this>| opl:isDescribedUsing | northwind: | | <http://localhost:8890/Northwind/CustomerContact/ANATR#this>| rdf:type | foaf:Person | | <http://localhost:8890/Northwind/CustomerContact/ANATR#this>| rdf:type | northwind:CustomerContact| | <http://localhost:8890/Northwind/CustomerContact/ANATR#this>| opl:isDescribedUsing | northwind: | | <http://localhost:8890/Northwind/CustomerContact/ANTON#this>| rdf:type | foaf:Person | | <http://localhost:8890/Northwind/CustomerContact/ANTON#this>| rdf:type | northwind:CustomerContact| | <http://localhost:8890/Northwind/CustomerContact/ANTON#this>| opl:isDescribedUsing | northwind: | | <http://localhost:8890/Northwind/CustomerContact/AROUT#this>| rdf:type | foaf:Person | +------------------------+------------------------+------------------------+ 10 result(s) (530 ms) VirtSesRep> show n. +---------- |SearchResults http://www.zillow.com/static/xsd/SearchResults.xsd |UpdatedPropertyDetails http://www.zillow.com/static/xsd/UpdatedPropertyDetails.xsd |a http://www.w3.org/2005/Atom |aapi http://rdf.alchemyapi.com/rdf/v1/s/aapi-schema# |address http://schemas.talis.com/2005/address/schema# |admin http://webns.net/mvcb/ |amz http://webservices.amazon.com/AWSECommerceService/2005-10-05 |atom http://atomowl.org/ontologies/atomrdf# |audio http://purl.org/media/audio# |awol http://bblfish.net/work/atom-owl/2006-06-06/# |aws http://soap.amazon.com/ |b3s http://b3s.openlinksw.com/
* set JAVA_OPTS=-Dinfo.aduna.platform.appdata.basedir=\path\to\other\dir\ (on Windows) * export JAVA_OPTS='-Dinfo.aduna.platform.appdata.basedir=/path/to/other/dir/' (on Linux/UNIX/Mac OS X)
There are two methods of making a remote RDF4J or Sesame HTTP connection to a Virtuoso repository:
If a RDF4J or Sesame HTTP Repository endpoint, as detailed above already exists, the Remote Repository Manager class can be used to make a remote connection as follows by specify the URL to the remote RDF4J or Sesame HTTP Server and the
//Initialize Remote Repository Manager RepositoryManager repositoryManager = new RemoteRepositoryManager( "http://hostname:portno/openrdf-sesame" ); repositoryManager.initialize(); //Set Virtuoso (or any other) repositoryID on http://hostname:portno/openrdf-sesame Repository repository = repositoryManager.getRepository("RepositoryID"); // Open a connection to this repository con = repository.getConnection(); // ... do something
A direct connection to the default built-in Virtuoso SPARQL Endpoint can be made using the RDF4J or Sesame HTTP Repository class by simply specifying the URL to the Virtuoso SPARQL Endpoint i.e.
http://{host}:{port}/sparql
as follows:
// Initialize Direct SPARQL Endpoint HTTP Repository connection String endpointURL = "http://hostname:portno/sparql"; HTTPRepository sparqlEndpoint = new HTTPRepository(endpointURL, ""); sparqlEndpoint.initialize(); // Open a connection to this repository con = sparqlEndpoint.getConnection(); // ... do something