Virtuoso Open-Source Wiki
Virtuoso Open-Source, OpenLink Data Spaces, and OpenLink Ajax Toolkit
Advanced Search
Help?
Location: / Dashboard / Main / VOSIndex / VOSRDFDataProviders / VirtJenaProvider

Virtuoso Jena Provider

What is Jena

Jena is an open source Semantic Web framework for Java. It provides an API to extract data from and write to RDF graphs. The graphs are represented as an abstract "model". A model can be sourced with data from files, databases, URIs or a combination of these. A Model can also be queried through SPARQL and updated through SPARUL.

What is the Virtuoso Jena Provider

The Virtuoso Jena RDF Data Provider is a fully operational Native Graph Model Storage Provider for the Jena Framework, enables Semantic Web applications written using the Jena RDF Frameworks to query the Virtuoso RDF Quad store directly. The Provider has been tested against the Jena 2.5.5 version currently available.

Setup

Required Files

You should download the Virtuoso Jena Provider JAR archive, Virtuoso JDBC Driver, Jena Framework and associated classes and sample programs from our download page.

Compiling Jena Sample Programs

  1. Edit the sample programs VirtuosoSPARQLExampleX.java, where X = 1 to 9. Set the JDBC connection strings within to point to a valid Virtuoso Server instance, using the form:

    "jdbc:virtuoso://localhost:1111/charset=UTF-8/log_enable=2", "dba", "dba"

    • charset=UTF-8: to work correctly with different encodings such as cirilic, etc.
    • log_enable=2: to use row auto commit
    • use these settings to process large rdf data.
  2. Ensure that full paths to jena.jar, arq.jar, virt_jena.jar, and virtjdbc3.jar are included in the active CLASSPATH setting.
  3. Compile the Jena Sample applications using the following command:

    javac VirtuosoSPARQLExample1.java VirtuosoSPARQLExample2.java VirtuosoSPARQLExample3.java VirtuosoSPARQLExample4.java VirtuosoSPARQLExample5.java VirtuosoSPARQLExample6.java VirtuosoSPARQLExample7.java VirtuosoSPARQLExample8.java VirtuosoSPARQLExample9.java

Testing

Once the Provider classes and sample program have been successfully compiled, the Provider can be tested using the sample programs included. Ensure your active CLASSPATH includes full paths to all of the following files, before executing the example commands --

  • icu4j_3_4.jar
  • iri.jar
  • xercesImpl.jar
  • axis.jar
  • commons-logging-1.1.1.jar
  • jena.jar
  • arq.jar
  • virtjdbc3.jar
  • virt_jena.jar
  1. VirtuosoSPARQLExample1 returns the contents of the RDF Quad store of the targeted Virtuoso instance, with the following command:

    java VirtuosoSPARQLExample1

  2. VirtuosoSPARQLExample2 reads in the contents of the following FOAF URIs --

    http://kidehen.idehen.net/dataspace/person/kidehen#this http://www.w3.org/People/Berners-Lee/card#i http://demo.openlinksw.com/dataspace/person/demo#this

    -- and returns the RDF data stored, with the following command:

    java VirtuosoSPARQLExample2

  3. VirtuosoSPARQLExample3 performs simple addition and deletion operation on the content of the triple store, with the following command:

    java VirtuosoSPARQLExample3

  4. VirtuosoSPARQLExample4 demonstrates the use of the graph.contains method for searching triples, with the following command:

    java VirtuosoSPARQLExample4

  5. VirtuosoSPARQLExample5 demonstrates the use of the graph.find method for searching triples, with the following command:

    java VirtuosoSPARQLExample5

  6. VirtuosoSPARQLExample6 demonstrates the use of the graph.getTransactionHandler method, with the following command:

    java VirtuosoSPARQLExample6

  7. VirtuosoSPARQLExample7 demonstrates the use of the graph.getBulkUpdateHandler method, with the following command:

    java VirtuosoSPARQLExample7

  8. VirtuosoSPARQLExample8 demonstrates how to insert triples into a graph, with the following command:

    java VirtuosoSPARQLExample8

  9. VirtuosoSPARQLExample9 demonstrates the use of the CONSTRUCT, DESCRIBE, and ASK SPARQL query forms, with the following command:

    java VirtuosoSPARQLExample9

Javadoc API Documentation

Jena Provider Javadoc API Documentation is available enabling the complete set of classes, interfaces and methods implemented for the provider to be viewed.

CategoryJena

Powered By Virtuoso