Christian; I think you're expecting '=' in the SPARQL FILTER to do a
parwise comparison. It doesn't. You can verify by entering the
following query in the SPARQL View and viewing an instance of C1. If
there are multiple values for property_B, all values of property_A are
returned by SPARQL:
SELECT *
WHERE {
?this :property_A ?A .
?s2 :property_B ?B .
FILTER (?A = ?B) .
}
So the first step is to create a function that returns 'true' if the
property is found in one of property_B's values. A SPIN function will
do the trick:
spin:constraint
sp:arg1 (the literal to find)
sp:arg2 (the property to search)
spin:body
ASK WHERE {
?x ?arg2 ?val .
FILTER (?val = ?arg1) .
}
Let's name this :findValue, then replace your FILTER statement with:
FILTER (!:findValue(?A, :property_B))
>From there the constraint violation warning should work as you
expected.
-- Scott
On Jan 13, 3:16 pm, Christian Fuerber <[email protected]> wrote:
> Hi,
> I'm trying to identify literals in a property A of class C1 that do
> not have an identical literal in property B of class C2 using
> spin:constraint defined in class C1. When I'm using the following
> query, it works as long as there is only one resource with a literal
> for property B.
>
> # Literal is not listed
> CONSTRUCT {
> _:b0 a spin:ConstraintViolation .
> _:b0 spin:violationRoot ?this .
> _:b0 spin:violationPath vocab:property_A .}
>
> WHERE {
> ?this vocab:property_A ?A .
> ?s2 vocab:property_B ?B .
> FILTER (?A != ?B) .
>
> }
>
> If there is more than one resource with a literal for property B of
> class C2, then every literal of property A is flagged by
> spin:constraint. But only literals should be flagged that do not have
> an identical literal in property B.
>
> Thank you for any help with this problem!
>
> Best,
> Christian
--
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.