Changeset 18100 for ext

Show
Ignore:
Timestamp:
09/23/07 00:52:25 (16 months ago)
Author:
Darren_Duncan
Message:

ext/Muldis-DB/ : rewrote Validator.pm code (now much smaller) to the new Muldis DB API, temp commented-out part of Example.pm

Location:
ext/Muldis-DB
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • ext/Muldis-DB/Changes

    r18093 r18100  
    9999    replaced in the next releases. 
    100100 
     101    * (Validator.pm)  Rewrote the foods/suppliers/shipments scenario, which 
     102    is basically all the code, so it uses the new API in Interface.pm; this 
     103    version is barely half the code size of the old one, but it doesn't 
     104    create a user-defined routine to combine the tasks to be done; an 
     105    additional version will be provided in a subsequent release that does. 
     106    The SYNOPSIS, plus the MDB_50_Validate_Example.t, were minor updated. 
     107 
    101108    * (SeeAlso.pod)  Updated the PROSPECTIVE MULDIS DB EXTENSIONS section 
    102109    mainly to bring various names, terminology, and references up to date 
  • ext/Muldis-DB/lib/Muldis/DB/Engine/Example.pm

    r18091 r18100  
    107107        (Str :$func_name!, Hash :$args!) { 
    108108 
    109     my $f = ::Muldis::DB::Engine::Example::Public::FuncBinding.new( 
    110         :dbms(self) ); 
     109#    my $f = ::Muldis::DB::Engine::Example::Public::FuncBinding.new( 
     110#        :dbms(self) ); 
    111111 
    112112    my $result = ::Muldis::DB::Engine::Example::Public::Var.new( 
    113113        :dbms(self), 'sys.Core.Universal.Universal' ); 
    114114 
    115     $f.bind_func( :func_name($func_name) ); 
    116     $f.bind_result( :var($result) ); 
    117     $f.bind_params( :args($args) ); 
    118  
    119     $f.call(); 
     115#    $f.bind_func( :func_name($func_name) ); 
     116#    $f.bind_result( :var($result) ); 
     117#    $f.bind_params( :args($args) ); 
     118 
     119#    $f.call(); 
    120120 
    121121    return $result; 
     
    126126method call_proc (Str :$proc_name!, Hash :$upd_args!, Hash :$ro_args!) { 
    127127 
    128     my $p = ::Muldis::DB::Engine::Example::Public::ProcBinding.new( 
    129         :dbms(self) ); 
    130  
    131     $p.bind_proc( :proc_name($proc_name) ); 
    132     $p.bind_upd_params( :args($upd_args) ); 
    133     $p.bind_ro_params( :args($ro_args) ); 
    134  
    135     $p.call(); 
     128#    my $p = ::Muldis::DB::Engine::Example::Public::ProcBinding.new( 
     129#        :dbms(self) ); 
     130 
     131#    $p.bind_proc( :proc_name($proc_name) ); 
     132#    $p.bind_upd_params( :args($upd_args) ); 
     133#    $p.bind_ro_params( :args($ro_args) ); 
     134 
     135#    $p.call(); 
    136136 
    137137    return; 
     
    193193    $dbms!assoc_vars.{self.WHERE} = self; 
    194194 
    195     $!var = ::Muldis::DB::Engine::Example::VM::Var.new( 
    196         :decl_type($decl_type) ); # TODO; or some such 
     195#    $!var = ::Muldis::DB::Engine::Example::VM::Var.new( 
     196#        :decl_type($decl_type) ); # TODO; or some such 
    197197 
    198198    return; 
     
    207207 
    208208method fetch_ast of Array () { 
    209     return $!var.as_phmd(); # TODO; or some such 
     209#    return $!var.as_phmd(); # TODO; or some such 
    210210} 
    211211 
     
    214214method store_ast (Array :$ast!) { 
    215215    # TODO: input checks. 
    216     $!var = from_phmd( $ast ); # TODO; or some such 
     216#    $!var = from_phmd( $ast ); # TODO; or some such 
    217217    return; 
    218218} 
  • ext/Muldis-DB/lib/Muldis/DB/Engine/Example/PhysType.pm

    r18093 r18100  
    486486 
    487487method root_type of Str () { 
    488     my $unqltp = ($self->_allows_quasi() ?? 'Quasi' !! '') ~ 'Tuple'; 
     488    my Str $unqltp = (self._allows_quasi() ?? 'Quasi' !! '') ~ 'Tuple'; 
    489489    return "sys.Core.$unqltp.$unqltp"; 
    490490} 
     
    492492method which of Str () { 
    493493    if (!$!which.defined) { 
    494         my $unqltp = ($self->_allows_quasi() ?? 'Quasi' !! '') ~ 'Tuple'; 
     494        my Str $unqltp = (self._allows_quasi() ?? 'Quasi' !! '') ~ 'Tuple'; 
    495495        my Str $root_type = "sys.Core.$unqltp.$unqltp"; 
    496496        my Str $tpwl = $root_type.graphs ~ q{ } ~ $root_type; 
     
    600600 
    601601method root_type of Str () { 
    602     my $unqltp = ($self->_allows_quasi() ?? 'Quasi' !! '') ~ 'Relation'; 
     602    my Str $unqltp = (self._allows_quasi() ?? 'Quasi' !! '') ~ 'Relation'; 
    603603    return "sys.Core.$unqltp.$unqltp"; 
    604604} 
     
    606606method which of Str () { 
    607607    if (!$!which.defined) { 
    608         my $unqltp 
    609             = ($self->_allows_quasi() ?? 'Quasi' !! '') ~ 'Relation'; 
     608        my Str $unqltp 
     609            = (self._allows_quasi() ?? 'Quasi' !! '') ~ 'Relation'; 
    610610        my Str $root_type = "sys.Core.$unqltp.$unqltp"; 
    611611        my Str $tpwl = $root_type.graphs ~ q{ } ~ $root_type; 
  • ext/Muldis-DB/lib/Muldis/DB/Validator.pm

    r18088 r18100  
    1414sub main (Str :$engine_name!, Any :$dbms_config!) { 
    1515 
    16     plan( 13 ); 
     16    plan( 12 ); 
    1717 
    1818    say "#### Muldis::DB::Validator starting test of $engine_name ####"; 
     
    2323    isa_ok( $dbms, 'Muldis::DB::Interface::DBMS' ); 
    2424 
    25     _scenario_foods_suppliers_shipments( $dbms ); 
     25    _scenario_foods_suppliers_shipments_v1( $dbms ); 
    2626 
    2727    say "#### Muldis::DB::Validator finished test of $engine_name ####"; 
     
    3232########################################################################### 
    3333 
    34 sub _scenario_foods_suppliers_shipments 
     34sub _scenario_foods_suppliers_shipments_v1 
    3535        (Muldis::DB::Interface::DBMS $dbms!) { 
    3636 
    37     # Declare our example executable code as Muldis DB ASTs. 
    38  
    39     my $tynm_Text = ::Muldis::DB::Literal::EntityName.new( :text<sys.type.Text> ); 
    40     my $tynm_UInt = ::Muldis::DB::Literal::EntityName.new( :text<sys.type.UInt> ); 
    41  
    42     my $atnm_colour  = ::Muldis::DB::Literal::EntityName.new( :text<colour> ); 
    43     my $atnm_country = ::Muldis::DB::Literal::EntityName.new( :text<country> ); 
    44     my $atnm_farm    = ::Muldis::DB::Literal::EntityName.new( :text<farm> ); 
    45     my $atnm_food    = ::Muldis::DB::Literal::EntityName.new( :text<food> ); 
    46     my $atnm_qty     = ::Muldis::DB::Literal::EntityName.new( :text<qty> ); 
    47  
    48     my $sca_type_Text = ::Muldis::DB::Literal::TypeInvo.new( :kind<Scalar>, :spec($tynm_Text) ); 
    49     my $sca_type_UInt = ::Muldis::DB::Literal::TypeInvo.new( :kind<Scalar>, :spec($tynm_UInt) ); 
    50  
    51     my $qrel_type_Relation = ::Muldis::DB::Literal::QuasiTypeInvo.new( :kind<Any>, :spec<Relation> ); 
    52  
    53     my $heading_suppliers = ::Muldis::DB::Literal::TypeDict.new( :map([ 
    54         [$atnm_farm,    $sca_type_Text], 
    55         [$atnm_country, $sca_type_Text], 
    56     ]) ); 
    57     my $heading_foods = ::Muldis::DB::Literal::TypeDict.new( :map([ 
    58         [$atnm_food,   $sca_type_Text], 
    59         [$atnm_colour, $sca_type_Text], 
    60     ]) ); 
    61     my $heading_shipments = ::Muldis::DB::Literal::TypeDict.new( :map([ 
    62         [$atnm_farm, $sca_type_Text], 
    63         [$atnm_food, $sca_type_Text], 
    64         [$atnm_qty,  $sca_type_UInt], 
    65     ]) ); 
    66     my $heading_colours = ::Muldis::DB::Literal::TypeDict.new( :map([ 
    67         [$atnm_colour, $sca_type_Text], 
    68     ]) ); 
    69  
    70     my $rel_type_suppliers = ::Muldis::DB::Literal::TypeInvo.new( 
    71         :kind<Relation>, :spec($heading_suppliers) ); 
    72     my $rel_type_foods = ::Muldis::DB::Literal::TypeInvo.new( 
    73         :kind<Relation>, :spec($heading_foods) ); 
    74     my $rel_type_shipments = ::Muldis::DB::Literal::TypeInvo.new( 
    75         :kind<Relation>, :spec($heading_shipments) ); 
    76  
    77     my $pnm_matched_suppl = ::Muldis::DB::Literal::EntityName.new( :text<matched_supp> ); 
    78     my $pnm_desi_colour   = ::Muldis::DB::Literal::EntityName.new( :text<desi_colour> ); 
    79     my $pnm_src_suppl     = ::Muldis::DB::Literal::EntityName.new( :text<src_suppl> ); 
    80     my $pnm_src_foods     = ::Muldis::DB::Literal::EntityName.new( :text<src_foods> ); 
    81     my $pnm_src_shipm     = ::Muldis::DB::Literal::EntityName.new( :text<src_shipm> ); 
    82  
    83     my $opnm_rel_asn = ::Muldis::DB::Literal::EntityName.new( :text<sys.rtn.Relation.assign> ); 
    84     my $opnm_rel_jn  = ::Muldis::DB::Literal::EntityName.new( :text<sys.rtn.Relation.join> ); 
    85     my $opnm_rel_sjn = ::Muldis::DB::Literal::EntityName.new( :text<sys.rtn.Relation.semijoin> ); 
    86  
    87     my $anm_filter  = ::Muldis::DB::Literal::EntityName.new( :text<filter> ); 
    88     my $anm_source  = ::Muldis::DB::Literal::EntityName.new( :text<source> ); 
    89     my $anm_sources = ::Muldis::DB::Literal::EntityName.new( :text<sources> ); 
    90     my $anm_target  = ::Muldis::DB::Literal::EntityName.new( :text<target> ); 
    91     my $anm_v       = ::Muldis::DB::Literal::EntityName.new( :text<v> ); 
    92  
    93     my $expr_3jn_ssp_sfd_scl = ::Muldis::DB::Literal::FuncInvo.new( 
    94         :func($opnm_rel_jn), 
    95         :ro_args(::Muldis::DB::Literal::_ExprDict.new( :map([ 
    96             [$anm_sources, newQuasiSet( 
    97                 :heading($qrel_type_Relation), 
    98                 :body([ 
    99                     ::Muldis::DB::Literal::VarInvo.new( :v($pnm_src_shipm) ), 
    100                     ::Muldis::DB::Literal::VarInvo.new( :v($pnm_src_foods) ), 
    101                     ::Muldis::DB::Literal::Relation.new( 
    102                         :heading($heading_colours), 
    103                         :body([ 
    104                             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    105                                 [$atnm_colour, ::Muldis::DB::Literal::VarInvo.new( 
    106                                     :v($pnm_desi_colour) )], 
    107                             ]) ), 
    108                         ]), 
    109                     ), 
    110                 ]), 
    111             )], 
    112         ]) )), 
    113     ); 
    114  
    115     my $query_suppl_of_foods_of_clr = ::Muldis::DB::Literal::HostGateRtn.new( 
    116         :upd_params(::Muldis::DB::Literal::TypeDict.new( :map([ 
    117             [$pnm_matched_suppl, $rel_type_suppliers], 
    118         ]) )), 
    119         :ro_params(::Muldis::DB::Literal::TypeDict.new( :map([ 
    120             [$pnm_desi_colour, $sca_type_Text], 
    121             [$pnm_src_suppl,   $rel_type_suppliers], 
    122             [$pnm_src_foods,   $rel_type_foods], 
    123             [$pnm_src_shipm,   $rel_type_shipments], 
    124         ]) )), 
    125         :vars(::Muldis::DB::Literal::TypeDict.new( :map([]) )), 
    126         :stmts([ 
    127             ::Muldis::DB::Literal::ProcInvo.new( 
    128                 :proc($opnm_rel_asn), 
    129                 :upd_args(::Muldis::DB::Literal::_ExprDict.new( :map([ 
    130                     [$anm_target, ::Muldis::DB::Literal::VarInvo.new( :v($pnm_matched_suppl) )], 
    131                 ]) )), 
    132                 :ro_args(::Muldis::DB::Literal::_ExprDict.new( :map([ 
    133                     [$anm_v, ::Muldis::DB::Literal::FuncInvo.new( 
    134                         :func($opnm_rel_sjn), 
    135                         :ro_args(::Muldis::DB::Literal::_ExprDict.new( :map([ 
    136                             [$anm_source, ::Muldis::DB::Literal::VarInvo.new( 
    137                                 :v($pnm_src_suppl) )], 
    138                             [$anm_filter, $expr_3jn_ssp_sfd_scl], 
    139                         ]) )), 
    140                     )], 
    141                 ]) )), 
    142             ), 
    143             ::Muldis::DB::Literal::ProcReturn.new(), 
    144         ]), 
    145     ); 
    146  
    147     # Load our example executable code into the virtual machine. 
    148  
    149     my $prep_rtn_suppl_of_foods_of_clr = $dbms.prepare( 
    150         :rtn_ast($query_suppl_of_foods_of_clr) ); 
    151     isa_ok( $prep_rtn_suppl_of_foods_of_clr, 
    152         'Muldis::DB::Interface::HostGateRtn' ); 
    153  
    154     my $src_suppliers = $dbms.new_var( :decl_type($rel_type_suppliers) ); 
    155     isa_ok( $src_suppliers, 'Muldis::DB::Interface::HostGateVar' ); 
    156     my $src_foods = $dbms.new_var( :decl_type($rel_type_foods) ); 
    157     isa_ok( $src_foods, 'Muldis::DB::Interface::HostGateVar' ); 
    158     my $src_shipments = $dbms.new_var( :decl_type($rel_type_shipments) ); 
    159     isa_ok( $src_shipments, 'Muldis::DB::Interface::HostGateVar' ); 
    160  
    161     my $desi_colour = $dbms.new_var( :decl_type($sca_type_Text) ); 
    162     isa_ok( $desi_colour, 'Muldis::DB::Interface::HostGateVar' ); 
    163  
    164     my $matched_suppl = $dbms.new_var( :decl_type($rel_type_suppliers) ); 
    165     isa_ok( $matched_suppl, 'Muldis::DB::Interface::HostGateVar' ); 
    166  
    167     $prep_rtn_suppl_of_foods_of_clr.bind_host_params( 
    168         :upd_args([ 
    169             [$pnm_matched_suppl, $matched_suppl], 
    170         ]), 
    171         :ro_args([ 
    172             [$pnm_desi_colour, $desi_colour], 
    173             [$pnm_src_suppl,   $src_suppliers], 
    174             [$pnm_src_foods,   $src_foods], 
    175             [$pnm_src_shipm,   $src_shipments], 
    176         ]), 
    177     ); 
    178  
    179     # Declare our example literal source data sets as Muldis DB ASTs. 
    180  
    181     my $rel_def_suppliers = ::Muldis::DB::Literal::Relation.new( 
    182         :heading($heading_suppliers), 
    183         :body([ 
    184             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    185                 [$atnm_farm,    ::Muldis::DB::Literal::Text.new( :v<Hodgesons> )], 
    186                 [$atnm_country, ::Muldis::DB::Literal::Text.new( :v<Canada> )], 
    187             ]) ), 
    188             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    189                 [$atnm_farm,    ::Muldis::DB::Literal::Text.new( :v<Beckers> )], 
    190                 [$atnm_country, ::Muldis::DB::Literal::Text.new( :v<England> )], 
    191             ]) ), 
    192             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    193                 [$atnm_farm,    ::Muldis::DB::Literal::Text.new( :v<Wickets> )], 
    194                 [$atnm_country, ::Muldis::DB::Literal::Text.new( :v<Canada> )], 
    195             ]) ), 
    196         ]), 
    197     ); 
    198  
    199     my $rel_def_foods = ::Muldis::DB::Literal::Relation.new( 
    200         :heading($heading_foods), 
    201         :body([ 
    202             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    203                 [$atnm_food,   ::Muldis::DB::Literal::Text.new( :v<Bananas> )], 
    204                 [$atnm_colour, ::Muldis::DB::Literal::Text.new( :v<yellow> )], 
    205             ]) ), 
    206             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    207                 [$atnm_food,   ::Muldis::DB::Literal::Text.new( :v<Carrots> )], 
    208                 [$atnm_colour, ::Muldis::DB::Literal::Text.new( :v<orange> )], 
    209             ]) ), 
    210             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    211                 [$atnm_food,   ::Muldis::DB::Literal::Text.new( :v<Oranges> )], 
    212                 [$atnm_colour, ::Muldis::DB::Literal::Text.new( :v<orange> )], 
    213             ]) ), 
    214             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    215                 [$atnm_food,   ::Muldis::DB::Literal::Text.new( :v<Kiwis> )], 
    216                 [$atnm_colour, ::Muldis::DB::Literal::Text.new( :v<green> )], 
    217             ]) ), 
    218             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    219                 [$atnm_food,   ::Muldis::DB::Literal::Text.new( :v<Lemons> )], 
    220                 [$atnm_colour, ::Muldis::DB::Literal::Text.new( :v<yellow> )], 
    221             ]) ), 
    222         ]), 
    223     ); 
    224  
    225     my $rel_def_shipments = ::Muldis::DB::Literal::Relation.new( 
    226         :heading($heading_shipments), 
    227         :body([ 
    228             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    229                 [$atnm_farm, ::Muldis::DB::Literal::Text.new( :v<Hodgesons> )], 
    230                 [$atnm_food, ::Muldis::DB::Literal::Text.new( :v<Kiwis> )], 
    231                 [$atnm_qty,  ::Muldis::DB::Literal::Int.new( :v(100) )], 
    232             ]) ), 
    233             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    234                 [$atnm_farm, ::Muldis::DB::Literal::Text.new( :v<Hodgesons> )], 
    235                 [$atnm_food, ::Muldis::DB::Literal::Text.new( :v<Lemons> )], 
    236                 [$atnm_qty,  ::Muldis::DB::Literal::Int.new( :v(130) )], 
    237             ]) ), 
    238             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    239                 [$atnm_farm, ::Muldis::DB::Literal::Text.new( :v<Hodgesons> )], 
    240                 [$atnm_food, ::Muldis::DB::Literal::Text.new( :v<Oranges> )], 
    241                 [$atnm_qty,  ::Muldis::DB::Literal::Int.new( :v(10) )], 
    242             ]) ), 
    243             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    244                 [$atnm_farm, ::Muldis::DB::Literal::Text.new( :v<Hodgesons> )], 
    245                 [$atnm_food, ::Muldis::DB::Literal::Text.new( :v<Carrots> )], 
    246                 [$atnm_qty,  ::Muldis::DB::Literal::Int.new( :v(50) )], 
    247             ]) ), 
    248             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    249                 [$atnm_farm, ::Muldis::DB::Literal::Text.new( :v<Beckers> )], 
    250                 [$atnm_food, ::Muldis::DB::Literal::Text.new( :v<Carrots> )], 
    251                 [$atnm_qty,  ::Muldis::DB::Literal::Int.new( :v(90) )], 
    252             ]) ), 
    253             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    254                 [$atnm_farm, ::Muldis::DB::Literal::Text.new( :v<Beckers> )], 
    255                 [$atnm_food, ::Muldis::DB::Literal::Text.new( :v<Bananas> )], 
    256                 [$atnm_qty,  ::Muldis::DB::Literal::Int.new( :v(120) )], 
    257             ]) ), 
    258             ::Muldis::DB::Literal::_ExprDict.new( :map([ 
    259                 [$atnm_farm, ::Muldis::DB::Literal::Text.new( :v<Wickets> )], 
    260                 [$atnm_food, ::Muldis::DB::Literal::Text.new( :v<Lemons> )], 
    261                 [$atnm_qty,  ::Muldis::DB::Literal::Int.new( :v(30) )], 
    262             ]) ), 
    263         ]), 
    264     ); 
    265  
    266     # Load our example literal source data sets into the virtual machine. 
    267  
    268     $src_suppliers.store_ast( :val_ast($rel_def_suppliers) ); 
     37    # Declare our Perl-lexical variables to use for source data. 
     38 
     39    my $src_suppliers 
     40        = $dbms.new_var( :decl_type('sys.Core.Relation.Relation') ); 
     41    isa_ok( $src_suppliers, 'Muldis::DB::Interface::Var' ); 
     42    my $src_foods 
     43        = $dbms.new_var( :decl_type('sys.Core.Relation.Relation') ); 
     44    isa_ok( $src_foods, 'Muldis::DB::Interface::Var' ); 
     45    my $src_shipments 
     46        = $dbms.new_var( :decl_type('sys.Core.Relation.Relation') ); 
     47    isa_ok( $src_shipments, 'Muldis::DB::Interface::Var' ); 
     48 
     49    # Load our example literal source data sets into said Perl-lexicals. 
     50 
     51    $src_suppliers.store_ast( 
     52        :ast([ 'Relation', 'sys.Core.Relation.Relation', [ 
     53            { 
     54                'farm'    => [ 'NEText', 'Hodgesons' ], 
     55                'country' => [ 'NEText', 'Canada' ], 
     56            }, 
     57            { 
     58                'farm'    => [ 'NEText', 'Beckers' ], 
     59                'country' => [ 'NEText', 'England' ], 
     60            }, 
     61            { 
     62                'farm'    => [ 'NEText', 'Wickets' ], 
     63                'country' => [ 'NEText', 'Canada' ], 
     64            }, 
     65        ] ]), 
     66    ); 
    26967    pass( 'no death from loading example suppliers data into VM' ); 
    270     $src_foods.store_ast( :val_ast($rel_def_foods) ); 
     68 
     69    $src_foods.store_ast( 
     70        :ast([ 'Relation', 'sys.Core.Relation.Relation', [ 
     71            { 
     72                'food'   => [ 'NEText', 'Bananas' ], 
     73                'colour' => [ 'NEText', 'yellow' ], 
     74            }, 
     75            { 
     76                'food'   => [ 'NEText', 'Carrots' ], 
     77                'colour' => [ 'NEText', 'orange' ], 
     78            }, 
     79            { 
     80                'food'   => [ 'NEText', 'Oranges' ], 
     81                'colour' => [ 'NEText', 'orange' ], 
     82            }, 
     83            { 
     84                'food'   => [ 'NEText', 'Kiwis' ], 
     85                'colour' => [ 'NEText', 'green' ], 
     86            }, 
     87            { 
     88                'food'   => [ 'NEText', 'Lemons' ], 
     89                'colour' => [ 'NEText', 'yellow' ], 
     90            }, 
     91        ] ]), 
     92    ); 
    27193    pass( 'no death from loading example foods data into VM' ); 
    272     $src_shipments.store_ast( :val_ast($rel_def_shipments) ); 
     94 
     95    $src_shipments.store_ast( 
     96        :ast([ 'Relation', 'sys.Core.Relation.Relation', [ 
     97            { 
     98                'farm' => [ 'NEText', 'Hodgesons' ], 
     99                'food' => [ 'NEText', 'Kiwis' ], 
     100                'qty'  => [ 'PInt', 'perl_pint', 100 ], 
     101            }, 
     102            { 
     103                'farm' => [ 'NEText', 'Hodgesons' ], 
     104                'food' => [ 'NEText', 'Lemons' ], 
     105                'qty'  => [ 'PInt', 'perl_pint', 130 ], 
     106            }, 
     107            { 
     108                'farm' => [ 'NEText', 'Hodgesons' ], 
     109                'food' => [ 'NEText', 'Oranges' ], 
     110                'qty'  => [ 'PInt', 'perl_pint', 10 ], 
     111            }, 
     112            { 
     113                'farm' => [ 'NEText', 'Hodgesons' ], 
     114                'food' => [ 'NEText', 'Carrots' ], 
     115                'qty'  => [ 'PInt', 'perl_pint', 50 ], 
     116            }, 
     117            { 
     118                'farm' => [ 'NEText', 'Beckers' ], 
     119                'food' => [ 'NEText', 'Carrots' ], 
     120                'qty'  => [ 'PInt', 'perl_pint', 90 ], 
     121            }, 
     122            { 
     123                'farm' => [ 'NEText', 'Beckers' ], 
     124                'food' => [ 'NEText', 'Bananas' ], 
     125                'qty'  => [ 'PInt', 'perl_pint', 120 ], 
     126            }, 
     127            { 
     128                'farm' => [ 'NEText', 'Wickets' ], 
     129                'food' => [ 'NEText', 'Lemons' ], 
     130                'qty'  => [ 'PInt', 'perl_pint', 30 ], 
     131            }, 
     132        ] ]), 
     133    ); 
    273134    pass( 'no death from loading example shipments data into VM' ); 
    274135 
     
    276137    # data and see what suppliers there are for foods coloured 'orange'. 
    277138 
    278     $desi_colour.store_ast( :val_ast(::Muldis::DB::Literal::Text.new( :v<orange> )) ); 
     139    my $desi_colour = $dbms.new_var( :decl_type('sys.Core.Text.Text') ); 
     140    isa_ok( $desi_colour, 'Muldis::DB::Interface::Var' ); 
     141    $desi_colour.store_ast( :ast([ 'NEText', 'orange' ]) ); 
    279142    pass( 'no death from loading desired colour into VM' ); 
    280143 
    281     $prep_rtn_suppl_of_foods_of_clr.execute(); 
    282     pass( 'no death from executing prepared search routine' ); 
    283  
    284     my $rel_def_matched_suppl = $matched_suppl.fetch_ast(); 
     144    my $matched_suppl = $dbms.call_func( 
     145        :func_name('sys.Core.Relation.semijoin'), 
     146        :args({ 
     147            'source' => $src_suppliers, 
     148            'filter' => $dbms.call_func( 
     149                :func_name('sys.Core.Relation.join'), 
     150                :args({ 
     151                    'topic' => [ 'QuasiSet', 
     152                            'sys.Core.Spec.QuasiSetOfRelation', [ 
     153                        $src_shipments, 
     154                        $src_foods, 
     155                        [ 'Relation', 'sys.Core.Relation.Relation', [ 
     156                            { 
     157                                'colour' => $desi_colour, 
     158                            }, 
     159                        ] ], 
     160                    ] ], 
     161                }), 
     162            ), 
     163        }), 
     164    ); 
     165    pass( 'no death from executing search query' ); 
     166    isa_ok( $matched_suppl, 'Muldis::DB::Interface::Var' ); 
     167 
     168    my $matched_suppl_ast = $matched_suppl.fetch_ast(); 
    285169    pass( 'no death from fetching search results from VM' ); 
    286170 
    287171    # Finally, use the result somehow (not done here). 
    288172    # The result should be: 
    289     #    Relation( 
    290     #        { farm<'Hodgesons'>, country<'Canada'> }, 
    291     #        { farm<'Beckers'>,   country<'England'> }, 
    292     #    ); 
     173    # [ 'Relation', 'sys.Core.Relation.Relation', [ 
     174    #     { 
     175    #         'farm'    => [ 'NEText', 'Hodgesons' ], 
     176    #         'country' => [ 'NEText', 'Canada' ], 
     177    #     }, 
     178    #     { 
     179    #         'farm'    => [ 'NEText', 'Beckers' ], 
     180    #         'country' => [ 'NEText', 'England' ], 
     181    #     }, 
     182    # ] ] 
    293183 
    294184    say "# debug: orange food suppliers found:"; 
    295     say "# " ~ $rel_def_matched_suppl.as_perl(); 
     185    say "# " ~ $matched_suppl_ast.as_perl(); 
    296186 
    297187    return; 
     
    333223        :dbms_config({}), 
    334224    ); 
    335  
    336     1; 
    337225 
    338226The current release of Muldis::DB::Validator uses L<Test> internally, and 
  • ext/Muldis-DB/t/MDB_50_Validate_Example.t

    r16640 r18100  
    44 
    55Muldis::DB::Validator::main( 
    6         :engine_name('Muldis::DB::Engine::Example'), 
    7         :dbms_config({}), 
    8     ); 
     6    :engine_name('Muldis::DB::Engine::Example'), 
     7    :dbms_config({}), 
     8);