I'm working with spin constraints (spin 1.4.0 via Maven).  I have them 
firing but I'm confused about how to label them so I can see which 
constraint has failed.  The full code (and data) is 
at https://github.com/jameshowison/softcite (may be some local paths in 
there, sorry!) and I run the constraints via mvn 
-Dtest=AppTest#testSPINConstraints test

I'm using the output code from the Kennedy's example, edited to use 
getCustomizedLabel rather than getLabel (although using just getLabel 
doesn't work as I'd expect either):

for(ConstraintViolation cv : cvs) {
System.out.println(" - at " + 
SPINLabels.get().getCustomizedLabel(cv.getRoot()) + ": " + cv.getMessage());

I've tried to follow the code through cv.getMessage() but I got lost in 
abstract interfaces somewhere :)

This is the constraint:

bioj:SoftwareMention a rdfs:Class ;
  spin:constraint
              [ a       spl:Attribute ;
                rdfs:comment "Must have one and exactly one classification 
"^^xsd:string ;
                spl:predicate citec:mention_category ;
                spl:minCount 1 ;
                spl:maxCount 1 ;
                # spl:valueType citec:MentionClassification ;
               # spl:defaultValue ex:Red
              ] ;
.

Originally I was working with 1.3.1 and I was getting the Resource ID but 
no message:

- at citec:a2007-36-BMC_PLANT_BIOL-B03-mention: 

Now I've upgraded to 1.4.0 and I'm getting a generic message (progress!):

- at citec:a2007-36-BMC_PLANT_BIOL-B03-mention: Attribute 
citec:mention_category :  [1,1]

But how would I output the rdfs:comment from the constraint?

As a secondary, but likely related question, I have this constraint:

bioj:ArticleSoftwareLink a rdfs:Class ;
spin:constraint
            [ a       sp:Ask ;
              sp:text """
          # Can only find versions if they exist
                  ASK WHERE {
                      ?this a bioj:ArticleSoftwareLink ;
                                      citec:has_version_indicator false ;
                                      citec:version_is_findable true .
                  }"""
            ] ;
.

That outputs the generic:

- at bioj:a2003-44-BBA-GEN_SUBJECTS-SWISS-MODEL: SPIN constraint at 
bioj:ArticleSoftwareLink

But I'd like it to output the comment in the query (  # Can only find 
versions if they exist ), I understand that the sp:text gets parsed and 
that should end up as an rdfs:comment property on the constraint, not sure 
if that's actually right. 

In any case (and perhaps more confusingly) I'd tried having the comment as 
rdfs:comment or rdfs:label for the constraint, but having either of those 
there produces a NullPointerException:

java.lang.NullPointerException
at org.topbraid.spin.util.JenaUtil.getStringProperty(JenaUtil.java:617)
at 
org.topbraid.spin.system.SPINLabels.getCustomizedLabel(SPINLabels.java:57)
at 
edu.utexas.ischool.jhowison.TTLRepository.runSPINconstraints(TTLRepository.java:523)

Any ideas?  

Thanks,
James

-- 
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, 
SPARQLMotion, SPARQL Web Pages and SPIN.
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-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to