Re: RIF+XML data ready for publication

Hi Gary,

"Gary Hallmark" <gary.hallmark@oracle.com> wrote on 21/10/2010 16:22:46:
> 
> Another issue with encoding xpaths in strings is that it invites 
> usage like ?x[fn:concat("eg:" "name")->"Gary"]. This seems forbidden
> by the semantics, but in a rather cryptic way.

I did not think of that kind of use, but the semantics does not forbid it.

And I do not think that it should, either. Of course, doing something like 
that would probably be bad practice in most cases, but I can imagine cases 
(e.g. involving manipulating XML documents) where this is what you want, 
and need, to do.

For instance (trying to make up an example), you process XML data in a 
stream, and you have a rule that says: if an element has a child element 
with name "Name", in any namespace, whose content is a list, then insert 
an <my:NameCorrespondance> element in the stream, blablabla:

For all ?x ?pre ?elt ?l ?n(
 If And(?x[fn:concat(?pre ":" "Name")-> ?l]
        fn:is-list(?l)))
 Then Do((?nc New())
         Assert(?nc["my:fullname"->?l])
         Assert(?nc["my:firstname"->fn:string(fn:get(?l 0))])
         Assert(?nc["my:lastname"->fn:string(fn:get(?l 
fn:numeric-substract(fn:count(?l) 1)))])
         Assert(?nc#"/my:NameCorrespondance")
         act:Print(fn:concat("<my:NameCorrespondance><my:fullname>" 
fn:string(?l) "</my:fullname><my:firstname>" ...))))

Cheers,

Christian

Sauf indication contraire ci-dessus:/ Unless stated otherwise above:
Compagnie IBM France
Siege Social : 17 avenue de l'Europe, 92275 Bois-Colombes Cedex
RCS Nanterre 552 118 465
Forme Sociale : S.A.S.
Capital Social : 612.509.964 ?
SIREN/SIRET : 552 118 465 03644

Received on Thursday, 21 October 2010 21:48:11 UTC