通过SPARQL UPDATE从本体中删除空白节点 [英] Delete blank node from ontology through SPARQL UPDATE

查看:92
本文介绍了通过SPARQL UPDATE从本体中删除空白节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

借助SPARQL UPDATE插入"操作,我将一些数据存储在Protege制成的本体模型中.下面是更新查询.

I am storing some data in my ontology model made in protege with help of a SPARQL UPDATE 'insert' operation. Below is the update query.

PREFIX test: <http://www.semanticweb.org/muhammad/ontologies/2017/2/untitled-ontology-14#>
insert {
  [] test:Kpi_Variable ?s ;
     test:hasValue_ROB4 ?p ;
     test:hasTime ?now .
}
where {

    values (?s ?p) {
        (test:Actual_Production_Time 33)
    }
    bind (now() as ?now)
}

它通过以下方式存储在rdf图中:

It stores in the rdf graph in the following way:

[ test:Kpi_Variable   test:Actual_Production_Time ;
  test:hasTime        "2017-06-02T14:40:33.187+03:00"^^xsd:dateTime ;
  test:hasValue_ROB4  33
] .

现在,我想使用删除"操作删除此空白节点.我尝试了很多方法,但是没有用. 有什么建议吗?

Now I want to delete this blank node with the 'delete' operation. I have tried many ways but that didn't work. Any Suggestions?

推荐答案

使用 DELETE :

PREFIX test: <http://www.semanticweb.org/muhammad/ontologies/2017/2/untitled-ontology-14#>

DELETE
  {
  ?b  test:Kpi_Variable ?s ;
      test:hasValue_ROB4 ?p ;
      test:hasTime ?t .
  }
WHERE
  {
  ?b  test:Kpi_Variable ?s ;
      test:hasValue_ROB4 ?p ;
      test:hasTime ?t .
  FILTER (?t < now())
  FILTER (isBlank(?b))
  # ...
  VALUES (?s ?p) { (test:Actual_Production_Time 33) }
  }

使用 DELETE WHERE :

PREFIX test: <http://www.semanticweb.org/muhammad/ontologies/2017/2/untitled-ontology-14#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
DELETE
WHERE
  {
  ?s  test:Kpi_Variable test:Actual_Production_Time ;
      test:hasValue_ROB4 33 ;
      test:hasTime "2017-06-00T00:00:00.000+00:00"^^xsd:dateTime . 
  }

空白节点和空白节点标签(以及FILTER等).不能DELETE WHERE中使用.

Blank nodes and blank node labels (as well as FILTER etc.) can not be used in DELETE WHERE.

这篇关于通过SPARQL UPDATE从本体中删除空白节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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