W3C home > Mailing lists > Public > public-cwm-talk@w3.org > January to March 2004

Working with lists

From: Graham Klyne <gk@ninebynine.org>
Date: Mon, 08 Mar 2004 19:51:36 +0000
Message-Id: <5.1.0.14.2.20040308184757.00bb2bf0@127.0.0.1>
To: public-cwm-talk@w3.org

I notice (from the change log) that CWM's collection (list) handling has 
changed, and that it seems to be difficult to perform some "simple" 
inferences over lists.

Below is some test code that I assumed would do some simple inferences on 
lists of values, but which doesn't do any of what I'd expect.

I wonder if I'm missing something here?  Am I the only person who's trying 
to use RDF collections (lists) in this way?

#g
--

[[
# Cwm-list-test.n3
#
# Command line used:
#   C:\Dev\W3C\Swap1144\cwm.py --n3=tl --think Cwm-list-test.n3

@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdft: <http://id.ninebynine.org/2003/rdfext/rdft#> .
@prefix wd:   <http://id.ninebynine.org/wip/2003/wlanDevices/> .
@prefix wp:   <http://id.ninebynine.org/wip/2003/wlanPolicy/> .
@prefix wc:   <http://id.ninebynine.org/wip/2003/wlanConnection/> .
@prefix :     <#> .

wp:WlanPolicy a wp:ConnectionPolicy ;
     wp:allowedConnections
       ( [ wc:devid "1" ; wc:devid "9" ]
         [ wc:devid "2" ; wc:devid "8" ]
         [ wc:devid "2" ; wc:devid "9" ]
       ) .

:foo :bar ( "1" "2" "3" ) .


# Simple rule to annotate a list link element

   { ?r rdf:first ?h . }
=>
   { ?r a :List } .


# Auxiliary rules to flatten members of a collection

   { ?r rdf:first ?h ;
        rdf:rest  ?t . }
=>
   { ?r rdft:includes ?h ;
        rdft:more     ?t . } .

   { ?r rdft:more ?m .
     ?m rdf:first ?h ;
        rdf:rest  ?t . }
=>
   { ?r rdft:includes ?h ;
        rdft:more     ?t . } .
]]


------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact
Received on Monday, 8 March 2004 14:52:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:11:01 GMT