diff --git a/proj_info/dumps/scene08_dump/init.edgeql b/proj_info/dumps/scene08_dump/init.edgeql new file mode 100755 index 0000000..8b1dbdd --- /dev/null +++ b/proj_info/dumps/scene08_dump/init.edgeql @@ -0,0 +1,5 @@ +# DESCRIBE SYSTEM CONFIG +CONFIGURE INSTANCE SET session_idle_transaction_timeout := 'PT10S'; + +# DESCRIBE ROLES +ALTER ROLE edgedb { SET password_hash := 'SCRAM-SHA-256$4096:uW/qwJYN670oH0drUrqR+g==$75aALunV2+1FahpEUh74VDSTys4mauysRRd/uafN7gE=:kCGhj9XQIWjla4CjzWPscgoyuyMOwD0RLHJSkXowhU0=';}; diff --git a/proj_info/dumps/scene08_dump/main.dump b/proj_info/dumps/scene08_dump/main.dump new file mode 100755 index 0000000..5dda7c9 Binary files /dev/null and b/proj_info/dumps/scene08_dump/main.dump differ diff --git a/proj_info/dumps/scene09_dump/init.edgeql b/proj_info/dumps/scene09_dump/init.edgeql new file mode 100755 index 0000000..8b1dbdd --- /dev/null +++ b/proj_info/dumps/scene09_dump/init.edgeql @@ -0,0 +1,5 @@ +# DESCRIBE SYSTEM CONFIG +CONFIGURE INSTANCE SET session_idle_transaction_timeout := 'PT10S'; + +# DESCRIBE ROLES +ALTER ROLE edgedb { SET password_hash := 'SCRAM-SHA-256$4096:uW/qwJYN670oH0drUrqR+g==$75aALunV2+1FahpEUh74VDSTys4mauysRRd/uafN7gE=:kCGhj9XQIWjla4CjzWPscgoyuyMOwD0RLHJSkXowhU0=';}; diff --git a/proj_info/dumps/scene09_dump/main.dump b/proj_info/dumps/scene09_dump/main.dump new file mode 100755 index 0000000..e3901ee Binary files /dev/null and b/proj_info/dumps/scene09_dump/main.dump differ diff --git a/proj_info/dumps/scene10_dump/init.edgeql b/proj_info/dumps/scene10_dump/init.edgeql new file mode 100755 index 0000000..8b1dbdd --- /dev/null +++ b/proj_info/dumps/scene10_dump/init.edgeql @@ -0,0 +1,5 @@ +# DESCRIBE SYSTEM CONFIG +CONFIGURE INSTANCE SET session_idle_transaction_timeout := 'PT10S'; + +# DESCRIBE ROLES +ALTER ROLE edgedb { SET password_hash := 'SCRAM-SHA-256$4096:uW/qwJYN670oH0drUrqR+g==$75aALunV2+1FahpEUh74VDSTys4mauysRRd/uafN7gE=:kCGhj9XQIWjla4CjzWPscgoyuyMOwD0RLHJSkXowhU0=';}; diff --git a/proj_info/dumps/scene10_dump/main.dump b/proj_info/dumps/scene10_dump/main.dump new file mode 100755 index 0000000..7c26e7a Binary files /dev/null and b/proj_info/dumps/scene10_dump/main.dump differ diff --git a/proj_info/edgedb.toml b/proj_info/edgedb.toml index fdaa311..d47a69a 100755 --- a/proj_info/edgedb.toml +++ b/proj_info/edgedb.toml @@ -1,2 +1,2 @@ [edgedb] -server-version = "4.5" \ No newline at end of file +server-version = "5.4" \ No newline at end of file diff --git a/proj_info/final_schema.esdl b/proj_info/final_schema.esdl index 7d63877..e316a52 100644 --- a/proj_info/final_schema.esdl +++ b/proj_info/final_schema.esdl @@ -150,7 +150,11 @@ module default { }; - type GangsterSpy extending Character, IsSpy; + type GangsterSpy extending Character, IsSpy { + overloaded police_rank: PoliceRank { + default:= PoliceRank.Protected; + } + }; type Landmark extending Place; type Location extending Place; diff --git a/proj_info/initial_schema.esdl b/proj_info/initial_schema.esdl index 690d3fe..36f13fd 100755 --- a/proj_info/initial_schema.esdl +++ b/proj_info/initial_schema.esdl @@ -75,7 +75,11 @@ module default { } type PoliceSpy extending Character, IsSpy; - type GangsterSpy extending Character, IsSpy; + type GangsterSpy extending Character, IsSpy { + overloaded police_rank: PoliceRank { + default:= PoliceRank.Protected; + } + }; type Landmark extending Place; type Location extending Place; diff --git a/proj_info/migrations/00001.edgeql b/proj_info/migrations/00001-m1icz4h.edgeql similarity index 95% rename from proj_info/migrations/00001.edgeql rename to proj_info/migrations/00001-m1icz4h.edgeql index 9baf5ca..9edba98 100755 --- a/proj_info/migrations/00001.edgeql +++ b/proj_info/migrations/00001-m1icz4h.edgeql @@ -1,4 +1,4 @@ -CREATE MIGRATION m1ol5jxvc6l2at2kztb5zask5icf6ckasntcbidrrfsx677askknoq +CREATE MIGRATION m1icz4hxkdlltw2fwwiief5tjgomwgr2ihpmdeny7owr235wmpqecq ONTO initial { CREATE ABSTRACT TYPE default::Person { @@ -33,13 +33,7 @@ CREATE MIGRATION m1ol5jxvc6l2at2kztb5zask5icf6ckasntcbidrrfsx677askknoq CREATE PROPERTY remarks: std::str; CREATE PROPERTY title: std::str; }; - CREATE SCALAR TYPE default::GangsterRank EXTENDING enum; CREATE SCALAR TYPE default::PoliceRank EXTENDING enum; - CREATE ABSTRACT TYPE default::IsGangster { - CREATE PROPERTY gangster_rank: default::GangsterRank { - SET default := (default::GangsterRank.Nobody); - }; - }; CREATE ABSTRACT TYPE default::IsPolice { CREATE PROPERTY dept: std::str; CREATE PROPERTY police_rank: default::PoliceRank { @@ -47,10 +41,23 @@ CREATE MIGRATION m1ol5jxvc6l2at2kztb5zask5icf6ckasntcbidrrfsx677askknoq }; CREATE PROPERTY is_officer := ((.police_rank >= default::PoliceRank.PI)); }; - CREATE ABSTRACT TYPE default::IsSpy EXTENDING default::IsPolice, default::IsGangster; - CREATE TYPE default::PoliceSpy EXTENDING default::Character, default::IsSpy; CREATE TYPE default::Police EXTENDING default::Character, default::IsPolice; + CREATE SCALAR TYPE default::GangsterRank EXTENDING enum; + CREATE ABSTRACT TYPE default::IsGangster { + CREATE PROPERTY gangster_rank: default::GangsterRank { + SET default := (default::GangsterRank.Nobody); + }; + }; + CREATE ABSTRACT TYPE default::IsSpy EXTENDING default::IsPolice, default::IsGangster; + CREATE TYPE default::GangsterSpy EXTENDING default::Character, default::IsSpy { + ALTER PROPERTY police_rank { + SET default := (default::PoliceRank.Protected); + SET OWNED; + SET TYPE default::PoliceRank; + }; + }; CREATE TYPE default::Gangster EXTENDING default::Character, default::IsGangster; + CREATE TYPE default::PoliceSpy EXTENDING default::Character, default::IsSpy; CREATE TYPE default::GangsterBoss EXTENDING default::Gangster { ALTER PROPERTY gangster_rank { SET default := (default::GangsterRank.Boss); @@ -59,10 +66,6 @@ CREATE MIGRATION m1ol5jxvc6l2at2kztb5zask5icf6ckasntcbidrrfsx677askknoq CREATE CONSTRAINT std::expression ON ((__subject__ = default::GangsterRank.Boss)); }; }; - ALTER TYPE default::IsGangster { - CREATE LINK gangster_boss: default::GangsterBoss; - }; - CREATE TYPE default::GangsterSpy EXTENDING default::Character, default::IsSpy; CREATE SCALAR TYPE default::DayOfWeek EXTENDING enum; CREATE SCALAR TYPE default::FuzzyDay EXTENDING std::int64 { CREATE CONSTRAINT std::expression ON (((__subject__ >= 1) AND (__subject__ <= 31))); @@ -137,6 +140,9 @@ CREATE MIGRATION m1ol5jxvc6l2at2kztb5zask5icf6ckasntcbidrrfsx677askknoq ALTER TYPE default::Event { CREATE MULTI LINK `when`: default::FuzzyTime; }; + ALTER TYPE default::IsGangster { + CREATE LINK gangster_boss: default::GangsterBoss; + }; ALTER TYPE default::GangsterBoss { CREATE CONSTRAINT std::expression ON ((__subject__ != .gangster_boss)) { SET errmessage := "The boss can't be his/her own boss."; diff --git a/proj_info/migrations/00002.edgeql b/proj_info/migrations/00002-m1d4u43.edgeql similarity index 88% rename from proj_info/migrations/00002.edgeql rename to proj_info/migrations/00002-m1d4u43.edgeql index 8214fcb..f288bd8 100755 --- a/proj_info/migrations/00002.edgeql +++ b/proj_info/migrations/00002-m1d4u43.edgeql @@ -1,5 +1,5 @@ -CREATE MIGRATION m16j44velzxt3wk6olqyjdj6yvptu4k6jrbeqlultuzdjdtx7fd7jq - ONTO m1ol5jxvc6l2at2kztb5zask5icf6ckasntcbidrrfsx677askknoq +CREATE MIGRATION m1d4u43vqej5cm2hj3atx2rwj64geqmcxwwqahnwx53d6yz5jedfaa + ONTO m1icz4hxkdlltw2fwwiief5tjgomwgr2ihpmdeny7owr235wmpqecq { CREATE ALIAS default::hon := ( std::assert_exists(std::assert_single((SELECT diff --git a/proj_info/migrations/00003.edgeql b/proj_info/migrations/00003-m1iolrl.edgeql similarity index 81% rename from proj_info/migrations/00003.edgeql rename to proj_info/migrations/00003-m1iolrl.edgeql index 721cd93..148380b 100755 --- a/proj_info/migrations/00003.edgeql +++ b/proj_info/migrations/00003-m1iolrl.edgeql @@ -1,5 +1,5 @@ -CREATE MIGRATION m16xboo673icbje6taadxtud76v5hfutc3hjzxexhy42lszjhogpda - ONTO m16j44velzxt3wk6olqyjdj6yvptu4k6jrbeqlultuzdjdtx7fd7jq +CREATE MIGRATION m1iolrlkdl63zmbic6vfn3jcbkcygyvzoj6fcg4jo7qv7nfctnjrnq + ONTO m1d4u43vqej5cm2hj3atx2rwj64geqmcxwwqahnwx53d6yz5jedfaa { CREATE ALIAS default::chen := ( std::assert_exists(std::assert_single((SELECT diff --git a/proj_info/migrations/00004.edgeql b/proj_info/migrations/00004-m1dccfq.edgeql similarity index 65% rename from proj_info/migrations/00004.edgeql rename to proj_info/migrations/00004-m1dccfq.edgeql index d3a4757..330e3ab 100755 --- a/proj_info/migrations/00004.edgeql +++ b/proj_info/migrations/00004-m1dccfq.edgeql @@ -1,5 +1,5 @@ -CREATE MIGRATION m136gnzuezxpgyv7ju4pgostosaq3uql6nnqlyzipkvnjmcdicalxq - ONTO m16xboo673icbje6taadxtud76v5hfutc3hjzxexhy42lszjhogpda +CREATE MIGRATION m1dccfqhsgaadnglq2ckmbu5a2e7yzpxqb2cuf2airm75lj7unb27a + ONTO m1iolrlkdl63zmbic6vfn3jcbkcygyvzoj6fcg4jo7qv7nfctnjrnq { CREATE TYPE default::ChenLauContact EXTENDING default::Event { ALTER LINK who { diff --git a/proj_info/migrations/00005.edgeql b/proj_info/migrations/00005-m1fn7t6.edgeql similarity index 87% rename from proj_info/migrations/00005.edgeql rename to proj_info/migrations/00005-m1fn7t6.edgeql index c7acfa3..62dee35 100755 --- a/proj_info/migrations/00005.edgeql +++ b/proj_info/migrations/00005-m1fn7t6.edgeql @@ -1,5 +1,5 @@ -CREATE MIGRATION m1fjui2bohofvhbeyii2pas6fzupyb7a5odygxpqaeewnxrkbtqrhq - ONTO m136gnzuezxpgyv7ju4pgostosaq3uql6nnqlyzipkvnjmcdicalxq +CREATE MIGRATION m1fn7t6zu27x3lrukpvwfqgliidyq6ouxtqmwqa77mjjuqu37npe6q + ONTO m1dccfqhsgaadnglq2ckmbu5a2e7yzpxqb2cuf2airm75lj7unb27a { CREATE ALIAS default::police_station := ( std::assert_exists(std::assert_single((SELECT diff --git a/proj_info/migrations/00006.edgeql b/proj_info/migrations/00006-m1aied2.edgeql similarity index 83% rename from proj_info/migrations/00006.edgeql rename to proj_info/migrations/00006-m1aied2.edgeql index 8229577..9568a10 100755 --- a/proj_info/migrations/00006.edgeql +++ b/proj_info/migrations/00006-m1aied2.edgeql @@ -1,5 +1,5 @@ -CREATE MIGRATION m1uv5jvgusazq2gzf3n2nuiprqremmgfkiphxwydvhqttk7dqida7a - ONTO m1fjui2bohofvhbeyii2pas6fzupyb7a5odygxpqaeewnxrkbtqrhq +CREATE MIGRATION m1aied2jdcfmhoyemqucenfzfugenpfkrltizeqmppzossbnlgdiea + ONTO m1fn7t6zu27x3lrukpvwfqgliidyq6ouxtqmwqa77mjjuqu37npe6q { CREATE ABSTRACT TYPE default::Archive; CREATE TYPE default::CriminalRecord EXTENDING default::Archive { diff --git a/proj_info/migrations/00007.edgeql b/proj_info/migrations/00007-m1d2wep.edgeql similarity index 86% rename from proj_info/migrations/00007.edgeql rename to proj_info/migrations/00007-m1d2wep.edgeql index 3bf5be0..92ca0cb 100755 --- a/proj_info/migrations/00007.edgeql +++ b/proj_info/migrations/00007-m1d2wep.edgeql @@ -1,5 +1,5 @@ -CREATE MIGRATION m1ngvzy5p3nncwvb6a5s565yxpkpme45yca2wkfxa764ha3nq5amja - ONTO m1uv5jvgusazq2gzf3n2nuiprqremmgfkiphxwydvhqttk7dqida7a +CREATE MIGRATION m1d2wepwiyhx6ddv7rey265hmvm73jorq6as6ddtu337jwjfdrl4sq + ONTO m1aied2jdcfmhoyemqucenfzfugenpfkrltizeqmppzossbnlgdiea { CREATE FUNCTION default::is_hi_fi_store_open(dow: default::DayOfWeek, visit_hour: std::int64) -> std::bool USING (WITH open_hours := diff --git a/proj_info/migrations/00008.edgeql b/proj_info/migrations/00008-m1en23a.edgeql similarity index 84% rename from proj_info/migrations/00008.edgeql rename to proj_info/migrations/00008-m1en23a.edgeql index f2c4c68..3848b60 100755 --- a/proj_info/migrations/00008.edgeql +++ b/proj_info/migrations/00008-m1en23a.edgeql @@ -1,5 +1,5 @@ -CREATE MIGRATION m167aa2yvy7i3v65yyzo4clj6ik3ugilphxirh2o42wnq7g2i7xnta - ONTO m1ngvzy5p3nncwvb6a5s565yxpkpme45yca2wkfxa764ha3nq5amja +CREATE MIGRATION m1en23ahl7rdq4pcuaoejswszaybhzlgxc3qwpcks56ba7rmc5q6wq + ONTO m1d2wepwiyhx6ddv7rey265hmvm73jorq6as6ddtu337jwjfdrl4sq { CREATE ALIAS default::year_2002 := ( std::assert_exists(std::assert_single((SELECT diff --git a/proj_info/migrations/00009.edgeql b/proj_info/migrations/00009-m1dem5e.edgeql similarity index 66% rename from proj_info/migrations/00009.edgeql rename to proj_info/migrations/00009-m1dem5e.edgeql index c781eb2..e531e3c 100755 --- a/proj_info/migrations/00009.edgeql +++ b/proj_info/migrations/00009-m1dem5e.edgeql @@ -1,5 +1,5 @@ -CREATE MIGRATION m17ioxejmqetxu4ex54m2gt66tjxtyicsvy67eb3p5nhn3hjrz4zhq - ONTO m167aa2yvy7i3v65yyzo4clj6ik3ugilphxirh2o42wnq7g2i7xnta +CREATE MIGRATION m1dem5eboiim52mq67hlkcoznwqmusag66vp6yfh7ynuggbp3y5cfq + ONTO m1en23ahl7rdq4pcuaoejswszaybhzlgxc3qwpcks56ba7rmc5q6wq { CREATE TYPE default::Beverage { CREATE LINK consumed_by: default::Character; diff --git a/proj_info/migrations/00010.edgeql b/proj_info/migrations/00010-m1ngyzn.edgeql similarity index 85% rename from proj_info/migrations/00010.edgeql rename to proj_info/migrations/00010-m1ngyzn.edgeql index 5ca53e1..f9a9493 100755 --- a/proj_info/migrations/00010.edgeql +++ b/proj_info/migrations/00010-m1ngyzn.edgeql @@ -1,5 +1,5 @@ -CREATE MIGRATION m1ppscybzqoxvx32xwgtfcxz5n4k7nprbzhrkw6n2nn7lleky2ngma - ONTO m17ioxejmqetxu4ex54m2gt66tjxtyicsvy67eb3p5nhn3hjrz4zhq +CREATE MIGRATION m1ngyznn6gdb6gjlvzcgw7dvdrmz7fbbfxzllxc3765gviarr4dvvq + ONTO m1dem5eboiim52mq67hlkcoznwqmusag66vp6yfh7ynuggbp3y5cfq { CREATE SCALAR TYPE default::TeamTreatNumber EXTENDING std::sequence; CREATE TYPE default::CIBTeamTreat { diff --git a/proj_info/migrations/00011.edgeql b/proj_info/migrations/00011-m1lp75t.edgeql similarity index 76% rename from proj_info/migrations/00011.edgeql rename to proj_info/migrations/00011-m1lp75t.edgeql index 71ebb65..a85668d 100755 --- a/proj_info/migrations/00011.edgeql +++ b/proj_info/migrations/00011-m1lp75t.edgeql @@ -1,5 +1,5 @@ -CREATE MIGRATION m1cyfd35g55tg36lvobgy2hmxkrpmvvk432vskn5exxmslw3bxyv2a - ONTO m1ppscybzqoxvx32xwgtfcxz5n4k7nprbzhrkw6n2nn7lleky2ngma +CREATE MIGRATION m1lp75tn62kfa4dbkkkv2u4pr3t2jjeyrix7cntwllnjid2mmu23qq + ONTO m1ngyznn6gdb6gjlvzcgw7dvdrmz7fbbfxzllxc3765gviarr4dvvq { CREATE TYPE default::Envelope { CREATE ACCESS POLICY allow_select_insert_delete diff --git a/proj_info/migrations/00012-m1f62bc.edgeql b/proj_info/migrations/00012-m1f62bc.edgeql new file mode 100755 index 0000000..40e31ba --- /dev/null +++ b/proj_info/migrations/00012-m1f62bc.edgeql @@ -0,0 +1,5 @@ +CREATE MIGRATION m1f62bczhdawkow3bphndbuie3gdl2htatf5mxatxw54hqjoy5laaa + ONTO m1lp75tn62kfa4dbkkkv2u4pr3t2jjeyrix7cntwllnjid2mmu23qq +{ + CREATE EXTENSION pg_trgm VERSION '1.6'; +}; diff --git a/proj_info/migrations/00012.edgeql b/proj_info/migrations/00012.edgeql deleted file mode 100755 index 042fad3..0000000 --- a/proj_info/migrations/00012.edgeql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE MIGRATION m1phcwjq6nmblgjtyh4dov4gm2fspye4oub7ybyjv3dryr56vwnfjq - ONTO m1cyfd35g55tg36lvobgy2hmxkrpmvvk432vskn5exxmslw3bxyv2a -{ - CREATE EXTENSION pg_trgm VERSION '1.6'; -}; diff --git a/proj_info/migrations/00013.edgeql b/proj_info/migrations/00013-m1yd24u.edgeql similarity index 96% rename from proj_info/migrations/00013.edgeql rename to proj_info/migrations/00013-m1yd24u.edgeql index b297f19..20b01b4 100755 --- a/proj_info/migrations/00013.edgeql +++ b/proj_info/migrations/00013-m1yd24u.edgeql @@ -1,5 +1,5 @@ -CREATE MIGRATION m177hjcna3qg77ddbvyxmmbrye3wpwcknz7i6qa4n6ivbq5jejxwwq - ONTO m1phcwjq6nmblgjtyh4dov4gm2fspye4oub7ybyjv3dryr56vwnfjq +CREATE MIGRATION m1yd24uzikzfjk3lbwpgeyzo6kjgourvj5wu7psvbog67u3n4wjmpq + ONTO m1f62bczhdawkow3bphndbuie3gdl2htatf5mxatxw54hqjoy5laaa { CREATE EXTENSION pgcrypto VERSION '1.3'; CREATE ALIAS default::morse_code_of_undercover := ( diff --git a/proj_info/migrations/00014.edgeql b/proj_info/migrations/00014-m1ecf5p.edgeql similarity index 59% rename from proj_info/migrations/00014.edgeql rename to proj_info/migrations/00014-m1ecf5p.edgeql index 2f55af4..d3e2783 100755 --- a/proj_info/migrations/00014.edgeql +++ b/proj_info/migrations/00014-m1ecf5p.edgeql @@ -1,5 +1,5 @@ -CREATE MIGRATION m1hgbgfi27lwf3vg6pilotkr4i6vxhuqns3zzvhlf7y5czuj53giva - ONTO m177hjcna3qg77ddbvyxmmbrye3wpwcknz7i6qa4n6ivbq5jejxwwq +CREATE MIGRATION m1ecf5pn6k7l4kwhb5w3eg3ucwppgfykndhsxaxkputy3kig7itwva + ONTO m1yd24uzikzfjk3lbwpgeyzo6kjgourvj5wu7psvbog67u3n4wjmpq { ALTER TYPE default::Character { ALTER LINK lover { diff --git a/proj_info/queries/scene01/01_start.edgeql b/proj_info/queries/scene01/01_start.edgeql new file mode 100755 index 0000000..db20692 --- /dev/null +++ b/proj_info/queries/scene01/01_start.edgeql @@ -0,0 +1,27 @@ +insert FuzzyTime {fuzzy_year:= 1992}; + +insert Actor { + name:= "曾志偉", + eng_name:= "Eric", + nickname:= "獎老", +}; + +insert GangsterBoss { + name:= "韓琛", + nickname:= "琛哥", + classic_lines:= ["一將功成萬骨枯"], + actors := assert_single((select Actor filter .name = "曾志偉")), +}; + +insert Actor { + name:= "陳冠希", + eng_name:= "Edison", +}; + +insert GangsterSpy { + name:= "劉建明", + nickname:= "劉仔", + gangster_boss:= assert_single((select GangsterBoss filter .name = "韓琛")), + dept:= "警校學生", + actors := assert_single((select Actor filter .name in {"陳冠希"})), +}; \ No newline at end of file diff --git a/proj_info/queries/scene01/02_end.edgeql b/proj_info/queries/scene01/02_end.edgeql new file mode 100755 index 0000000..c37c3e6 --- /dev/null +++ b/proj_info/queries/scene01/02_end.edgeql @@ -0,0 +1,14 @@ +select test_alias(); + +insert Scene { + title:= "韓琛初現", + detail:= "韓琛準備派遣多個身家較為清白的小弟臥底至香港警隊,包括建明。" ++ + "他向小弟們講述著自己的過去,並說自己不相信算命先生所說的" ++ + "「一將功成萬骨枯」。他認為出來混的,未來的路怎麼走應該由自己決定。", + remarks:= "1.假設此場景為1992年。", + who:= {hon, lau}, + `when`:= year_1992, + where:= (insert Location {name:= "佛堂"}) , + references:= [("維基百科-無間道", "https://zh.wikipedia.org/zh-tw/%E7%84%A1%E9%96%93%E9%81%93"), + ("香港警察職級", "https://zh.wikipedia.org/zh-tw/%E9%A6%99%E6%B8%AF%E8%AD%A6%E5%AF%9F%E8%81%B7%E7%B4%9A")] +}; \ No newline at end of file diff --git a/proj_info/queries/scene02/01_start.edgeql b/proj_info/queries/scene02/01_start.edgeql new file mode 100755 index 0000000..27524e3 --- /dev/null +++ b/proj_info/queries/scene02/01_start.edgeql @@ -0,0 +1,21 @@ +insert PoliceSpy { + name:="陳永仁", + nickname:= "仁哥", + gangster_boss:= hon, + actors := (insert Actor { + name:= "余文樂", + eng_name:= "Shawn", + nickname:= "六叔", + }), +}; + +insert Police { + name:= "黃志誠", + nickname:= "黃sir", + police_rank:= PoliceRank.SIP, + actors := (insert Actor { + name:= "黃秋生", + eng_name:= "Anthony", + nickname:= "大飛哥", + }), +}; \ No newline at end of file diff --git a/proj_info/queries/scene02/02_1st.edgeql b/proj_info/queries/scene02/02_1st.edgeql new file mode 100755 index 0000000..efab5fe --- /dev/null +++ b/proj_info/queries/scene02/02_1st.edgeql @@ -0,0 +1 @@ +select test_alias(); \ No newline at end of file diff --git a/proj_info/queries/scene02/03_end.edgeql b/proj_info/queries/scene02/03_end.edgeql new file mode 100755 index 0000000..b8bef16 --- /dev/null +++ b/proj_info/queries/scene02/03_end.edgeql @@ -0,0 +1,18 @@ +insert ChenLauContact { + how:= "面對面", + detail:= "永仁假裝鬧事被趕出警校時,與建明在門口有一面之緣。", + `when`:= year_1992, + where:= (insert Landmark {name:= "警校"}), +}; + +insert Scene { + title:= "我想跟他換", + detail:= "葉校長與黃sir準備於警校新生中,挑選適合的新人臥底至黑社會。" ++ + "永仁天資優異,觀察入微,為臥底的不二人選。兩人指示永仁假裝鬧" ++ + "事並趁機將其趕出警校,而建明此時剛好入學,看著永仁背影喃喃自" ++ + "語道:「我想跟他換」。或許建明從一開始就真的想做個好人?", + remarks:= "1.假設黃Sir於1992年官階為`SIP`。", + who:= {wong, chen, lau}, + `when`:= year_1992, + where:= (select Landmark filter .name="警校"), +}; \ No newline at end of file diff --git a/proj_info/queries/scene03/01_start.edgeql b/proj_info/queries/scene03/01_start.edgeql new file mode 100755 index 0000000..f58d124 --- /dev/null +++ b/proj_info/queries/scene03/01_start.edgeql @@ -0,0 +1,3 @@ +insert FuzzyTime {fuzzy_year:= 1994}; + +insert Landmark {name:= "警察局"}; \ No newline at end of file diff --git a/proj_info/queries/scene03/02_1st.edgeql b/proj_info/queries/scene03/02_1st.edgeql new file mode 100755 index 0000000..1cf65fe --- /dev/null +++ b/proj_info/queries/scene03/02_1st.edgeql @@ -0,0 +1,12 @@ +select test_alias(); + +update lau set { + police_rank:= PoliceRank.PC +}; + +insert ChenLauContact { + how:= "面對面", + detail:= "建明逮捕永仁並在警局替其做筆錄。", + `when`:= year_1994, + where:= police_station, +}; \ No newline at end of file diff --git a/proj_info/queries/scene03/03_end.edgeql b/proj_info/queries/scene03/03_end.edgeql new file mode 100755 index 0000000..dc04a39 --- /dev/null +++ b/proj_info/queries/scene03/03_end.edgeql @@ -0,0 +1,36 @@ +with records:= {("CCR9314768", "OFFNCE: A.O.A.B.H "), ("RN992317", "CD-POD ")}, +for record in records +union (insert CriminalRecord { + ref_no:= record.0, + code:= record.1, + involved:= chen, +}); + + + +select CriminalRecord {**}; + +for record in CriminalRecord +union ( + update record + set { + code:= str_trim_end(.code) + } +); + +select CriminalRecord {**}; + +select chen {criminal_records:= ."1992-12-01T00:00:00+08"; +select to_datetime("1992-12-01T00:00:00+08"); +select to_datetime(1992, 12, 1, 0, 0, 0, "Asia/hong_kong"); +select to_datetime("1992-12-01T00:00:00", "Asia/hong_kong"); + +select "9 years 10 months"; + +select "1992-12-01T00:00:00+08" + "9 years 10 months"; + +with t:=(select "1992-12-01T00:00:00+08" + "9 years 10 months") +select cal::to_local_datetime(t, "Asia/hong_kong"); + +select "1992-12-01T00:00:00" + "9 years 10 months"; + +select "2002-10-25" - "2002-10-01"; + +insert Scene { + title:= "三年之後又三年", + detail:= "永仁與黃sir相約於天台交換情報,韓琛將於這星期進行毒品" ++ + "交易,地點未知。黃sir則說他費盡心力將永仁傷人的案子由" ++ + "坐牢改成看心理醫生,交待永仁要照做。永仁抱怨自己被黃sir" ++ + "騙了,說好只當三年臥底,結果現在都快十年了,不知道何時才" ++ + "能恢復警察身份。十年間發生了太多事,永仁看著黃sir送的手錶" ++ + ",他有時候真的不知道該用什麼心態面對黃sir(詳情請見無間道Ⅱ" ++ + "及無間道Ⅲ)。", + who:= {wong, chen}, + `when`:= year_2002, + where:= (insert Location {name:="天台"}), +}; diff --git a/proj_info/queries/scene06/01_start_end.edgeql b/proj_info/queries/scene06/01_start_end.edgeql new file mode 100755 index 0000000..dad31e8 --- /dev/null +++ b/proj_info/queries/scene06/01_start_end.edgeql @@ -0,0 +1,143 @@ +insert Location {name:="大廈三樓"}; + +update wong +set { + police_rank:= PoliceRank.SP, + dept:= "有組織罪案及三合會調查科(O記)", +}; + +for i in range_unpack(range(1, 11)) +union ( + insert Police { + name:= "police_" ++ i, + dept:= "有組織罪案及三合會調查科(O記)", + police_rank:= PoliceRank.SPC, + } +); + +update lau +set { + police_rank:= PoliceRank.SIP, + dept:= "刑事情報科(CIB)", +}; + +insert Police{ + name:= "林國平", + nickname:="大B", + police_rank:= PoliceRank.SSGT, + dept:= "刑事情報科(CIB)", + actors:= ( + insert Actor{ + name:= "林家棟", + eng_name:= "Gordon", + } + ) +}; + +for name in {"大象", "孖八"} +union ( + insert Police { + name:= name, + nickname:= name, + dept:= "刑事情報科(CIB)", + police_rank:= PoliceRank.SGT, + } +); + +for i in range_unpack(range(11, 14)) +union ( + insert Police { + name:= "police_" ++ i, + dept:= "刑事情報科(CIB)", + police_rank:= PoliceRank.SPC, + } +); + +insert Gangster { + name:= "迪比亞路", + nickname:= "迪路", + gangster_boss:= hon, + gangster_rank:= GangsterRank.Leader, + actors:= (insert Actor { + name:= "林迪安", + eng_name:="Dion", + }), +}; + +insert Gangster { + name:= "徐偉強", + nickname:= "傻強", + gangster_boss:= hon, + gangster_rank:= GangsterRank.Leader, + actors:= (insert Actor { + name:= "杜汶澤", + eng_name:= "Edward", + }), +}; + +for i in range_unpack(range(1, 11)) +union ( + insert Gangster { + name:= "gangster_" ++ i, + gangster_boss:= hon, + gangster_rank:= GangsterRank.Nobody, + } +); + +for loc in {"葵涌碼頭", "三號幹線", "龍鼓灘"} +union ( + insert Landmark{ + name:= loc, + } +); + +insert ChenLauContact { + how:= "面對面", + detail:= "黃sir帶隊進入韓琛毒品交易現場", + `when`:= year_2002, + where:= assert_single((select Location filter .name="大廈三樓")), +}; + +with p:= Police union PoliceSpy union GangsterSpy, + g:= (group p by .police_rank), +select g {**}; + +with p:= Police union PoliceSpy union GangsterSpy, + g:= (group p by .police_rank), +select g {police_rank:= .key.police_rank, + counts:= count(.elements)} +order by .police_rank desc; + +with g:= (group Place + using name_length:= len(.name) + by name_length), +select g {name_length:= .key.name_length , + counts:= count(.elements), + names:= .elements.name} +order by .name_length desc; + +with g:= (group Place + using name_length:= len(.name) + by name_length), +select g {name_length:= .key.name_length , + counts:= count(.elements), + names:= .elements.name} +order by .counts desc; + +with policemen:= (select Police filter .dept in {"有組織罪案及三合會調查科(O記)", "刑事情報科(CIB)"}), + gangsters:= (select Gangster filter .gangster_boss=hon) +insert Scene { + title:= "有內鬼終止交易", + detail:= "O記聯合CIB準備於今晚韓琛與泰國佬交易可卡因(古柯鹼)時,來個" ++ + "人贓並獲。建明知道後,假裝打電話給家人,通知韓琛。韓琛一直監" ++ + "聽警方頻道,並指示迪路和傻強四處亂晃,不要前往交易地點。過程中," ++ + "永仁一直以摩斯密碼與黃sir聯絡。黃sir在得知韓琛監聽頻道後,隨即" ++ + "轉換頻道,並使用舊頻道發出今晚行動取消的指令。韓琛信以為真,指示" ++ + "迪路和傻強可以前往龍鼓灘交易。正當交易完成,黃sir準備先逮捕迪路" ++ + "和傻強將毒品扣下,再衝進屋逮捕韓琛之際,建仁使用簡訊傳送「有內鬼," ++ + "終止交易」到韓琛所在位置附近的所有手機。", + who:= policemen union gangsters union {chen, lau, hon}, + `when`:= year_2002, + where:= (select Place filter .name="大廈三樓" or .name="龍鼓灘"), + remarks:= "1.假設國平官階為`SSGT`,大象與孖八官階為`SGT`。" +}; \ No newline at end of file diff --git a/proj_info/queries/scene07/02_1st.edgeql b/proj_info/queries/scene07/02_1st.edgeql new file mode 100755 index 0000000..3755853 --- /dev/null +++ b/proj_info/queries/scene07/02_1st.edgeql @@ -0,0 +1,30 @@ +insert Store {name:="龍鼓灘"}; + +insert Beverage { + name:= "熱奶茶", + produced_by:= assert_single((select Store filter .name="龍鼓灘")), + consumed_by:= lau, + `when`:= (insert FuzzyTime {fuzzy_hour:=15, fuzzy_minute:=15}), #三點三 + where:= police_station, +}; + +insert Beverage { + name:= "綠茶", + consumed_by:= lau, + `when`:= (insert FuzzyTime {fuzzy_hour:=20, fuzzy_minute:=15}), + where:= assert_single((select Location filter .name="大廈三樓")), +}; + +insert Beverage { + name:= "凍檸茶", + produced_by:= assert_single((select Store filter .name="龍鼓灘")), + consumed_by:= hon, + `when`:= (insert FuzzyTime {fuzzy_hour:=23, fuzzy_minute:=15}), + where:= police_station, +}; + +select Beverage {name} filter .consumed_by=lau; + +select lau {name, nickname, beverages:= .(select Police filter .name="test_DCP").id, +select Police filter .id=pid; + +with pid:= (select Police filter .name="test_DCP").id, +select pid; + +with pid:= (select Police filter .name="test_DCP").id, +select (pid) {*}; + +with pid:= (select Police filter .name="test_DCP").id, +select pid; + +with pid:= (select Police filter .name="test_DCP").id, +delete pid; + +reset global current_user_id; + +