Hi Martynas,
I tried your example from TBC and the constraint is correctly tested
there (although there is an NPE in 4.3 when you look at instances of
your class, now fixed for 4.4). I assume you are running this via the
API, so I can only guess what else may be wrong. Maybe missing imports
in the query graph. You may need to step through the code to see what
it's really doing, or provide more details on your scenario and what
happens. I also tried the following that comes with SPL and works fine too:
:ProductOrServiceModel
....
spin:constraint [ a spl:ObjectCountPropertyConstraint ;
arg:maxCount 2 ;
arg:property rdf:type
] .
Does the latter work for you?
Holger
On 9/25/2013 10:23, [email protected] wrote:
Hey,
I couldn't find a complete example of a SPIN cardinality constraint,
but I put together pieces that I found (mainly in the SPL). However, I
can't get it to work -- the constraint does not seem to execute.
:ProductOrServiceModel a rdfs:Class, owl:Class ;
rdfs:subClassOf gr:ProductOrServiceModel ;
spin:constraint [ a :CardinalityViolationTemplate ;
spl:predicate rdf:type ;
spl:minCount "3"^^xsd:integer
] .
:CardinalityViolationTemplate a spin:Template ;
spin:body [ a sp:Construct ;
sp:text """CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?this .
_:b0 spin:violationPath ?predicate .
_:b0 rdfs:label "Property {?predicate} does not have the required
cardinality of min {?minCount} and max {?maxCount}" .
}
WHERE {
{
FILTER (bound(?minCount) && (spl:objectCount(?this,
?predicate) < ?minCount)) .
}
UNION
{
FILTER (bound(?maxCount) && (spl:objectCount(?this,
?predicate) > ?maxCount)) .
}
}"""^^xsd:string ] ;
spin:constraint [ a spl:Argument ;
spl:predicate spl:predicate ;
spl:valueType rdf:Property
] ,
[ a spl:Argument ;
spl:predicate spl:minCount ;
spl:valueType xsd:integer ;
spl:optional "true"^^xsd:boolean
] ,
[ a spl:Argument ;
spl:predicate spl:maxCount ;
spl:valueType xsd:integer ;
spl:optional "true"^^xsd:boolean
] .
Can you see what's wrong here?
Thanks,
Martynas
graphityhq.com
--
-- 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/groups/opt_out.
--
-- 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/groups/opt_out.