com.complexible.stardog.StardogException: No driver was found which supports the connection string:

61 views
Skip to first unread message

serca...@gmail.com

unread,
May 23, 2014, 9:05:16 AM5/23/14
to sta...@clarkparsia.com
Hi,
we study this code:

import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.vocabulary.VCARD;




import java.io.FileInputStream;

import com.complexible.stardog.api.ConnectionConfiguration;
import com.complexible.stardog.api.Connection;
import com.complexible.stardog.api.admin.AdminConnection;
import com.complexible.stardog.api.admin.AdminConnectionConfiguration;
import com.complexible.stardog.jena.SDJenaFactory;
import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.ResultSetFormatter;
import com.hp.hpl.jena.sparql.resultset.ResultsFormat;
import com.sun.corba.se.spi.activation.Server;
import com.complexible.stardog.Stardog;
import com.complexible.stardog.StardogException;
 



public class HellowordRDF {
   //static final String fullName = "SSP";
   public static void main (String []args)
{
Model m = ModelFactory.createDefaultModel();
String resourceURl = "http://www.example.com/test/";
Resource r = m.createResource(resourceURl + "r");
Property p = m.createProperty(resourceURl + "p");
r.addProperty(p , "helloword", XSDDatatype.XSDstring);
//r.addProperty(VCARD.FN, fullName);
m.write(System.out, "Turtle");
/*
Server aServer = Stardog
                .buildServer()
                .bind(SNARLProtocolConstants.EMBEDDED_ADDRESS)
                .start();
 
// first create a temporary database to use (if there is one already, drop it first)
AdminConnection aAdminConnection = AdminConnectionConfiguration.toEmbeddedServer().credentials("admin", "admin").connect();
if (aAdminConnection.list().contains("testJena")) {
aAdminConnection.drop("testJena");
}
aAdminConnection.createMemory("testJena");
aAdminConnection.close();
  */
Connection aConn = null;
try {
ConnectionConfiguration conConf = ConnectionConfiguration.to("FoodDB");
conConf.server("http://localhost:5820/");
aConn = conConf.credentials("admin", "admin").connect();
} catch (StardogException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}  // now open the connection
 
// obtain a jena for the specified stardog database.  Just creating an in-memory database
// this is roughly equivalent to ModelFactory.createDefaultModel.
Model aModel = null;
try {
aModel = SDJenaFactory.createModel(aConn);
} catch (StardogException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
 
// start a transaction before adding the data.  This is not required, but it is faster to group the entire add into a single transaction rather
// than rely on the auto commit of the underlying stardog connection.
aModel.begin();
 
// read data into the model.  note, this will add statement at a time.  Bulk loading needs to be performed directly with the BulkUpdateHandler provided
// by the underlying graph, or read in files in RDF/XML format, which uses the bulk loader natively.  Alternatively, you can load data into the stardog
// database using it's native API via the command line client.
//aModel.getReader("N3").read(aModel, new FileInputStream("data/sp2b_10k.n3"), "");
 
// done!
aModel.commit();
 
// Query that we will run against the data we just loaded
String aQueryString = "select * where { ?s ?p ?o. filter(?s = <http://localhost/publications/articles/Journal1/1940/Article1>).}";
 
// Create a query...
Query aQuery = QueryFactory.create(aQueryString);
 
// ... and run it
QueryExecution aExec = QueryExecutionFactory.create(aQuery, aModel);
 
// now print the results
ResultSetFormatter.out(aExec.execSelect(), aModel);
 
// always close the execution
aExec.close();
 
// close the model to free up the connection to the stardog database
aModel.close();
 
//aServer.stop(); 
 
}
}

We take this error:com.complexible.stardog.StardogException: No driver was found which supports the connection string: 
please help.

Fernando Hernandez

unread,
May 23, 2014, 9:35:37 AM5/23/14
to sta...@clarkparsia.com
Sounds like you're missing jars in your classpath. Please make sure that you included all Stardog jars – since you're running the embedded server – in your classpath.

Cheers,
Fernando
Reply all
Reply to author
Forward
0 new messages