|
|
Index
| Recent Threads
| Who's Online
| User List
| Search
| Help
| |
|
Forum closing down This forum will be closing down due to extensive spamming activities. As a first step, registration of new members has been disabled. Existing members will be able to use the forum for now, but please consider using the sesame-general mailing list instead. |
![]() |
openRDF.org Forum » Sesame & Rio: Help » Thread: HTTP POST for INSERT, DELETE, UPDATE |
|
Total posts in this thread: 16
|
[Add To My Favorites] [Watch this Thread] [Post new Thread] |
| Author |
|
|
Aug 29, 2007 3:44:44 AM
hendlerman Regular Joined: Sep 14, 2004 Posts: 36 Status: Offline |
Hi All, I am running Sesame 2.0 beta5 and have built a PHP class to connect to it using the Zend Framework for PHP (simple HTTP client/JSON parser). Querying is working great. I have not been able to figure out how to add/update/ or delete statements from the documentation. I see onthis page, which is still under development, that there is under 8.6.1.x a number of operations available at the path of /repositories/[repository]/statements:
It appears with the above that I must define the header. Are there any links which might provide further documentation as to what the above DATA types can look like (especially the TRANSACTION data)? Sorry if I've missed something in the manual. Thanks. |
||
|
|
Aug 29, 2007 10:47:48 AM
arjohn OpenRDF project lead The Netherlands Joined: Jan 23, 2004 Posts: 1289 Status: Offline |
Turtle and RDF/XML are RDF formats. You can simply PUT or POST data in one of the supported RDF formats to the above URL as-is, which will cause the data to be added to the repository. An overview of the implemented RDF formats and references to their specifications is available in section 8.11 "Content types" of the user guide. Note that you do have to specify the appropriate MIME type for the used data format in the Content-Type header, as per the HTTP spec. The "transaction data format" is a Sesame-specific format for encoding transactions (which can include removal operations). This is an XML-based format. Unfortunately, the format isn't really documented yet. You may be able to extract it from the source code though, which is available here. I'll give you an example transaction document to get you up to speed: <?xml version="1.0"?> Hope this helps. ---------------------------------------- Arjohn Kampman, OpenRDF project lead, Aduna |
||
|
|
Aug 29, 2007 11:37:07 AM
hendlerman Regular Joined: Sep 14, 2004 Posts: 36 Status: Offline |
Perfect. I'll follow up here with how it goes, and link to the source code for the connector class. Thanks! |
||
|
|
Aug 29, 2007 4:06:58 PM
hendlerman Regular Joined: Sep 14, 2004 Posts: 36 Status: Offline |
I've got the 'add' transaction working with a POST, but not the 'clear'. In some blocks I only have a subject or predicate with a 'clear', assuming that leaving them blank makes them a wildcard. Is this the correct way to do a conditional clear? <?xml version="1.0"?> or a clear and add (an update?) <?xml version="1.0"?> I'm guessing for wildcard I need a bnode, or something, to make sure the parser knows which is the subject/predicate/object? Also, at the moment, querying is still very fast, but the adds and clears takes 10 seconds via the HTTP stuff (using a memory store). |
||
|
|
Aug 30, 2007 9:59:40 AM
arjohn OpenRDF project lead The Netherlands Joined: Jan 23, 2004 Posts: 1289 Status: Offline |
No, this is not correct. The XML-tags have been named after the operations in the Repository API, the clear-operation only operates on contexts. To remove specific statements, you need to use the remove-operation with <null/> for wildcards, e.g.: <?xml version="1.0"?>
Wildcard are indicated by <null/>, <bnode>bla</bnode> identifies a specific bnode.
Hmm, that's pretty bad. What the size of the repository? Does it use inferencing? ---------------------------------------- Arjohn Kampman, OpenRDF project lead, Aduna |
|||||||
|
|
Aug 30, 2007 10:43:25 AM
hendlerman Regular Joined: Sep 14, 2004 Posts: 36 Status: Offline |
Perfect <remove>and <null/>did the trick and deleting and updating are working as expected.
I've only seen that option for queries, but not for updating - if it is off by default, I am not doing inferencing. The size of the test store is nearly 0, it's an empty store I run some tests on. It may be the PHP code, I do 5 requests in a row that run sequentially (not concurrently). I'll let you know what I find out. Is there anything I should look for in the configuration of Sesame? |
|||||
|
|
Aug 30, 2007 11:33:19 AM
arjohn OpenRDF project lead The Netherlands Joined: Jan 23, 2004 Posts: 1289 Status: Offline |
Whether inferencing is enabled or not depends on the repository configuration. The query request parameter simply states whether inferred statements should be considered in the evaluation. So what my question basically comes down to is: did you create an inferencing repository ('memory-rdfs' template in the console), or did you create a non-inferencing repository ('memory' template in console). ---------------------------------------- Arjohn Kampman, OpenRDF project lead, Aduna |
||
|
|
Aug 30, 2007 1:48:05 PM
hendlerman Regular Joined: Sep 14, 2004 Posts: 36 Status: Offline |
It was the "memory" template. |
|||
|
|
Aug 30, 2007 6:42:37 PM
hendlerman Regular Joined: Sep 14, 2004 Posts: 36 Status: Offline |
I tested with "native" template as well and it the same speed issues appeared. Actually around 20 seconds per submit. I noticed that the return is "HTTP/1.1 204 NO CONTENT". I thought that maybe this was causing the PHP HTTP client do something wrong. I've found a bug in Zend's code with handling 204, since they try to read an empty buffer on the socket! So everything is good here! Look for a post with the code I've been using and a patch for Zend ;). Thanks for all the help! |
||
|
|
Aug 30, 2007 7:02:16 PM
hendlerman Regular Joined: Sep 14, 2004 Posts: 36 Status: Offline |
attached is a patch for the Zend Framework. ---------------------------------------- |
||
|
|
[Show Printable Version of Thread] [Post new Thread] |