ncbo / goo

Graph Oriented Objects (GOO) for Ruby. A RDF/SPARQL based ORM.
http://ncbo.github.io/goo/
Other
15 stars 6 forks source link

Triples are left after object delete #66

Closed palexander closed 11 years ago

palexander commented 11 years ago

It appears as though some triples are left behind after object delete, at least in the case of OntologySubmission. In ontologies_linked_data, run:

rake data:create
rake data:delete

Query 4store: select * {?s ?p ?o}

{"s"=>
  {"type"=>"uri",
   "value"=>
    "http://data.bioontology.org/metadata/ontologies/HOM-UCARE-API-TST/1"},
 "p"=>
  {"type"=>"uri", "value"=>"http://data.bioontology.org/metadata/uuid"},
 "o"=>
  {"type"=>"literal",
   "value"=>"e0ef6bf0-4d5f-0130-a64f-14109fcf01cb",
   "datatype"=>"http://www.w3.org/2001/XMLSchema#string"}},
{"s"=>
  {"type"=>"uri",
   "value"=>
    "http://data.bioontology.org/metadata/ontologies/HOM-UCARE-API-TST/1"},
 "p"=>
  {"type"=>"uri",
   "value"=>"http://data.bioontology.org/metadata/pullLocation"},
 "o"=>{"type"=>"uri", "value"=>"http://example.com"}},
{"s"=>
  {"type"=>"uri",
   "value"=>
    "http://data.bioontology.org/metadata/ontologies/HOM-UCARE-API-TST/1"},
 "p"=>
  {"type"=>"uri",
   "value"=>"http://data.bioontology.org/metadata/submissionId"},
 "o"=>
  {"type"=>"literal",
   "value"=>"1",
   "datatype"=>"http://www.w3.org/2001/XMLSchema#integer"}}

We would expect related objects to be left in the store (IE SubmissionStatus, User, etc), but these are normal attribute triples.

msalvadores commented 11 years ago

Note to myself: The bug here is Query.model_to_triples it is not finding all attributes to be deleted.

msalvadores commented 11 years ago

It seems that the delete does not remove all the attributes if the object is not fully loaded. I have added:

self.load unless self.loaded?

First line in Resource.delete