Documentation

Lodestar is a Linked Data Browser and SPARQL endpoint. Lodestar is a Java based web app that can wrap any existing SPARQL endpoint to provide a set of additional SPARQL and Linked Data services. Lodestar was developed to provide a consistent set of SPARQL and Linked Data services across the European Bioinformatics Institute (EBI). Some of the service provided by Lodestar:

To see a demonstration of the Lodestar linked data browser please see the Expression Atlas RDF SPARQL endpoint. Lodestar has been primarily developed as an internal tool for EBI resources, however, the application should be sufficiently generic that others can use and adopt it as they see fit. We can't guarantee any support for the software at this time, but please feel free to use it or adapt for your own purposes and let us know how you get on.

Availability

The source code for Lodestar is available from GitHub at https://github.com/EBISPOT/lodestar. This can be deployed in any Java servlet container (such as Tomcat)

Installation

Deploy the lode.war from the downloads section into your Java servlet container. Assuming you are running tomcat on port 8080, you can drop the lode.war file into the tomcat webapps directory. Restart tomcat and you should have a sparql endpoint at http://localhost:8080/lode/sparql. Lodestar is a wrapper for a standard SPARQL endpoint, so once deployed you need to configure Lodestar to point at an accessible SPARQL endpoint. Typically these are endpoints provided by existing triple stores such as Virtuoso, Sesame and OWLIM.

Building from source

Checkout the source code from the GitHub respository. You can build the web application with

mvn clean package
.

If you want to use the virtuoso configuration you will need to use the virtuoso profile.

mvn -P virtuoso clean package

This build will most likely fail as it requires the virtuoso Jena providers and virtuoso JDBC libraries from OpenLink. In the lode-virtuoso-impl pom.xml there are two dependencies, one on virt-jena and one on virt-jdbc. Get the latest jars from here here and install locally with maven.

Configuration

A clean install will deploy a Lodestar instance that has been configured to wrap the DBpedia SPARQL endpoint (http://www.dbpedia.org/sparql). To connect to a different SPARQL endpoint over HTTP you need to set the lode.sparqlendpoint.url property. Assuming a Tomcat based setup, this property can either be set in the tomcat startup script or you can edit the properties file directly in $TOMCAT_HOME/webapps/lode/WEB-INF/classes/lode.properties

Advanced Configuration

The following properties can be set that control some of the more advanced Lodestar features

# Set the max number of results returned by your sparql endpoint
  lode.sparql.query.maxlimit=1000
# List the relations to show at the top in the box at the top of the linkded data explorer page
  lode.explorer.toprelationship=http://xmlns.com/foaf/0.1/page,http://purl.org/dc/terms/identifier
# List any predicates that you want to hide in the HTML view of the linked data browser, not type is already dealt with by lodestar so we ignore it as we don't want to show it twice
  lode.explorer.ignore.relationship=http://www.w3.org/1999/02/22-rdf-syntax-ns#type
# List any resource types (classes) that you want to hide form the linked data HTML view
  lode.explorer.ignore.types=http://www.w3.org/2000/01/rdf-schema#Resource
# Ignore blank nodes in the HTML view
  lode.explorer.ignore.blanknode=true
# set the predicates used to describe resource labels (ordered in preference)
  lode.explorer.label=http://www.w3.org/2004/02/skos/core#prefLabel,http://www.w3.org/2000/01/rdf-schema#label
# set the predicates used to provide a description for resources
   lode.explorer.description=http://purl.org/dc/terms/description,http://purl.org/dc/elements/1.1/description
# Set the predicates that link to depictions of resources
  lode.explorer.depict=http://xmlns.com/foaf/0.1/depiction
# Set the max number of objects to show for a given resource in the HTML view
  lode.explorer.max.objects=50
# Specifies if the query engine should use any inference when answering queries. This should be false when querying over http and is only relevant when using the virtuoso JDBC configuration at the moment
lode.explorer.useInference=false
		

Embedding Lodestar into existing website

Lodestar comes with a basic HTML layout, but assumes you will want to apply your own style. Integrating Lodestar into your web app can be done using Javascript. See the example html files query.html and explore.html to see how little code is needed to drop a SPARQL endpoint of resource description into an existing html page. For example, you can drop a SPARQL endpoint into a static page with the following html. Note the scripts and CSS files that must be imported into your page.

<html>
 <head>
  <title>SPARQL Endpoint</title>
  <link rel="stylesheet" type="text/css" href="css/lode-style.css" />
  <link rel="stylesheet" type="text/css" href="codemirror/codemirror.css" />
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  <script type="text/javascript" src="codemirror/codemirror.js"></script>
  <script type="text/javascript" src="codemirror/sparql.js"></script>
  <script type="text/javascript" src="scripts/namespaces.js"></script>
  <script type="text/javascript" src="scripts/queries.js"></script>
  <script type="text/javascript" src="scripts/lode.js"></script>
 </head>
<body onload="$('#sparql-content').sparql({namespaces : lodeNamespacePrefixes});">
 <div class="grid_24" id="sparql-content"> </div>
</body>
</html>
		

Notice the SPARQL function takes a set of default namespaces. This can be configured in the scripts/namespaces.js file.

var lodeNamespacePrefixes = {
  rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
  rdfs: 'http://www.w3.org/2000/01/rdf-schema#',
  owl: 'http://www.w3.org/2002/07/owl#',
  xsd: 'http://www.w3.org/2001/XMLSchema#',
  dc: 'http://purl.org/dc/elements/1.1/',
  foaf: 'http://xmlns.com/foaf/0.1/',
};
		

You can edit the example queries that appear alongside the SPARQL query box by editing the scripts/queries.js.

var exampleQueries = [
 {
   shortname : "Query 1",
   description: "People who were born in Berlin before 1900",
   query: "PREFIX : <http://dbpedia.org/resource/>\n" +
            "PREFIX dbo: <http://dbpedia.org/ontology/>\n\n" +
            "SELECT ?name ?birth ?death ?person WHERE {\n" +
            "?person dbo:birthPlace :Berlin .\n" +
            "?person dbo:birthDate ?birth .\n" +
            "?person foaf:name ?name .\n" +
            "?person dbo:deathDate ?death .\n" +
            "FILTER (?birth < \"1900-01-01\"^^xsd:date) . \n" +
            "}   \n" +
            "ORDER BY ?name"
    }
]
		  

Connecting to Virtuoso

If you are connecting to a Virtuoso instance you can configure Lodestar to connect directly via JDBC. This can increase performance and allows you to exploit some of the advanced virtuoso features, like inference and their extended SPARQL syntax, in your queries. There are two virtuoso connection configurations, the first is for direct jdbc connections, and the second uses a virtuoso JNDI datasource. This second option is reccommended for production servers as it allows your servlet container to manage connections and connection pooling to the virtuoso instance.

Direct JDBC connection

Set the following properties in the lode.properties file

# virtuoso jdbc connection details#
lode.sparqlendpoint.url=jdbc:virtuoso://localhost:1111
lode.explorer.virtuoso.user=dba
lode.explorer.virtuoso.password=dba
# Set the name of the inference rule graph
lode.explorer.virtuoso.inferencerule=default-rules
# Query all graphs by default
lode.explorer.virtuoso.allgraphs=true
# set a limit on query time out, default is -1 (no limit)
lode.explorer.virtuoso.querytimeout=-1
		

You will also need to make a changes in the spring config in $TOMCAT_HOME/webapps/lode/WEB-INF/ebi-lode-service.xml. Edit the jenaSparqlService bean description and the explorerServiceImpl bean description to use the jenaVirtuosoExecutorService. e.g.

<bean id="jenaSparqlService" class="uk.ac.ebi.fgpt.lode.impl.JenaSparqlService"> <property name="endpointURL" value="${lode.sparqlendpoint.url}"/>
 <property name="maxQueryLimit" value="${lode.sparql.query.maxlimit}"/>
 <property name="queryExecutionService" ref="jenaVirtuosoExecutorService"/>
</bean>

<bean name="explorerServiceImpl" class="uk.ac.ebi.fgpt.lode.impl.JenaExploreService">
 <property name="queryReader" ref="queryReader"/>
 <property name="queryExecutionService" ref="jenaVirtuosoExecutorService"/>
</bean>
		

JNDI datasource

Set the following properties in the lode.properties file

# virtuoso jdbc connection details#
lode.sparqlendpoint.url=localhost
lode.sparqlendpoint.port=1111
lode.explorer.virtuoso.user=dba
lode.explorer.virtuoso.password=dba
# Set the name of the inference rule graph
lode.explorer.virtuoso.inferencerule=default-rules
# Query all graphs by default
lode.explorer.virtuoso.allgraphs=true
# set a limit on query time out, default is -1 (no limit)
lode.explorer.virtuoso.querytimeout=-1
		

Specify your context Resource element. For tomcat this can go in $CATALINA_BASE/conf/server.xml, or in a specifc application context (better) (e.g. $CATALINA_BASE/conf/Catalina/localhost/lode.xml)

    <Resource
                name="jdbc/virtuoso"
                auth="Container"
                factory="virtuoso.jdbc4.VirtuosoDataSourceFactory"
                type="virtuoso.jdbc4.VirtuosoConnectionPoolDataSource"
                description="Virtuoso Pool"
                connectionFactoryClassName="virtuoso.jdbc4.VirtuosoConnectionPoolDataSource"
                charset="UTF-8"
                initialPoolSize="0"
                minPoolSize="0"
                maxPoolSize="8"
                maxPoolSize="20"
                propertyCycle="0"
                maxIdleTime="10"
                maxStatements="100"
            >
  <</Resource>

You will also need to make a changes in the spring config in $TOMCAT_HOME/webapps/lode/WEB-INF/ebi-lode-service.xml. You need to use the virtusoDataSource provider and jenaVirtusosConnectionPoolService beans. Use the jenaVirtuosoConnectionPoolService as input the jenaSparqlService and explorerServiceImpl. e.g. Edit the jenaSparqlService bean description and the explorerServiceImpl bean description to use the jenaVirtuosoExecutorService. e.g.




    <bean id="virtuosoDataSourceProvider" class="uk.ac.ebi.fgpt.lode.impl.VirtuosoDatasourceProvider">
        <constructor-arg name="endpointUrl" value="${lode.sparqlendpoint.url}"/>
        <constructor-arg name="port" value="${lode.sparqlendpoint.port}"/>
    </bean>

    <bean id="jenaVirtuosoConnectionPoolService" class="uk.ac.ebi.fgpt.lode.impl.JenaVirtuosoConnectionPoolService">
        <constructor-arg ref="virtuosoDataSourceProvider"/>
    </bean>

    <bean id="jenaSparqlService" class="uk.ac.ebi.fgpt.lode.impl.JenaSparqlService">
        <property name="maxQueryLimit" value="${lode.sparql.query.maxlimit}"/>
        <property name="queryExecutionService" ref="jenaVirtuosoConnectionPoolService"/>
    </bean>


    <bean name="explorerServiceImpl" class="uk.ac.ebi.fgpt.lode.impl.JenaExploreService">
        <property name="queryReader" ref="queryReader"/>
        <property name="queryExecutionService" ref="jenaVirtuosoConnectionPoolService"/>
    </bean>
		

Issues and support

Issues and feature requests

To request a new feature or if you think you've found a bug, use the GitHub issue tracker or contact support below.

Support

If you need help using this tool, please email ontology-tools-support@ebi.ac.uk.

Contact

For more information or to get involved please email Simon Jupp.

Acknowledgements

This tool was developed by Simon Jupp.

Top