Re: use of constraints

is also fine for

cwm http://www.agfa.com/w3c/euler/medP.n3 -think 
-filter=http://www.agfa.com/w3c/euler/medF.n3

and is returning

    :Ann     :isPrescribed :aspirin .


i.e. with given

### medP.n3
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. 
@prefix m: <http://www.agfa.com/w3c/euler/medP#>.
@prefix X: <http://www.agfa.com/w3c/euler/medP#>.

m:Ann a m:Patient.
m:Ann m:complication m:gastroEntritis.
{m:Ann m:complication m:gastricUlcer} => {}.
{m:Ann m:complication m:postSurgery} => {}.

m:aspirin m:prescribedFor m:gastroEntritis.
m:aspirin m:excludedFor (m:gastricUlcer m:postSurgery).

@forAll X:P, X:D, X:M, X:L.
{X:P m:complication X:D.
 X:M m:prescribedFor X:D.
 X:M m:excludedFor X:L.
 X:P m:fineWith X:L} => {X:P m:isPrescribed X:M}.

@forAll X:P.
{X:P a m:Patient} => {X:P m:fineWith rdf:nil}.

@forAll X:L, X:P, X:A, X:B.
{X:L rdf:first X:A; a rdf:List.
 {X:P m:complication X:A} => {}.
 X:L rdf:rest X:B.
 X:P m:fineWith X:B} => {X:P m:fineWith X:L}.

@forAll X:M, X:L.
{X:M m:excludedFor X:L} => {X:L a rdf:List}.

@forAll X:L, X:R.
{X:L rdf:rest X:R; a rdf:List} => {X:R a rdf:List}.


and filter

### medF.n3
@prefix m: <http://www.agfa.com/w3c/euler/medP#>.
@prefix X: <http://www.agfa.com/w3c/euler/medF#>.

@forAll X:P, X:M.
{X:P m:isPrescribed X:M} => {X:P m:isPrescribed X:M}.


-- 
Jos De Roo, AGFA http://www.agfa.com/w3c/jdroo/




Jos De_Roo/AMDUS/MOR/Agfa-NV/BE/BAYER@AGFA
Sent by: public-cwm-talk-request@w3.org
18/08/2005 23:08

 
        To:     Jos De_Roo/AMDUS/MOR/Agfa-NV/BE/BAYER@AGFA
        cc:     public-cwm-talk@w3.org
        Subject:        Re: use of constraints



dunno what I did wrong in test sequnce, but now cwm is happy with
the => direction as well when using @forAll :X.

-- 
Jos De Roo, AGFA http://www.agfa.com/w3c/jdroo/




Jos De_Roo/AMDUS/MOR/Agfa-NV/BE/BAYER@AGFA
Sent by: public-cwm-talk-request@w3.org
18/08/2005 22:49

 
        To:     public-cwm-talk@w3.org
        cc:     (bcc: Jos De_Roo/AMDUS/MOR/Agfa-NV/BE/BAYER)
        Subject:        use of constraints



assume one calls
  {set-of-triples} => {}.
a constraint.
 
I found constraints quite useful
to write rules to detect inconsistencies
e.g.
  {?Y owl:disjointWith ?Z. ?X a ?Y, ?Z} => {}.

and to use single triple constraints as rule premise
e.g.
  {?X :cp :hipInjury. {?X :fracture :femur} => {}}
   => {?X :contusion :hip}.
so that given
  :Ann :cp :hipInjury.
  {:Ann :fracture :femur} => {}.
one could derive
  :Ann :contusion :hip.
and if it would somehow be the case that
  :Ann :fracture :femur.
then one can clearly detect that inconsistency.

cwm doesn't seem to be happy with that..


ah-ha! cwm seems to be happy when given
  @forAll :X.
  {:X :cp :hipInjury. {} <= {:X :fracture :femur}}
   => {:X :contusion :hip}.

  :Ann :cp :hipInjury.
  {} <= {:Ann :fracture :femur}.

to answer
    :Ann     :contusion :hip .

for query
  []
  q:select {?P :contusion ?G};
  q:where  {?P :contusion ?G}.

and I'm wondering about that..


-- 
Jos De Roo, AGFA http://www.agfa.com/w3c/jdroo/

Received on Sunday, 18 September 2005 22:45:33 UTC