Skip to content

Working with ricordo rdfstore API

sarala edited this page Sep 12, 2012 · 2 revisions
  1. Install Virtuoso RDF store from http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/.

  2. Populate the RDF store. An example data set can be found at https://sites.google.com/site/ricordowp4/file-cabinet/sbmltordf

  • resources folder consists of all curated BioModels in RDF
  • rdfloader.sql supports setting up of Virtuoso to load multiple RDF files
  • in order to get the API working with minimal changes, load rdfschema.rdf and sbmlrdfschema.rdf as ricordo-rule
  1. Update your pom file to use ricordo-rdfstore
<repository>
     <id>ebi-repo</id>
     <name>EBI Repository</name>
     <url>http://www.ebi.ac.uk/~maven/m2repo/</url>
 </repository>

<dependencies>
     <dependency>
        <groupId>uk.ac.ebi.ricordo</groupId>
        <artifactId>rdfstore</artifactId>
        <version>1.0</version>
    </dependency>
</dependencies>
  1. Assuming you are using spring, import ricordo-rdfstore-config.xml file
<import resource="classpath:ricordo-rdfstore-config.xml"/>
  1. Create a config.properties file and add the following. Change the values as needed. Default values are appropriate in many cases except rdf store end point configurations. Note: sparql query template files follow the sbmlrdfshema, if using a different data set, the query files need to be changed accordingly.
# rdf store end point
rdfstore.url=jdbc:virtuoso://localhost:1111
rdfstore.username=dba
rdfstore.password=dba

#Path to sparql query tempalates
sparql.resource=/

qualifier.file=/bioqualifiers.txt
qualifier.url=http://biomodels.net/biology-qualifiers/
  1. You are ready to explore the API
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import uk.ac.ebi.ricordo.rdfstore.service.RdfStoreService;
import uk.ac.ebi.ricordo.rdfstore.bean.ResourceList;

public class RDFStoreExample {
    public static void main(String [] args){
        ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:spring-config.xml");
        RdfStoreService rdfStoreService = (RdfStoreService )ctx.getBean("rdfStoreServiceImpl");
        ResourceList resourceList = new ResourceList();
        rdfStoreService.search("","getResources",resourceList);
        resourceList.getCount();
    }
}
Clone this wiki locally