Unique Index?

Mar 8, 2014 at 8:34 PM
Is there an attribute I can use to declare that a property should be a unique index?

For instance, I want users to be able to register, provide an email address, and create a unique nickname. However, I'd like to let them logon (once registered), by providing either their unique email address, or unique nickname.

In this instance, both the nickname and the email address need to be unique, but are simple properties of the IUser entity.

How can I declare both the email address and the nickname as unique entities?
Mar 9, 2014 at 4:05 PM

You will need to check for uniqueness before creating the users, there isn't any database-level schema that enforces a unique constraint on properties. The notion of unique constraints is not native to RDF (though it is part of OWL, but BrightstarDB isn't currently and probably never will be an engine that supports OWL constraints).

I have in the past toyed with the idea of allowing transactions to be guarded by tests for triple patterns that must not exist in the store for the transaction to be applied (currently transactions are guarded by a test on triples patterns that must exist - this is used for the optimistic locking). That might be something that could be included in a future release and then surfaced in EF with some simple unique property constraints for single-valued properties at least... I've added an issue for this to the tracker on github - https://github.com/BrightstarDB/BrightstarDB/issues/85