SPARUL and SPARQL Protocol

August 25th, 2008

UPDATE! Apparently there was an inconsistency in the specs for ASK. It appears that that the <boolean> element should be a child element of <sparql>. So, I’ve changed my proposal a bit. Thanks for finding this bengee!

So one of the things I was working on today was implementing INSERT DATA and DELETE DATA queries for my SPARQL service. After some googling and pinging people on identi.ca, it seemed clear that there is no generally accepted result format for these kinds of queries. bengee suggested I throw something out there and see what people thought. So, here goes:

I thought perhaps it might be easiest to just mimic the ASK response. But instead of providing a <boolean> element, I thought of using <inserted> and <deleted> instead. For example:

PREFIX dc: <http://purl.org/dc/elements/1.1/>
INSERT DATA
{ <http://example/book3> dc:title    "A new book" ;
                         dc:creator  "A.N.Other" .
}

Would return the following result:

<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
  <head></head>
  <inserted>1</inserted>
</sparql>

Likewise for DELETE, but using the <deleted> element instead. If the query contained both INSERT and DELETE directives, both elements would be in the response:

<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
  <head></head>
  <inserted>12</inserted>
  <deleted>21</deleted>
</sparql>

Anywho, that’s the direction I’m heading unless someone comes up with something better. If you be that someone, please add a comment…

Leave a Reply