【问题标题】:How to stack SpinSail on top of GraphDB remote repository如何在 GraphDB 远程存储库上堆叠 SpinSail
【发布时间】:2019-06-11 16:11:32
【问题描述】:

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

到目前为止,我已经设法在支持 Spin Rules 的远程服务器上创建了一个 SailRepository(更多详细信息见下文),但它似乎只支持 Spin 并且 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"
        ]
    ] .

虽然一个普通的配置文件(例如,如果有人通过工作台创建一个存储库)看起来像下面这样:

@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 rdf4j


    【解决方案1】:

    目前 GraphDB(8.10.0 版)不支持 SpinSail。此类选项正在考虑用于下一个 GraphDB 版本之一。

    【讨论】:

      猜你喜欢
      • 2011-05-09
      • 1970-01-01
      • 2020-10-21
      • 2019-12-25
      • 2012-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多