使用查询删除blazegraph删除整个命名空间而不仅仅是构造结果

时间:2018-06-01 14:04:22

标签: rest http-delete blazegraph

我正在向我的本地blazegraph发出DELETE REST调用: http://localhost:9999/blazegraph/namespace/GraphInfo

身体:

PREFIX rsabox:<http:\/\/ibm.com\/ResultSetABox#>  
PREFIX rstbox:<http:\/\/ibm.com\/ResultSetTBox#>  
CONSTRUCT {
  ?result ?pred ?obj .
  ?resultSet rstbox:hasResult ?result .
} WHERE {
    SELECT ?result ?pred ?obj ?resultSet
    WHERE {
      ?result rdf:type rstbox:queryResult .
      ?resultSet rstbox:hasResult ?result .
      ?resultSet rdf:type rstbox:resultSet .
      ?resultSet rstbox:setID ?setID .
      FILTER (?setID = 1) .
      ?result ?pred ?obj .
      FILTER (?pred NOT IN (
        owl:topObjectProperty,
        rstbox:topObjectProperty,
        rstbox:hasRefInst,
        rstbox:resultOf,
        rdf:type
      )
    )
  }
}

但结果是整个命名空间被删除,而不仅仅是构造中的主语,谓词,对象条目。

blazegraph的回应是: “删除:GraphInfo”

也许我不能从这里正确理解REST API:https://wiki.blazegraph.com/wiki/index.php/REST_API#DELETE

基本上,我通过发布我想要从图形(命名空间)中删除的text / turtle来创建一组结果。我应该POST(而不是删除)相同的查询,而不是CONSTRUCT,使用DELETE?

另外,我是否需要过滤器,或者我应该删除所有包含推断关系的内容(例如,只使用?结果?pred?obj)

1 个答案:

答案 0 :(得分:1)

我发现,我需要使用update =使用带有DELETE查询的正文进行POST,如下所示:

update=PREFIX rsabox:<http://ibm.com/ResultSetABox#>  
PREFIX rstbox:<http://ibm.com/ResultSetTBox#>  
DELETE {
    ?result ?pred ?obj .
    ?resultSet rstbox:hasResult ?result .
  } WHERE {
SELECT ?result ?pred ?obj ?resultSet
WHERE {
      ?result rdf:type rstbox:queryResult .
      ?resultSet rstbox:hasResult ?result .
      ?resultSet rdf:type rstbox:resultSet .
      ?resultSet rstbox:setID ?setID .
      FILTER (?setID = 1) .
      ?result ?pred ?obj .
  }
}

我对他们的显示感到困惑?更新URI并讨论发出查询......