Unique Constraint

Post Reply
wgoebl
Posts: 20
Joined: 09 Dec 2011, 11:08

Hi,

Protege does not check if a name (e.g. of an application) is unique.

For us it is an important requirement to have a constraint which enforces that certain key attribute are unique.

How can I implement this?

Thanks,

Wolfgang
jmk
Posts: 137
Joined: 31 May 2012, 12:08
Location: France

I'm not sure protégé can enforces its constraints without programming ....

Yau may check the violating instances with the "facet constraint tab" though.

See : http://protege.cim3.net/cgi-bin/wiki.pl ... traintsTab
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Thanks J-M,

Absolutely right. And the facet constraints tab can be very useful but it is only when you 'run' the constraints e.g. in the facet constraints tab, that Protege checks the constraints rules.

The constraints are not enforced while you enter data into the forms. However, having said that, we have used the UniqueStringWidget by default on the name of every instance of every class where you define the name manually. Although Protege will let you type a duplicate name into the name slot, Protege will colour that name red so that you can see that it is violating the unique name constraint.

We have certainly found that a warning rather than strict enforcement is a more useful approach. Although it is extremely rare within the context of a particular class, sometimes you need to have two instances in the repository that have the same name - e.g. an Application Provider is known in the enterprise by the name of the Technology Product on which is it based.

There are a number of classes in the meta model where we automatically manage a fully-qualified name for an instance. This helps ensure unique names and also is a major labour-saving device as it fills in the name e.g. based on the names of instances that appear in some of the slots of that class. Examples of this sort of thing would be the relationship classes like the Usages or the Actor to Role relations.

For the manually-controlled names, such as the names of Application Providers, look out for the name turning red in the form as you type a duplicate!

Jonathan
Essential Project Team
Post Reply