位于不同服务器上的联合存储库

位于不同服务器上的联合存储库

本文介绍了allegro图-位于不同服务器上的联合存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个抽象存储库,以便在Allegro Graph上进行联邦搜索.我能够连接到存储在不同服务器上的存储库.但是,当我尝试使用联邦将它们组合在一起时,它引发了一个错误,即它无法在第二台服务器上找到存储库.有没有一种方法可以将存储在不同服务器上的两个存储库组合成可以进行联邦搜索的抽象存储库?

I'm trying to create an abstract repository for doing a federal search on Allegro Graph. I'm able to connect to the repositories stored on different server. However, when I tried to combined them using the federate, it throws an error that it cannot find the repo on the second server. Is there a way to combined two repositories stored on different server into an abstract repository where a federal search can be done?

    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

推荐答案

我能够使用Allegro Graph的AGServer创建联合存储库.这是我为那些可能会有所帮助的人所做的:

I was able to make a federated repository using the AGServer of Allegro Graph. Here's how I did it for those who might find it helpful:

AGVirtualRepository s = server2.virtualRepository("<http://<ip address>:10035/repositories/repo1> + <http://<ip address>:10035/repositories/repo2>");
AGRepositoryConnection combinedConn = s.getConnection();

这篇关于allegro图-位于不同服务器上的联合存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 18:07