-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
property defined with classname does not fully resume with resource #194
Comments
This isn't really about parent_strategy. This is a change in behavior for all resources that have class_name defined. Branch: blank_node_test
There are commented out puts statements that can be used for debugging to confirm that all triples are correctly in the repository and that the resumed chapter does not have all the triples for the body.
|
Not sure why this isn't working. Still digging. But here is where it appears to be falling over. These are the lines in #reload where before reload ch1 isn't populated, but after reload it is (for 0.6)
The 0.8 query fails to load all attributes of ch1. The query is slight different in that 0.6 sets the subject to rdf_subject and 0.8 sets it to obj. I don't have time to test this further today. I'll jump back in tomorrow, but wanted to indicate where I left off in case someone else explores it. |
I'm not sure the difference is happening at load time through path new -> reload -> query. The triples in self are the same at 0.6 and 0.8. When you attempt to access the property with class_name (e.g. bk1.has_chapter), it goes through get_values -> get_term (0.6) and get_values -> get_relation (0.8). The object that is returned is of the correct class in both cases. But for 0.8, the object only has the type triple. For 0.6, it has all triples for the rdf_subject of the object. |
Define class (DummyBook) for a resource that has a property (has_chapter) defined with class_name (DummyChapter).
Create instance of both and persist. NOTE: Not using parent_strategy for property resource.
Read resource that has a property defined with class_name from the repository.
Get resource from property.
Get title from property resource.
What happens is that ch1r has parent persistence strategy, so all requests for properties go through the final_parent which is bk1r. AND when bk1r was read from the repository, it only pulled in a single triple defining type of ch1r. At the point title is requested, it does not go to the repository and get the rest of the triples related to ch1r. I am assuming that this is (or could be) a lazy load situation where we don't want to explode the graph until that part is requested. A solution could involve a flag (e.g. loaded=TRUE | FALSE). The value of loaded could be used as follows...
The change of loaded from FALSE to TRUE could either happen at the first request of anything from has_chapter, or at the first request of a property from that resource. If DummyChapter also has a property with class_name, that instance would continue to have loaded => FALSE until it is directly requested. |
@no-reply @tpendragon Please review the last comment which summarizes how to reproduce, what is happening, and a proposed solution. |
I am looking for the right place to put a loaded=true|false flag. Currently, when you read the book from the repository, the following happens...
At this point, has_chapter has its type triple set in book. |
FIXES #194 - add loaded flag to lazy load property sources with parent_strategy
Branch: blank_node_test
TestFile: spec/active_triples/upgrade_from_6_to_8_spec.rb
Test:
There are commented out puts statements that can be used for debugging to confirm that all triples are correctly in the repository and that the resumed comment annotation does not have all the triples for the body.
NOTE: Test fails because hasBody, which should be an instance of DummyCommentBody and should hold all triples for the body, has only the type.
The text was updated successfully, but these errors were encountered: