issues about queries

Pierluigi Sanna luzzone at gmail.com
Tue May 9 19:03:51 CEST 2006


Hi, my name is Pierluigi and I'm actually using cduce for my final stage.
I made a program to take the list of all the authors, but I found some problems.
Here the structure of my types:

type uricloud = <uricloud>[ nodelist edgelist ]
type nodelist = <nodelist>[ node* ]
type node = <node id=String name=String>[ properties types ]
type edgelist = <edgelist>[ edge* ]
type edge = <edge id=String target=String source=String>[ properties types ]
type properties = <properties>[ property* ]
type property = <property name=String>[ PCDATA]
type types = <types>[ type+ ]
type type = <type>[ PCDATA]

(* take the <type> fields of a node, which state if a node is an
author or whatelse *)
let tipi (x : node) :  [String*] =
  map [x]/types/type with <type ..>t -> t

(* Check the type fields to state if a node is an author *)
let isAuthor (x : [String*]) : Bool = not((select aa
  from aa in x
  where aa = author) = [])

Now I would like to take the list of all the authors; this is my best
attempt, that doesn't work

let findAuthors (x : uricloud) : [node*] = select c
  from c in [x]/<nodelist>_/<node ..>_
  where (( tipi(isAuthor c)) = 'true )

Any suggestion will be very appreciated, thanks in advance

Pierluigi




More information about the Cduce-users mailing list