【问题标题】:Delete blank node from ontology through SPARQL UPDATE通过 SPARQL UPDATE 从本体中删除空白节点
【发布时间】:2017-11-03 22:35:09
【问题描述】:

借助 SPARQL UPDATE 'insert' 操作,我将一些数据存储在我由 protege 制作的本体模型中。下面是更新查询。

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图中:

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

现在我想通过“删除”操作删除这个空白节点。我尝试了很多方法,但没有奏效。 有什么建议吗?

【问题讨论】:

    标签: sparql rdf owl apache-jena blank-nodes


    【解决方案1】:

    使用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 等)can not 用于DELETE WHERE

    【讨论】:

      猜你喜欢
      • 2017-10-22
      • 2018-03-13
      • 1970-01-01
      • 2018-05-10
      • 1970-01-01
      • 1970-01-01
      • 2019-03-25
      • 2017-10-11
      • 2017-04-12
      相关资源
      最近更新 更多