如何在 GraphDB 远程存储库之上堆叠 SpinSail

How to stack SpinSail on top of GraphDB remote repository

我正在使用 GraphDB 来存储我的三元组并且需要在 GraphDB[=51 上堆叠 SpinSail 组件=] 支持 Spin Rules 以及 GraphDB 默认支持的所有其他功能。

到目前为止,我已经成功地在支持 Spin Rules 的远程服务器上创建了一个 SailRepository(下面有更多详细信息),但似乎它仅支持 Spin 和 none GraphDB 支持的其他功能(例如查看图表、通过文件添加三元组、搜索等) .)

存储库创建后的配置文件如下所示:

@prefix ms: <http://www.openrdf.org/config/sail/memory#> .
@prefix rep: <http://www.openrdf.org/config/repository#> .
@prefix sail: <http://www.openrdf.org/config/sail#> .
@prefix sr: <http://www.openrdf.org/config/repository/sail#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<#Test1> a rep:Repository;
  rep:repositoryID "Test1";
  rep:repositoryImpl [
      rep:repositoryType "openrdf:SailRepository";
      sr:sailImpl [
          sail:delegate [
              sail:sailType "openrdf:MemoryStore";
              ms:persist true
            ];
          sail:sailType "openrdf:SpinSail"
        ]
    ] .

虽然一个普通的配置文件(即如果有人通过 workbench 创建一个存储库)看起来像下面的:

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rep: <http://www.openrdf.org/config/repository#> .
@prefix sail: <http://www.openrdf.org/config/sail#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<#Test> a rep:Repository;
  rep:repositoryID "Test";
  rep:repositoryImpl [
      rep:repositoryType "graphdb:FreeSailRepository";
      <http://www.openrdf.org/config/repository/sail#sailImpl> [
          <http://www.ontotext.com/trree/owlim#base-URL> "http://example.org/owlim#";
          <http://www.ontotext.com/trree/owlim#check-for-inconsistencies> "false";
          <http://www.ontotext.com/trree/owlim#defaultNS> "";
          <http://www.ontotext.com/trree/owlim#disable-sameAs> "false";
          <http://www.ontotext.com/trree/owlim#enable-context-index> "false";
          <http://www.ontotext.com/trree/owlim#enable-literal-index> "true";
          <http://www.ontotext.com/trree/owlim#enablePredicateList> "true";
          <http://www.ontotext.com/trree/owlim#entity-id-size> "32";
          <http://www.ontotext.com/trree/owlim#entity-index-size> "10000000";
          <http://www.ontotext.com/trree/owlim#imports> "";
          <http://www.ontotext.com/trree/owlim#in-memory-literal-properties> "true";
          <http://www.ontotext.com/trree/owlim#query-limit-results> "0";
          <http://www.ontotext.com/trree/owlim#query-timeout> "0";
          <http://www.ontotext.com/trree/owlim#read-only> "false";
          <http://www.ontotext.com/trree/owlim#repository-type> "file-repository";
          <http://www.ontotext.com/trree/owlim#ruleset> "owl2-rl-optimized";
          <http://www.ontotext.com/trree/owlim#storage-folder> "storage";
          <http://www.ontotext.com/trree/owlim#throw-QueryEvaluationException-on-timeout> "false";
          sail:sailType "graphdb:FreeSail"
        ]
    ];
  rdfs:label "Test" .

以下代码用于创建存储库。

RemoteRepositoryManager manager = new RemoteRepositoryManager("http://localhost:7200");
        manager.init();

        String repositoryId = "Test1";

        // create a configuration for the SAIL stack
        boolean persist = true;

        // create a configuration for the SAIL stack
        SailImplConfig spinSailConfig = new MemoryStoreConfig(persist);

        spinSailConfig = new SpinSailConfig(spinSailConfig);

        RepositoryImplConfig repositoryTypeSpec = new SailRepositoryConfig(spinSailConfig);

        // create a configuration for the repository implementation
        // RepositoryImplConfig repositoryTypeSpec = new SailRepositoryConfig(backendConfig);

        RepositoryConfig repConfig = new RepositoryConfig(repositoryId, repositoryTypeSpec);
        manager.addRepositoryConfig(repConfig);

创建此存储库后,我可以通过 SPARQL 部分将以下规则插入其中(通过使用 INSERT DATA) :

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sp: <http://spinrdf.org/sp#>
PREFIX spin: <http://spinrdf.org/spin#>
PREFIX ex: <http://example.org/>

INSERT DATA {
ex:Person a rdfs:Class ;
    spin:rule [
        a sp:Construct ;
    sp:text """PREFIX ex: <http://example.org/>
               CONSTRUCT { ?this ex:childOf ?parent . }
               WHERE { ?parent ex:parentOf ?this . }"""
] . }

然后同样添加如下语句:

PREFIX ex: <http://example.org/>

INSERT DATA {
ex:John a ex:Father ;
        ex:parentOf ex:Lucy .
ex:Lucy a ex:Person .
}

之后通过运行以下查询:

PREFIX ex: <http://example.org/>

SELECT ?child WHERE { ?child ex:childOf ?parent }

我能够确认 Spin 规则已成功执行。

所以我的问题是:

有没有一种方法可以创建支持 GraphDB 的所有功能的远程存储库,然后然后在其上堆叠 SpinSail 组件?

目前 GraphDB(版本 8.10.0)不支持 SpinSail。下一个 GraphDB 版本正在考虑这样的选项。