0

我有一个关于使用 SPARQL 从三重存储(fuseki)中删除元素的问题。我已将以下元素存储在图表中:

<ChargingRequest/66769> a keak-ev:ChargingRequest ;
cnr:priority 2 ; 
keak-ev:chargingNeed [
 keak-eval:temporalContext [
    keak-time:start "2015-09-15T12:00:00Z"^^xsd:dateTime ;
    keak-time:end "2015-09-15T18:00:00Z"^^xsd:dateTime
  ] ;
  keak-eval:minimalValue [ # the powerMin
    qudt:unit qudt-unit:Watt ; 
    qudt:numericValue "7000"^^xsd:double 
  ] ;
] .

我想删除节点 <ChargingRequest/66769> 和他的所有属性。

我试过了

   DELETE WHERE {
     <http://localhost:3030/keak/ChargingRequest/66769>  ?p ?o.
     keak-ev:chargingNeed ?p ?o
  }

但它不会删除下面的节点

keak-eval:temporalContext [
    keak-time:start "2015-09-15T12:00:00Z"^^xsd:dateTime ;
    keak-time:end "2015-09-15T18:00:00Z"^^xsd:dateTime
  ] ;
  keak-eval:minimalValue [ # the powerMin
    qudt:unit qudt-unit:Watt ; 
    qudt:numericValue "7000"^^xsd:double 
  ] ;

请帮助我,并感谢您的时间。

4

2 回答 2

2

有多种方法可以做到这一点,但我认为一个请求中的 3 个操作是最清楚的:注意这是一个请求 - 请参阅“;” 分离操作。

  # Delete 3-deep
  DELETE {
    ?x ?p ?o 
  } WHERE {
     <http://localhost:3030/keak/ChargingRequest/66769>  ?q ?n1.
     ?n1 ?p1 ?x .
     ?x ?p ?o .
  } ;

  # Delete 2-deep
  DELETE {
    ?x ?p ?o 
  } WHERE {
     <http://localhost:3030/keak/ChargingRequest/66769>  ?q ?x.
     ?x ?p ?o .
  } ;
  # Delete immediate
  DELETE WHERE { <http://localhost:3030/keak/ChargingRequest/66769>  ?q ?x. }
于 2015-12-30T14:48:17.687 回答
0

我设法使它工作,这是最终的解决方案

WITH <http://localhost:3030/keak/>  
 DELETE { 
  ?x ?p ?o 
} WHERE { 
  <http://localhost:3030/keak/ChargingRequest/66769>  ?q ?n1.
  ?n1 ?p1 ?x .
  ?x ?p ?o .
};

WITH <http://localhost:3030/keak/>  
 DELETE {
  ?x ?p ?o 
 } WHERE  {
   <http://localhost:3030/keak/ChargingRequest/66769>  ?q ?x.
   ?x ?p ?o .
 };

WITH <http://localhost:3030/keak/>  
 DELETE {
   <http://localhost:3030/keak/ChargingRequest/66769> ?q ?x 
 } WHERE  {
    <http://localhost:3030/keak/ChargingRequest/66769>  ?q ?x.
}

非常感谢您的回答

于 2015-12-31T10:46:54.430 回答