Hi Jeff,

On Dec 2, 2009, at 2:14 PM, Schmitz, Jeffrey A wrote:

> 
> Hello,
>   I currently have a model in which I've defined Cardinality constraints on 
> some Class attributes using the "Create from SPIN template" tool.  

Which SPIN template did you use for cardinality checking? If this is under your 
control, why don't you CONSTRUCT the spin:violationPath to remember the 
property at creation time?

> For a test I inject a cardinality constraint violation into the model.  I 
> then run spin constraint checking on the model with the following code:
> 
>                List<ConstraintViolation> cvs = 
> SPINConstraints.check(memModel, null);
> 
> and while I'm getting a returned ConstraintViolation object, the object has 
> no message.  I noticed when I view the model in TBC, it shows the constraint 
> violation and provides a message stating that there is a SPIN constraint 
> violation and lists the predicate that has the cardinality constraint error, 
> although it doesn't actually say it's a cardinality constraint violation.
> 
> In my code, I am able to call cvs.getRoot().getURI() to get the URI of the 
> individual that has the constraint violation, but I can't figure out how to 
> retrieve the predicate that has the cardinality violation like TBC is doing.

TBC uses some SPIN extensions for this extra logic. It involves introspecting 
the WHERE clause to find patterns such as

    ?this ?p ?o

and these are used as suggestions on what could be the source of the violation. 
A single violation might this way be attached to zero or more properties at 
once. This is fairly tricky code, and in order to reduce maintenance burden of 
the public part of the API I did not add it to the open source branch.

> 
> Really, the best would be if I could just attach a "cardinality constraint 
> error" message to the attributes that have cardinality constraints on them in 
> the model, but I don't see anyway to add such a message like can be done for 
> spin:constraint's specified as ASK queries (by adding comments to the ASK 
> query).  Is there a way to do this for such cardinality constraints?

I need more information, see my first point.

Regards,
Holger

--

You received this message because you are subscribed to the Google Groups 
"TopBraid Composer Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/topbraid-composer-users?hl=en.


Reply via email to