äž»ãªç®æš
ç¹å®ã®ããããã£ã䜿çšããŠããã¥ã¡ã³ããäœæããå¿ èŠãããã®ã¯ãªãã§ããïŒãŸããã©ã®ããããã£ãå¶åŸ¡ã§ããŸããïŒ æåã®è³ªåã«å¯Ÿããçãã¯ã»ãšãã©æçœã§ãã ã»ãšãã©ã®ææžã¯åãªãããã¹ãã§ã¯ãªããããã€ãã®ã»ãã³ãã£ã¯ã¹ãåããŠããŸãã XMLã¯æ§æè¡šçŸã®åé¡ã解決ããã¹ããŒãã¯æå³çãªæå³ã®åé¡ãéšåçã«è§£æ±ºããŸãã ããã¥ã¡ã³ããã¹ããŒã ã«æºæ ããŠãããããæå¹ãªããã¥ã¡ã³ãã®ã¯ã©ã¹å šäœã«å¯ŸããŠæå¹ãªäžé£ã®äºåå®çŸ©æžã¿ã¢ã¯ã·ã§ã³ãå®è¡ã§ããŸããå¥ã®åœ¢åŒã§ã®è¡šç€ºãç¹å®ã®ã¿ã¹ã¯ã®éèŠãªæ å ±ã®ãšã¯ã¹ããŒããã°ããŒãã«ãªå¶éãèæ ®ããæ°ããæ å ±ã®ã€ã³ããŒãã§ãã ãã®å Žåã«æãäžè¬çã«äœ¿çšãããã¡ã«ããºã ã¯XSLTå€æã§ãããã®æå³ã¯æ¬¡ã®å³ã§èª¬æã§ããŸãã
åè·¯ã®ä»æ§ã¯ 2çªç®ã®è³ªåã«å®å šã«çããŸãããåè·¯ã®æ©èœãç解ããããã®æãéèŠãªç¹ã«ã€ããŠã®ã¿èª¬æããŸãã ãã®ããããã®ã¹ããŒã ã§ã¯æ¬¡ã®ããšãã§ããŸãã
- ããŒã¿ããŒããšå±æ§ã®é¡ååãå³å¯ã«å¶åŸ¡ããŸãã
- ããŒãã®ã·ãŒã±ã³ã¹ã決å®ããå¿ èŠãªããŒããšå±æ§ã®ååšãç£èŠããŸãã
- ç¹å®ã®ã³ã³ããã¹ãã§èŠçŽ ã®äžææ§ãèŠæ±ããŸãã
- ã³ã³ããã¹ãã«å¿ããŠãäžéšã®å±æ§ãŸãã¯ãã®ä»ã®å±æ§ã®ååšãå¿ èŠãšããããªã¢ã³ãããŒããäœæããŸãã
- ããŒããŸãã¯å±æ§ã®ã°ã«ãŒãã§ç¹å®ã®è¿°èªã®å®è¡ãèŠæ±ããŸãã
ç°¡åãªäŸãšããŠãèšäºã®ç®æ¬¡ãåŒçšã§ããŸã-ã¹ããŒã ã¯ããŒã¿ã®ã»ãã³ãã£ã¯ã¹ãèšå®ã§ããŸããã¿ã€ãã«-ããŒãžããããŒãžãæé ã§ããããšãåäžã®ååããªãããšãå®çŸ©æžã¿ã®èŠçŽ ã玹ä»ãããåç §ãã«è¡ããããããã°å¿ èŠã§ãçµè«ã®èŠçŽ ã æãè€éã§åŒ·åãªäŸã¯XMLããŒã¿ããŒã¹ã§ããXMLããŒã¿ããŒã¹ã§ã¯ãé¡ååãšããŒã¿ã®æå¹æ§ã®äž¡æ¹ãã¹ããŒãã®ã¿ã«ãã£ãŠæ±ºå®ãããŸãã
æå¹æ§ã倱ããªãããã«ãéžæãããã¹ããŒã ãæ¢ã«æºãããŠããããã¥ã¡ã³ããå€æŽãããããšããããããŸãã ããã§ã¯ãããã¥ã¡ã³ããžã®æ å ±ã®WebãšãŒãžã§ã³ãïŒã¢ã°ãªã²ãŒã¿ãŒïŒã®è¿œå ãXMLããŒã¿ããŒã¹ã®ã¯ãšãªã®å€æŽãªã©ã®èªåå€æŽãããã³èŠèŠçãªXMLãšãã£ã¿ãŒã§ã®æåå€æŽã«ã€ããŠèª¬æããŠããŸãã 倧ããªããã¥ã¡ã³ãã®å®å šãªæ€èšŒæäœã«ã¯ãæ°åç§ä»¥äžã®ããªãã®æéããããå Žåããããäžè¬ã«ãååã®å€æŽ-æ€èšŒ-æåŠ/解決ãã¢ãããŒãã䜿çšã§ããŸããã ãããŠãããžã¥ã¢ã«ãšãã£ã¿ãŒã®å Žåã¯ãããã«å€ãã®ããšãæã¿ãŸããã¢ãããã¯ã¢ã¯ã·ã§ã³ããã§ãã¯ã§ããã ãã§ãªããã¹ããŒã ã«åŸã£ãŠæå¹ãªç¹å®ã®ããŒããå€æŽããããã®ãã¹ãŠã®ãªãã·ã§ã³ãæäŸã§ããããã«ããŸãã ãã ãã åªããXMLãšãã£ã¿ãŒã¯ãããå®è¡ã§ããŸããã©ã®ããã«å®è¡ããããç解ããããšããŸãã
å¿ èŠãªXMLã¹ããŒãæ å ±
W3C XMLã¹ããŒãã¯ã XML DTD ïŒããã¥ã¡ã³ãã¿ã€ãå®çŸ©ïŒã®ã¢ã€ãã¢ãçºå±ããããã®ã§ãã äž¡æ¹ã®æšæºã¯ããã®ããã¥ã¡ã³ãã®æ§æäžã®å¶éã«é¢ããŠã¯ã©ã¹ïŒãŸãã¯ã¿ã€ãïŒãèšè¿°ããäžé£ã®å®£èšïŒãã©ã¡ãŒã¿ãŒãªããžã§ã¯ããèŠçŽ ãããã³å±æ§ïŒã«ãã£ãŠããã¥ã¡ã³ãã®ã¬ã€ã¢ãŠããèšè¿°ããŸãã DTDã¯ãã¢ãããã¯çšèªãŸãã¯ã¿ã€ããã£ã¯ã·ã§ããªã®èŠçŽ ã«å¯Ÿããäžé£ã®æ£èŠè¡šçŸãèæ ®ããŸãã åã¿ã€ãã¯ãä»ã®ã¿ã€ããã¢ãããã¯çšèªããã³ä»£æ¿æäœã|ããé£çµãããããã³æŒç®åãïŒããã+ããã*ããæå³ã®ãªãã·ã§ã³ã1ã€ä»¥äžã®ååšããŸãã¯ãŒã以äžã«åºã¥ããŠæ§ç¯ãããŸãèŠçŽ ã XMLã¹ããŒãã¯XML DTDæ§æãšã¯ç°ãªããDTDã®æ©èœã次ã®3ã€ã®æ¹æ³ã§æ¡åŒµããŸãã
- æå®ããåå空éã«äžèŽããèŠçŽ ã䜿çšã§ãããã³ãã¬ãŒãïŒanyãanyTypeãanyAttributeïŒã
- ç¹å®ã®ã¿ã€ãã®èª¬æã®ä»£ããã«äœ¿çšã§ããã¿ã€ãã®ã»ãããå®çŸ©ãã眮æã°ã«ãŒãã
- ç¹°ãè¿ãã®æ°ãåèŠçŽ ã«ã€ããŠãã¿ã€ãå ã®ãªã«ã¬ã³ã¹ã®æå°ããã³æ倧蚱容æ°ã決å®ããŸãïŒKleeneæŒç®åã®äžè¬åïŒã*ããã+ãïŒã
ã¹ããŒãã®ã¢ã«ãŽãªãºã ã«ããæ€èšŒã¯ãDTD [1]ã®å¯Ÿå¿ããã¿ã¹ã¯ãããè€éãªã¿ã¹ã¯ã§ãããXMLã¹ããŒããèšè¿°ããããã®åŸã®æšæºã¯ãæ€èšŒãéåžžã«å®¹æã«ããèŠåã«ãã£ãŠè£è¶³ãããŸãã
Unique Particle Attributionã«ãŒã«ã§ã¯ãããã¥ã¡ã³ãã®åèŠçŽ ãã芪èŠçŽ ã®ã³ã³ãã³ãã¢ãã«å ã®ä»»æã®1ã€ã®xsdïŒelementãŸãã¯xsdïŒä»»æã®ç²åã«äžæã«å¯Ÿå¿ããŠããå¿ èŠããããŸã[2]ã
äžè¬çã«ãUnique Particle AttributionïŒUPAïŒã«ãŒã«ã¯XMLã¹ããŒãã®æ§é ã«å¯Ÿããå³å¯ãªèŠä»¶ã§ã¯ãããŸããããéåžžã«æãŸããæšå¥šäºé ãšäœ¿çšãããŠããã¹ããŒãã®äžéšã®ã¿ãããã«æºæ ããŠããŸããã ããŒãã£ã¯ã«ã®å®çŸ©ã«é¢ããäžææ§ã®èŠåãžã®éåã瀺ãæãåçŽãªäŸãèããŠã¿ãŸãããã
次ã®ããã«ã¹ããŒã ãå®çŸ©ããŸãã
<xsd:element name="root">
<xsd:complexType>
<xsd:choice>
<xsd:element name="e1"/>
<xsd:any namespace="##any"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
次ã«ã1ã€ã®èŠçŽ ã§æ§æãããXMLããã¥ã¡ã³ãã¯ãäžææ§ã®èŠåãžã®éåã蚌æããŸãã èŠçŽ ã¯ãxsdïŒelmentããã³xsdïŒä»»æã®ãã©ã³ãã«åæã«ãããã³ã°ã§ããŸãã
幞ããªããšã«ãã»ãšãã©ã®ããã«äœ¿ããã¹ããŒã ã¯UPAã«ãŒã«ã«åŸããŸãã ã¹ããŒã ãUPAã«ãŒã«ã«æºæ ããŠããå Žåã«ã®ã¿ããããªãèæ ®äºé ãåœãŠã¯ãŸããŸãããäžè¬ã«ãæšè«ãå°ãå€æŽããã ãã§ãé床ã®äœäžã«ããäºææ§ã®ãªãUPAã¹ããŒã ã§ãæ£ç¢ºæ§ãéæã§ããŸãã
æ€èšŒããŒã«ã®æ§ç¯
ãŸããæ§é ã®åºæ¬çãªå€æŽãå®çŸ©ããŸããããã¯ãæ£ç¢ºæ§ããã§ãã¯ããŸãã
- è¿œå ïŒäœçœ®nã«ã¿ã€ãxã®ãµãã¢ã€ãã ãäœæã
- åé€ïŒäœçœ®nã®ãµãèŠçŽ ãåé€ããŸãã
- MOVEïŒèŠçŽ ãäœçœ®nããäœçœ®mã«è»¢éããŸãïŒè»¢éã¯èŠçŽ ã®åé€ãšè¿œå ã«éå®ãããŸãããäžéç¶æ ã¯ããã¥ã¡ã³ãã®æå¹æ§ã«éåããå ŽåããããŸãïŒã
次ã«ãè€éãªã¹ããŒãã¿ã€ãã®ã³ã³ãã³ãã¢ãã«ã«ã€ããŠèª¬æããŸãã
- ç²åïŒ
â¢MinOccurs-çšèªã®ç¹°ãè¿ãã®æå°æ°ïŒ0ã®å Žåãçšèªã¯ãªãã·ã§ã³ã«ãªããŸãïŒã
â¢MaxOccurs-é ã®ç¹°ãè¿ãã®æ倧æ°ïŒç¡éã¯èš±å¯ãããŸã-infïŒã
â¢çšèªïŒèŠçŽ ã®èª¬æããã¿ãŒã³ãã·ãŒã±ã³ã¹ããŸãã¯éžæã
- èŠçŽ ã®èª¬æïŒtypedefïŒïŒ
â¢ããŒã«ã«åã
â¢åå空éã®ååïŒçç¥ã§ããŸãããã®å ŽåãèŠçŽ ã¯ä»»æã®åå空éã§æå¹ãšèŠãªãããŸãïŒã
â¢çœ®æã°ã«ãŒã-typedefãå«ãåŒã§åãå ¥ãããããã¹ãŠã®èŠçŽ ã®ã»ããã
- ãã³ãã¬ãŒãïŒä»»æïŒïŒ
â¢çœ®æèŠçŽ ã«æå¹ãªåå空éã®ååïŒååšããªãå ŽåããããŸãïŒã
- ã·ãŒã±ã³ã¹ïŒ
â¢èš±å®¹ãããç²åã®é 次ãªã¹ãã
- éžæè¢ïŒ
â¢èš±å®¹ãããå€ãã®ç²åã
æ€èšŒã¢ã«ãŽãªãºã ã«çŽæ¥ã¢ã¯ã»ã¹ã§ããŸãã æåã«å¿ èŠãªã¢ã¯ã·ã§ã³ã¯ããã¹ããŒã ã®ã¿ã€ãã->ããã®ã¿ã€ãã®èŠçŽ ã®åå«ã®æå¹æ§ããã§ãã¯ã§ãããªãŒãããã³ããäœæããããšã§ãã ã¿ã¹ã¯ã¯ã次ã®2ã€ã®ååž°ã¢ã¯ã·ã§ã³ã«ãªããŸãã
1.äžããããç²åããäžããããæçµç¶æ Sãæã€é決å®æ§æéç¶æ æ©æ¢° ïŒNFAïŒã®æ§ç¯ïŒ
aã Sã«åæç¶æ nãèšå®ããŸãã
bã MaxOccursããŒãã£ã¯ã«ãç¡é倧ïŒinfïŒã«çããå ŽåïŒ
â¢æ°ããäžéç¶æ tãè¿œå ããŸãã çšèªã®NFAãžã®å€æããååŸïŒã±ãŒã¹2ïŒã tããnããã³nããSã«ã€ãã·ãã³ãšããžãè¿œå ããŸãã
cã MaxOccursããŒãã£ã¯ã«ã®æ°ãmã®å ŽåïŒ
â¢ïŒMaxOccurs-MinOccursïŒçšèªå€æã®ãã§ãŒã³ãæ§ç¯ããæçµç¶æ Sããéå§ããåã¹ãããã§äžéç¶æ ããæçµç¶æ Sã«ã€ãã·ãã³ãªããè¿œå ããŸãã
ããšãã°ãMaxOccurs = 4ããã³MinOccurs = 2ã®å Žåã次ã®ãªãŒãããã³ãååŸãããŸãã
dã æ°ããåæç¶æ nããåã®æé ã§ååŸããåæç¶æ ãžã®çšèªå€æã®minOccursã³ããŒãäœæããŸãã
2.äžããããçšèªã§äžããããåä¿¡ç¶æ Sãæã€é決å®æ§æéç¶æ ãã·ã³ã®æ§ç¯ïŒ
aã çšèªããã³ãã¬ãŒãïŒanyïŒã®å ŽåïŒ
â¢æ°ããç¶æ bãäœæããçšèªã¿ã€ãã§ããŒã¯ããããšããžã§Sã«æ¥ç¶ããbãè¿ããŸãã
bã çšèªãèŠçŽ ã®èª¬æã®å ŽåïŒ
â¢æ°ããç¶æ bãäœæãã眮æã°ã«ãŒãã®åèŠçŽ ã«å¯ŸããŠãèŠçŽ ã®ã¿ã€ãã§ããŒã¯ãããbããSãžã®ãšããžãäœæããbãè¿ããŸãã
cã çšèªãéžæã®å ŽåïŒ
â¢æ°ããç¶æ bãäœæããŸããéžæããèŠçŽ ããšã«ãªãŒãããã³ãäœæãïŒã±ãŒã¹1ïŒãç¶æ bããã³ç¶æ Sã®ã€ãã·ãã³ãšããžã«æ¥ç¶ããŸããbãè¿ããŸãã
dã çšèªãã·ãŒã±ã³ã¹ã®å ŽåïŒ
â¢åéžæèŠçŽ ã«ã€ããŠããªãŒãããã³ãäœæãïŒã±ãŒã¹1ïŒãååŸãããªãŒãããã³ãç¶æ Sããéé ã§æ¥ç¶ãããã§ãŒã³ã®æåã®ç¶æ ãè¿ããŸãã
次ã«ãååŸããNFA [3]ã«ãã³ããœã³ã¢ã«ãŽãªãºã ãé©çšããŠã決å®æ§ãªãŒãããã³ãæ§ç¯ããŸãã ãã³ããœã³ã¢ã«ãŽãªãºã ã¯ãåãã©ãã«ã®éã€ãã·ãã³ãšããžã®æãç³ã¿ã«åºã¥ããŠã決å®ãªãŒãããã³Ahoããã³Ulmanãæ§ç¯ããã¢ã«ãŽãªãºã ãšåãå Žåã«é©çšã§ããŸã[4]ã ãã ããå Žåã«ãã£ãŠã¯ãå ã®ãªãŒãããã³ïŒæé 1ã2ã§äœæïŒã䜿çšãããšãAho and Ulmanã¢ã«ãŽãªãºã ã¯æ±ºå®çãªãªãŒãããã³ãæ§ç¯ã§ããŸããã
ããã¯ã次ã®ãããª1ã€ã®é ç¹ãã2ã€ã®å€åãã®ãšããžãããå Žåã«çºçããŸãã
- ãããã®ã©ãã«ã¯ãåãããŒã«ã«åãšåå空éåãæã€ã¿ã€ãã®èª¬æã§ãã
- ã©ãã«ã¯ãéè€ããé åãæã€ãã¿ãŒã³ã®ååã§ãã
- äžæ¹ã®ãšããžã®ã©ãã«ã¯ãã³ãã¬ãŒãã§ãããããäžæ¹ã¯ã¿ã€ãã®èª¬æã§ãããäž¡æ¹ãšãåãããŒã ã¹ããŒã¹ã«ãããã¿ã€ãã®èª¬æã¯ãã³ãã¬ãŒãé åã«å«ãŸããŠããŸãã
åã±ãŒã¹ãUPAå¶éã®éåã«å¯Ÿå¿ããŠããããšã瀺ãã®ã¯ç°¡åã§ãïŒ3çªç®ã®ã±ãŒã¹ã¯ãããŒãã£ã¯ã«å®çŸ©ã®äžææ§ã®èŠåã«éåããã¹ããŒã ã®äŸã§ãã§ã«æ€èšãããŠããŸãïŒã ãããã£ãŠããããã®ç¹ã¯è§£ã®æ£ç¢ºãã劚ããŸãããã¢ã«ãŽãªãºã ã®åºåã§ã¯ã察å¿ããåã®èŠçŽ ã®å 容ãæ€èšŒãã決å®è«çãªæéç¶æ ãã·ã³ãåžžã«ååŸããŸãã
ææ¡ãããã¢ã«ãŽãªãºã ãåã¿ã€ãã®åè·¯ã«é©çšãããã®ã¿ã€ãã®èŠçŽ ã®åå«ããã§ãã¯ã§ãã察å¿ã¿ã€ã->ãªãŒãããã³ãååŸããŸãã
æåŸã®åé¡ã§ãããç¹å®ã®ããªãŒèŠçŽ ã§æäœãæ€èšŒãããšãã®ç®çã®æéç¶æ ãã·ã³ã®éžæã解決ããããšã¯æ®ã£ãŠããŸãã ã»ãšãã©ãã¹ãŠïŒããšãã°ã MSXMLãlibxmlïŒã®å®å šãªããªããŒã¿ãŒã«ãã£ãŠçæãããæ€èšŒã¿ã€ãïŒPSVIã äºåŸæ€èšŒæ å ±ã»ããïŒã®ãã€ã³ãã£ã³ã°ã®æ§é ã圹ç«ã¡ãŸãã ããªãŒã®ä»»æã®èŠçŽ ã«ã€ããŠãã¹ããŒã ã®èª¬æã§ããã«å¯Ÿå¿ããåã瀺ããŸããããã¯ãç®çã®ãªãŒãããã³ãçæããæ£ç¢ºãªåã§ãã
ãã®å ŽåãPSVIæ§é ã®å®è£ ã¯ãããªãŒã®åèŠçŽ ã®ã¹ããŒã ã®ã¿ã€ããžã®åç §ã«ãã£ãŠè¡šãããŸãã
MOVEããã³REMOVEæäœã¯ãªãã©ã³ãã®ã¿ã€ããå€æŽããªãããïŒãããã£ãŠãPSVIæ§é ãå€æŽããå¿ èŠã¯ãããŸããïŒãxèŠçŽ ã®è¿œå ã«äŒŽãADDæäœã§ã¯PSVIæ§é ã«xã¿ã€ããè¿œå ããå¿ èŠããããŸãã ãããã£ãŠãæ§é ã®å€æŽãšãšãã«ãæ€èšŒã¿ã€ãã®ãã€ã³ãã£ã³ã°ã®æ å ±ã»ãããå€æŽããéšåæ€èšŒã®åé¡ã解決ããå€éšæ€èšŒãåŒã³åºãããšãªãPSVIããªãŒããµããŒãããŸãã
çµæã®æ¯èŒ
äžè¬çã«ãçŽæ¥ã®æ¯èŒã¯ãããŸãã-çµå±ãç¹å®ã®ã±ãŒã¹ïŒUPAæºæ ïŒã§ç¹å®ã®åé¡ïŒæäœADD / REMOVE / MOVEïŒã解決ããã¢ãã€ã³ã«ã€ããŠèª¬æããŸãããããã®å Žåãå®å šãªæ€èšŒã䜿çšããããšããå Žåã«æ¯ã¹ãŠãé床ãå€§å¹ ã«åäžããããšã瀺ããããšæããŸãã PSVIãçæããåç §ããªããŒã¿ãŒãšããŠMSXML6ãéžæãããããããããåäœæéãšæ¯èŒããŸãã
æ§é èŠçŽ ã®æ° | ãã¹ãã¬ãã« | åè·¯ã¿ã€ãã®æ° | MSXML6ã®å¹³åæ€èšŒæé | 説æãããŠããã¢ãã€ã³ã䜿çšããå¹³åæ€èšŒæé |
32 | 4 | 16 | 10ããªç§ | <1 ms |
32 | 4 | 40 | 16ããªç§ | <1 ms |
120,000 | 4 | 16 | 51ããªç§ | <2 ms |
120,000 | 4 | 40 | 62ããªç§ | <2 ms |
120,000 | 32 | 16 | 2300ããªç§ | <5ããªç§ |
120,000 | 32 | 40 | 2600ããªç§ | <6 ms |
ãããã£ãŠãéåžžã«èš±å®¹å¯èœãªå¹³åã¹ãã£ã³ã¿ã€ã ã¢ãŠããåŸãããããžã¥ã¢ã«ãšãã£ã¿ãŒã§ãã®å Žã§ãã©ãã°ã¢ã³ãããããã¡ã«ããºã ãå®è£ ã§ããå¯èœãªXMLããŒã¿ããŒã¹ã«å¯ŸããŠ1ç§ãããã®ã¯ãšãªæ°ãå€ããªããŸãã
åç §è³æ
[1] XML Schema Validatorã ãã³ããœã³ããã³ãªãŒS.ããã³R.ããŒãã³ãW3Cããšãžã³ãã©å€§åŠã2003幎ã
[2] XMLã¹ããŒãããŒã1ïŒæ§é ã ãã³ãªãŒã»Sã»ãã³ããœã³ãããããã»ããŒãããã¬ãŒã»ããããŒããã¢ã»ã¡ã³ãã«ãŸãŒã³ãç·šéè ã W3Cå§åã2001幎ã
[3] æ£èŠè¡šçŸã®ãããã³ã°ã¯ç°¡åã§é«éã§ãã ã©ã¹ã³ãã¯ã¹ã2007幎ã
[4]ã³ã³ãã€ã©æ§ç¯ã®ååã A.ã¢ãã D.ãŠã«ãã³ã MãïŒããŒã«ã1977幎ã