Skip to content
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

Allow index's sid to be pulled in query results #287

Merged
merged 1 commit into from
Dec 2, 2022
Merged

Conversation

bplatz
Copy link
Contributor

@bplatz bplatz commented Dec 2, 2022

With json-ld, we completely hide the underlying index's subject id integers in query results.

There may still be some advanced circumstances where getting this is desired (working with one now). This re-enables the ability to request :_id in the subject crawl as a special keyword to request the underlying sid.

ex this query in the test

@(fluree/query db {:select {'?s [:_id :* {:ex/favArtist [:_id :schema/name]}]}
                   :where  [['?s :type :ex/User]]})

Produces this result:

[{:_id          211106232532999,
  :id           :ex/bob,
  :rdf/type     [:ex/User],
  :schema/name  "Bob",
  :ex/favArtist {:_id         211106232533000
                 :schema/name "Picasso"}}
 {:_id         211106232532998,
  :id          :ex/alice,
  :rdf/type    [:ex/User],
  :schema/name "Alice"}]

@bplatz bplatz requested a review from a team December 2, 2022 16:08
@dpetran
Copy link
Contributor

dpetran commented Dec 2, 2022

Can you say a bit more about the use case?

@bplatz
Copy link
Contributor Author

bplatz commented Dec 2, 2022

Comparing values across different query results are extremely fast when comparing integers, which is the whole reason our indexes use them to begin with.

Also for this reason dbproto/-subid is used extensively in our code.

This allows our nice graph crawl mechanism to expose the same benefits where you'd otherwise have to do a subsequent blocking async -subid call afterwards - which would not only slow things down but is redundant because this information was already known in the query results processing.

Copy link
Contributor

@zonotope zonotope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📇

@bplatz bplatz merged commit 59530be into main Dec 2, 2022
@bplatz bplatz deleted the feature/select-sid branch December 2, 2022 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants