Replacing Sesame with Stardog

1 view
Skip to first unread message

Mike Roberts

unread,
Apr 22, 2014, 4:31:43 AM4/22/14
to sta...@clarkparsia.com
Hello,
I'm trying to integrate Stardog into our software. I read Stardog documentation and this google group but I can not understand what grades of compatibility/compliance Stardog has with Openrdf Sesame.
We currently use Sesame's RemoteRepositoryManager but I don't know how to turn into Stardog. Should I start Stardog server and connect to it as I used to do with Sesame server?
Here is the main piece of code where we retrieve an existing repository or we create a new one using a ttl configuration file.
Is there any good samaritan that could help me in modifying it?

  RemoteRepositoryManager repManager = new RemoteRepositoryManager(serverLocation);
  repManager
.initialize();

 
Repository systemRepository = repManager.getSystemRepository();
 
if (!RepositoryConfigUtil.hasRepositoryConfig(systemRepository, getRepositoryID())) {
   
ValueFactory vf = systemRepository.getValueFactory();
   
Graph graph = new GraphImpl(vf);
   
Map<String, String> vars = new HashMap<String, String>();
    vars
.put("ontology.dir", ontologyDir.getAbsolutePath());
    vars
.put("repository.id", getRepositoryID());
    vars
.put("repository.label", getRepositoryID());
    vars
.put("imports.files", storage.getModelFilesToImport());
    vars
.put("imports.namespaces", storage.getModelNamespacesToImport());
   
RDFParser rdfParser = Rio.createParser(RDFFormat.TURTLE, vf);
    rdfParser
.setRDFHandler(new StatementCollector(graph));
   
Reader in = substituteVariables(vars, ttlFile.getInputStream());
    rdfParser
.parse(in, RepositoryConfigSchema.NAMESPACE);
   
Resource repositoryNode = GraphUtil.getUniqueSubject(graph, RDF.TYPE, RepositoryConfigSchema.REPOSITORY);
   
RepositoryConfig repConfig = RepositoryConfig.create(graph, repositoryNode);
    repConfig
.validate();
   
RepositoryConfigUtil.updateRepositoryConfigs(systemRepository, repConfig);
 
}
  repository
= repManager.getRepository(getRepositoryID());
 
RepositoryConnection connection = repository.getConnection();

Thanks a lot
Mike

Mike Grove

unread,
Apr 22, 2014, 6:21:08 AM4/22/14
to stardog
We don't support RemoteRepositoryManager; we are not using Sesame's protocol so it's built-in repository management does not work with the Stardog DBMS.  With that said, I'm working on changes to make it easier to integrate Stardog into Sesame's workbench and create/manage Stardog databases without relying directly on Stardog code.

I'm shooting for the next release for those changes, but in the meantime, the distributed example "SesameExample.java" shows how you'd create a Stardog-backed Repository instances.  You'd have to run the server in embedded mode as the example does, or run it separately on the CLI.  You can use the admin API, or the CLI to create databases and then connect to them using StardogRepository.

Cheers,

Mike


--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

Mike Roberts

unread,
Apr 23, 2014, 6:43:03 AM4/23/14
to sta...@clarkparsia.com
Thank you Mike.
For sake of completeness I post the code I wrote to replace Sesame RemoteRepositoryManager part

 AdminConnection dbms = AdminConnectionConfiguration.toServer("snarl://localhost:5820/").credentials("admin", "admin").connect();
 
ConnectionConfiguration cconf = null;
 
if(dbms.list().contains(getRepositoryID()))
   cconf
= ConnectionConfiguration.to(getRepositoryID()).server("snarl://localhost:5820/").credentials("admin", "admin");
 
else {
   cconf
= dbms.disk(getRepositoryID()).searchable(true).create();
 
}
 cconf
.reasoning(ReasoningType.SL);
 repository
= new StardogRepository(cconf);
 
if(!repository.isInitialized())
 repository
.initialize();
 
RepositoryConnection connection = repository.getConnection();
Reply all
Reply to author
Forward
0 new messages