Comment : Charset=windows-1252
Comment : test cases for management of user-defined types

Comment : create a point type with physical possrep cartesian and components X and Y - AND a silly but technically correct constraint
Request : cmd (assert userdefinedtype,userdefinedtype(tuple(typename(point)sp_expression( gt\(x,y\) )possrepname(point))))cmd (assert udtorderingoperator,udtorderingoperator(tuple(typename(point)sp_expression( or\(gt\(the_x\(parameter\(v1\(point\)\)\),the_x\(parameter\(v2\(point\)\)\)\),and\(eq\(the_x\(parameter\(v1\(point\)\)\),the_x\(parameter\(v2\(point\)\)\)\),gt\(the_y\(parameter\(v1\(point\)\)\),the_y\(parameter\(v2\(point\)\)\)\)\)\) ))))cmd (assert udtphysicalpossrepcomponent,udtphysicalpossrepcomponent(tuple(typename(point)componenttypename(float)componentname(x)ordinal(10)logicallength(1))tuple(typename(point)componenttypename(float)componentname(y)ordinal(20)logicallength(1))))
Reply   : 

Comment : test it
Request : inquire extend(table_dee,p(point(x(1)y(2))))
Reply   : 858993459:-1:java.lang.IllegalArgumentException:The component values Y:2.0 X:1.0  violate the possrep constraint expression gt(x,y).
Request : inquire extend(table_dee,p(point(x(1)y(1))))
Reply   : 858993459:-1:java.lang.IllegalArgumentException:The component values Y:1.0 X:1.0  violate the possrep constraint expression gt(x,y).
Request : inquire extend(table_dee,p(point(x(2)y(1))))
Reply   : RELATION(HEADING(P(POINT))BODY(TUPLE(P(Y(1.0)X(2.0)))))
Request : inquire extend(table_dee,p1gtp2(gt(point(x(2)y(1)),point(x(3)y(2)))))
Reply   : RELATION(HEADING(P1GTP2(BOOLEAN))BODY(TUPLE(P1GTP2(False))))
Request : inquire extend(table_dee,p1gtp2(gt(point(x(2)y(1)),point(x(2)y(1)))))
Reply   : RELATION(HEADING(P1GTP2(BOOLEAN))BODY(TUPLE(P1GTP2(False))))
Request : inquire extend(table_dee,p1gtp2(gt(point(x(2)y(1)),point(x(2)y(0)))))
Reply   : RELATION(HEADING(P1GTP2(BOOLEAN))BODY(TUPLE(P1GTP2(True))))
Request : inquire extend(table_dee,p1gtp2(gt(point(x(2)y(1)),point(x(1)y(0)))))
Reply   : RELATION(HEADING(P1GTP2(BOOLEAN))BODY(TUPLE(P1GTP2(True))))
Request : inquire extend(table_dee,p1eqp2(eq(point(x(5)y(4)),point(y(4)x(5)))))
Reply   : RELATION(HEADING(P1EQP2(BOOLEAN))BODY(TUPLE(P1EQP2(True))))
Request : inquire extend(table_dee,p1eqp2(eq(point(x(5)y(4)),point(y(5)x(5)))))
Reply   : 858993459:-1:java.lang.IllegalArgumentException:The component values Y:5.0 X:5.0  violate the possrep constraint expression gt(x,y).
Request : inquire extend(table_dee,p1eqp2(eq(point(x(5)y(4)),point(y(3)x(5)))))
Reply   : RELATION(HEADING(P1EQP2(BOOLEAN))BODY(TUPLE(P1EQP2(False))))

Comment : a few tests about the THE_operators
Request : inquire extend(table_dee,x(the_x(point(x(3.141592)y(3.14159))))y(the_y(point(x(3.141592)y(3.14159)))))
Reply   : RELATION(HEADING(X(FLOAT)Y(FLOAT))BODY(TUPLE(X(3.141592)Y(3.14159))))
Request : inquire extend(table_dee,z(mult(the_x(point(x(3.141592)y(3.14159))),the_y(point(x(3.141592)y(3.14159))))))
Reply   : RELATION(HEADING(Z(FLOAT))BODY(TUPLE(Z(9.86959401128))))

Comment : Incorporate a user-defined value in a valueselector in a view, then change the type and see what happens
Request : assert virtualrelvar,virtualrelvar(tuple(relvarname(pointpipi)sp_expression( relation\(heading\(p\(point\)\)body\(tuple\(p\(point\(x\(3.141592\)y\(3.14159\)\)\)\)\)\) )))
Reply   : 

Comment : test it
Request : inquire pointpipi
Reply   : RELATION(HEADING(P(POINT))BODY(TUPLE(P(Y(3.14159)X(3.141592)))))

Comment : change the ordinal position of the 'x' part in the physical representation
Request : update udtphysicalpossrepcomponent,udtphysicalpossrepcomponent(tuple(typename(point)componenttypename(float)componentname(x)ordinal(10)logicallength(1))),(ordinal(int(30)))
Reply   : 

Comment : test it
Request : inquire pointpipi
Reply   : RELATION(HEADING(P(POINT))BODY(TUPLE(P(Y(3.14159)X(3.141592)))))
Request : inquire extend(pointpipi,(x(the_x(p))y(the_y(p))))
Reply   : RELATION(HEADING(P(POINT)X(FLOAT)Y(FLOAT))BODY(TUPLE(P(Y(3.14159)X(3.141592))X(3.141592)Y(3.14159))))

Comment : drop them all back again
Request : unassert virtualrelvar,virtualrelvar(tuple(relvarname(pointpipi)sp_expression( relation\(heading\(p\(point\)\)body\(tuple\(p\(point\(x\(3.141592\)y\(3.14159\)\)\)\)\)\) )))
Reply   : 
Request : cmd (unassert userdefinedtype,userdefinedtype(tuple(typename(point)sp_expression( gt\(x,y\) )possrepname(point))))cmd (unassert udtorderingoperator,udtorderingoperator(tuple(typename(point)sp_expression( or\(gt\(the_x\(parameter\(v1\(point\)\)\),the_x\(parameter\(v2\(point\)\)\)\),and\(eq\(the_x\(parameter\(v1\(point\)\)\),the_x\(parameter\(v2\(point\)\)\)\),gt\(the_y\(parameter\(v1\(point\)\)\),the_y\(parameter\(v2\(point\)\)\)\)\)\) ))))cmd (unassert udtphysicalpossrepcomponent,udtphysicalpossrepcomponent(tuple(typename(point)componenttypename(float)componentname(x)ordinal(30)logicallength(1))tuple(typename(point)componenttypename(float)componentname(y)ordinal(20)logicallength(1))))
Reply   : 
END
