ãã¤ã´ã£ããã»ã¹ãã´ã¡ãã¯ã«ããè¡æçãªãã¼ã¿ãã¼ã¹çè«ã§ããé¢æçãã¼ã¿ã¢ãã«ãã©ãããããã¾ã説æã§ãããï¼ ã¨è²ã ã¨æ©ãã§ãã¾ãã¾ãããã¾ã¼ãæ¸ããã¨ããããæ¸ãå§ãã¦ãã¾ãã¾ãããã
ãã¼ãããã£ããããããã£ããããé¢æçãã¼ã¿ã¢ãã«ã®ä¸çã¸ãããããåè«ã®è¨èã¯åºã¦ãã¾ãããåè«ã®äºåç¥èã¯ã»ã¼ã¼ãã§OKã§ããã
[è¿½è¨ date="ç¿æ¥"]åãæ¥ãå¢ãã§æ¸ãã¾ããã®ã§ãä¸æ³¨æã¨æ©ã¨ã¡ããæ··ãã£ã¦ãã¾ããã追è¨ã¨åãæ¶ãç·ã®å½¢ã§è¨æ£ã¨æ³¨è¨ã足ãã¾ãããåå¥ã¬ãã«ã®è¡¨ç¾ã®å¤æ´ã¯ç´æ¥ç·¨éãã¦ãã¾ãã
ãã¨ããã¨ãåè«ã®åºæ¬ç¨èªãç¥ãããã¨ãã¯ã³ãã©ã⦠ã£ã¦ãâ¦â¦ãã´ã¡ã³ï¼[/追è¨]
å 容ï¼
- ã¯ããã«
- æ¬ã®è³¼å ¥ã®ãµã³ãã«
- ã¹ãã¼ãã®ã°ã©ã表ç¾
- ãã¼ã¨ãè¨ç®ã«ã©ã ã¨ã
- åã¨ãã¦ã®ã¹ãã¼ã
- é¢æã¨ãã¦ã®ãã¼ã¿ãã¼ã¹ç¶æ
- ãã¼ãã«ã®å¤å
- èªç¶å¤æã¨ãã¦ã®ãã¼ã¿æä½
- ãã¼ã¿ãã¼ã¹ã«åè«ã使ãæ¾é¡
ã¯ããã«
é¢æçãã¼ã¿ã¢ãã«ã§ã¯ããã®ãã¨ãå¾¹åºçã«åç´åãã¾ããç¾å®ä¸çã¨ã®å¯¾å¿ã®é©åæ§ãéç¨ã®å®¹ææ§ãªã©ã価å¤å¤æãä¼´ãè°è«ã¯ãã¾ããï¼ããã¯å¥ãªã¿ã¤ãã³ã°ã§ãã¦ãã ããï¼ãçè«çãªå¤¾éç©ã容赦ãªãåãé¤ãã¾ããææ§ã§è¡å¦çãªã¦ã³ãã¯ãªãã¦ãã£ã¦ã®ã»ãï¼ ãã®çµæããã¼ã¿ãã¼ã¹ã®åçã常èã ã¨æããã¦ããããªãã®é¨åãç¡æå³åãã¾ãã
- ãã¼ãã«ã¨ãã¡ã¤ã³ï¼ååçå¤ã®é åï¼ã®åºå¥ã¯ããªãã
- 第ä¸æ£è¦å½¢ã¨ããæ¦å¿µã¯ãªãããååçãªå¤ãã¨ããæ¦å¿µããªãã®ã§ãã³ã»ã³ã¹ã¨ãªãã
- 主ãã¼ãå¤é¨ãã¼ã¨ãã£ãæ¦å¿µã¯åãªãæ段ï¼ããªãã¯ã§ãã£ã¦ãæ¬è³ªçã§ã¯ãªãã
- å¾å±æ§ï¼ä¾åæ§ï¼ã¨ãã¸ãã¹ã«ã¼ã«ããã®ä»ã®å¶ç´ãåºå¥ããªãã§ä¸æ§ã«æ±ãã
- ãã¼ãã«ã¯éåã¨èãã¦ãããããã®è¦ç´ ãã¿ãã«ã§ããå¿ è¦ã¯ãªããã¤ã¾ãããã¼ãã«ï¼ã®ã¤ã³ã¹ã¿ã³ã¹ï¼ãç´ç©ã®é¨åéåã¨ã¯èããªãã
- 諸ã ã®æéæ§ãåæã¨ã¯ããªããå¿ è¦ãªã¨ãã ãæéæ§ãä»®å®ããã
ä»åã®èª¬æã§ã¯é¨åååï¼partial mapï¼ã使ãã®ã§æ¬¡ã®ç¹ã注æãã¦ããã¾ãã
- undefinedã®æå³ã®NULLã¯é æ ®ãªã使ãããã ãããNULLãã§ã¯ãªãã¦è¨å·ãâ¥ãã使ã£ã¦è¡¨ãã
以ä¸ã§ãç°¡åãªãµã³ãã«ã¹ãã¼ããæ示ãã¦ãããããâéåã¨é¨åååã®åâã§è§£éãã¾ãã
æ¬ã®è³¼å ¥ã®ãµã³ãã«
ã人ãæ¬ãè³¼å ¥ããããã¨ãã¢ãã«åãã¾ãããã¼ãã«ã¯ãPersonï¼äººï¼ãBookï¼æ¬ï¼ãPurchaseï¼è³¼å ¥ï¼ã®3ã¤ã¨ãã¾ãããã¼ã¿åã«Stringã¨Integerãããã¨ãã¦ããããã¯ååããæ³åãããã馴æã¿ã®æå³ãæã¤ã¨ãã¾ãããï¼ç´°ãã話ã¯å²æï¼ãä»ã«ãçå¹´ææ¥ã®æ¥ä»ç¨ã«YMDã¨ãããã¼ã¿åã使ãã¾ãããããã¯Integerã®3ã¤çµã¿ãã«ã®åã ã¨ãã¾ãããã¨ãDateTimeã¯YMDããç²¾å¯ãªï¼ç§æ°ã¾ã§ã¨ãã®ï¼æå»ã§ãã
ãã¼ãã«ã¹ãã¼ãã®è¨è¿°ã¯ä»®ã«æ¬¡ã®å½¢ã使ãã¨ãã¾ãã
table Person {
// 人ã®åå
name: String,// 人ã®çå¹´ææ¥
birth: YMD
};
JSONã¿ãããªå½¢ã§ãè¦ãããããã§ãããnameã¨birthããPersonãã¼ãã«ã®ã«ã©ã ã§ããYMDã¯ã¿ãã«åã ãã第ä¸æ£è¦å½¢ãããªãã£ã¦ï¼ ã ã¼ããããããªãã¨ã¯ãã¼ãã¢ã¤ã¤ã®ã
人ã«çªå·ãä»ãã¦ä¸»ãã¼ã«ããã»ããããã£ã¦ï¼ ãã®ã»ãã確ãã«ä¾¿å©ããã§ãããä»åã¯ããããã·ã¨ãã¾ããããããã¯ã¶ã¯å¿ é ãªãã®ã§ã¯ãªãã®ã§*1ã
ãã¼ã¿åï¼ãã¡ã¤ã³ï¼ã¨ãã¼ãã«ã¯åºå¥ããªãã®ã§ãStringã¨YMDãâãã¼ãã«âã§ããPersonåæ§ã«tableã¨ãã¦å®£è¨ãã¦ããã¾ãããã
table String {};table YMD {};
ãStringãtableãã£ã¦ãè¨èã¨ãã¦ã¯éåæãããã§ãããããã©ããæ°ã«ããªãã§ãã©ããã¦ãæ°ã«ãªããªããã©ããéåãå²ãå½ã¦ããããã ãã set ã¨ãã®ãã¼ã¯ã¼ãã«ãã¦ãset Personãset String ã¨ãã«èªã¿æ¿ãã¦ãã ãããStringã«ã¯ã«ã©ã ããªãã®ã§ {} ã§ããYMDã«ãã«ã©ã ãããã¾ãããYï¼yearï¼ãMï¼monthï¼ãDï¼dayï¼ãåãåºãã«ã©ã ãããã ãããã£ã¦ï¼ ãªãã§ãããã®ã¹ãã¼ãå ã§ã¯ãªãã§ããã¹ãã¼ãã解éãããå ã®ä¸ç*2ã«ã¯ãY, M, D ãåãåºãååãããã§ãããããã
Stringã¨YMDã®å®£è¨ã«ã¯ãfixedã£ã¦ãã¼ã¯ã¼ããä»ãã¦ããã¾ãã
fixed table String {};fixed table YMD {};
fixedã®æå³ã¯ããã®ã¹ãã¼ããéç¨ããã以åã«ããã¼ãã«ã®æå³ã¨ãªãéåãåºå®ãã¦ãã¾ããã¨ãæ示ãã¾ããfixedã§ãªããã¼ãã«ã¯ãæéã«å¾ã£ã¦å 容ï¼éåï¼ãå¤åãã¾ãã
ã¹ãã¼ãã®ç¶ããæ¸ãã¦ãã¾ãã¾ãããã
fixed table String {};fixed table YMD {};
table Person {
name: String,
birth: YMD
};fixed table Integer {};
table Book {
isbn: Integer
};fixed table DateTime {};
table Purchase {
person: Person,
book: Book,
dateTime: DateTime,
};
ISBNã¯æ´æ°ãï¼ ã¨ããåãæ¬ãã¾ã¨ãè²·ãã§ããªããã¨ãã®çªã£è¾¼ã¿ã©ããã¯ããã§ãããããã»ã¨ãã©ãã¼ãã¢ã¤ã¤ãã¨ã§ããããã¾ã¨ãè²·ãã¯ãåãã¬ã³ã¼ããåæ°åå ¥ãã¡ããæ¹æ³ãããã¾ã -- ä¸é¨ã®äººããæ¯å«ãããã¦ããéè¤ã許ãéåï¼ããã°ããã«ãã»ããï¼ã§ãããã¯ã©ã¤ã¹ãªæ§æï¼ã¨ããåè«ã®ææ³ï¼ã使ãã°æ®éã«å®å¼åã§ãã¾ãã
ã¹ãã¼ãã®ã°ã©ã表ç¾
ã«ã©ã ã¯åã®å°ï¼ã¨ããããç¢å°ã¨æã£ã¦ãï¼ã¨èããã®ã§ãåè«ã®è¨æ³ã§ã¯ä¾ãã°nameã«ã©ã ã¯ãname:PersonâString ã®ããã«ãªãã¾ããä»åã¯ãã«ã©ã åã«éè¤ã¯ããã¾ããããååã®ã«ã©ã ãåºã¦ãã¦ãã¾ã£ããªããPerson.name:PersonâString ã®ããã«ãã¼ãã«åã¨ãããã§ä¿®é£¾ããã°ããã§ãããããããå¥ã«ãã¼ãã¢ã¤ã¤è©±ã§ããã©*3ã
ãã¦ãåã¯å¯¾è±¡ã¨å°ãããªãã®ã§ãæåã°ã©ãã§å³ç¤ºã§ãã¾ããä»åã®ã¹ãã¼ãã«åºã¦ããé ç¹ï¼ãã¼ãããã¼ããã¯ã¹ï¼ã¯ {String, YMD, Person, Integer, Book, DateTime, Purchase} ã§ããããã®ããã ãçµã¶è¾ºï¼ã¨ãã¸ãã¢ã¼ã¯ï¼ã¯æ¬¡ã®ã¨ããã§ãã大æåå°æåã®éãã«æ³¨æãã¦ãã ããã
- name:PersonâString
- birth:PersonâYMD
- isbn:BookâInteger
- person:PurchaseâPerson
- book:PurchaseâBook
- dateTime:PurchaseâDateTime
ã¨ããããã¯ãåã®å¯¾è±¡ã¨ã¯é ç¹ã®ãã¨ãåã®å°ã¨ã¯è¾ºã®ãã¨ã ã¨æã£ã¦ãã ãããCatyã®GraphVizã³ãã³ãã§å³ã«æãã¦ã¿ã¾ãããfixedãªãã¼ãã¯æ°´è²ãããã§ãªããã¼ãã¯ãã³ã¯ã«ãã¾ããã
ããªã¼ã®å½¢ã«ãªã£ã¦ããã®ã¯ç¹ã«æå³ã¯ããã¾ããï¼ãã¾ãã¾ããããªã£ã¦ãã¾ã£ãï¼ããã®å³ãæãCatyScriptã½ã¼ã¹ã³ã¼ãã¯æ¬¡ï¼
// this is CatyScript
[
gv:node --style=filled --fillcolor=skyblue String,
gv:node --style=filled --fillcolor=skyblue YMD,
gv:node --style=filled --fillcolor=pink Person,
gv:node --style=filled --fillcolor=skyblue Integer,
gv:node --style=filled --fillcolor=pink Book,
gv:node --style=filled --fillcolor=skyblue DateTime,
gv:node --style=filled --fillcolor=pink Purchase,gv:edge --label=name Person String,
gv:edge --label=birth Person YMD,
gv:edge --label=isbn Book Integer,
gv:edge --label=person Purchase Person,
gv:edge --label=book Purchase Book,
gv:edge --label=dateTime Purchase DateTime,
] | gv:graph --label=book-perchase
ãã¼ã¨ãè¨ç®ã«ã©ã ã¨ã
ã©ããã¦ãæ°ã«ãªã£ã¦ãã¾ã人ããããããããªãã®ã§ã主ãã¼ï¼å¤é¨ãã¼ãå¾å±æ§ãªã©ã«ãã©ãªã¨è§¦ãã¦ããã¾ãã
ãã¾ã人ï¼personï¼ã«ãªãããã®çªå·ãä»ãã¦ããããnumã«ã©ã ã§åãåºããã¨ãã¾ããããidã«ã©ã ã¨å½åãããã¨ããã§ãããidã¯åè«çãªæå³ã§ï¼æçå°ã¨ãã¦ï¼ä½¿ãã®ã§ãnum:PersonâInteger ã¨ãã¾ããnumã®å®ç¾ã«ã¯ããå ¨åååã§ããåå°ã«ãªããã¨ããæ¡ä»¶ã課ããã¨ã«ãã¾ãããã®å ¨ååå°æ§ã®æ¡ä»¶ãä»ãã¦ç¹å®ãããã«ã©ã ã主ãã¼ã§ãï¼åä¸ãã¼ã¨è¤åãã¼ã®åºå¥ã¯ãªãã§ãï¼ã
ä¸è¬ã«ãf:AâB ãåå°ãªé¨ååå*4ã®ã¨ããfã¯ãããããå¯éãã¨ãªãã¾ããããããå¯éï¼å³å¯ã«å®ç¾©å¯è½ãªè¨èï¼ã¨ã¯ãé¨ååå g:BâA ããã£ã¦ããf;g 㨠g;f ããå®ç¾©ãããç¯å²ã§ã¯æçååã¨ä¸è´ããããã¨ã§ããããããå¯éãªé¨åååfã®"ããããéååâããf~1 ï¼f-1 ã¨ä¼¼ã¦ããå¾®å¦ã«éãè¨æ³ï¼ã¨æ¸ããã¨ã«ãã¾ãã
num:PersonâInteger ã¯åå°ãããã«ãããããéåå num~1 ãåå¨ãã¦ãnum;num~1 = idPerson ãæç«ãã¾ããperson:PurchaseâPerson ã¨ã¯å¥ã«ãå¤é¨ãã¼ã«ç¸å½ããååã personNum:PurchaseâInteger ã¨ããã¨ã次ã®çå¼ãæç«ãã¦ããã¯ãã§ãã
- person = personNum;num~1 : PurchaseâPerson
ãã®ãããªçå¼ããã¹ãã´ã¡ãã¯ã¯ãã¹åå¤é¢ä¿ï¼path equivalence relationï¼ã¨å¼ã³ãããããå¶ç´ããã¹åå¤é¢ä¿ã§è¡¨ç¾ãã¦ãã¾ãããã¹åå¤é¢ä¿ãåè«ã®è¨èã§è¨ãã°å¯æå³å¼*5ã§ãä¸ã®ã±ã¼ã¹ã§ã¯ãperson, personNum, num~1 ã3辺ã¨ããä¸è§å½¢ãå¯æï¼2ã¤ã®çµè·¯ã®ã©ã£ã¡ããã©ã£ã¦ãçµæãåãï¼ã¨ãªãã¾ãã
ãã¦ãçå¹´ææ¥ããå¹´é½¢ãè¨ç®ããé¢æ°ï¼ååï¼ã calcAge:YMDâInteger ã¨ãã¾ãããã¡ãããcalcAgeã«ã¯ãç¾å¨ã®æ¥æãã¨ããæé»ã®ãã©ã¡ã¼ã¿ãããã¾ãããããã¯çç¥ãã¦ãã¾ããPersonã®ageã«ã©ã ããbirth;calcAge ã¨ããååã®çµåï¼compositionï¼ã¨ãã¦å®ç¾©ããã¨ããã®å®ç¾©èªä½ã次ã®çå¼ã¨ãªãã¾ãã
- age = birth;calcAge : PersonâInteger
ãããå¯æãªä¸è§å½¢ãå½¢æãã¾ããã
num, num~1, personNum, calcAge, age ãå ¥ããã°ã©ãã¯æ¬¡ã®ããã«ãªãã¾ãã
ãã®å³ã«ã¯æ示ããã¦ã¾ãããã次ã®ãããªçå¼ï¼ä¸çå¼ã課ããã¦ãããã¨ãããä¸åº¦æ³¨æãã¦ããã¾ãã
- num;num~1 = idPerson : PersonâPerson
- num~1;num â idInteger : IntegerâInteger
- person = personNum;num~1 : PurchaseâPerson
- age = birth;calcAge : PersonâInteger
person:PurchaseâPerson ã¨ããååãã 主ãã¼numã¨å¤é¨ãã¼personNumã使ã£ã¦ personNum;num~1 ã¨è¡¨ç¾ããã®ã¯ãåãªã代æ¿æ段ã ã¨åããã§ããããããããããªãã¯ã¯ã使ããªãã¦æ¸ããªã使ããªãã»ããç´æ¥çã§åãããããã®ã§ã*6ã
[追è¨]age:PersonâInteger ã¯ãè¨ç®ã«ãã£ã¦å¤ãå¾ãããã«ã©ã ã®ä¾ã¨ãã¦åºãã¾ããããã¹ãã¼ããæ§æããæ£å¼ãªã«ã©ã ï¼å°ï¼ã§ã¯ããã¾ããã[/追è¨]
åã¨ãã¦ã®ã¹ãã¼ã
ããã¾ã§ãã¹ãã¼ãã®æå³è«ãå åããã¦ãããã¼ãã«ã¯éåãã«ã©ã ã¯é¨åååãã§ãããã®ããã«èª¬æãã¦ãã¾ããããããã¯æ£ç¢ºã§ã¯ããã¾ãããã¹ãã¼ãèªä½ã¯ç´ç²ã«è¨å·çãªæ§é ç©ã§ãããã¹ãã¼ãã¨ã¯åãªãæåã°ã©ãã ãã¨èããã°ååã§ãããããä¸æ©é²ãã¦ãã¹ãã¼ãã¨ã¯åã ãã¨ã¿ãªãã¨åè«ã¸ã¨ç¹ããã¾ãããã¡ãããåã¨ãã¦ã®ã¹ãã¼ãã®è©±ããã¾ããããã®ç¯ã¯è¥å¹²ã®äºåç¥èãä»®å®ãã¦ããã®ã§ãåããã«ããã£ãããã¹ãã¼ãã¨ã¯åãªãæåã°ã©ãã ãã¨ããç解ã§ãã¾ãã¾ããã
æåã°ã©ãGããã£ã¦ãGã®é ç¹ã«ã辺ã«ãã©ãã«ï¼ååï¼ãä»ãã¦ãã¦ãé ç¹ï¼è¾ºã¯ã©ãã«ã§èå¥ã§ããã¨ãã¾ãããã®ä»®å®ã®ãã¨ãé ç¹ï¼è¾ºããèªä½ã¨ãã®ã©ãã«ãåä¸è¦ãã¾ãã
Gã®é ç¹ã¨è¾ºã"äºãéãâã«ç¾ããåããã¹ã¨å¼ã³ã¾ãããã ãããã¹ã¯æ¬¡ã®æ¡ä»¶ãæºããã¾ãã
- æä½ã§ãé ç¹ã2åã¯ç¾ããã
- æåã¨æå¾ã¯é ç¹ã§ããã
- é£ãåã£ã¦åºç¾ããé ç¹ã¨è¾ºã¯æ¥åãã¦ããã
ä¾é¡ã§ãããæ¬ã®è³¼å ¥ãã®ã°ã©ãï¼äºçªç®ã®ã»ãï¼ã«é¢ãã¦ã[Purchase, person, Person, birth, YMD, calcAge, Integer] ã¨ã [Integer, num~1, Person, name, String] ãªã©ã¯ãã¹ã§ããï¼ãã²æã§ãã©ã£ã¦ã¿ã¦ãã ãããï¼[Person, Person] ããã¹ã«ãªãã¾ãã[Book, isbn, Integer, num~1, Person, birth, YMD] ã¯ãç¾å®çãªæå³ã¯ãªãã®ã§ãããã¹ã«ãªãã¾ãã
æåã°ã©ãGã®ãã¹ã®å ¨ä½ãPath(G)ã¨ããã¨ã次ã®ããã«ãã¦åCãæ§æã§ãã¾ããï¼ãã¢ãã¤ãã¨æåã°ã©ãããåãæ§æãããã«ãè¨è¿°ãããï¼
- |C| := (Gã®é ç¹ã®éå)
- Mor(C) := Path(G)
- fâMor(C) ã«å¯¾ãã¦ãdom(f) := (ãã¹ã®æåã®é ç¹), cod(f) := (ãã¹ã®æå¾ã®é ç¹)
- Aâ|C| ã«å¯¾ãã¦ãidA := [A, A]
- å°ã®çµåã¯ããã¹ã®ããã¨ã風ã®é£æ¥
以ä¸ã®æé ã§ä½ã£ãåã¯ã°ã©ãGããçæãããèªç±åã¨å¼ã³ã¾ãããã¼ã¿ãã¼ã¹ã¹ãã¼ãã®å ´åã¯ãæåã°ã©ã以å¤ã«å¶ç´æ¡ä»¶ï¼ãã¹åå¤é¢ä¿ï¼ãããã®ã§ãããããèæ ®ãã¦åãä½ãã¾ã*7ã
æåã°ã©ãã¨å¶ç´æ¡ä»¶ã®çµã¯ãåã®è¡¨ç¤ºï¼presentationï¼ã¨å¼ã³ã¾ãããã¯ãã«ç©ºéã®åºåºãããçæå ã¨é¢ä¿ãã«ãã代æ°ç³»ã®å®ç¾©ããåç¥ã®æ¹ã¯ãåã®è¡¨ç¤ºãåããããªã¢ãã ã¨æã£ã¦ãã ãããæéã°ã©ãã¨æéåã®å¶ç´æ¡ä»¶ãããªã表示ã¯æé表示ã¨å¼ã°ãã¾ããæé表示ãæã¤åã¯ãçµã¿åããçï¼è¨ç®çï¼combinatorial/computationalï¼ã«æ±ããã¨ãã§ãã¾ãã
å ·ä½çãªè¨è¿°ãè¨ç®ã§ã¯è¡¨ç¤ºãå¿ è¦ã«ãªãã®ã§ããã¼ã¿ãã¼ã¹ã¹ãã¼ãã¯è¡¨ç¤ºä»ãã®åããããã¯åã®è¡¨ç¤ºãã¹ãã¼ããªã®ã ã¨æã£ã¦ããã¾ãã¾ããã以ä¸ã§ã¯ãåãã®ãã®ãããåã®è¡¨ç¤ºã§ããã°ã©ãï¼ï¼å¶ç´æ¡ä»¶ï¼ãã¹ãã¼ãã¨ã¿ãªãã¦èª¬æãã¾ãã
é¢æã¨ãã¦ã®ãã¼ã¿ãã¼ã¹ç¶æ
ã¹ãã¼ãã¯ãããèªä½ã¯æåã°ã©ããã¤ã¾ãã丸ã¨ç¢å°ãããªãå³å½¢ã«éãã¾ããããã¼ã¿ãã¼ã¹ã¨ãã¦ã®æå³ãä¸ããããã«æ¬¡ã®å²ãå½ã¦ããã¾ãã
- ã°ã©ãã®é ç¹ã«ã¯éåãå²ãå½ã¦ãã
- ã°ã©ãã®è¾ºã«ã¯éåã®ããã ã®é¨åååãå²ãå½ã¦ãã
ã°ã©ãã®é ç¹ããã¼ãã«ã§ãã°ã©ãã®è¾ºãã«ã©ã ã ã£ãã®ã§ï¼
- ãã¼ãã«ï¼ã®ååï¼ã«ã¯éåãå²ãå½ã¦ãã
- ã«ã©ã ï¼ã®ååï¼ã«ã¯éåã®ããã ã®é¨åååãå²ãå½ã¦ãã
ã§ãããããã§é¨ååå f:AâB ã¨ã¯ãAã®é¨åéåXä¸ã§å®ç¾©ãããååã®ãã¨ã§ããX = A ã®ã¨ããããããXã空ã®ã¨ããããã¾ããé¨åååã®çµåï¼compositionï¼ã¯ãå®ç¾©ã§ããç¯å²ã§ããããåºæ¥ãã ãé å¼µã£ã¦è¡ãã¾ããéåã¨é¨åååãããªãä½ç³»ï¼åã§ããï¼ãPartialã¨æ¸ãã¾ãã
ä¸è¨ã®ãããªãããã¼ãã«ã«éåãã«ã©ã ã«é¨åååãã¨ããå²ãå½ã¦ãããã¼ã¿ãã¼ã¹ç¶æ ã¨ããã¼ã¿ãã¼ã¹ã¤ã³ã¹ã¿ã³ã¹ã¨å¼ã³ã¾ãã誤解ã®å¿é ããªããã°ãåã«ãã¼ã¿ã¨å¼ãã§ãããã§ãããã
[追è¨]ã¹ãã´ã¡ãã¯ã®ãªãªã¸ãã«ã®å®ç¾©ã¯ãPartialã§ã¯ãªãã¦Setã使ã£ã¦ãã¾ããã¤ã¾ããæªå®ç¾©ã¨ãã¦ã®NULLãèªããªãç«å ´ã§ãããã ããSet以å¤ã¯ãã¡ã¨ãããã¨ã§ã¯ãªãã¦ãã¹ãã´ã¡ãã¯èªèº«ãSet以å¤ã®åã使ã£ã¦ãã¾ããåãPartialãé¸ãã çç±ã¯ãé¢æçãã¼ã¿ã¢ãã«ãã©ã説æãããï¼ èãã¦ã¾ããã«æ¸ãã¦ããã¾ãã[/追è¨]
ãã¼ã¿ãã¼ã¹ã¹ãã¼ãSã«å¯¾ãã¦ããã®ãã¼ã¿ãã¼ã¹ç¶æ ã D:SâPartial ã®ããã«æ¸ãã¾ãããã¼ãã«åã«ãã¼ãã«ã®å 容ã§ããéåãã«ã©ã åã«ãã®å®ç¾ã§ããé¨åååã対å¿ããã¦ããã®ã§ãååã¨åãè¨æ³ã使ãã¾ãããã®æã®å¯¾å¿ã¯ãåè«ã§ã¯é¢æï¼functorï¼ã¨å¼ã³ã¾ãããããã£ã¦ã
- ãã¼ã¿ãã¼ã¹ç¶æ ã¯é¢æã§ãã
ã¨ãªãã¾ãããããé¢æçãã¼ã¿ã¢ãã«ï¼functorial data modelï¼ã¨ããååã®ç±æ¥ã§ããçãæ¨èªã«ãããªãããã¼ã¿ï¼é¢æãã
ã¹ãã¼ãSä¸ã®ãã¼ã¿ãã¼ã¹ç¶æ ã¯ï¼æ®éã¯ï¼ããããããã¾ããããä¸æç¹ãåãã°ã²ã¨ã¤ã®é¢æ D:SâPartial ãå®ã¾ãã¾ããå¥ãªæç¹ã§ã¯å¥ãªé¢æ D':SâPartial ã¨ãªãã§ãããããã¼ã¿ãã¼ã¹ç¶æ ã¯æã å»ã ã¨å¤åãã¾ãã
ããããå¤åããªãã»ãããããã¼ãã«ï¼ã«ã©ã ãããã¾ããä¾ãã°ãä»åã®ä¾é¡ã«åºã¦ããStringãIntegerããæã å»ã ã¨å¤åããã®ã¯ããããè¿·æã§ããã¹ãã¼ãã«ãããtable宣è¨ã§fixedï¼ä»®ã®è¨æ³ã§ããï¼ã¨ä»ãã¦*8ãæ°´è²ã§å³ç¤ºãã¦ãããã¼ãã«ã¯å¤åããªãã»ããæã¾ããã®ã§ãããã ãããå¤åããï¼ããªãããç¸å¯¾çãªãã®ã§ããä¾ãã°ãã¢ã¹ãã¼æåã ãã許ãStringã ã£ãã®ããããã§ã¯ä¸ä¾¿ãªã®ã§ã¦ãã³ã¼ãããµãã¼ãããããã«å¤åãããã¨ãããã§ããããStringã§ãµãã¼ãããæåç¯å²ãæã å»ã ã¨å¤åãããã¨ããªãã¨ãè¨ãã¾ããã
å®éã¯ã次ã®ãããªãã¨ã§ãã
- å²ãå½ã¦ãããéåãæ¯è¼çå¤åãã«ããååã¯ãã¼ã¿åã®ååï¼ä¾ãã°Stringï¼ã¨èããã
- å²ãå½ã¦ãããéåãé »ç¹ã«å¤åããååã¯å¸¸èçãªæå³ã§ã®ãã¼ãã«ã®ååï¼ä¾ãã°Personï¼ã¨èããã
ãã¼ãã«ã®å¤å
æã ã®ãµã³ãã«ã§ã¯ãæã å»ã ã¨å¤åããã®ã¯ãPerson, Book, Purchaseã®3ã¤ã®ãã¼ãã«ã§ãï¼å³ã§ã¯ãã³ã¯ã®ãã¼ãï¼ãPersonã¯ä¼å¡åç°¿ã®ãããªãã®ãªã®ã§ãå¢ãããæ¸ã£ããããã§ããããBookã¯ãã³ãã³å¢ãããã§ãããæ¬ã絶çã«ãªãã°æ¸ãã¾ããPurchaseã¯ãéå»ãã°ãæ¨ã¦ãªããã°å¢ããä¸æ¹ã®è¨é²ã§ãã
[追è¨]ä»åã®ç°¡åãªãµã³ãã«ã§ããå®æã«ã¬ã³ã¼ããåé¤ããã¨æ´åæ§ãä¿ã¦ãªããªãã¾ãããã®è¾ºã®ãã¨ã¯ãã¾ãæ©ä¼ãããããã¦è¿°ã¹ããã¨æãã¾ãã[/追è¨]
Personãã¼ãã«ã«æ³¨ç®ããã¨ãã¦ãã¨ãããã¼ã¿ãã¼ã¹ç¶æ Dã¨å¥ãªãã¼ã¿ãã¼ã¹ç¶æ D'ã§Personãã¼ãã«ãå¤åããã¨ãã¾ãããã¼ãã«å 容ï¼éåï¼ãJSONãªãã©ã«ã使ã£ã¦è¡¨è¨ããã¨ãã¾ããä¸çªå¤å´ã®ä¸æ¬å¼§ï¼{, }ï¼ã¯éåã表ãæ¬å¼§ã§ãã
D(Person) = { {"name": "æ¿æ±ãã³å", "birth": [1985, 10, 1]}, {"name": "大å£ãã±å", "birth": [1991, 6, 23]} } D'(Person) = { {"name": "大å£ãã±å", "birth": [1991, 6, 23]}, {"name": "å°å®®å±±ã¬ã³å¤ª", "birth": [1967, 3, 7]} }
ã¾ã¼ãè¦æ¯ã¹ãã°ã©ãå¤åãããåãã£ã¦ãã¾ãã®ã§ããã念ã®ãããμ:D(Person)âD'(Person) ã¨ããé¨åååã§å¤åãæ確åãã¦ããã¾ããè¨è¿°ã®åç´åã®ããã人ã®ååã ãã§é¨åååμãè¨è¿°ãã¾ãã
- μ("åæ±ãã³å") = â¥
- μ("大å£ãã±å") = "大å£ãã±å"
â¥ã¯æªå®ç¾©ã表ãè¨å·ã§ãããã®é¨ååå μ:D(Person)âD'(Person) ã¯æ¬¡ã®äºå®ã表ç¾ãã¾ãã
- "åæ±ãã³å" ã®ã¬ã³ã¼ãã¯åé¤ãããã
- "大å£ãã±å" ã®ã¬ã³ã¼ãã¯ãã®ã¾ã¾ã
- "å°å®®å±±ã¬ã³å¤ª" ã®ã¬ã³ã¼ãã¯è¿½å ãããã
[追è¨]ãã¼ãã«ã®å¤åã¯ãã¬ã³ã¼ãã®è¿½å ï¼åé¤ã®ã¿ã§ãSQLã®UPDATEæã®ãããªå¤æ´ã¯å¥ã«æ±ãã¹ãã§ããããã®ç¯ã®æ®ãã®è¨è¿°ã¯ããã®è¦³ç¹ããè¨æ£ãã¾ããã[/追è¨]
ç¾å®çãªä¾ã ã¨ããã£ã¦åããã«ãããããããªãã®ã§ãμ:{1, 2, 3, 4} â {2, 4, 5} ã¨ãã¦ã¿ã¾ãããã
- μ(1) = â¥
- μ(2) = 2
- μ(3) = â¥
- μ(4) = 4
ããã¯æ¬¡ã®å¤åãè¨è¿°ãã¾ãã
- ãã¨ã®1ã¯åé¤ãããã
- ãã¨ã®2ã¯ãã®ã¾ã¾ã
- ãã¨ã®3ã¯
4ã«å¤åããï¼æ´æ°ãããï¼åé¤ãããã - ãã¨ã®4ã¯ãã®ã¾ã¾ã
- 5ã追å ãããã
é¨åååã§å¤åãè¨è¿°ããä¸è¬çãªã«ã¼ã«ã¯æ¬¡ã®ããã«ãªãã¾ããXâA ãå®ç¾©åã¨ããé¨ååå°åå f:AâB ãããã¨ãï¼
- Xã«å±ããªãAã®è¦ç´ ã¯åé¤ãããã¨ã¿ãªãã
- f(a) = b ã®ã¨ãã
aãbã«å¤åããï¼æ´æ°ãããï¼aã¨bã¯ï¼ç°ãªãæç¹ã«ãããï¼åããã®ã¨ã¿ãªãã - fã®åã«å±ããªãBã®è¦ç´ ã¯æ°ãã«è¿½å ãããã¨ã¿ãªãã
åå°ã®æ¡ä»¶ãä»ããªãã¨ãã¯ï¼
- aâ a' 㧠f(a) = f(a') = b ã®ã¨ããaã¨a'ã¯ãã¼ã¸ããã¦bã«ãªã£ãã¨ã¿ãªãã
èªç¶å¤æã¨ãã¦ã®ãã¼ã¿æä½
[追è¨]ãæ´æ°ãã¨ããè¨èã¯ãSQLã®UPDATEæä½ãé£æ³ããã®ã§ããå¤æ´ãã«ç½®æãã¾ããã[/追è¨] [追è¨ã®è¿½è¨]SQLã®UPDATEæã®ãããªæä½ï¼åå¥ã®ã¬ã³ã¼ãã«å¯¾ããå¤æ´ï¼ã¯ãã ãããåãã£ããã©ããããæ¸ãæ°åãæºã¾ãã¾ã§ã«æéããããããã[/追è¨ã®è¿½è¨]
åç¯ã® μ:D(Person)âD'(Person) ã¯ãã¼ãã«Personã®å¤åãè¨è¿°ãã¾ãã1ã¤ã®ãã¼ãã«ã ãã§ã¯ãªãã¦ããã¼ã¿ãã¼ã¹ã«å±ããè¤æ°ã®ãã¼ãã«ãåæã«å¤æ´ããããã¨ãããããããã¾ãããä¾ãã°ãPersonã¨Purchaseãåæã«å¤æ´ãããã¨ãã次ã®2ã¤ã®Î¼ã使ãã¾ãã
- μPerson:D(Person)âD'(Person)
- μPurchase:D(Purchase)âD'(Purchase)
Bookã«ã¯ä½ã®å¤åããªãã¨ãã¦ããμBook = idBook ï¼Bookã®éåä¸ã®æçååï¼ã ã¨ãã¦æ¬¡ã®ããã«æ¸ãã¾ãã
- μBook:D(Book)âD'(Book)
StringãIntegerã«å¯¾ãã¦ãåæ§ã«æçååã μString, μInteger ã¨ãã¦æ¡ç¨ã§ãã¾ãããã®çµæããã¹ã¦ã®ãã¼ãã«Xã«å¯¾ãã¦ãμX:D(X)âD'(X) ãå®ç¾©ã§ãããã¨ã«ãªãã¾ãã
{μPerson, μPurchase, μBook, μString, μInteger, ...} ã¯ããã¹ã¦ã®ãã¼ãã«ã«å¯¾ããå¤æ´ãæãããã®ã§ããã¼ã¿ãã¼ã¹å ¨ä½ã¸ã®æä½ã®è¡¨ç¾ã¨ãªã£ã¦ãã¾ãããã¼ãã«ã§ç®å°ãä»ããããé¨åååã®æï¼ãã°ï¼ {μX | Xã¯ãã¼ãã«} ã¯ãåè«ã§ã¯é¢æã®ããã ã®èªç¶å¤æã¨å¼ã°ãããã®ã§ãã
å®ã¯ããã¼ãã«å¤æ´ã®éã¾ããèªç¶å¤æã§ããããã«ã¯æ¡ä»¶ãä»ãã¾ããc:SâT ãã¹ãã¼ãã«ç¾ãããã¼ãã«ã¨ã«ã©ã ã®ã¨ãã次ã®çå¼ãæºããå¿ è¦ãããã¾ãã
- D(c);μT = μS;D'(c) : D(S)âD'(T)
å ·ä½ä¾ãã²ã¨ã¤æããã¨ï¼
- D(person);μPerson = μPurchase;D'(person) : D(Purchase)âD'(Person)
ããã¯æ¬¡ã®æå³ãæã¡ã¾ãã
- å¤ãPurchaseãã¼ãã«ã®personã«ã©ã ã®å¤ï¼Personã¬ã³ã¼ãï¼ã®å¤æ´ååμã®çµæã¯ãPurchaseãã¼ãã«ã®å¤æ´ååμã®çµæã«å¯¾ããpersonã«ã©ã ã®å¤ã«çããã
ã¤ã¾ããå¤æ´åå¾ã§æ´åæ§ãä¿ãããããã®å¶ç´æ¡ä»¶ã«ãªã£ã¦ãã¾ãããã®å¶ç´æ¡ä»¶ããåè«ã§ã¯å¯æå³å¼ã¨ããå½¢ã§æ¸ãã®ãæ®éã§ãã
D(S) -- D(c) --> D(T) | | |μ_S |μ_T | | v v D'(S) - D'(c) -> D'(T)
å¾å±æ§ï¼ä¾åæ§ï¼ããã¸ãã¹ã«ã¼ã«ããã¼ã¿æä½æã®æ´åæ§ãªã©ã®æ§ã ãªå¶ç´ãããã¹ã¦ä¸å¾ã«å¯æå³å¼ã«ãã£ã¦è¡¨ç¾ã§ãã¾ããå¯æå³å¼ã®ä¸è¬åã§ããé«æ¬¡ã»ã«ã使ãã¨ãããæè»ã§å¤æ§ãªå¶ç´è¨è¿°ãã§ãã¾ãã
ãã¼ã¿ãã¼ã¹ã«åè«ã使ãæ¾é¡
ããã§ãããã¤ã´ã£ããã»ã¹ãã´ã¡ãã¯ã¯ãã¼ã¿ãã¼ã¹çã®é©å½å ã -- é¢æçãã¼ã¿ã¢ãã«ãã«æãã¦ããã次ã®å¯¾å¿é¢ä¿ãã²ã¨ã¨ãã説æãã¾ããã
ãã¼ã¿ãã¼ã¹ã®æ¦å¿µ | åè«ã®æ¦å¿µ |
---|---|
ãã¼ã¿ãã¼ã¹ã®ã¹ãã¼ã | å |
ãã¼ã¿ãã¼ã¹ã®ãã¼ãã« | åã®å¯¾è±¡ |
ãã¼ãã«ã®ã«ã©ã | åã®å° |
ãã¼ã¿ãã¼ã¹ã®ç¶æ ï¼ã¤ã³ã¹ã¿ã³ã¹ | é¢æ |
ãã¼ã¿æä½ | èªç¶å¤æ |
ã¹ãã´ã¡ãã¯ã¯é¢æçãã¼ã¿ã¢ãã«ã®ç¹å¾´ã次ã®ããã«æ¸ãã¦ãã¾ãã
a straightforward model of databases under which every theorem about small categories becomes a theorem about databases.
å°ããåã«é¢ãããã¹ã¦ã®å®çããã®ã¾ã¾ãã¼ã¿ãã¼ã¹ã«é¢ããå®çã¨ãªããããªãç´æ¥çãªãã¼ã¿ã¢ãã«
ãã®è¨èã®æå³ããã¨ããï¼ãã®ã¤ã³ãã¯ãã¯å®ã«ç大ã§ãããã¼ã¿ãã¼ã¹ã«é¢ãã諸æ¦å¿µãã極ãã¦ç´æ¥çã«ãåè«ã®ãªãã«ã¹ãããªã¨åãè¾¼ã¾ãã¦ãã¾ãã¾ãããããªãã°ããã¼ã¿ãã¼ã¹ã«é¢ãã¦åè«ã®éå ·ãï¼ãã¹ã¦ã§ã¯ãªãã«ããç¸å½ã«ï¼ä½¿ãã¦ãã¾ãã®ã§ããåè«ã®æ çµã¿ã¨éå ·ã®å¼·çãããåç¥ã®æ¹ãªãã身éããããããã«åããã¨ã ã¨æ°ä»ãã§ãããã
éä¼´ãã¢ããï¼ã¯ã©ã¤ã¹ãªæ§æã¯æ¢ã«ã¹ãã´ã¡ãã¯ãå©ç¨ãå§ãã¦ãã¾ãã代æ°ãããã¸ã¼ã代æ°å¹¾ä½ã®æ¹æ³ããªãã§ããã¢ããã¼çææ³ãæå ¥ããã¦ããå¯è½æ§ã¯é«ãã§ããããã¸ã£ãã¯ã»ã¢ã©ã´ã¡ï¼Jack Moravaï¼ã¯ã"Theories of anything"ã§ãã¹ãã´ã¡ãã¯çè«ã«å¯¾ãã¦åã«ã¯ãµãããªç解ã§ããªã示åã並ã¹ã¦ãã¾ããã¾ã£ããæ ¹æ ã®ãªã話ã§ã¯ãªãã§ãããã
ããå°ãç¾å®çï¼å®åçãªè©±ããã¾ãããï¼ é¢æçãã¼ã¿ã¢ãã«ã®ææ³ã¯é¢ä¿ã¢ãã«ä»¥å¤ã®ãã¼ã¿ã¢ãã«ã«ãé©ç¨ã§ãã¾ããNoSQLãå°é ãã¦ããæ代ã®æ½®æµã«ãã£ãããã¦ããã¨è¨ãã¾ããã¹ãã´ã¡ãã¯ã¯ãRDFã¨SPARCLã«ãèå³ããããããããã°ãã°ä¾ã«åºãã¦ãã¾ããWebã«ãã¼ã¿ãã¼ã¹æ§é ï¼ãããåæ§é ï¼ãä¸ãããã¨ã¯ãLinked Dataãªã©ã®åãã§åã³æ³¨ç®ãæµ´ã³ãããç¥ãã¾ããã
ã¯ããã¦é¢æçãã¼ã¿ã¢ãã«ãç¥ã£ãã¨ãåãé©æããäºæ ãããã¦ã®ããè¾¼ãã§ãã¾ã£ãçç±ãå°ãã¯ä¼ãã£ãã§ããããã
*1:åå§ååã§çå¹´ææ¥ãåã人ã¯åºå¥ã§ããªãã¨ããçµå©ãã¦å§ãå¤ããã¨å¥äººæ±ãã«ãªãã¨ããç¾å®çãªåé¡ãããç¹ã¯æ³¨æãã¦ããã¾ãã
*2:åã¯ã¢ã³ãã¨ã³ãåã¨å¼ãã§ãã¾ããSetãPartialã使ããã¾ãã
*3:å®è£ è ã®ç«å ´ã§ã¯ãåå空éãååå½¢å¼ã®æ±ºå®ã¯ããªãé ã®çãåé¡ã§ãã
*4:é¨åååã®åã«ãããã¢ãå°ã¨ã¯éããªãã§ãã
*5:å¯æå³å¼ã¯ãå®ã¯2-ã»ã«ã§ããããæ£ç¢ºãªè¨è¿°ã«ã¯é«æ¬¡åã使ãã¹ãã§ãããã
*6:å®åä¸ã主ãã¼ çªå·ãªã©ã«ããIDã«ã©ã ã¯å¿
é ã ã¨ããã®ã¯ãã®ã¨ããã ã¨æãã¾ãããããã¯ããã®æèã¨ã¯å¥ãªè©±ã§ãã
*7:ããã«ã¯ãæ½å¨çã«é«æ¬¡åã®æ§ææ³ã使ãã¾ãã
*8:fixedã¯ãããã°ã©ãã³ã°è¨èªã®constãfinalã«ä¼¼ããã®ã§ãã