374 SELECT X.cw_name |
377 SELECT X.cw_name |
375 FROM cw_Tag AS X |
378 FROM cw_Tag AS X |
376 UNION ALL |
379 UNION ALL |
377 SELECT X.cw_name |
380 SELECT X.cw_name |
378 FROM cw_Transition AS X |
381 FROM cw_Transition AS X |
|
382 UNION ALL |
|
383 SELECT X.cw_name |
|
384 FROM cw_Workflow AS X |
|
385 UNION ALL |
|
386 SELECT X.cw_name |
|
387 FROM cw_WorkflowTransition AS X |
379 ORDER BY 1'''), |
388 ORDER BY 1'''), |
380 |
389 |
381 # DISTINCT, can use relation under exists scope as principal |
390 # DISTINCT, can use relation under exists scope as principal |
382 ('DISTINCT Any X,Y WHERE X name "CWGroup", Y eid IN(1, 2, 3), EXISTS(X read_permission Y)', |
391 ('DISTINCT Any X,Y WHERE X name "CWGroup", Y eid IN(1, 2, 3), EXISTS(X read_permission Y)', |
383 '''SELECT DISTINCT X.cw_eid, rel_read_permission0.eid_to |
392 '''SELECT DISTINCT X.cw_eid, rel_read_permission0.eid_to |
460 FROM cw_CWRType AS X, cw_RQLExpression AS Y |
469 FROM cw_CWRType AS X, cw_RQLExpression AS Y |
461 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid)'''), |
470 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid)'''), |
462 |
471 |
463 ('Any MAX(X)+MIN(X), N GROUPBY N WHERE X name N;', |
472 ('Any MAX(X)+MIN(X), N GROUPBY N WHERE X name N;', |
464 '''SELECT (MAX(T1.C0) + MIN(T1.C0)), T1.C1 FROM (SELECT X.cw_eid AS C0, X.cw_name AS C1 |
473 '''SELECT (MAX(T1.C0) + MIN(T1.C0)), T1.C1 FROM (SELECT X.cw_eid AS C0, X.cw_name AS C1 |
|
474 FROM cw_BaseTransition AS X |
|
475 UNION ALL |
|
476 SELECT X.cw_eid AS C0, X.cw_name AS C1 |
465 FROM cw_Basket AS X |
477 FROM cw_Basket AS X |
466 UNION ALL |
478 UNION ALL |
467 SELECT X.cw_eid AS C0, X.cw_name AS C1 |
479 SELECT X.cw_eid AS C0, X.cw_name AS C1 |
468 FROM cw_CWCache AS X |
480 FROM cw_CWCache AS X |
469 UNION ALL |
481 UNION ALL |
496 UNION ALL |
508 UNION ALL |
497 SELECT X.cw_eid AS C0, X.cw_name AS C1 |
509 SELECT X.cw_eid AS C0, X.cw_name AS C1 |
498 FROM cw_Tag AS X |
510 FROM cw_Tag AS X |
499 UNION ALL |
511 UNION ALL |
500 SELECT X.cw_eid AS C0, X.cw_name AS C1 |
512 SELECT X.cw_eid AS C0, X.cw_name AS C1 |
501 FROM cw_Transition AS X) AS T1 |
513 FROM cw_Transition AS X |
|
514 UNION ALL |
|
515 SELECT X.cw_eid AS C0, X.cw_name AS C1 |
|
516 FROM cw_Workflow AS X |
|
517 UNION ALL |
|
518 SELECT X.cw_eid AS C0, X.cw_name AS C1 |
|
519 FROM cw_WorkflowTransition AS X) AS T1 |
502 GROUP BY T1.C1'''), |
520 GROUP BY T1.C1'''), |
503 |
521 |
504 ('Any MAX(X)+MIN(LENGTH(D)), N GROUPBY N ORDERBY 1, N, DF WHERE X name N, X data D, X data_format DF;', |
522 ('Any MAX(X)+MIN(LENGTH(D)), N GROUPBY N ORDERBY 1, N, DF WHERE X name N, X data D, X data_format DF;', |
505 '''SELECT (MAX(T1.C1) + MIN(LENGTH(T1.C0))), T1.C2 FROM (SELECT X.cw_data AS C0, X.cw_eid AS C1, X.cw_name AS C2, X.cw_data_format AS C3 |
523 '''SELECT (MAX(T1.C1) + MIN(LENGTH(T1.C0))), T1.C2 FROM (SELECT X.cw_data AS C0, X.cw_eid AS C1, X.cw_name AS C2, X.cw_data_format AS C3 |
506 FROM cw_File AS X |
524 FROM cw_File AS X |
1027 FROM cw_Note AS N, cw_Personne AS P |
1045 FROM cw_Note AS N, cw_Personne AS P |
1028 WHERE NOT EXISTS(SELECT 1 WHERE N.cw_ecrit_par=P.cw_eid) AND N.cw_eid=512'''), |
1046 WHERE NOT EXISTS(SELECT 1 WHERE N.cw_ecrit_par=P.cw_eid) AND N.cw_eid=512'''), |
1029 |
1047 |
1030 ('Any S,ES,T WHERE S state_of ET, ET name "CWUser", ES allowed_transition T, T destination_state S', |
1048 ('Any S,ES,T WHERE S state_of ET, ET name "CWUser", ES allowed_transition T, T destination_state S', |
1031 '''SELECT T.cw_destination_state, rel_allowed_transition1.eid_from, T.cw_eid |
1049 '''SELECT T.cw_destination_state, rel_allowed_transition1.eid_from, T.cw_eid |
1032 FROM allowed_transition_relation AS rel_allowed_transition1, cw_CWEType AS ET, cw_Transition AS T, state_of_relation AS rel_state_of0 |
1050 FROM allowed_transition_relation AS rel_allowed_transition1, cw_Transition AS T, cw_Workflow AS ET, state_of_relation AS rel_state_of0 |
1033 WHERE T.cw_destination_state=rel_state_of0.eid_from AND rel_state_of0.eid_to=ET.cw_eid AND ET.cw_name=CWUser AND rel_allowed_transition1.eid_to=T.cw_eid'''), |
1051 WHERE T.cw_destination_state=rel_state_of0.eid_from AND rel_state_of0.eid_to=ET.cw_eid AND ET.cw_name=CWUser AND rel_allowed_transition1.eid_to=T.cw_eid'''), |
|
1052 |
1034 ('Any O WHERE S eid 0, S in_state O', |
1053 ('Any O WHERE S eid 0, S in_state O', |
1035 '''SELECT S.cw_in_state |
1054 '''SELECT S.cw_in_state |
1036 FROM cw_Affaire AS S |
1055 FROM cw_Affaire AS S |
1037 WHERE S.cw_eid=0 AND S.cw_in_state IS NOT NULL |
1056 WHERE S.cw_eid=0 AND S.cw_in_state IS NOT NULL |
1038 UNION ALL |
1057 UNION ALL |
1104 |
1123 |
1105 def test_nonregr_sol(self): |
1124 def test_nonregr_sol(self): |
1106 delete = self.rqlhelper.parse( |
1125 delete = self.rqlhelper.parse( |
1107 'DELETE X read_permission READ_PERMISSIONSUBJECT,X add_permission ADD_PERMISSIONSUBJECT,' |
1126 'DELETE X read_permission READ_PERMISSIONSUBJECT,X add_permission ADD_PERMISSIONSUBJECT,' |
1108 'X in_basket IN_BASKETSUBJECT,X delete_permission DELETE_PERMISSIONSUBJECT,' |
1127 'X in_basket IN_BASKETSUBJECT,X delete_permission DELETE_PERMISSIONSUBJECT,' |
1109 'X initial_state INITIAL_STATESUBJECT,X update_permission UPDATE_PERMISSIONSUBJECT,' |
1128 'X update_permission UPDATE_PERMISSIONSUBJECT,' |
1110 'X created_by CREATED_BYSUBJECT,X is ISSUBJECT,X is_instance_of IS_INSTANCE_OFSUBJECT,' |
1129 'X created_by CREATED_BYSUBJECT,X is ISSUBJECT,X is_instance_of IS_INSTANCE_OFSUBJECT,' |
1111 'X owned_by OWNED_BYSUBJECT,X specializes SPECIALIZESSUBJECT,ISOBJECT is X,' |
1130 'X owned_by OWNED_BYSUBJECT,X specializes SPECIALIZESSUBJECT,ISOBJECT is X,' |
1112 'SPECIALIZESOBJECT specializes X,STATE_OFOBJECT state_of X,IS_INSTANCE_OFOBJECT is_instance_of X,' |
1131 'SPECIALIZESOBJECT specializes X,IS_INSTANCE_OFOBJECT is_instance_of X,' |
1113 'TO_ENTITYOBJECT to_entity X,TRANSITION_OFOBJECT transition_of X,FROM_ENTITYOBJECT from_entity X ' |
1132 'TO_ENTITYOBJECT to_entity X,FROM_ENTITYOBJECT from_entity X ' |
1114 'WHERE X is CWEType') |
1133 'WHERE X is CWEType') |
1115 self.rqlhelper.compute_solutions(delete) |
1134 self.rqlhelper.compute_solutions(delete) |
1116 def var_sols(var): |
1135 def var_sols(var): |
1117 s = set() |
1136 s = set() |
1118 for sol in delete.solutions: |
1137 for sol in delete.solutions: |
1377 ('Personne X WHERE X has_text %(text)s', |
1396 ('Personne X WHERE X has_text %(text)s', |
1378 """SELECT X.eid |
1397 """SELECT X.eid |
1379 FROM appears AS appears0, entities AS X |
1398 FROM appears AS appears0, entities AS X |
1380 WHERE appears0.words @@ to_tsquery('default', 'hip&hop&momo') AND appears0.uid=X.eid AND X.type='Personne'"""), |
1399 WHERE appears0.words @@ to_tsquery('default', 'hip&hop&momo') AND appears0.uid=X.eid AND X.type='Personne'"""), |
1381 |
1400 |
1382 ('Any X WHERE X has_text "toto tata", X name "tutu"', |
1401 ('Any X WHERE X has_text "toto tata", X name "tutu", X is IN (Basket,File,Folder)', |
1383 """SELECT X.cw_eid |
1402 """SELECT X.cw_eid |
1384 FROM appears AS appears0, cw_Basket AS X |
1403 FROM appears AS appears0, cw_Basket AS X |
1385 WHERE appears0.words @@ to_tsquery('default', 'toto&tata') AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1404 WHERE appears0.words @@ to_tsquery('default', 'toto&tata') AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1386 UNION ALL |
1405 UNION ALL |
1387 SELECT X.cw_eid |
1406 SELECT X.cw_eid |
1389 WHERE appears0.words @@ to_tsquery('default', 'toto&tata') AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1408 WHERE appears0.words @@ to_tsquery('default', 'toto&tata') AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1390 UNION ALL |
1409 UNION ALL |
1391 SELECT X.cw_eid |
1410 SELECT X.cw_eid |
1392 FROM appears AS appears0, cw_Folder AS X |
1411 FROM appears AS appears0, cw_Folder AS X |
1393 WHERE appears0.words @@ to_tsquery('default', 'toto&tata') AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1412 WHERE appears0.words @@ to_tsquery('default', 'toto&tata') AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1394 UNION ALL |
1413 """), |
1395 SELECT X.cw_eid |
|
1396 FROM appears AS appears0, cw_Image AS X |
|
1397 WHERE appears0.words @@ to_tsquery('default', 'toto&tata') AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
|
1398 UNION ALL |
|
1399 SELECT X.cw_eid |
|
1400 FROM appears AS appears0, cw_State AS X |
|
1401 WHERE appears0.words @@ to_tsquery('default', 'toto&tata') AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
|
1402 UNION ALL |
|
1403 SELECT X.cw_eid |
|
1404 FROM appears AS appears0, cw_Tag AS X |
|
1405 WHERE appears0.words @@ to_tsquery('default', 'toto&tata') AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
|
1406 UNION ALL |
|
1407 SELECT X.cw_eid |
|
1408 FROM appears AS appears0, cw_Transition AS X |
|
1409 WHERE appears0.words @@ to_tsquery('default', 'toto&tata') AND appears0.uid=X.cw_eid AND X.cw_name=tutu"""), |
|
1410 |
1414 |
1411 ('Personne X where X has_text %(text)s, X travaille S, S has_text %(text)s', |
1415 ('Personne X where X has_text %(text)s, X travaille S, S has_text %(text)s', |
1412 """SELECT X.eid |
1416 """SELECT X.eid |
1413 FROM appears AS appears0, appears AS appears2, entities AS X, travaille_relation AS rel_travaille1 |
1417 FROM appears AS appears0, appears AS appears2, entities AS X, travaille_relation AS rel_travaille1 |
1414 WHERE appears0.words @@ to_tsquery('default', 'hip&hop&momo') AND appears0.uid=X.eid AND X.type='Personne' AND X.eid=rel_travaille1.eid_from AND appears2.uid=rel_travaille1.eid_to AND appears2.words @@ to_tsquery('default', 'hip&hop&momo')"""), |
1418 WHERE appears0.words @@ to_tsquery('default', 'hip&hop&momo') AND appears0.uid=X.eid AND X.type='Personne' AND X.eid=rel_travaille1.eid_from AND appears2.uid=rel_travaille1.eid_to AND appears2.words @@ to_tsquery('default', 'hip&hop&momo')"""), |
1541 ('Personne X WHERE X has_text "toto tata"', |
1545 ('Personne X WHERE X has_text "toto tata"', |
1542 """SELECT X.eid |
1546 """SELECT X.eid |
1543 FROM appears AS appears0, entities AS X |
1547 FROM appears AS appears0, entities AS X |
1544 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.eid AND X.type='Personne'"""), |
1548 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.eid AND X.type='Personne'"""), |
1545 |
1549 |
1546 ('Any X WHERE X has_text "toto tata", X name "tutu"', |
1550 ('Any X WHERE X has_text "toto tata", X name "tutu", X is IN (Basket,File,Folder)', |
1547 """SELECT X.cw_eid |
1551 """SELECT X.cw_eid |
1548 FROM appears AS appears0, cw_Basket AS X |
1552 FROM appears AS appears0, cw_Basket AS X |
1549 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1553 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1550 UNION ALL |
1554 UNION ALL |
1551 SELECT X.cw_eid |
1555 SELECT X.cw_eid |
1553 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1557 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1554 UNION ALL |
1558 UNION ALL |
1555 SELECT X.cw_eid |
1559 SELECT X.cw_eid |
1556 FROM appears AS appears0, cw_Folder AS X |
1560 FROM appears AS appears0, cw_Folder AS X |
1557 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1561 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1558 UNION ALL |
1562 """), |
1559 SELECT X.cw_eid |
|
1560 FROM appears AS appears0, cw_Image AS X |
|
1561 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
|
1562 UNION ALL |
|
1563 SELECT X.cw_eid |
|
1564 FROM appears AS appears0, cw_State AS X |
|
1565 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
|
1566 UNION ALL |
|
1567 SELECT X.cw_eid |
|
1568 FROM appears AS appears0, cw_Tag AS X |
|
1569 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
|
1570 UNION ALL |
|
1571 SELECT X.cw_eid |
|
1572 FROM appears AS appears0, cw_Transition AS X |
|
1573 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.cw_eid AND X.cw_name=tutu"""), |
|
1574 )): |
1563 )): |
1575 yield t |
1564 yield t |
1576 |
1565 |
1577 |
1566 |
1578 |
1567 |
1617 WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.eid AND X.type='Personne'"""), |
1606 WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.eid AND X.type='Personne'"""), |
1618 ('Personne X WHERE X has_text %(text)s', |
1607 ('Personne X WHERE X has_text %(text)s', |
1619 """SELECT X.eid |
1608 """SELECT X.eid |
1620 FROM appears AS appears0, entities AS X |
1609 FROM appears AS appears0, entities AS X |
1621 WHERE MATCH (appears0.words) AGAINST ('hip hop momo' IN BOOLEAN MODE) AND appears0.uid=X.eid AND X.type='Personne'"""), |
1610 WHERE MATCH (appears0.words) AGAINST ('hip hop momo' IN BOOLEAN MODE) AND appears0.uid=X.eid AND X.type='Personne'"""), |
1622 ('Any X WHERE X has_text "toto tata", X name "tutu"', |
1611 ('Any X WHERE X has_text "toto tata", X name "tutu", X is IN (Basket,File,Folder)', |
1623 """SELECT X.cw_eid |
1612 """SELECT X.cw_eid |
1624 FROM appears AS appears0, cw_Basket AS X |
1613 FROM appears AS appears0, cw_Basket AS X |
1625 WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1614 WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1626 UNION ALL |
1615 UNION ALL |
1627 SELECT X.cw_eid |
1616 SELECT X.cw_eid |
1629 WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1618 WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1630 UNION ALL |
1619 UNION ALL |
1631 SELECT X.cw_eid |
1620 SELECT X.cw_eid |
1632 FROM appears AS appears0, cw_Folder AS X |
1621 FROM appears AS appears0, cw_Folder AS X |
1633 WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1622 WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
1634 UNION ALL |
1623 """) |
1635 SELECT X.cw_eid |
|
1636 FROM appears AS appears0, cw_Image AS X |
|
1637 WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
|
1638 UNION ALL |
|
1639 SELECT X.cw_eid |
|
1640 FROM appears AS appears0, cw_State AS X |
|
1641 WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
|
1642 UNION ALL |
|
1643 SELECT X.cw_eid |
|
1644 FROM appears AS appears0, cw_Tag AS X |
|
1645 WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.cw_eid AND X.cw_name=tutu |
|
1646 UNION ALL |
|
1647 SELECT X.cw_eid |
|
1648 FROM appears AS appears0, cw_Transition AS X |
|
1649 WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.cw_eid AND X.cw_name=tutu""") |
|
1650 ] |
1624 ] |
1651 for t in self._parse(queries): |
1625 for t in self._parse(queries): |
1652 yield t |
1626 yield t |
1653 |
1627 |
1654 |
1628 |