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();
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");
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
// 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.