{"action":"created","issue":{"url":"https://api.github.com/repos/antoniogarrote/rdfstore-js/issues/96","labels_url":"https://api.github.com/repos/antoniogarrote/rdfstore-js/issues/96/labels{/name}","comments_url":"https://api.github.com/repos/antoniogarrote/rdfstore-js/issues/96/comments","events_url":"https://api.github.com/repos/antoniogarrote/rdfstore-js/issues/96/events","html_url":"https://github.com/antoniogarrote/rdfstore-js/issues/96","id":77343381,"number":96,"title":"Question about deleting","user":{"login":"johlrogge","id":58219,"avatar_url":"https://avatars.githubusercontent.com/u/58219?v=3","gravatar_id":"","url":"https://api.github.com/users/johlrogge","html_url":"https://github.com/johlrogge","followers_url":"https://api.github.com/users/johlrogge/followers","following_url":"https://api.github.com/users/johlrogge/following{/other_user}","gists_url":"https://api.github.com/users/johlrogge/gists{/gist_id}","starred_url":"https://api.github.com/users/johlrogge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johlrogge/subscriptions","organizations_url":"https://api.github.com/users/johlrogge/orgs","repos_url":"https://api.github.com/users/johlrogge/repos","events_url":"https://api.github.com/users/johlrogge/events{/privacy}","received_events_url":"https://api.github.com/users/johlrogge/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-17T16:28:06Z","updated_at":"2015-05-26T13:02:36Z","closed_at":null,"body":"I have been trying my very limited sparql skills on a persistent store with no luck.\r\n\r\nI have a graph of *owl:thing* that can be *myschema:containedIn* *owl:thing*.\r\nMost things have *foaf:depiction* *foaf:image*.\r\n\r\nMy problem now is that I want to delete thing *A* and all triples related to *A* in any direction.\r\n\r\nI am not sure what is implemented and how I would express such a thing. \r\n\r\nI have tried the following:\r\n\r\n```javascript\r\n'PREFIX h: <http://dishoarder.com/hoard/1.0> \\\r\nDELETE {<'+context.uri+'> h:containedIn ?s} \\\r\nWHERE { \\\r\n  <'+context.uri+'> h:containedIn ?s . \\\r\n}'\r\n```\r\nAnd all I manage to do with that is delete everything in my graph :)\r\n\r\nI'm sure it is my DELETE WHERE that is messed up somehow but it would be nice to be pointed in the right direction. Can I use the high level API delete somehow here? What is the best way to approach this?"},"comment":{"url":"https://api.github.com/repos/antoniogarrote/rdfstore-js/issues/comments/105518919","html_url":"https://github.com/antoniogarrote/rdfstore-js/issues/96#issuecomment-105518919","issue_url":"https://api.github.com/repos/antoniogarrote/rdfstore-js/issues/96","id":105518919,"user":{"login":"johlrogge","id":58219,"avatar_url":"https://avatars.githubusercontent.com/u/58219?v=3","gravatar_id":"","url":"https://api.github.com/users/johlrogge","html_url":"https://github.com/johlrogge","followers_url":"https://api.github.com/users/johlrogge/followers","following_url":"https://api.github.com/users/johlrogge/following{/other_user}","gists_url":"https://api.github.com/users/johlrogge/gists{/gist_id}","starred_url":"https://api.github.com/users/johlrogge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johlrogge/subscriptions","organizations_url":"https://api.github.com/users/johlrogge/orgs","repos_url":"https://api.github.com/users/johlrogge/repos","events_url":"https://api.github.com/users/johlrogge/events{/privacy}","received_events_url":"https://api.github.com/users/johlrogge/received_events","type":"User","site_admin":false},"created_at":"2015-05-26T13:02:36Z","updated_at":"2015-05-26T13:02:36Z","body":"I have made a small example that shows one of the problems I've been having:\r\n\r\n```javascript\r\nwindow.onload = function main() {\r\n    rdfstore.create({persistent:true, name:'test',clear:true}, function(err, store) {\r\n        store.registerDefaultProfileNamespaces();\r\nstore.setPrefix('h', 'http://example.com/hoard/1.0/');\r\n\r\n        var insert = 'INSERT DATA { \\\r\n<http://example.com/things/root> a owl:thing; \\\r\nfoaf:depiction <http://example.com/images/someimage.jpg> . \\\r\n<http://example.com/images/someimage.jpg> foaf:thumbnail <http://example.com/images/thumbs/someimage.jpg> . \\\r\n}';\r\n\r\n        var insert2 = 'INSERT DATA { \\\r\n<http://example.com/things/child1> a owl:thing; \\\r\nfoaf:depiction <http://example.com/images/someimage2.jpg>; \\\r\nh:containedIn <http://example.com/root> \\\r\n. \\\r\n<http://example.com/images/someimage2.jpg> foaf:thumbnail <http://example.com/images/thumbs/someimage2.jpg> . \\\r\n}';\r\n\r\n\r\n        var construct = 'CONSTRUCT {<http://example.com/things/child1> ?p ?o} \\\r\nWHERE {<http://example.com/things/child1> ?p ?o}';\r\n        \r\n        \r\n        console.log(\"insert \", insert);\r\n        store.execute(insert, function(err, result){\r\n            store.execute(insert2, function(e, r){\r\n                if(err) {\r\n                    console.log(\"error! \", err);\r\n                }\r\n                console.log(\"Seems to work...\");\r\n                store.execute(construct, function(e, graph){\r\n                    console.log(\"graph \", graph);\r\n                    store.delete(graph, function(err){\r\n                        console.log(\"err? \", err);\r\n\r\n                    store.execute('SELECT ?s WHERE  {?s ?p ?o}',\r\n                                  function(err, results){\r\n                                      results.forEach(function(triple){\r\n                                          console.log(\"triple \", triple);\r\n                                      });\r\n                                  });\r\n                    });\r\n                });\r\n            });\r\n        });\r\n    });\r\n};\r\n```\r\n\r\nIt gives me \r\n```\r\nUncaught TypeError: Cannot read property 'token' of null(anonymous function) @ rdf_store.js:24534(anonymous function) @ rdf_store.js:23294(anonymous function) @ rdf_store.js:29571(anonymous function) @ rdf_store.js:29553(anonymous function) @ rdf_store.js:29534(anonymous function) @ rdf_store.js:29550(anonymous function) @ rdf_store.js:2956745.Lexicon.retrieve.async.seq.request.onsuccess @ rdf_store.js:23282\r\n```\r\nOn the last select if I do store.delete(graph, ...) before that.\r\n\r\nThe constructed graph contains 3 triples as expected [child1 contained in root], [child1 depiction someimage2], [child1 a owl:thing]\r\n\r\nI'll be digging some more. Just wanted to post an update with a reproducable error. Perhaps I'm doing something that is obviously wrong in which case I would appreciate a pointer.\r\n\r\n/J"}}