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

improve hash algorithm #173

Open
michielrogissart-cognizone opened this issue Nov 30, 2022 · 0 comments
Open

improve hash algorithm #173

michielrogissart-cognizone opened this issue Nov 30, 2022 · 0 comments

Comments

@michielrogissart-cognizone
Copy link
Contributor

For now, the hash function works as follow:

  • if the model does not contain blank nodes
    • compute hash of statements as string
    • XOR the hashes
  • if the model contains blank nodes:
    • create sorted turtle
    • compute hash of sorted turtle

This is because there is no standard way to assign IDs to blank nodes. To ensure that the algorithm always returns the same hash for the same model, these ids shouldn't affect the hash.

Note that the sorted turtle would also work for models without blank nodes, but it is faster to not sort the statements.

A better approach would be to have predictable ids for blank nodes so that the first method can be used for models with blank nodes.

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

No branches or pull requests

1 participant