Thursday, May 16, 2013

Virtuoso - Java

import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.sparql.engine.http.QueryExceptionHTTP;

public class QueryTest {

public static void main(String[] args) {
    String service = "http://your.virtuososerver.org/sparql";
    String query = "SELECT * WHERE {?s ?p ?o}";
    QueryExecution qe = QueryExecutionFactory.sparqlService(service, query);
    try {
       ResultSet results = qe.execSelect() ;
       for ( ; results.hasNext() ; ) {
           QuerySolution soln = results.nextSolution() ;
           RDFNode x = soln.get("s") ;
           RDFNode r = soln.get("p") ; 
           RDFNode l = soln.get("o") ;   
       }
    } catch (Exception e) {
        System.out.println("Query error:"+e);
    } finally {
        qe.close();
    }
 }
 
Source:
http://stackoverflow.com/questions/5531224/setup-rdf-ontology-with-virtuoso
http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtJenaProvider 

Related Posts:

  • Virtuoso - Javaimport com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.sparql.engine.http.QueryExceptionHTTP; public class QueryTest { public static void main(String[] args) … Read More
  • Virtuoso - Import OntologyAssume one wants to import in Virtuoso the cert ontology http://www.w3.org/ns/auth/cert# : Using the Conductor UI at http://<cname>/conductor -> Database -> Interactive SQL or from the ISQL command line, execut… Read More
  • Virtuoso - Download & Installation Download Wizard http://download.openlinksw.com/ Select product "OpenLink Virtuoso: Personal Edition " From "Pr… Read More
  • Virtuoso - Getting Yourself a Linked Data URI in 5 minutes or less Simple steps registering ODS user Go to ODS Framework Click Sign Up Register either using the sample form or with existing OpenID Import data to your ODS profile using the "Import" feature Go to Edit profile Ope… Read More
  • Virtuoso - Install Package FCT Browser View the Imported Data Using FCT Browser Make sure you have installed the Virtuoso Faceted Browser VAD package. Go to http://http://<cname>/fct Go to "Entity URI lo… Read More

0 comments:

Post a Comment