Thanks a lot for your quick help! This works excellent! Regards, Christian
On 14 Jan., 05:34, "Irene Polikoff" <[email protected]> wrote: > Christian, > > This is really just a basic SPARQL question, nothing specific to SPIN. > > First, let me explain why your query behaves the way it does. Let's assume > you have the following triples > > :r1 vocab:property_A "blue". > :r2 vocab:property_A "red". > :r3 vocab:property_B "blue". > > When you run your query, you will get r2, but not r1 because there is a > triple with vocab:property_B predicate and an object different from "red" > > :r3 vocab:property_B "blue". triple > > You will not get r1 because no triple with vocab:property_B predicate has as > an object different from "blue" > > If you now add a triple > > :r4 vocab:property_B "green". or > :r4 vocab:property_B "red". or > :r3 vocab:property_B "green". - does not really matter as long as the > predicate is vocab:property_B and object is something other than "blue", the > query will return both, r1 and r2 because you now have a triple with > vocab:property_B predicate and an object different from "red" AND a triple > with vocab:property_B predicate and an object different from "blue" > > What you need to do is something along these lines > > CONSTRUCT { > _:b0 a spin:ConstraintViolation . > _:b0 spin:violationRoot ?this . > _:b0 spin:violationPath vocab:property_A .} > > WHERE { > ?this vocab:property_A ?A . > OPTIONAL {?s2 vocab:property_B ?A} . > FILTER (!bound(?s2)) . > > } > > Regards, > > Irene > > -----Original Message----- > From: [email protected] > > [mailto:[email protected]] On Behalf Of Christian > Fuerber > Sent: Wednesday, January 13, 2010 4:17 PM > To: TopBraid Composer Users > Subject: [tbc-users] Matching Literals of different data type properties > > 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.
