Sesame 通过RepositoryManager创建的存储库的行为与通过workbench创建的repo不同

Sesame 通过RepositoryManager创建的存储库的行为与通过workbench创建的repo不同,sesame,rdfstore,Sesame,Rdfstore,我使用以下代码创建sesame本机java存储: 创建本机java存储: // create a configuration for the SAIL stack boolean persist = true; String indexes = "spoc,posc,cspo"; SailImplConfig backendConfig = new NativeStoreConfig(indexes); // stack an inferencer config on top

我使用以下代码创建sesame本机java存储:

创建本机java存储:

  // create a configuration for the SAIL stack
  boolean persist = true;
  String indexes = "spoc,posc,cspo";
  SailImplConfig backendConfig = new NativeStoreConfig(indexes);
  // stack an inferencer config on top of our backend-config
  backendConfig = new ForwardChainingRDFSInferencerConfig(backendConfig);
  // create a configuration for the repository implementation
  RepositoryImplConfig repositoryTypeSpec = new SailRepositoryConfig(backendConfig);
  RepositoryConfig repConfig = new RepositoryConfig(repositoryId, repositoryTypeSpec);
  repConfig.setTitle(repositoryId);
  manager.addRepositoryConfig(repConfig);
  Repository repository = manager.getRepository(repositoryId);
创建内存中存储:

  // create a configuration for the SAIL stack
  boolean persist = true;
  SailImplConfig backendConfig = new MemoryStoreConfig(persist);
  // stack an inferencer config on top of our backend-config
  backendConfig = new ForwardChainingRDFSInferencerConfig(backendConfig);
  // create a configuration for the repository implementation
  RepositoryImplConfig repositoryTypeSpec = new SailRepositoryConfig(backendConfig);
  RepositoryConfig repConfig = new RepositoryConfig(repositoryId, repositoryTypeSpec);
  repConfig.setTitle(repositoryId);
  manager.addRepositoryConfig(repConfig);
  Repository repository = manager.getRepository(repositoryId);
当我在这个repo中存储数据并进行查询时,结果与使用workbench创建的存储库返回的结果不同。我的结果集中有重复/多个条目

内存中存储的行为相同

我还注意到,我的三元组属于一个空白上下文,而在通过workbench创建的存储库中则不是这样


我上面的代码有什么问题?

据我所知,您的代码没有问题。如果从工作台创建的存储行为不同,这很可能意味着它配置了不同的SAIL堆栈

最有可能出现这种差异的是:

// stack an inferencer config on top of our backend-config
backendConfig = new ForwardChainingRDFSInferencerConfig(backendConfig);
您已经在这里的顶部配置了一个推理器。如果通过工作台创建的存储库不使用推理机,那么您将在相同的查询上得到不同的结果,有时包括明显的重复结果


如果你认为这是个问题,你可以用两种方法来解决。当然,其中之一就是不要在创建存储库时在其顶部放置推理器。另一个是禁用特定查询的推理。在工作台中,可以通过禁用查询屏幕中的“包含推断语句”复选框来实现这一点。以编程方式,可以通过在准备好的查询对象上使用Query.setIncludeInferredfalse来实现这一点。有关详细信息,请参阅

这条线路可能会给我带来麻烦。backendConfig=new ForwardChainingRDFSExpressionRConfigbackendConfig;你能解释一下吗??