fluree / db

Fluree database library
https://fluree.github.io/db/
Other
340 stars 23 forks source link

uniqueness constraints #222

Open dpetran opened 2 years ago

dpetran commented 2 years ago

This is less necessary with :where constraints on updates and deletes.

We should throw an exception if someone tries to create a duplicate of a unique value.

SHACL may be able to constrain uniqueness across a class.

bplatz commented 2 years ago

It doesn't seem that at least core SHACL supports this. While I'd rather just use a Fluree namespace for non-SHACL or non-OWL things for now, this proposal (not a standard) does support it for reference: https://datashapes.org/constraints.html#UniqueValueForClassConstraintComponent

mpoffald commented 1 year ago

@jakep36 are you using uniqueness constraints in Nexus yet?

bplatz commented 1 year ago

JSON-LD has a built in uniqueness constraint which is @id. This is not something we had with legacy Fluree.

I'd like to support uniqueness constraints at a class-level, something folks have wanted to do at a collection-level in Fluree historically. This is per my prior note.

Whatever we end up doing, if anything, will be outside of the standards as this would end up being unique capability for Fluree. One that can certainly come later.

mpoffald commented 1 year ago

@bplatz The context for the question was trying to triage which milestone this belongs in. We weren't sure if this was vital enough to Nexus that it should be included in 3.0.0-alpha1, some folks on the team thought it might be but we weren't sure.

From your comment, it sounds like this is more of an interesting future enhancement than it is critical for Nexus, is that right? How critical is this for customers? I'm wondering if it needs a milestone at all at this point.

bplatz commented 1 year ago

@mpoffald This certainly doesn't need to be in alpha 1, and is a nice to have feature. This is not a feature RDF databases have, but one that I think could be a nice addition for Fluree in the future.