Date: 2012-09-14 20:36:01
From: nicola.vitucci@gmail.com
Hi all,
I guess this question has already been answered, but I cannot find any
reference. Basically, a SPARQL update query like this cannot be parsed:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://www.semanticweb.org/owlapi/ontologies/MyOnt#>
INSERT {?p rdf:type :MyClass}
WHERE {?p :hasProp ?rl}
What's wrong? And, if possible, how should I write it?
Thanks,
Nicola

asked 03 Apr '13, 10:57

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k143160227
accept rate: 30%


Date: 2012-09-16 15:09:17
From: barry.bishop@ontotext.com
Hi Nicola,
The getting started application is only designed only for executing 
queries (at the moment). The Sesame API treats queries and updates as 
two separate (but related) things, so pushing updates through the query 
api will fail.
It would be quite straightforward to add this functionality to 
GettingStarted, e.g. by adding a function something like this:
void executeUpdate(String updateString) {
Update update = 
repositoryConnection.prepareUpdate(QueryLanguage.SPARQL, updateString);
update.execute();
connection.commit();
}
You might want to put the updates in a separate file similar to the 
query file, or put them in the same file (in which case you will need to 
catch query parse execptions and try the update function instead).
I hope this helps,
barry
link

answered 03 Apr '13, 10:58

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k143160227
accept rate: 30%

Date: 2012-09-16 09:45:23
From: barry.bishop@ontotext.com
Hello Nicola,
Is this question related to OWLIM/Sesame? If so, which edition/version?
What are the symptoms of your problem? Do you get an error message?
Do you get a stack trace?
I tried this query using OWLIM-SE and it parses and executes correctly.
barry
link

answered 03 Apr '13, 10:57

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k143160227
accept rate: 30%

Date: 2012-09-16 11:42:02
From: nicola.vitucci@gmail.com
Hi Barry,
yes, I've tried with OWLIM-Lite (versions 5.1 and 5.2) as a query for
the Getting-Started application. Adding some exceptions it comes out
that the "INSERT" keyword is not recognized, so I get a
MalformedQueryException:
------
org.openrdf.query.MalformedQueryException: Encountered " "insert"
"INSERT "" at line 6, column 1.
Was expecting one of:
"base" ...
"prefix" ...
"select" ...
"construct" ...
"describe" ...
"ask" ...
------
It looks like SPARQL/Update queries are not parsed correctly. If you
need any more details just tell me.
Thanks,
Nicola
link

answered 03 Apr '13, 10:57

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k143160227
accept rate: 30%

Date: 2012-09-16 13:15:35
From: nunzianteantonio@gmail.com
Ho Nicola, are you using the openrdf workbench?if so, have you executed
your query in the "sparql update" menu?
-Antonio Nunziante
link

answered 03 Apr '13, 10:58

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k143160227
accept rate: 30%

Date: 2012-09-16 14:24:19
From: nicola.vitucci@gmail.com
Hi Antonio,
no, I just wrote the query in a text file as in the Getting Started
example application. So this syntax is not accepted? Do I have to do the
update via API?
Nicola
link

answered 03 Apr '13, 10:58

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k143160227
accept rate: 30%

Date: 2012-09-16 16:47:44
From: nicola.vitucci@gmail.com
Hi Barry (and Jeni, just read your answer too),
thank you for the answers, you're right. I know Sesame treats them
differently but I didn't notice the "update" method is missing in the
example application, so I thought there was another problem elsewhere.
So silly :-)
Thanks again,
nicola
link

answered 03 Apr '13, 10:58

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k143160227
accept rate: 30%

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:

×261
×242
×37

Asked: 03 Apr '13, 10:57

Seen: 5,127 times

Last updated: 08 Jul, 02:57

powered by BitNami OSQA