[英]sparql cascade in deleting individuals
i'm using Jena to interact with parliament triple store. 我正在使用耶拿(Jena)与议会三方商店进行互动。 The following sparql update query is to insert a new individual of a class Tenant i defined in my ontology: 以下sparql更新查询将插入我在本体中定义的Tenant类的新个体:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX ex: <http://www.example.org/Example#>
INSERT DATA
{
ex:tenant1 a ex:Tenant;
ex:hasName "admin";
ex:hasStatus "Enabled".
}
where both hasName and hasStatus are two properties defined in this ontology. 其中hasName和hasStatus都是该本体中定义的两个属性。 Then if i would delete ex:tenant1 individual, is there any way in sparqle to delete in cascade all the triples that has ex:tenant1 as subject? 然后,如果我要删除ex:tenant1个人,有没有办法在sparqle中级联删除以ex:tenant1为主题的所有三元组? So, deleting only ex:tenant1 a ex:Tenant , i'd like to delete any references to it. 因此,仅删除ex:tenant1和ex:Tenant ,我想删除对其的任何引用。 I hope i was clear in explaining my problem and thanks you in advance for your help. 希望我能清楚地解释我的问题,并在此先感谢您的帮助。
Sure. 当然。 Just 只是
PREFIX ex: <http://www.example.org/Example#>
DELETE WHERE { ex:tenant1 ?p ?o }
This is based on the documentation: 这基于文档:
3.1.3.3 DELETE WHERE 3.1.3.3删除位置
…. ...。
Example 11: 示例11:
This example request removes all statements about anything with a given name of "Fred" from the default graph: 此示例请求从默认图形中删除关于任何具有给定名称“ Fred”的事物的所有语句:
PREFIX foaf: <http://xmlns.com/foaf/0.1/> DELETE WHERE { ?person foaf:givenName 'Fred'; ?property ?value }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.