如何删除空白节点及其关联的三元组一个 sparql 查询?
How to delete blank node and its associated triples one sparql query?
示例数据:
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
@prefix p0: <http://www.mlacustom.com#> .
@prefix p2: <http://www.mla.com/term/> .
_:bnode7021016689601753065 p0:lastModifiedDateTime "2018-09-14T12:55:38"^^<xsd:dateTime> ;
p0:lastModifiedUser "admin"^^xs:string .
<http://www.mla.com/name/4204078359> p0:hasClassingFacet "http://www.mla.com/facet/RA"^^xs:string ;
p0:type "Normal"^^xs:string ;
p0:classification _:bnode3452184423513029143 ,
_:bnode6827572371999795686 ;
p0:recordType "Name"^^xs:string ;
p0:recordNumber "4204078359"^^xs:string ;
p0:stdDescriptor "classification111111"^^xs:string ;
p0:establishedBy "admin"^^xs:string ;
skos:prefLabel "classification111111"^^xs:string ;
p0:createdBy "admin"^^xs:string ;
a skos:Concept ;
p0:createdDate "2018-09-14T12:55:38"^^<xsd:dateTime> ;
p0:establishedDate "2018-09-14T12:55:38"^^<xsd:dateTime> ;
p0:hasRAsubFacet "http://www.mla.com/subfacet/classing-subject-authors"^^xs:string ;
p0:lastModifiedDate "2018-09-14T12:55:38"^^<xsd:dateTime> ;
p0:lastModifiedDetails _:bnode7021016689601753065 ;
p0:isProblematic "N,N"^^xs:string ;
p0:lastModifiedBy "admin"^^xs:string ;
p0:status "established"^^xs:string .
_:bnode3452184423513029143 p0:literature p2:1513 ;
p0:timePeriod p2:1005 ;
p0:language p2:3199 .
_:bnode6827572371999795686 p0:literature p2:11307 ;
p0:timePeriod p2:1009 ;
p0:language p2:31 .
在上面的数据中,我想删除 classification
空白节点及其相关数据 p0:literature, p0:timePeriod, p0:language
下面的 sparql 查询正在删除空白节点关联的三元组,这是预期的行为。
PREFIX skos-mla: <http://www.mlacustom.com#>
PREFIX name: <http://www.mla.com/name/>
WITH <thesaurus-term>
DELETE {
?class ?p ?o .
}
INSERT {}
WHERE {
name:4408003840 skos-mla:classification ?class .
?class ?p ?o .
}
我是说这个数据
_:bnode3452184423513029143 p0:literature p2:1513 ;
p0:timePeriod p2:1005 ;
p0:language p2:3199 .
_:bnode6827572371999795686 p0:literature p2:11307 ;
p0:timePeriod p2:1009 ;
p0:language p2:31 .
但是我也想删除主IRI的分类三元组。
这些三元组:
<http://www.mla.com/name/4204078359>
p0:classification _:bnode3452184423513029143 ,
_:bnode6827572371999795686 ;
我必须删除单个 sparql 中的三元组。
对于上述示例数据,以下更新将删除 p0:classification
三元组以及与其相关的两个 bNodes 的所有内容:
PREFIX p0: <http://www.mlacustom.com#>
delete {
<http://www.mla.com/name/4204078359> p0:classification ?bnode .
?bnode ?p ?o .
} where {
<http://www.mla.com/name/4204078359> p0:classification ?bnode .
?bnode ?p ?o .
}
示例数据:
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
@prefix p0: <http://www.mlacustom.com#> .
@prefix p2: <http://www.mla.com/term/> .
_:bnode7021016689601753065 p0:lastModifiedDateTime "2018-09-14T12:55:38"^^<xsd:dateTime> ;
p0:lastModifiedUser "admin"^^xs:string .
<http://www.mla.com/name/4204078359> p0:hasClassingFacet "http://www.mla.com/facet/RA"^^xs:string ;
p0:type "Normal"^^xs:string ;
p0:classification _:bnode3452184423513029143 ,
_:bnode6827572371999795686 ;
p0:recordType "Name"^^xs:string ;
p0:recordNumber "4204078359"^^xs:string ;
p0:stdDescriptor "classification111111"^^xs:string ;
p0:establishedBy "admin"^^xs:string ;
skos:prefLabel "classification111111"^^xs:string ;
p0:createdBy "admin"^^xs:string ;
a skos:Concept ;
p0:createdDate "2018-09-14T12:55:38"^^<xsd:dateTime> ;
p0:establishedDate "2018-09-14T12:55:38"^^<xsd:dateTime> ;
p0:hasRAsubFacet "http://www.mla.com/subfacet/classing-subject-authors"^^xs:string ;
p0:lastModifiedDate "2018-09-14T12:55:38"^^<xsd:dateTime> ;
p0:lastModifiedDetails _:bnode7021016689601753065 ;
p0:isProblematic "N,N"^^xs:string ;
p0:lastModifiedBy "admin"^^xs:string ;
p0:status "established"^^xs:string .
_:bnode3452184423513029143 p0:literature p2:1513 ;
p0:timePeriod p2:1005 ;
p0:language p2:3199 .
_:bnode6827572371999795686 p0:literature p2:11307 ;
p0:timePeriod p2:1009 ;
p0:language p2:31 .
在上面的数据中,我想删除 classification
空白节点及其相关数据 p0:literature, p0:timePeriod, p0:language
下面的 sparql 查询正在删除空白节点关联的三元组,这是预期的行为。
PREFIX skos-mla: <http://www.mlacustom.com#>
PREFIX name: <http://www.mla.com/name/>
WITH <thesaurus-term>
DELETE {
?class ?p ?o .
}
INSERT {}
WHERE {
name:4408003840 skos-mla:classification ?class .
?class ?p ?o .
}
我是说这个数据
_:bnode3452184423513029143 p0:literature p2:1513 ;
p0:timePeriod p2:1005 ;
p0:language p2:3199 .
_:bnode6827572371999795686 p0:literature p2:11307 ;
p0:timePeriod p2:1009 ;
p0:language p2:31 .
但是我也想删除主IRI的分类三元组。 这些三元组:
<http://www.mla.com/name/4204078359>
p0:classification _:bnode3452184423513029143 ,
_:bnode6827572371999795686 ;
我必须删除单个 sparql 中的三元组。
对于上述示例数据,以下更新将删除 p0:classification
三元组以及与其相关的两个 bNodes 的所有内容:
PREFIX p0: <http://www.mlacustom.com#>
delete {
<http://www.mla.com/name/4204078359> p0:classification ?bnode .
?bnode ?p ?o .
} where {
<http://www.mla.com/name/4204078359> p0:classification ?bnode .
?bnode ?p ?o .
}