Hello guys, I tried to update an ontology using the command below but I got the following errors:

Encountered " "delete" "DELETE "" at line 9, column 1. Was expecting one of: "base" ... "prefix" ... "select" ... "construct" ... "describe" ... "ask" ...

PREFIX sswap:http://sswapmeet.sswap.info/sswap/ PREFIX d:http://localhost:9090/reservationService/onto/Reservation/ PREFIX resource:http://localhost:9090/Reservation/getAvaliableCottageService/ PREFIX owl:http://www.w3.org/2002/07/owl# PREFIX rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#

DELETE { ?s d:bookerFirstName " " . }

INSERT { ?s d:bookerFirstName "Edris" . }

WHERE { ?s d:bookerFirstName " " . }

please, what could I be doing wrong? Thanks

asked 08 May '14, 12:11

helpdesk's gravatar image

helpdesk
1224
accept rate: 0%

edited 08 May '14, 12:12


I guess you are using workbench. It seems that you are pushing this query in "Query" section. You should use "SPARQL Update" section instead to do INSERT/DELETE kind of queries.

link

answered 08 May '14, 12:38

Marek%20%C5%A0urek's gravatar image

Marek Šurek
161212127
accept rate: 0%

Hello @Marek Surek, I tried it now in the Update section and it works but when I queried the repository but didn't see the object changed from "" to "Edris". Though i din't see any error, it didn't change. Any idea why?

(08 May '14, 16:36) helpdesk

Here is the query to see if the object has been updated select ?o WHERE { ?s rdf:type sswap:Subject. ?s ?p ?o. FILTER NOT EXISTS { ?s rdf:type ?o } FILTER NOT EXISTS { ?s sswap:mapsTo ?o } }

seems nothing was updated even though the updating was succesful.

(08 May '14, 16:49) helpdesk

It could be that your INSERT/DELETE update did not alter anything because the WHERE clause did not produce any results.

Check that a query like:

SELECT * WHERE { ?s d:bookerFirstName " " . }

returns any results Also, there is an <interval> between the quotes with that update, but you are quoting an empty literal ("") in your response to @Marek Šurek's answer) ... which may be the cause of the issue

(09 May '14, 05:51) Damyan Ognyanov ♦♦

HI Damyan, I got it solved now but I want to ask you a question. Suppose I have two values; one a predicator and the other the object. Now, I want to dynamically replace these values with the ones(predicate and object in the database) I have in the sesame database. I learnt one could use the setBinding of the Value class. Is this possible?

(09 May '14, 16:28) helpdesk

Not sure what exactly you are asking for. Think about your data as set of immutable triples. Each change is actually either removing and/or adding new ones to the dataset, not replacing some of the components (subject, predicate or object).

So in essence you like to remove all the triples having some fixed predicate and object and for each of the subjects of these to assert new triples with some other fixed predicate and object, right?

So an update like one bellow will do: delete {?s <urn:old-predicate> <urn:old-object> .} insert {?s <urn:new-predicate> <urn:new-object> .} where { ?s <urn:old-predicate> <urn:old-object> . }

other than that you may use BIND() to set speciffic values to some of the variables or pass the bindings as part of the update.

delete {?s ?oldpred <urn:old-object> .} insert {?s <urn:new-predicate> <urn:new-object> .} where { BIND(<urn:old-predicate> as ?oldpred). ?s ?oldpred <urn:old-object> . }

HTH

(10 May '14, 01:44) Damyan Ognyanov ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×38

Asked: 08 May '14, 12:11

Seen: 61,734 times

Last updated: 13 Jan, 01:42

powered by BitNami OSQA