sparql - Delete connected triples -
@prefix users: <http://example.org/2017/6/user_schema#> . @prefix user: <http://example.org/2017/6/user#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . user:account_62eb31ea-e665-49ec-9675-4282ced149da users:uniqueid <urn:uuid:62eb31ea-e665-49ec-9675-4282ced149da> ; rdf:type foaf:onlineaccount , users:entity ; foaf:accountname 'foo' ; foaf:accountservicehomepage <http://example.com/myaccount> . user:user_62eb31ea-e665-49ec-9675-4282ced149da rdf:type foaf:person , users:administrator , users:user ; foaf:holdsaccount user:account_62eb31ea-e665-49ec-9675-4282ced149da ; foaf:mbox <mailto:foo@example.com> ; # meaningless bnode example demonstration purposes # should deleted user:xxx [ user:a user:b ] .
what try accomplish
- find account
user:uniqueid
- delete it's triples
- find resources references account
foaf:holdsaccount <urn:uuid:62eb31ea-e665-49ec-9675-4282ced149da>
- delete triples well
- also delete triples related bnodes (if any)
what came with
prefix users: <http://example.org/2017/6/user_schema#> prefix user: <http://example.org/2017/6/user#> prefix foaf: <http://xmlns.com/foaf/0.1/> <http://bewellup.org/2017/6/product/bwu_product_user> delete { ?s ?p ?o . } { bind (<urn:uuid:62eb31ea-e665-49ec-9675-4282ced149da> ?accountid) { ?s rdf:type foaf:onlineaccount ; users:uniqueid ?accountid . ?s ?p ?o . } union { ?account rdf:type foaf:onlineaccount ; users:uniqueid ?accountid . ?s foaf:holdsaccount ?account . ?s ?p ?o . } }
is there more concise or efficient way delete created triples?
how triples linked bnodes deleted?
prefix users: <http://bewellup.org/2017/6/product/bwu_user_schema#> prefix user: <http://bewellup.org/2017/6/product/bwu_product_user#> prefix foaf: <http://xmlns.com/foaf/0.1/> <http://bewellup.org/2017/6/product/bwu_product_user> delete { ?s ?p ?o . ?s_del ?p_del ?o_del . } { bind (<urn:uuid:62eb31ea-e665-49ec-9675-4282ced149da> ?accountid) { ?s rdf:type foaf:onlineaccount ; users:uniqueid ?accountid . ?s ?p ?o . optional{filter(isblank(?o)) ?o (:|!:)* ?s_del . ?s_del ?p_del ?o_del. } } union { ?account rdf:type foaf:onlineaccount ; users:uniqueid ?accountid . ?s foaf:holdsaccount ?account . ?s ?p ?o . optional{filter(isblank(?o)) ?o (:|!:)* ?s_del . ?s_del ?p_del ?o_del.} } }
Comments
Post a Comment