Presentation on theme: "ISSUE 95 Lists. Changhais wish list The notion of field typed as a list (or a collection) should exist –For a list or a collection, it would be good to."— Presentation transcript:
ISSUE 95 Lists
Changhais wish list The notion of field typed as a list (or a collection) should exist –For a list or a collection, it would be good to have indication about the cardinality (min and max), and the type of element. The information is very useful in authoring the rules PRD 1.0 should support simply operators like: –Length: take the length and write tests on it. –Contains: does the list contain such and such element? –Equality: Equality between 2 lists –Extraction of elements, like getFirst(), getElement(n), getLast(). Later on (for PRD 2.0?), we could use the list / collection as a support for aggregates, like the average revenue of all the customers in the list, and in the action part have a construct to loop on the elements of the lists.
Sandros questions Can lists contain other lists? Can lists contain objects? (eg rif:local and rif:iri consts that represent frames, or something?) –If so, would expect some kind of type/class constraints on these objects? Can lists contain variables? –For example, the list [1, ?x, 3], with a variable in it, can "contain" anything, but once it does and ?x is bound, then it only contains 1, 3, and that thing. This is Prolog's list behavior, and people on the telecon the other day said it was fine for PRD, but I suspect on closer inspection it will turn out to be a real problem. Can you construct a list? –if p(?x) and q(?y) then create new list x : [?x ?y] assert pq(x) In terms of functions/operators (getFirst,...) how does this look:
Michaels proposal TERM ::= IRIMETA? (Const | Var | Expr | 'External' '(' Expr ')' | LIST) LIST ::= 'Seq(' TERM* ')' | 'Seq(' TERM+ '|' TERM ')' Examples –Empty list: Seq( ) –Closed list with variable inside: Seq(a ?Y c) –Open list with variables: Seq(a ?Y c | ?Z) –Equality of lists: Seq(Head | Tail) = Seq(a ?Y c) –Nested list: Seq(a Seq(?X b) c)