• IEEE 802.21 MEDIA INDEPENDENT HANDOVER • DCN:21-05-0407-03-0000 • Title: Integration of XML and TLV • Date Submitted: January, 9, 2006 • Presented at IEEE 802.21 session in Vancouver • Authors or Source(s): • Yoshihiro Ohba, Kenichi Taniuchi and Subir Das • Abstract: This document describes two methods for converting XML 1.0 data to TLV format. The two methods and XML 1.0 are compared in terms of number of encoded octets and processing time for three typical query types. 21-05-0407-03-0000 IEEE 802.21 presentation release statements • This document has been prepared to assist the IEEE 802.21 Working Group. It is offered as a basis for discussion and is not binding on the contributing • • individual(s) or organization(s). The material in this document is subject to change in form and content after further study. The contributor(s) reserve(s) the right to add, amend or withdraw material contained herein. The contributor grants a free, irrevocable license to the IEEE to incorporate material contained in this contribution, and any modifications thereof, in the creation of an IEEE Standards publication; to copyright in the IEEE’s name any IEEE Standards publication even though it may include portions of this contribution; and at the IEEE’s sole discretion to permit others to reproduce in whole or in part the resulting IEEE Standards publication. The contributor also acknowledges and accepts that this contribution may be made public by IEEE 802.21. The contributor is familiar with IEEE patent policy, as outlined in Section 6.3 of the IEEE-SA Standards Board Operations Manual <http://standards.ieee.org/guides/opman/sect6.html#6.3> and in Understanding Patent Issues During IEEE Standards Development http://standards.ieee.org/board/pat/guide.html> 21-05-0407-03-0000 Information Service Properties • Information Service representation and Information query/exchange shall be • Extensible: • • Flexible: • • The specification shall be able to support future PHY/MAC technology, without changing the 802.21 specification itself every time a new PHY/MAC technology is invented The specification shall be able to support various types of queries to be useful for different handover mechanisms, protocols, algorithms and policies. Efficient: • The specification shall avoid unnecessary information query/exchange and should have less information encoding overhead 21-05-0407-03-0000 A Possible Approach • Schema-based semantic query with binary encoding • Schema provides extensibility • Semantic query provides flexibility and query efficiency • Binary encoding provides encoding efficiency How can we achieve all of above functionalities? It is evident that only by integrating XML and TLV, we can achieve best of each solution 21-05-0407-03-0000 Candidate Solutions • XML provides schema-based semantic query • But needs to send more bits over the air if we use native XML 1.0 format • TLV provides binary encoding • But does not provide a standard query language for semantic query It is evident that only by integrating XML and TLV, we can achieve best of each solution 21-05-0407-03-0000 How Can We integrate? • • Possible approach : XML binary representation • Convert XML data contained in query result into TLV • Two example conversion methods Method A: Applicable to any XML data • Alias-based conversion • • • • • • Convert XML namespace names to integers Convert XML tag names to integers Convert XML attribute names to integers Convert ENTRY names to integers • Mappings are carried with data Dynamic integer mapping Method B: Applicable to a particular query language • Semantic bundling • • • Two or more semantically -related XML tags are mapped to a single integer for further optimization Taking advantage of the knowledge of the query language syntax Apply Method A for other operations 21-05-0407-03-0000 Method A 21-05-0407-03-0000 TLV Format for XML binary encoding Octets: 0x1= STR 0x2= XMLVER 0x3 = DOCTYPE 0x4 = ENTDEF 0x5 = DOC 0x6 = NSDEF 0x7 = BASE 0x8 = TAGDEF 0x9 = ATRDEF 0xa = ENT 0xb = NS 0xc = TAG 0xd = ATR 0xe = STRALDEF 21-05-0407-03-0000 Type Length Value 1 2 Variable Type field values 0xf = STRAL 0x10 = YES 0x11 = NO 0x12 = BLANKNODE 0x13 = RDFTRIPLES 0x14 = VARIABLE 0x15 = RESULT … STR TLV • Value field contains an octet string Octets: 21-05-0407-03-0000 0x1 Length Octet String 1 2 Variable STRALDEF TLV • Value field: String Alias Number and Octet String Octets: 21-05-0407-03-0000 0xe Length 1 2 String Alias Octet String Number 2 Variable STRAL TLV • Value field: Octets: 21-05-0407-03-0000 0xf Length 1 2 String Alias Number 2 XMLVER TLV • Corresponds to <?xml version=“…”> tag • Value field contains the version string • In case of <?xml version=“1.0”>, XMLVER TLV can be omitted Octets: 21-05-0407-03-0000 0x2 Length Octet String 1 2 2 DOCTYPE TLV • Corresponds to <!DOCTYPE document_type> commentary tag • Value field contains the document_type string Octets: 21-05-0407-03-0000 0x3 Length STR TLV 1 2 2 ENTDEF TLV • Corresponds to “<!ENTRY entry_name entry_value>” Octets: 0x4 Length 1 2 21-05-0407-03-0000 Entry Number 2 STR TLV (Entry name) Variable STR TLV (Entry value) Variable DOC TLV • Corresponds to the first non-commentary tag Octets: 21-05-0407-03-0000 0x5 Length 1 2 List of NSDEF TLVs BASE Value (option) (Octet String) Variable Variable NSDEF TLV • Corresponds to “xmlns:namespace_name” attribute Octets: 0x6 Length 1 2 21-05-0407-03-0000 NS Number 2 STR TLV STR TLV or ENT TLV (NS name [Optional]) (NS value) Variable Variable BASE TLV • Corresponds to “xmln:base” attribute Octets: 21-05-0407-03-0000 0x7 Length STR TLV or ENT TLV 1 2 Variable TAGDEF TLV • Corresponds to the non-commentary tags except for the first one Octets: 0x8 Length 1 2 Tag Number 2 NS Number 2 Tag Name (Octet String) Variable If there is no explicit namespece, then NS Number value is 0 (zero) 21-05-0407-03-0000 Predefined Tag Numbers (1..999) • • • • • • • • sparql= 1 head = 2 variable = 3 results = 4 result = 5 binding = 6 literal = 7 boolean = 8 TAGDEF TLV is not needed for the above tags 21-05-0407-03-0000 TAG TLV • Corresponds to a non-commentary tag Octets: 0xc Length Tag Number Zero or more ATR TLVs 1 2 2 Variable 21-05-0407-03-0000 Zero or more TAG TLVs or TAGDEFs or ATRDEFs or STR TLV or STRAL TLV [OPTIONAL] Variable ATRDEF TLV • Corresponds to an attribute_name=attribute_value part in tag Octets: 21-05-0407-03-0000 0x9 Length 1 2 Attribute Number 2 Attribute Name (Octet String) Variable Predefined Attribute Numbers (1..999) • name = 1 • datatype = 2 • ordered = 3 • distince = 4 ATRDEF TLV is not needed for the above attribute numbers 21-05-0407-03-0000 ATR TLV • Corresponds to an attribute_name=attribute_value part in tag Octets: 0xd Length 1 2 Attribute Number 2 Entry Number 2 If there is no explicit entry, then Entry Number value is 0 (zero) 21-05-0407-03-0000 STR TLV or STRAL TLV Variable ENT TLV Octets: 21-05-0407-03-0000 0xa Length 1 2 Entry Number 2 NS TLV Octets: 21-05-0407-03-0000 0xb Length 1 2 NS Number 2 Type of query used in XML • XML-based query language, e.g., SPARQL, has three types query: • Construction query: used for sub-graph fetch • • Selection query: used for selected bindings • • RDF triples are returned pairs of variable names and values are returned Boolean query: Used for binary answer • “yes” or “no” is returned 21-05-0407-03-0000 Example of a Construction query • Query for obtaining IEs of a neighboring PoA PREFIX mihbase: <http://www.mih.org/> CONSTRUCT ?s ?p ?o WHERE { GRAPH ?g1{ ?s ?p ?o ?x mihbase:poa ?poa. ?poa mihbase:poa-type 19 . ?poa mihbase:poa-id “aabbccddeeff” . } } 21-05-0407-03-0000 Construction query result • Query result in XML 1.0 (1198 Bytes) <?xml version="1.0"?> <!DOCTYPE rdf:RDF [ <!ENTITY rdf "http://www.w3.org/1999/02/22-rdfsyntax-ns#"> <!ENTITY rdfs "http://www.w3.org/2000/01/rdfschema#"> <!ENTITY mihbase "http://www.mih.org/basicschema#"> <!ENTITY base "http://mediaindependentinformationserver.org/" > ]> <rdf:RDF xmlns:rdf="&rdf;" xmlns:rdfs="&rdfs;" xmlns:mihbase="&mihbase;" xml:base="&base;"> <rdf:Description rdf:about="&base;network2"> <rdf:type rdf:resource="&mihbase;Network"/> <mihbase:mdi> <rdf:Description> <mihbase:data-rate>54000</mihbase:data-rate> </rdf:Description> 21-05-0407-03-0000 • Query result in XML binary in TLV (680 Bytes) [0x3][229][ [0x1][7]["rdf:RDF"] [0x4][54][1][ [0x1][3]["rdf"] [0x1][43]["http://www.w3.org/1999/02/22-rdf-syntaxns#"] ] [0x4][49][2][ [0x1][4]["rdfs"] [0x1][37]["http://www.w3.org/2000/01/rdf-schema#"] ] [0x4][47][3][ [0x1][7]["mihbase"] [0x1][32]["http://www.mih.org/basic-schema#"] ] [0x4][57][4][ [0x1][4]["base"] [0x1][45]["http://mediaindependentinformationserver.or g/"] ] ] [0x5][61] [ [0x6][13][1][ [0x1][3]["rdf"] [0xa][2][1] ] [0x6][14][2][ [0x1][4]["rdfs"] [0xa][2][2]] [0x6][17][3][ [0x1][7]["mihbase"] [0xa][2][3]] [0x7][5][ [0xa][2][4]]]] [0x8][15][1000][1]["Description"] [0x9][9][1000][1]["about"] </mihbase:mdi> <mihbase:mii> <rdf:Description> <mihbase:poa> <rdf:Description> <mihbase:poa-type>19</mihbase:poa-type> <mihbase:poa-id>aabbccddeeff</mihbase:poaid> </rdf:Description> </mihbase:poa> <mihbase:neighboring-poa> <rdf:Description> <mihbase:poa-type>19</mihbase:poa-type> <mihbase:poa-id>112233445566</mihbase:poaid> </rdf:Description> </mihbase:neighboring-poa> <mihbase:neighboring-poa> <rdf:Description> <mihbase:poa-type>19</mihbase:poa-type> <mihbase:poa-id>0123456789ab</mihbase:poaid> </rdf:Description> </mihbase:neighboring-poa> </rdf:Description> </mihbase:mii> </rdf:Description> </rdf:RDF> 21-05-0407-03-0000 [0xc][310][1000][ [0xd][15][1][ [0xa][2][4]["network2"] ] [0x8][8][1001][1]["type"] [0x9][12][1001][1]["resource"] [0xc][16][1001][ [0xd][11][1001][3]["Network"] ] [0x8][7][1002][3]["mdi"] [0xc][37][1002][ [0xc][32][1000][ [0x8][14][1003][0x1][9]["data-rate"] [0xc][10][1003][0x1][5][“54000”] ] ] [0x8][7][1004][3]["mii"] [0xc][182][1004][ [0xc][177][1000][ [0x8][7][1005][3]["poa"] [0xc][60][1000][ [0x8][12][1006][3]["poa-type"] [0xc][7][1006][0x1][2][“19”] [0x8][10][1007][3]["poa-id"] [0xc][17][1007][0x1][12]["aabbccddeeff"] ] [0x8][19][1008][3]["neighboring-poa"] [0xc][37][1008][ [0xc][32][1000][ [0xc][7][1006][0x1][2][“19”] [0xc][17][1007][0x1][12]["112233445566"] ] ] [0xc][37][1008][ [0xc][32][1000][ [0xc][7][1006][0x1][2][“19”] [0xc][17][1007][0x1][12]["0123456789ab"] ] ] ] ] ] Example of a Selection query • Query for obtaining neighboring PoA PREFIX mihbase: <http://www.mih.org/> SELECT ?poa-id WHERE { ?mii mihbase:poa ?poa . ?poa mihbase:poa-id 123456789abc . ?mii mihbase:neighboring-poa ?neighboring-poa . ?neighboring-poa mihbase:poa-id ?poa-id .} 21-05-0407-03-0000 Selection query result • Query result in XML 1.0 (1596 Bytes) <?xml version="1.0"?> <sparql xmlns="http://www.w3.org/2005/sparqlresults#"> <head> <variable name=”poa-id”/> </head> <results ordered=”false” distince=”false”> <result> <binding name=”poa-id”> <literal datatype="http://www.w3.org/2001/XMLSchema#hexBi nary"> aabbccddeeff</literal></binding> </result> <result> <binding name=”poa-id”> <literal datatype=”http://www.w3.org/2001/XMLSchema#hexBi nary”> 112233445566</literal></binding> …….(more 8 poa-ids are written here) </rebult> </results> </sparql > 21-05-0407-03-0000 • Query result in XML binary in TLV (694 Bytes) [0xc][694][1][ [0x6][41][0][ [0x1][38]["http://www.w3.org/2005/sparqlresults#"]] [0xc][20][2][ [0xc][15][3][ [0x9][10][1][0]["poa-id"]]] [0xc][621][4][ [0x9][9][3][0]["false"][0x9][9][4][0]["false"] [0xc][97][5][ [0xc][15][6][ [0x9][10][1][0]["poa-id"]] [0xc][76][7][ [0xe][44][1][http://www.w3.org/2001/XMLSchema#hexBin ary] [0x9][9][2][0][0xf][2][1] [0x1][12]["aabbccddeeff"]]] [0xc][52][5][ [0xc][15][6][ [0x9][10][1][0]["poa-id"]] [0xc][29][7][ [0x9][9][2][0][0xf][2][1] [0x1][12]["112233445566"]]] …(more 8 poa-ids are written here) ]] Example of a Boolean query • Query for asking if a neighboring PoA is 802.11 PREFIX mihbase: <http://www.mih.org/> ASK {?poa mihbase:poa-type 19 ; ?poa mihbase:poa-id “aabbccddeeff” } 21-05-0407-03-0000 Boolean query result • Query result in XML 1.0 (153 Bytes) <?xml version="1.0"?> <sparql xmlns="http://www.w3.org/2005/06/sparqlResults"> <head></head> <results> <boolean>true</boolean> </results> </sparql> 21-05-0407-03-0000 • Query result in XML binary in TLV (52 Bytes) [0xc][49][1][0x6][44][1][0x1][39]["http://www.w3.org/2005 /06/sparqlResults"] [0xc][2][2] [0xc][14][4] [0xc][9][8][0x1][4]["true"] ] Comparison of the formats 1198 Construction query 680 1596 Method A Selection query 694 153 Boolean query 52 0 21-05-0407-03-0000 500 1000 1500 Number of encoded bytes 2000 XML 1.0 Method B 21-05-0407-03-0000 TLV Format for XML binary encoding Octets: 0x1= STR 0x2= XMLVER 0x3 = DOCTYPE 0x4 = ENTDEF 0x5 = DOC 0x6 = NSDEF 0x7 = BASE 0x8 = TAGDEF 0x9 = ATRDEF 0xa = ENT 0xb = NS 0xc = TAG 0xd = ATR 0xe = STRALDEF 21-05-0407-03-0000 Type Length Value 1 2 Variable Type field values 0xf = STRAL 0x10 = YES 0x11 = NO 0x12 = BLANKNODE 0x13 = RDFTRIPLES 0x14 = VARIABLE 0x15 = RESULT … YES TLV • • • • Value field: NULL This TLV may be used for encoding result of “yes” for Boolean query of SPARQL. When this TLV is carried, other TLVs carried in the same query result can be omitted. Receiver which receives this TLV decodes it to an appropriate XML format for the corresponding SPARQL Query results. Octets: 21-05-0407-03-0000 0x10 Length(=0) 1 2 NO TLV • • • • Value field: NULL This TLV may be used for encoding result of “no” for Boolean query of SPARQL. When this TLV is carried, other TLVs carried in the same query result can be omitted. Receiver which receives this TLV decodes it to an appropriate XML format for the corresponding SPARQL Query results. Octets: 21-05-0407-03-0000 0x11 Length(=0) 1 2 BLANKNODE TLV 0x12 Octets: 21-05-0407-03-0000 1 Length(=2) Blank Node Number 2 2 RDFTRIPLES TLV Octets: 0x13 Length 1 2 Zero or more NS TLV (Optional) (Subject) Variable BLANKNODE TLV or STR TLV or STRAL TLV (Subject) Variable Zero or more Zero or more BLANKNODE TLV or NS TLV (Optional) NS TLV (Optional) STR TLV or (Predicate) (Object) STRAL TLV (Predicate) Variable 21-05-0407-03-0000 Variable Variable BLANKNODE TLV or STR TLV or STRAL TLV (Object) Variable VARIABLE TLV Octets: 21-05-0407-03-0000 0x14 Length STR TLV 1 2 Variable RESULT TLV Octets: 0x15 Length NS TLV (OPTIONAL) BLANKNODE TLV or STR TLV or STRAL TLV 1 2 Variable Variable 21-05-0407-03-0000 Construction query result with SPARQL optimization • (SPARQL Query Results XML Format) 1198 Bytes <?xml version="1.0"?> <!DOCTYPE rdf:RDF [ <!ENTITY rdf "http://www.w3.org/1999/02/22-rdfsyntax-ns#"> <!ENTITY rdfs "http://www.w3.org/2000/01/rdfschema#"> <!ENTITY mihbase "http://www.mih.org/basicschema#"> <!ENTITY base "http://mediaindependentinformationserver.org/" > ]> <rdf:RDF xmlns:rdf="&rdf;" xmlns:rdfs="&rdfs;" xmlns:mihbase="&mihbase;" xml:base="&base;"> <rdf:Description rdf:about="&base;network2"> <rdf:type rdf:resource="&mihbase;Network"/> <mihbase:mdi> <rdf:Description> <mihbase:data-rate>54000</mihbase:data-rate> </rdf:Description> 21-05-0407-03-0000 • (TLV) 587Bytes [0x6][50][1][0x1][45]["http://mediaindependentinformatio nserver.org/"] [0x6][37][2][0x1][32]["http://www.mih.org/basicschema#"] [0x6][48][3][0x1][43]["http://www.w3.org/1999/02/22-rdfsyntax-ns#"] [0x13][43] [0xb][2][1][0x1][8]["network2"] [0xb][2][3][0x1][4]["type"] [0xb][2][2][0x1][7]["Network"] ] [0x13][30] [0x12][2][1] [0xb][2][2][0x1][9]["data-rate"] [0x1][5]["54000"] ] [0x13][32] [0xb][2][1][0x1][8]["network2"] [0xb][2][2][0x1][3]["mdi"] [0x12][2][1] ] [0x13][26] [0x12][2][3] [0xb][2][2][0x1][8]["poa-type"] [0x1][2]["19"] ] [0x13][34] [0x12][2][3] [0xb][2][2][0x1][6]["poa-id"] [0x1][12]["aabbccddeeff"] ] </mihbase:mdi> <mihbase:mii> <rdf:Description> <mihbase:poa> <rdf:Description> <mihbase:poa-type>19</mihbase:poa-type> <mihbase:poa-id>aabbccddeeff</mihbase:poaid> </rdf:Description> </mihbase:poa> <mihbase:neighboring-poa> <rdf:Description> <mihbase:poa-type>19</mihbase:poa-type> <mihbase:poa-id>112233445566</mihbase:poaid> </rdf:Description> </mihbase:neighboring-poa> <mihbase:neighboring-poa> <rdf:Description> <mihbase:poa-type>19</mihbase:poa-type> <mihbase:poa-id>0123456789ab</mihbase:poaid> </rdf:Description> </mihbase:neighboring-poa> </rdf:Description> </mihbase:mii> </rdf:Description> </rdf:RDF> 21-05-0407-03-0000 [0x13][21] [0x12][2][2] [0xb][2][2][0x1][3]["poa"] [0x12][2][3] ] [0x13][26] [0x12][2][4] [0xb][2][2][0x1][8]["poa-type"] [0x1][2]["19"] ] [0x13][34] [0x12][2][4] [0xb][2][2][0x1][6]["poa-id"] [0x1][12]["112233445566"] ] [0x13][33] [0x12][2][2] [0xb][2][2][0x1][15]["neighboring-poa"] [0x12][2][4] ] [0x13][26] [0x12][2][5] [0xb][2][2][0x1][8]["poa-type"] [0x1][2]["19"] ] [0x13][34] [0x12][2][5] [0xb][2][2][0x1][6]["poa-id"] [0x1][12]["0123456789ab"] ] [0x13][33] [0x12][2][2] [0xb][2][2][0x1][15]["neighboring-poa"] [0x12][2][5] ] [0x13][32] [0xb][2][1][0x1][8]["network2"] [0xb][2][2][0x1][3]["mii"] [0x12][2][2] ] Selection query result with SPARQL optimization • (SPARQL Query Results XML Format) 1596 Bytes <?xml version="1.0"?> <sparql xmlns="http://www.w3.org/2005/sparqlresults#"> <head> <variable name=”poa-id”/> </head> <results ordered=”false” distince=”false”> <result> <binding name=”poa-id”> <literal datatype="http://www.w3.org/2001/XMLSchema#hexBi nary"> aabbccddeeff</literal></binding> </result> <result> <binding name=”poa-id”> <literal datatype=”http://www.w3.org/2001/XMLSchema#hexBi nary”> 112233445566</literal></binding> …….(more 8 poa-ids are written here) </rebult> </results> </sparql > 21-05-0407-03-0000 • (TLV) 192Bytes [0x14][9][0x1][6]["poa-id"] [0x15][15][0x1][12]["aabbccddeeff"] [0x15][15][0x1][12]["112233445566"] .....(more 8 poa-ids are written here) Boolean query result with SPARQL optimization • (SPARQL Query Results XML Format) 153 Bytes • (TLV) 3Bytes [0x10][0] <?xml version="1.0"?> <sparql xmlns="http://www.w3.org/2005/06/sparqlResults"> <head></head> <results> <boolean>true</boolean> </results> </sparql> 21-05-0407-03-0000 Comparison of the formats 1198 Construction query 587 1596 Method B Selection query 192 153 Boolean query 3 0 21-05-0407-03-0000 500 1000 1500 Number of encoded bytes 2000 XML 1.0 Comparison between Method A and Method B 21-05-0407-03-0000 Comparison of the formats XML 1.0 1198 680 587 Construction query Method A 413 Method B 1596 694 Selection query 192 290 gzip 153 52 Boolean query 3 150 0 21-05-0407-03-0000 500 1000 1500 Number of encoded bytes 2000 Two types of conversions Direct Conversion Binary Data 3-Step Conversion 21-05-0407-03-0000 Internal Data XML DOM Data conversion time measured on PDA (CPU: ARM 206MHz, OS: Linux) Constuction Query Direct Conversion Method A Binary to XML 3Step Conversion TBD gunzip TBD N/A TBD 15 XML to DOM 41 41 41 DOM to Internal 33 33 33 Total 21-05-0407-03-0000 7 Binary(TLV) to Internal Method B TBD TBD 89 Backup 21-05-0407-03-0000 Data conversion time for Method A measured on PC Internal data: DOM (Document Object Model) CPU: Pentium-M 1.7GHz OS: Linux •Construction query Internal to XML : 1-2ms XML to TLV: 2-3ms •Selection query Internal to XML : 3ms XML to TLV: 3ms •Boolean query Internal to XML : 1ms XML to TLV: 2ms 21-05-0407-03-0000