1 / 27

XML-Tuples & XML-Spaces V0.7

XML-Tuples & XML-Spaces V0.7. By David “Uncle Dave” Moffat. Presented by: Shurug Al-Khalifa. Outline. Overview of Tuple Spaces and XML-Spaces. Basic XML-Spaces & XML-Tuples operations. Database operations on XML-Spaces. Extended Database Queries on XML-Spaces. Introduction.

belita
Download Presentation

XML-Tuples & XML-Spaces V0.7

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML-Tuples & XML-Spaces V0.7 By David “Uncle Dave” Moffat Presented by: Shurug Al-Khalifa

  2. Outline • Overview of Tuple Spaces and XML-Spaces. • Basic XML-Spaces & XML-Tuples operations. • Database operations on XML-Spaces. • Extended Database Queries on XML-Spaces.

  3. Introduction • Implementation of tuples and tuple-spaces using XML. • Tuple  list of values (“Sam”, 7, 48.1). • Tuple Space  public repository that contains tuples. • Template  tuple set up for matching. • Using XML for the tuples and the commands.

  4. Definitions • XML-tuple  list of data fields in an XML format. • Data field  XML-tagged data. <name> Ralph </name> • XML-tuple field values are strings. • XML-space  tuple space with XML tuples. • An XML-space: • Referenced by a name. • Located on a server.

  5. Creating and Communicating with an XML-Space • “do” method. • Commands and parameters expressed in XML. XMLSpace xs = new XMLSpace (“MySpace”,“server.mine.org”);

  6. Writing XML-Tuples to an XML-Space String strTuple=“<write>”+ “ <name>Ralph</name>”+ “ <age>33</age>”+ “ <weight>190.7</weight>”+ “</write>”; String strResult; strResult=xs.do(strTuple); • Returns with<tuple> • If error, message with<error>

  7. Writing Several XML-Tuples at Once • Concatenate several<write>into one string. <write> <name>Ralph</name> <age>33</age> <weight>190.7</weight> </write> <write> : </write>

  8. Matching XML-Tuples • Create a template. • Template  XML-Tuple where fields may or may not have value in them.

  9. Reading XML-Tuples from an XML-Space • Read only. • Match a template. <read> <name/> <age>33</age> <weight/> </read> • Returns with<tuple> • If not Found, NULLis returned. • If error, message with<error>

  10. Reading XML-Tuples from an XML-Space • Read and remove. • Match a template. <take> <name/> <age>33</age> <weight/> </take> • Returns with<tuple> • If not Found,NULLis returned. • If error, message with<error>

  11. Reading XML-Tuples from an XML-Space • If client has to find a match. • Read <waitToRead> • Read and remove <waitToTake> • xs.doreturns: • Tuple if a match is found. • If a match is not found, waits until tuple exists then returns it.

  12. Reading Several XML-Tuples at Once • Read only. • Match a template. <scan> <name/> <age>33</age> <weight/> </scan> • Returns list of tuples with<tuple> • If not Found,NULLis returned. • If error, message with<error>

  13. Reading Several XML-Tuples at Once • Read and remove. • Match a template. <scanTake> <name/> <age>33</age> <weight/> </scanTake> • Returns list of tuples with<tuple> • If not Found, NULLis returned. • If error, message with<error>

  14. Counting the Number of Matching XML-Tuples • Match a template. <count> <name/> <age>33</age> <weight/> </count> • Returns number of tuples found with<count> • If error, message with<error>

  15. Registering for XML-Space Events • Event  operation on an XML-space. • . XMLSpaceListener interface. • . Register as a Listener. • . Give a template to the space.

  16. Registering for XML-Space Events • . XMLSpaceListener interface. Interface XMLSpaceListener { handleXMLSpaceEvent(String tuple, String space, String host, long lNum, boolean bErr); } • If error, message with<error> in “tuple”.

  17. Template Registering for XML-Space Events • . Register as a Listener. • . Give a template to the space. xs.addXMLSpaceListner(this,tplt) • Can register for different operations and templates

  18. XML-Space Queries • Basic query = scan <query> <name/> <age>33</age> <weight/> </query> • Returns a tuple or a list of tuples with<tuple> • If not Found, NULLis returned. • If error, message with<error>

  19. ANDing XML-Space Queries • Match with two given query templates. <andQuery> <query> : </query> <query> : </query> </andQuery> • Returns a tuple or a list of tuples with<tuple> • If not Found, NULLis returned. • If error, message with<error>

  20. ORing XML-Space Queries • Match with one or both given query templates. <orQuery> <query> : </query> <query> : </query> </orQuery> • Returns a tuple or a list of tuples with<tuple> • If not Found, NULLis returned. • If error, message with<error>

  21. Range Queries • Match with values within template range. <rangeQuery> <query> : </query> <query> : </query> </rangeQuery> • Returns a tuple or a list of tuples with<tuple> • If not Found, NULLis returned. • If error, message with<error> Lower Limit Upper Limit

  22. Nested Queries <orQuery> <andQuery> <query> : </query> <query> : </query> </andQuery> <rangeQuery> <query> : </query> <query> : </query> </rangeQuery> </orQuery>

  23. XML-Space Transactions • Used to perform an operation only if it is successful. <transaction/> <write> : </write> <write> : </write> • Everything is OK <commit/> • Anything is unsuccessful <abort/>

  24. Matching to Different “Depths” • A field: - have content but not subfields. <age>33</age> - be Null and have subfields. <name> <first>Karl</first> <last>Martin</last > </name> - have content and subfields. <phone>123 456 789 <ext>221</ext> </phone>

  25. Partial XML-Tuple Templates • Partial Template  does not specify all the fields or the subfields. <name/> <address> <city>Ann Arbor</city> </address> <phone> <ext/> </phone>

  26. Partial XML-Tuple Templateswith Wildcards • Used to match upper-level fields of template. • Breadth-wise<*/> <address> <city>Ann Arbor</city> </address> • Depth-wise<*> <address> <city>Ann Arbor</city> </address> </*>

  27. Conclusion • Tuple Spaces and XML-Spaces. • Operations on XML-Spaces & XML-Tuples. • Querying XML-Spaces.

More Related