比较模型的身份,但使用变量?用减号构造? [英] Compare models for identity, but with variables? Construct with minus?

查看:95
本文介绍了比较模型的身份,但使用变量?用减号构造?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的团队正在实施 Ceusters的参考跟踪的变体.在我们的实现中,可以始终更改实体的原始URI(更改为包含UUID的内容),尽管始终会保留指向原始URI的链接.

My team is implementing a variation of Ceusters's Referent Tracking. In our implementation, the original URI for an entity can be changed (to something containing a UUID), although a link to the original URI is always kept.

例如:

:Joey rdf:type :person .
:New_York_City  rdf:type :locality .
:Joey :hometown :New_York_City .

可能会变成:

:Joey :replacedWith :ABC123 .
:ABC123 rdf:type :person .
:New_York_City  :replacedWith :FFF555 .
:FFF555  rdf:type :locality .
:ABC123 :hometown :FFF555 .

我正在编写一些Scala集成测试,以查看我们的软件是否正确执行了引用跟踪.

I am writing some Scala integration tests to see if our software does the referent tracking correctly.

具体地说,我知道我应该期待这个CorrectPattern:

Specifically, I know I should expect this CorrectPattern:

:Joey :replacedWith ?person .
?person rdf:type :person .
:New_York_City  :replacedWith ?locale .
?locale  rdf:type :locality .
?person :hometown ?locale .

但是我不知道?person?locale的值是什么.

But I don't know what the values of ?person and ?locale will be.

我可以将SPARQL ASK表示为CorrectPattern ...,这将告诉我该模式是否存在.但我也想确认没有添加任何东西.

I can SPARQL ASK for CorrectPattern... that will tell me if the pattern is present. But I also want to confirm that nothing else has been added.

我以为我可以CONSTRUCT { ?s ?p ?o }MINUSCorrectPattern,并检查是否为空,但是Blazegraph在说:

I thought I could CONSTRUCT { ?s ?p ?o }, MINUS out CorrectPattern, and check for an empty result, but Blazegraph is saying:

java.util.concurrent.ExecutionException:org.openrdf.query.MalformedQueryException:CONSTRUCT WHERE仅允许WHERE子句中的语句模式.

java.util.concurrent.ExecutionException: org.openrdf.query.MalformedQueryException: CONSTRUCT WHERE only permits statement patterns in the WHERE clause.

有什么想法吗?我想检查整个三元组存储区中是否仅包含CorrectPattern,但我认为CorrectPattern必须包含变量.

Any ideas? I want to check that the whole triple store contains nothing more and nothing less than CorrectPattern, but I think CorrectPattern must contain variables.

推荐答案

@AKSW的评论再次为他提供了救助,他似乎并不特别着迷于赚取声誉积分.

Once again bailed out by a comment from @AKSW, who doesn't seem to be especially obsessed with earning reputation points.

CONSTRUCT带有嵌入式SELECT,可从我的模型中获取所有三元组,即使MINUS块中包含任何三元组,这些三元组也将耗尽.我很确定我可以充实MINUS块并完成我的任务.

This CONSTRUCT, with an embedded SELECT, gets all triples from my model, depleted of any triples in the MINUS block, even when they contain variables. I'm pretty sure I can flesh out the MINUS block and finish my task.

PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT 
  { 
    ?s ?p ?o .
  }
WHERE
  { SELECT  ?s ?p ?o
    WHERE
      { { ?s  ?p  ?o }
        MINUS
          { ?s  rdf:type  ?o }
      }
  }

这篇关于比较模型的身份,但使用变量?用减号构造?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆