W3C home > Mailing lists > Public > www-rdf-interest@w3.org > December 2002

Question/comment about cwm and builtin string handling

From: Graham Klyne <GK@NineByNine.org>
Date: Mon, 09 Dec 2002 22:03:55 +0000
Message-Id: <>
To: RDF interest group <www-rdf-interest@w3.org>

I'm looking at using cwm in the role of performing simple inferences in the 
area of network device management.  I've come across a very simple problem 
that may lead to a new area of cwm functionality (either:  maybe desirable, 
or present and unknown to me).

My problem is this:  given an IP address and standard form (n.n.n.n) and a 
subnet mask in the same form, I wish to construct the subnet broadcast 
address in the same form.  This involves a combination of string and 
arithmetic (or bitwise logical) operations.  I think I can probably bend 
the arithmetic stuff to do the necessary duties, but I see no way to get 
the required arithmetic values from the network address strings

I note that cwm has a builtin construct that allows one to assemble strings 
from a sequence of parts, but I'm not aware of anything that does the 
reverse.   A convenient function for decomposing a string might be 
something based on something like Python's regular expression match 
r.match(string).groups(None), returning a list of groups corresponding to 
pieces of a regular expression.  For cwm, I'm thinking of something like:

   ( stringval pattern ) string:matches ?groups


   ( stringval pattern ) string:matches ( ?group1 ?group2 ... ?groupn )

which is true if stringval matches pattern, and ?groups is bound to a list 
of substrings of stringval corresponding to groups in the regular 
expression.  I think this one feature would provide a flexible way to split 
string values in arbitrary ways.


Graham Klyne
Received on Monday, 9 December 2002 16:59:59 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:07:43 UTC