rdf list support

given

### test-rules.n3
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. 
@prefix : <test#>.

:Z :allOf (:A :B :C).

{?L rdf:first ?I} => {?L :item ?I}.
{?L rdf:rest ?R. ?R :item ?I} => {?L :item ?I}.
###

the query

### test-query.n3
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. 
@prefix q: <http://www.w3.org/2004/ql#>.
@prefix : <test#>.

[] q:select {?I :okFor ?Y}; q:where  {?Y :allOf ?L. ?L :item ?I}.
###

gives no answer with cwm
also given

### test-rules.n3
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. 
@prefix : <test#>.

:Z :allOf _:L1.
_:L1 rdf:first :A; rdf:rest _:L2.
_:L2 rdf:first :B; rdf:rest _:L3.
_:L3 rdf:first :C; rdf:rest rdf:nil.

{?L rdf:first ?I} => {?L :item ?I}.
{?L rdf:rest ?R. ?R :item ?I} => {?L :item ?I}.
###

cwm gives no answer
however..
given

### test-rules.n3
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. 
@prefix : <test#>.

:Z :allOf _:L1.
_:L1 :first :A; :rest _:L2.
_:L2 :first :B; :rest _:L3.
_:L3 :first :C; :rest :nil.

{?L :first ?I} => {?L :item ?I}.
{?L :rest ?R. ?R :item ?I} => {?L :item ?I}.
###

cwm gives the very interesting answer

     @prefix : <test#> .
 
    :A     :okFor :Z .
 
    :B     :okFor :Z .
 
    :C     :okFor :Z .

The good news is that recursive rules work great with forward chainer
but we use ( ) lists a lot in our work, in many places :)


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

Received on Saturday, 12 March 2005 10:56:59 UTC