Good stuff! I tried the obvious fix you suggested below (last week) but found the results puzzling. Now, I see why. For these rather generic constraints, it is definitely wise to use the spin:ConstraintViolation definition. At least, that way you know where to look when there is a problem.
On Mar 2, 9:40 am, Scott Henninger <[email protected]> wrote: > Yes! this is the case. The obvious fix would be: > ASK WHERE { > ?this ?prop ?obj . > ?prop rdfs:domain ?domain . > ?this a ?domainType . > FILTER (?domain != ?domainType) . > > } > > But this brings up a couple of other things. First, the type triple > will mismatch if the class is defined as an owl:Class (the domain for > rdf:type is rdfs:Resource). So a filter is needed for that. > > Also, in the absence of further information, the constraint warning is > hung on the type triple. It would be more informative to put it on > the property. Using the spin:ConstraintViolation definition is useful > here: > > CONSTRUCT { > _:b0 a spin:ConstraintViolation . > _:b0 spin:violationRoot ?this . > _:b0 spin:violationPath ?prop . > _:b0 rdfs:label "subject does not match defined domain type " .} > > WHERE { > ?this ?prop ?obj . > ?prop rdfs:domain ?domain . > ?this a ?domainType . > FILTER (?domain != ?domainType) . > FILTER (?prop != rdf:type) . > > } > > This will place the warning on the property that has the violation. > > Hope that helps and thanks again! > -- Scott > > On Mar 1, 4:45 pm, Lowell Vizenor <[email protected]> wrote: > > > Scott, > > > You might want to rethink the example you gave below for property > > domain definitions. The spin:constraint (as you defined it) flags all > > the cases where the subject matches the defined domain type. > > > --Lowell > > > On Feb 9, 12:54 pm, Scott Henninger <[email protected]> > > wrote: > > > > Christoph; Using SPIN requires a different way of thinking about the > > > problem. I believe what you want to state is that any use of the a > > > property needs to have a resource of the correct domain/range type > > > (correct me if I am misreading your intent). You can state this (more > > > directly) as a spin:constraint - here's an example for property domain > > > defs: > > > > # subject does not match defined domain type > > > ASK WHERE { > > > ?this ?prop ?obj . > > > ?prop rdfs:domain ?domain . > > > ?this a ?domain . > > > > } > > > > The constraint warning will show the text you put in the initial > > > comment - i.e. all instance of this violation will state "subject does > > > not match defined domain type (SPIN constraint at owl:Thing)" I > > > defined this at owl:Thing, but could have defined it for > > > rdfs:Resource, rdfs:class, or my:fiddlestyx. That's a big modeling > > > advantage, IMHO. > > > > You can also define this as a CONSTRUCT query, instead of ASK, and > > > make all violations a member of a class, such as > > > spin:ConstraintViolation. > > > > Holger's blog (http://composing-the-semantic-web.blogspot.com/) has > > > excellent examples. > > > > In terms of Pellet 2, if some entity were to do us the favor of > > > creating a 3rd party plugin, there would be no licensing > > > complications... > > > > -- Scott --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
