-
Notifications
You must be signed in to change notification settings - Fork 22
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
Make defaultContext a node #457
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. My guess is that the flake added for the defaultContext is redundant, but perhaps @bplatz could chime in on that and whether defaultContext flakes could appear in retracts
@@ -494,11 +501,20 @@ | |||
(flake/create new-issuer-sid const/$xsd:anyURI issuer-iri const/$xsd:string t true nil)]))) | |||
message-flakes (when message | |||
[(flake/create t const/$_commit:message message const/$xsd:string t true nil)]) | |||
default-ctx-flakes (when-let [default-ctx-iri (:id defaultContext)] | |||
(if-let [default-ctx-id (<? (dbproto/-subid db default-ctx-iri))] | |||
[(flake/create t const/$_ledger:context default-ctx-id const/$xsd:anyURI t true nil)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this flake get created even when there was another context (different from the default) supplied with the commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't since that's just a context, not a default context. I don't think it would given the different key naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good call where you have it.
I think we could go any way, including not storing it as a Flake at all. I think the balance is thinking if it will be useful in a query for people to ask questions.
I think the most important question will be when did the context change and what are the addresses... so having flakes to answer this I think would be useful:
{:select [?t ?ctx-id ?ctx-address]
:where [[?t :f/defaultContext ?ctx-id]
[?ctx-id :f/address ?ctx-address]]}
Which is exactly what you have.
You are also linking the ?ctx-id to every t
. That might be a bit excessive, but I can see it being useful for asking for it at a specific t
(e.g. t=42 here) with:
{:select [?ctx-id ?ctx-address]
:where [[42 :f/defaultContext ?ctx-id]
[?ctx-id :f/address ?ctx-address]]}
Even perhaps excessive, it is a relatively compact amount of information so if not needed, its not like we are paying a super high price.
So I like your decision here. I think we'll get better feedback once we have more users and can change course if necessary then.
Closes #449
Depends on fluree/json-ld#18
A couple things I'm slightly unsure of:
commit-data/add-commit-flakes
when the default context's sid already exists, do we need to add that flake (line 506) or is that redundant?