Search code examples
javareasoningallegrographfederated

Federated store with repositories on different server with reasoning


I want to create a federated store with reasoning in Allegrograph; i can do that with 2 repositories in the same Allegrograph system but when i try to create a federated store with two repositories located on different server; the method server.federatedisplay an error.

I tried to fix that using two solutions :

The first one i used virtualRepository to combine two repositories, it works but when i want to getConnection from my virtualRepository it display the error bellow : The code :

AGVirtualRepository s = server.virtualRepository("<http://ip:10035/repositories/repo1> + <http://ip:10036/repositories/repo2>");
      s.initialize();
      AGRepositoryConnection rainbowConn = s.getConnection();

      closeBeforeExit(rainbowConn);

The error : org.eclipse.rdf4j.repository.RepositoryException: com.franz.agraph.http.exception.AGHttpException: org.apache.commons.httpclient.NoHttpResponseException: The server myserver failed to respond

The second solution i used Federation Sail to add my repositories, it works but when i run my query the reasoning concept doesn't work even when i call tupleQuery.setIncludeInferred(true);

The code :

    AGServer server = new AGServer(SERVER_URL, USERNAME, PASSWORD);

    AGServer server2 = new AGServer(SERVER_URL2, USERNAME2, PASSWORD2);

    AGRepository repo1 = server.getCatalog(CATALOG_ID).openRepository("repo1");
    AGRepository repo2 = server2.getCatalog(CATALOG_ID).openRepository("repo2");

    Federation federation = new Federation();
    federation.addMember(repo1);
    federation.addMember(repo2);
    federation.setReadOnly(true); 
    SailRepository  combinedRepo = new SailRepository(federation);
    combinedRepo.initialize();

    SailRepositoryConnection gg =  combinedRepo.getConnection();

I don't know if there are any hints to fix my problem, Thanks


Solution

  • Using reasoning with SailRepository works i already did that maybe you have a problem in your query, can you show me your query and tell me what is the error