我正在尝试创建一个抽象存储库,用于在 Allegro Graph 上进行联邦搜索。我能够连接到存储在不同服务器上的存储库。但是,当我尝试使用联邦合并它们时,它会抛出一个错误,它无法在第二台服务器上找到 repo。有没有办法将存储在不同服务器上的两个存储库组合成一个可以进行联邦搜索的抽象存储库?
AGServer server = new AGServer(SERVER_URL1, USERNAME1, PASSWORD1);
AGRepository repo1 = server.getRootCatalog().openRepository(REPO1);
AGServer server2 = new AGServer(SERVER_URL2, USERNAME2, PASSWORD2);
AGRepository repo2 = server2.getRootCatalog().openRepository(REPO2);
System.out.println(repo1.getConnection().size());
System.out.println(repo2.getConnection().size());
AGAbstractRepository combinedRepo = server.federate(repo1, repo2);
combinedRepo.initialize();
combinedRepo.getConnection(); //this return an exception
Exception in thread "main" org.openrdf.repository.RepositoryException: org.openrdf.repository.RepositoryException: Repository not found with ID: REPO2
at com.franz.agraph.repository.AGCatalog.openRepository(AGCatalog.java:264)
...
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: org.openrdf.repository.RepositoryException: Repository not found with ID: REPO2
at com.franz.agraph.repository.AGCatalog.openRepository(AGCatalog.java:260)
... 6 more
TIA