Skip to content

Commit

Permalink
update proj_info/
Browse files Browse the repository at this point in the history
  • Loading branch information
jrycw committed Jul 28, 2024
1 parent 8c1bdf5 commit 9180006
Show file tree
Hide file tree
Showing 44 changed files with 803 additions and 45 deletions.
5 changes: 5 additions & 0 deletions proj_info/dumps/scene08_dump/init.edgeql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# DESCRIBE SYSTEM CONFIG
CONFIGURE INSTANCE SET session_idle_transaction_timeout := <std::duration>'PT10S';

# DESCRIBE ROLES
ALTER ROLE edgedb { SET password_hash := 'SCRAM-SHA-256$4096:uW/qwJYN670oH0drUrqR+g==$75aALunV2+1FahpEUh74VDSTys4mauysRRd/uafN7gE=:kCGhj9XQIWjla4CjzWPscgoyuyMOwD0RLHJSkXowhU0=';};
Binary file added proj_info/dumps/scene08_dump/main.dump
Binary file not shown.
5 changes: 5 additions & 0 deletions proj_info/dumps/scene09_dump/init.edgeql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# DESCRIBE SYSTEM CONFIG
CONFIGURE INSTANCE SET session_idle_transaction_timeout := <std::duration>'PT10S';

# DESCRIBE ROLES
ALTER ROLE edgedb { SET password_hash := 'SCRAM-SHA-256$4096:uW/qwJYN670oH0drUrqR+g==$75aALunV2+1FahpEUh74VDSTys4mauysRRd/uafN7gE=:kCGhj9XQIWjla4CjzWPscgoyuyMOwD0RLHJSkXowhU0=';};
Binary file added proj_info/dumps/scene09_dump/main.dump
Binary file not shown.
5 changes: 5 additions & 0 deletions proj_info/dumps/scene10_dump/init.edgeql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# DESCRIBE SYSTEM CONFIG
CONFIGURE INSTANCE SET session_idle_transaction_timeout := <std::duration>'PT10S';

# DESCRIBE ROLES
ALTER ROLE edgedb { SET password_hash := 'SCRAM-SHA-256$4096:uW/qwJYN670oH0drUrqR+g==$75aALunV2+1FahpEUh74VDSTys4mauysRRd/uafN7gE=:kCGhj9XQIWjla4CjzWPscgoyuyMOwD0RLHJSkXowhU0=';};
Binary file added proj_info/dumps/scene10_dump/main.dump
Binary file not shown.
2 changes: 1 addition & 1 deletion proj_info/edgedb.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[edgedb]
server-version = "4.5"
server-version = "5.4"
6 changes: 5 additions & 1 deletion proj_info/final_schema.esdl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion proj_info/initial_schema.esdl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE MIGRATION m1ol5jxvc6l2at2kztb5zask5icf6ckasntcbidrrfsx677askknoq
CREATE MIGRATION m1icz4hxkdlltw2fwwiief5tjgomwgr2ihpmdeny7owr235wmpqecq
ONTO initial
{
CREATE ABSTRACT TYPE default::Person {
Expand Down Expand Up @@ -33,24 +33,31 @@ CREATE MIGRATION m1ol5jxvc6l2at2kztb5zask5icf6ckasntcbidrrfsx677askknoq
CREATE PROPERTY remarks: std::str;
CREATE PROPERTY title: std::str;
};
CREATE SCALAR TYPE default::GangsterRank EXTENDING enum<Nobody, Leader, Boss>;
CREATE SCALAR TYPE default::PoliceRank EXTENDING enum<Protected, Cadet, PC, SPC, SGT, SSGT, PI, IP, SIP, CIP, SP, SSP, CSP, ACP, SACP, DCP, CP>;
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 {
SET default := (default::PoliceRank.Cadet);
};
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<Nobody, Leader, Boss>;
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);
Expand All @@ -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<Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday>;
CREATE SCALAR TYPE default::FuzzyDay EXTENDING std::int64 {
CREATE CONSTRAINT std::expression ON (((__subject__ >= 1) AND (__subject__ <= 31)));
Expand Down Expand Up @@ -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.";
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CREATE MIGRATION m136gnzuezxpgyv7ju4pgostosaq3uql6nnqlyzipkvnjmcdicalxq
ONTO m16xboo673icbje6taadxtud76v5hfutc3hjzxexhy42lszjhogpda
CREATE MIGRATION m1dccfqhsgaadnglq2ckmbu5a2e7yzpxqb2cuf2airm75lj7unb27a
ONTO m1iolrlkdl63zmbic6vfn3jcbkcygyvzoj6fcg4jo7qv7nfctnjrnq
{
CREATE TYPE default::ChenLauContact EXTENDING default::Event {
ALTER LINK who {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 :=
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CREATE MIGRATION m17ioxejmqetxu4ex54m2gt66tjxtyicsvy67eb3p5nhn3hjrz4zhq
ONTO m167aa2yvy7i3v65yyzo4clj6ik3ugilphxirh2o42wnq7g2i7xnta
CREATE MIGRATION m1dem5eboiim52mq67hlkcoznwqmusag66vp6yfh7ynuggbp3y5cfq
ONTO m1en23ahl7rdq4pcuaoejswszaybhzlgxc3qwpcks56ba7rmc5q6wq
{
CREATE TYPE default::Beverage {
CREATE LINK consumed_by: default::Character;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions proj_info/migrations/00012-m1f62bc.edgeql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE MIGRATION m1f62bczhdawkow3bphndbuie3gdl2htatf5mxatxw54hqjoy5laaa
ONTO m1lp75tn62kfa4dbkkkv2u4pr3t2jjeyrix7cntwllnjid2mmu23qq
{
CREATE EXTENSION pg_trgm VERSION '1.6';
};
5 changes: 0 additions & 5 deletions proj_info/migrations/00012.edgeql

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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 := (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CREATE MIGRATION m1hgbgfi27lwf3vg6pilotkr4i6vxhuqns3zzvhlf7y5czuj53giva
ONTO m177hjcna3qg77ddbvyxmmbrye3wpwcknz7i6qa4n6ivbq5jejxwwq
CREATE MIGRATION m1ecf5pn6k7l4kwhb5w3eg3ucwppgfykndhsxaxkputy3kig7itwva
ONTO m1yd24uzikzfjk3lbwpgeyzo6kjgourvj5wu7psvbog67u3n4wjmpq
{
ALTER TYPE default::Character {
ALTER LINK lover {
Expand Down
27 changes: 27 additions & 0 deletions proj_info/queries/scene01/01_start.edgeql
Original file line number Diff line number Diff line change
@@ -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 {"陳冠希"})),
};
14 changes: 14 additions & 0 deletions proj_info/queries/scene01/02_end.edgeql
Original file line number Diff line number Diff line change
@@ -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")]
};
21 changes: 21 additions & 0 deletions proj_info/queries/scene02/01_start.edgeql
Original file line number Diff line number Diff line change
@@ -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:= "大飛哥",
}),
};
1 change: 1 addition & 0 deletions proj_info/queries/scene02/02_1st.edgeql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select test_alias();
18 changes: 18 additions & 0 deletions proj_info/queries/scene02/03_end.edgeql
Original file line number Diff line number Diff line change
@@ -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="警校"),
};
3 changes: 3 additions & 0 deletions proj_info/queries/scene03/01_start.edgeql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
insert FuzzyTime {fuzzy_year:= 1994};

insert Landmark {name:= "警察局"};
12 changes: 12 additions & 0 deletions proj_info/queries/scene03/02_1st.edgeql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
select test_alias();

update lau set {
police_rank:= PoliceRank.PC
};

insert ChenLauContact {
how:= "面對面",
detail:= "建明逮捕永仁並在警局替其做筆錄。",
`when`:= year_1994,
where:= police_station,
};
36 changes: 36 additions & 0 deletions proj_info/queries/scene03/03_end.edgeql
Original file line number Diff line number Diff line change
@@ -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:= .<involved[is CriminalRecord] {**}};

select Character {name, criminal_records:= .<involved[is CriminalRecord] {**}};

insert Scene {
title:= "黑白顛倒",
detail:= "永仁留下多次案底,並曾經被建明逮捕,但也逐漸取得黑社會的信任。" ++
"建明畢業後則由警員(PC)做起,表現優異,獲面試晉陞見習督察(PI)" ++
"的機會。兩人的路就像黑白顛倒一般,誰是好人,誰又是壞人呢?",
remarks:= "1.假設此時為1994年。",
who:= {chen, lau},
`when`:= year_1994,
where:= police_station,
};
Loading

0 comments on commit 9180006

Please sign in to comment.