Re: New XML and XPath built-ins for CWM

Waleed,

Ah. Sorry I didn't before understand what you mean.  I think you need  
two things.

1. To have XML DOMs in the system. The way I would implement this  
would be as a new datatype: an XML DOM.

As it happens its not really new, when you think that RDF has an XML  
literal datatype which we just have not implemented in cwm.

The internal representation would be just the DOM tree as a value on  
a cwm literal object.

Now, where to put it? As a subclass of literal.

(Unless it can contain variables within the DOM tree, in which case  
subclass compound type.  The latter gets much more complicated as one  
would have to do unification between XML structures just as with  
unification between lists or formulae. This would be much more  
complicated!)

2. To have a named resource stand for a given object.  The moment you  
put cwm into identity-aware mode then you can say

:xml  = """<order>.........</order>"""^^xsd:xmlLiteral  or whatever  
the dt URI is

and the resource :xml will be smushed with the literal. This means a  
redirect will be set up so that all arcs about :xml is attached to  
the literal.

Tim






On Mar 10, 2006, at 15:07, Waleed K. Abdulla wrote:

> Tim,
>     My question was about computed 'resources' (as opposed to computed
> properties). My early implementation of XPath built-ins is at:
>
> http://www.xrules.org/cwm/default.aspx
>
>
>     This implementation is limited because I couldn't find support for
> computed resources in CWM. To explain the need for computed resources,
> see this example:
>
> ("<Order><Item>Book</Item><Item>Pen</Item></Order>" "/Order/Item")
> xpath:selectSingleNode :node .
>
>
>     The problem with this is that each time I use the property I  
> have to
> pass the whole XML document as a string and have it parsed. This is,
> obviously, not practical for big XML documents. It would be great if I
> can load and parse the XML document once, and then from that point
> forward, treat it as a resource (object) inside CWM. My code will,  
> then,
> look like this:
>
>
> "<Order>...</Order>"	x:parseAsXmlDocument		:xml .
>
> (:xml "/Order/Item")	xpath:selectSingleNode 		:node .
>
>
> where, :xml is of type x:XmlDocument and :node is of type x:XmlNode.
>
>
>     So, :xml is treated as a resource in CWM, yet a reference to an
> external implementation (a DOM in this case) is available that can be
> used by properties such as xpath:selectSingleNode to execute XPath
> expressions.
>
>     There might be support for this in CWM already, but I couldn't  
> find
> it!!
>
> Regards,
> Waleed
>
>
>
> -----Original Message-----
> From: public-cwm-talk-request@w3.org
> [mailto:public-cwm-talk-request@w3.org] On Behalf Of Tim Berners-Lee
> Sent: Thursday, March 09, 2006 11:40 AM
> To: Waleed Abdulla
> Cc: cwm; Dan Connolly
> Subject: Re: New XML and XPath built-ins for CWM
>
>
> Waleed,
>
> Juts came across your question a year ago asking about cwm built-ins.
>
> Yes, cwm does support computed properties.
>
> Did you get anywhere with making XPath builtins and XML dom data  
> types?
>
> Tim BL

Received on Saturday, 11 March 2006 02:05:45 UTC