** Hits head on desk **

Not an issue with Fuseki but with me :-(

Implicit caching of HTTP GET requests in my API meant that the GET of the Graph 
when it did exist was cached but that the DELETE did not remove the cached copy 
so that when the GET was done after the DELETE the cached copy was returned so 
it looked like the DELETE hadn't worked (when it actually had!)

Sorry for wasting your time but thanks anyway for the clarifications on some of 
Fuseki's behaviour regarding datasets

Rob

-----Original Message-----
From: Rob Vesse [mailto:[email protected]] 
Sent: 28 January 2011 10:17
To: [email protected]
Subject: RE: Fuseki DELETE doesn't seem to work

Andy

 

The URI of the graph is specified using the ?graph form - I attach again a Log 
Trace from Fuseki (I included one in the original email which showed the use of 
the ?graph form) this time with the --verbose option on:

 

10:04:15 INFO  Fuseki               :: Dataset: in-memory

10:04:15 INFO  Fuseki               :: Update enabled

10:04:15 INFO  Fuseki               :: Fuseki 0.1.0

10:04:15 INFO  Fuseki               :: Jetty 7.x.y-SNAPSHOT

10:04:15 INFO  Fuseki               :: Dataset = /dataset

10:04:15 INFO  Fuseki               :: Started 2011/01/28 10:04:15 GMT on port 
3030

10:04:21 INFO  Fuseki               :: [1] PUT 
http://localhost:3030/dataset/data?graph=http%3A%2F%2Fexample.org%2FfusekiTest

10:04:21 INFO  Fuseki               :: [1]   Content-Type         
application/rdf+xml

10:04:21 INFO  Fuseki               :: [1]   Host                 localhost:3030

10:04:21 INFO  Fuseki               :: [1]   Content-Length       2265

10:04:21 INFO  Fuseki               :: [1]   Expect               100-continue

10:04:21 INFO  Fuseki               :: [1]   Connection           Keep-Alive

10:04:21 INFO  Fuseki               :: [1]   Body: Content-Length=2265, 
Content-Type=application/rdf+xml, Charset=null => RDF/XML

10:04:21 INFO  Fuseki               :: [1] 201 Created

10:04:21 INFO  Fuseki               :: [2] PUT 
http://localhost:3030/dataset/data?graph=http%3A%2F%2Fexample.org%2FfusekiTest2

10:04:21 INFO  Fuseki               :: [2]   Content-Type         
application/rdf+xml

10:04:21 INFO  Fuseki               :: [2]   Host                 localhost:3030

10:04:21 INFO  Fuseki               :: [2]   Content-Length       5209

10:04:21 INFO  Fuseki               :: [2]   Expect               100-continue

10:04:21 INFO  Fuseki               :: [2]   Body: Content-Length=5209, 
Content-Type=application/rdf+xml, Charset=null => RDF/XML

10:04:21 INFO  Fuseki               :: [2] 201 Created

10:04:21 INFO  Fuseki               :: [3] DELETE 
http://localhost:3030/dataset/data?graph=http%3A%2F%2Fexample.org%2FfusekiTest

10:04:21 INFO  Fuseki               :: [3]   Host                 localhost:3030

10:04:21 INFO  Fuseki               :: [3] 204 No Content

 

Tried the same using --debug option as well as --verbose but doesn't give any 
additional output.

 

Unfortunately a complete minimal example in this case would require me to 
compile you up a standalone Windows executable which I will do if you really 
want?

 

I can't run the sequence you did as I'm running Fuseki under Windows and don't 
have the appropriate tools installed to run the SOH scripts.

 

In the following code this._serviceUri is a variable containing the URI of the 
/data endpoint of the Fuseki server to which we are communicating.

 

My PUT code:

 

        /// <summary>

        /// Saves a Graph to the Protocol Server

        /// </summary>

        /// <param name="g">Graph to save</param>

        public virtual void SaveGraph(IGraph g)

        {

            String saveUri = this._serviceUri;

            if (g.BaseUri != null) 

            {

                saveUri += "?graph=" + 
Uri.EscapeDataString(g.BaseUri.ToString());

            }

            try

            {

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new 
Uri(saveUri));

                request.Method = "PUT";

                request.ContentType = MimeTypesHelper.RdfXml[0];

                RdfXmlWriter writer = new RdfXmlWriter();

                writer.Save(g, new StreamWriter(request.GetRequestStream()));

 

                using (HttpWebResponse response = 
(HttpWebResponse)request.GetResponse())

                {

                    //If we get here then it was OK

                    response.Close();

                }

            }

            catch (WebException webEx)

            {

                throw new RdfStorageException("A HTTP Error occurred while 
trying to save a Graph to the Store", webEx);

            }

        }

My DELETE code:

 

        /// <summary>

        /// Deletes a Graph from the store

        /// </summary>

        /// <param name="graphUri">URI of the Graph to delete</param>

        public virtual void DeleteGraph(String graphUri)

        {

            String deleteUri = this._serviceUri;

            if (!graphUri.Equals(String.Empty))

            {

                deleteUri += "?graph=" + Uri.EscapeDataString(graphUri);

            }

 

            try

            {

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new 
Uri(deleteUri));

                request.Method = "DELETE";

                using (HttpWebResponse response = 
(HttpWebResponse)request.GetResponse())

                {

                    //If we get then it was OK

                    response.Close();

                }

            }

            catch (WebException webEx)

            {

                throw new RdfStorageException("A HTTP Error occurred while 
trying to delete a Graph from the Store", webEx);

            }

        }

 

Rob

 

 

-----Original Message-----
From: Andy Seaborne [mailto:[email protected]] 
Sent: 28 January 2011 09:59
To: [email protected]
Subject: Re: Fuseki DELETE doesn't seem to work

 

 

 

On 28/01/11 09:22, Rob Vesse wrote:

> Hi Andy

> 

> Ok good to know about the 204 being a valid success code

> 

> As far as I was aware this isn't the default graph.  I am doing a PUT to a 
> specific Graph URI so surely I should be able to DELETE it at that specific 
> URI as well?

 

What is the URI of the graph?  ?graph= form or server local URI?

 

(complete, minimal example please!)

 

> For the record I am only putting one Graph in there so is it being treated as 
> the default graph since it is the only Graph?  What does Fuseki count as 
> being the default graph?

 

The default graph is the graph specified ?default.

Named graphs are

 

What happens if you run the sequence I did?

 

> It would be helpful if the Fuseki documentation was expanded somewhat to 
> cover points like this.

 

Yes - submissions welcome.

 

I've also suggested the spec notes the behaviour on the default graph, 

rather than just deferring to DROP DEFAULT.

 

      Andy


Reply via email to