Question

Iam master student my project is to develop storymodel in jena. Now my task is to delete a statement using Id. If this is a statement:

{member1, member2, member3,  member4, statementID}

For Example:

[Alice, saw, mouse, garden]. 

statementID is invisible to the user.

In my model the above statement is saved as [ID, Property, Value]:

[statementID, hasSubject, Alice] ; 
[statementID, hasEvent, saw] ; 
[statementID, hasBeneficiary, Mouse] ; 
[statementID, hasLocation, garden]

In this way there are many statements like [bob, like, alice], [Edwin, meet, mouse, garden] and so on. In order to delete a selected statement, I have to built a method that finds all the triples for the selected statementID and delete them. My professor suggested me to use Sparql query to find the triples for selected statement ID, as its a new topic to me I have started reading about sparql query.

Était-ce utile?

La solution

Without a concrete example of your data, it's hard to say exactly what your query will be. Even so, it sounds like you're simply asking to delete all the triples whose subject is some particular statementId. That would just be:

delete { <statementId> ?p ?o }
where { <statementId> ?p ?o }

See 3.1.3.1 DELETE (Informative) in the SPARQL 1.1 specification for more information and examples.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top