Hex Artifact Content
Not logged in

Artifact b83318c7694593630b2d46799d461e7f4bba49b8:

Wiki page [ISO Metadata] by sandro 2013-03-18 16:09:35.
0000: 44 20 32 30 31 33 2d 30 33 2d 31 38 54 31 36 3a  D 2013-03-18T16:
0010: 30 39 3a 33 35 2e 36 36 33 0a 4c 20 49 53 4f 5c  09:35.663.L ISO\
0020: 73 4d 65 74 61 64 61 74 61 0a 50 20 31 30 33 37  sMetadata.P 1037
0030: 39 63 37 61 31 31 37 63 61 35 61 65 30 39 62 61  9c7a117ca5ae09ba
0040: 34 35 36 30 38 35 33 32 62 37 36 39 64 61 35 39  45608532b769da59
0050: 63 35 30 30 0a 55 20 73 61 6e 64 72 6f 0a 57 20  c500.U sandro.W 
0060: 31 37 36 34 36 0a 62 61 63 6b 20 74 6f 20 58 6d  17646.back to Xm
0070: 6c 42 6c 6f 62 20 3c 61 20 68 72 65 66 3d 22 68  lBlob <a href="h
0080: 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d  ttps://www.gaia-
0090: 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69  gis.it/fossil/li
00a0: 62 73 70 61 74 69 61 6c 69 74 65 2f 77 69 6b 69  bspatialite/wiki
00b0: 3f 6e 61 6d 65 3d 58 6d 6c 42 6c 6f 62 2b 61 6e  ?name=XmlBlob+an
00c0: 64 2b 56 69 72 74 75 61 6c 58 50 61 74 68 22 3e  d+VirtualXPath">
00d0: 6d 61 69 6e 20 70 61 67 65 3c 2f 61 3e 0d 0a 3c  main page</a>..<
00e0: 68 32 3e 49 53 4f 20 4d 65 74 61 64 61 74 61 20  h2>ISO Metadata 
00f0: 2d 20 49 6e 74 72 6f 3c 2f 68 32 3e 0d 0a 53 74  - Intro</h2>..St
0100: 61 72 74 69 6e 67 20 73 69 6e 63 65 20 76 65 72  arting since ver
0110: 73 69 6f 6e 20 3c 62 3e 34 2e 31 2e 30 3c 2f 62  sion <b>4.1.0</b
0120: 3e 20 53 70 61 74 69 61 4c 69 74 65 20 77 69 6c  > SpatiaLite wil
0130: 6c 20 73 75 70 70 6f 72 74 20 3c 62 3e 49 53 4f  l support <b>ISO
0140: 20 4d 65 74 61 64 61 74 61 3c 2f 62 3e 3b 20 61   Metadata</b>; a
0150: 6c 6c 20 6d 65 74 61 64 61 74 61 20 64 6f 63 75  ll metadata docu
0160: 6d 65 6e 74 73 20 65 78 61 63 74 6c 79 20 61 72  ments exactly ar
0170: 65 20 58 4d 4c 20 44 6f 63 75 6d 65 6e 74 73 2c  e XML Documents,
0180: 20 73 6f 20 74 68 65 20 77 68 6f 6c 65 20 49 53   so the whole IS
0190: 4f 20 4d 65 74 61 64 61 74 61 20 69 6d 70 6c 65  O Metadata imple
01a0: 6d 65 6e 74 61 74 69 6f 6e 20 73 69 6d 70 6c 79  mentation simply
01b0: 20 69 73 20 61 20 66 75 72 74 68 65 72 20 73 70   is a further sp
01c0: 65 63 69 61 6c 69 7a 65 64 20 65 78 74 65 6e 73  ecialized extens
01d0: 69 6f 6e 20 62 61 73 65 64 20 6f 6e 20 3c 62 3e  ion based on <b>
01e0: 58 6d 6c 42 4c 4f 42 3c 2f 62 3e 2e 3c 62 72 3e  XmlBLOB</b>.<br>
01f0: 0d 0a 53 65 76 65 72 61 6c 20 64 69 66 66 65 72  ..Several differ
0200: 65 6e 74 20 73 74 61 6e 64 61 72 64 20 73 70 65  ent standard spe
0210: 63 69 66 69 63 61 74 69 6f 6e 73 20 61 72 65 20  cifications are 
0220: 63 6f 6c 6c 65 63 74 69 76 65 6c 79 20 67 72 6f  collectively gro
0230: 75 70 65 64 20 75 6e 64 65 72 20 74 68 65 20 67  uped under the g
0240: 65 6e 65 72 69 63 20 6e 61 6d 65 20 6f 66 20 3c  eneric name of <
0250: 69 3e 49 53 4f 20 4d 65 74 61 64 61 74 61 3c 2f  i>ISO Metadata</
0260: 69 3e 3b 20 74 68 65 20 63 6f 6d 6d 6f 6e 20 63  i>; the common c
0270: 6f 72 65 20 72 65 66 65 72 65 6e 63 65 20 69 73  ore reference is
0280: 20 61 6c 77 61 79 73 20 62 61 73 65 64 20 6f 6e   always based on
0290: 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f   <a href="http:/
02a0: 2f 65 6e 2e 77 69 6b 69 70 65 64 69 61 2e 6f 72  /en.wikipedia.or
02b0: 67 2f 77 69 6b 69 2f 47 65 6f 73 70 61 74 69 61  g/wiki/Geospatia
02c0: 6c 5f 6d 65 74 61 64 61 74 61 22 3e 49 53 4f 20  l_metadata">ISO 
02d0: 31 39 31 31 35 20 2f 20 31 39 31 33 39 3c 2f 61  19115 / 19139</a
02e0: 3e 2c 20 62 75 74 20 6d 61 6e 79 20 66 75 72 74  >, but many furt
02f0: 68 65 72 20 73 70 65 63 69 61 6c 69 7a 65 64 20  her specialized 
0300: 65 78 74 65 6e 73 69 6f 6e 73 20 65 78 69 73 74  extensions exist
0310: 3a 20 6f 6e 65 20 6f 66 20 74 68 65 20 62 65 73  : one of the bes
0320: 74 20 6b 6e 6f 77 6e 20 62 65 69 6e 67 20 65 2e  t known being e.
0330: 67 2e 20 74 68 65 20 3c 61 20 68 72 65 66 3d 22  g. the <a href="
0340: 68 74 74 70 3a 2f 2f 69 6e 73 70 69 72 65 2e 6a  http://inspire.j
0350: 72 63 2e 65 63 2e 65 75 72 6f 70 61 2e 65 75 2f  rc.ec.europa.eu/
0360: 22 3e 49 4e 53 50 49 52 45 3c 2f 61 3e 20 45 55  ">INSPIRE</a> EU
0370: 20 49 6e 69 74 69 61 74 69 76 65 2e 0d 0a 3c 68   Initiative...<h
0380: 32 3e 44 42 20 54 61 62 6c 65 73 20 69 6d 70 6c  2>DB Tables impl
0390: 65 6d 65 6e 74 69 6e 67 20 49 53 4f 20 4d 65 74  ementing ISO Met
03a0: 61 64 61 74 61 3c 2f 68 32 3e 0d 0a 3c 76 65 72  adata</h2>..<ver
03b0: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43  batim>..SELECT C
03c0: 72 65 61 74 65 49 73 6f 4d 65 74 61 64 61 74 61  reateIsoMetadata
03d0: 54 61 62 6c 65 73 28 29 3b 0d 0a 3c 2f 76 65 72  Tables();..</ver
03e0: 62 61 74 69 6d 3e 0d 0a 54 68 65 20 3c 62 3e 43  batim>..The <b>C
03f0: 72 65 61 74 65 49 73 6f 4d 65 74 61 64 61 74 61  reateIsoMetadata
0400: 54 61 62 6c 65 73 28 29 3c 2f 62 3e 20 53 51 4c  Tables()</b> SQL
0410: 20 66 75 6e 63 74 69 6f 6e 20 77 69 6c 6c 20 61   function will a
0420: 74 74 65 6d 70 74 20 74 6f 20 63 72 65 61 74 65  ttempt to create
0430: 20 61 6c 6c 20 44 42 20 54 61 62 6c 65 73 20 72   all DB Tables r
0440: 65 71 75 69 72 65 64 20 69 6e 20 6f 72 64 65 72  equired in order
0450: 20 74 6f 20 65 6e 61 62 6c 65 20 49 53 4f 20 4d   to enable ISO M
0460: 65 74 61 64 61 74 61 20 73 75 70 70 6f 72 74 2e  etadata support.
0470: 3c 62 72 3e 0d 0a 41 6e 79 20 61 74 74 65 6d 70  <br>..Any attemp
0480: 74 20 74 6f 20 64 69 72 65 63 74 6c 79 20 63 72  t to directly cr
0490: 65 61 74 65 20 6f 72 20 6f 74 68 65 72 77 69 73  eate or otherwis
04a0: 65 20 6d 61 6e 69 70 75 6c 61 74 65 20 74 68 65  e manipulate the
04b0: 73 65 20 54 61 62 6c 65 73 20 69 73 20 73 74 72  se Tables is str
04c0: 6f 6e 67 6c 79 20 64 69 73 63 6f 75 72 61 67 65  ongly discourage
04d0: 64 3b 20 79 6f 75 20 61 72 65 20 61 6c 77 61 79  d; you are alway
04e0: 73 20 65 78 70 65 63 74 65 64 20 74 6f 20 70 72  s expected to pr
04f0: 6f 70 65 72 6c 79 20 69 6e 76 6f 6b 65 20 3c 62  operly invoke <b
0500: 3e 43 72 65 61 74 65 49 73 6f 4d 65 74 61 64 61  >CreateIsoMetada
0510: 74 61 54 61 62 6c 65 73 28 29 3c 2f 62 3e 2c 20  taTables()</b>, 
0520: 77 68 69 63 68 20 77 69 6c 6c 20 63 6f 72 72 65  which will corre
0530: 63 74 6c 79 20 64 65 66 69 6e 65 20 61 6c 6c 20  ctly define all 
0540: 72 65 71 75 69 72 65 64 20 50 72 69 6d 61 72 79  required Primary
0550: 20 2f 20 46 6f 72 65 69 67 6e 20 4b 65 79 20 63   / Foreign Key c
0560: 6f 6e 73 74 72 61 69 6e 74 73 2c 20 61 73 20 77  onstraints, as w
0570: 69 6c 6c 20 63 72 65 61 74 65 20 61 6c 6c 20 76  ill create all v
0580: 61 6c 69 64 61 74 69 6e 67 20 54 72 69 67 67 65  alidating Trigge
0590: 72 73 20 65 78 70 65 63 74 65 64 20 74 6f 20 73  rs expected to s
05a0: 75 70 70 6f 72 74 20 74 68 65 73 65 20 54 61 62  upport these Tab
05b0: 6c 65 73 2e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e  les...<verbatim>
05c0: 0d 0a 53 45 4c 45 43 54 20 43 72 65 61 74 65 49  ..SELECT CreateI
05d0: 73 6f 4d 65 74 61 64 61 74 61 54 61 62 6c 65 73  soMetadataTables
05e0: 28 20 31 20 29 3b 0d 0a 3c 2f 76 65 72 62 61 74  ( 1 );..</verbat
05f0: 69 6d 3e 0d 0a 3c 75 3e 50 6c 65 61 73 65 20 6e  im>..<u>Please n
0600: 6f 74 65 3c 2f 75 3e 3a 20 3c 62 3e 43 72 65 61  ote</u>: <b>Crea
0610: 74 65 49 73 6f 4d 65 74 61 64 61 74 61 54 61 62  teIsoMetadataTab
0620: 6c 65 73 28 29 3c 2f 62 3e 20 77 69 6c 6c 20 6f  les()</b> will o
0630: 70 74 69 6f 6e 61 6c 6c 79 20 61 63 63 65 70 74  ptionally accept
0640: 20 61 20 73 69 6e 67 6c 65 20 28 3c 69 3e 62 6f   a single (<i>bo
0650: 6f 6c 65 61 6e 3c 2f 69 3e 29 20 61 72 67 75 6d  olean</i>) argum
0660: 65 6e 74 20 69 6e 74 65 6e 64 65 64 20 74 6f 20  ent intended to 
0670: 63 68 6f 6f 73 65 20 62 65 74 77 65 65 6e 20 3c  choose between <
0680: 62 3e 73 74 72 69 63 74 3c 2f 62 3e 20 61 6e 64  b>strict</b> and
0690: 20 3c 62 3e 72 65 6c 61 78 65 64 3c 2f 62 3e 20   <b>relaxed</b> 
06a0: 54 72 69 67 67 65 72 73 20 61 6c 74 65 72 6e 61  Triggers alterna
06b0: 74 69 76 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74  tive implementat
06c0: 69 6f 6e 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69  ions:..<ul>..<li
06d0: 3e 77 68 65 6e 20 3c 62 3e 73 74 72 69 63 74 20  >when <b>strict 
06e0: 6d 6f 64 65 3c 2f 62 3e 20 69 73 20 73 70 65 63  mode</b> is spec
06f0: 69 66 69 65 64 20 28 3c 75 3e 64 65 66 61 75 6c  ified (<u>defaul
0700: 74 20 73 65 74 74 69 6e 67 3c 2f 75 3e 29 20 61  t setting</u>) a
0710: 6c 6c 20 4d 65 74 61 64 61 74 61 20 64 6f 63 75  ll Metadata docu
0720: 6d 65 6e 74 73 20 61 72 65 20 65 78 70 65 63 74  ments are expect
0730: 65 64 20 74 6f 20 73 75 63 63 65 73 73 66 75 6c  ed to successful
0740: 6c 79 20 70 61 73 73 20 61 20 66 6f 72 6d 61 6c  ly pass a formal
0750: 20 58 4d 4c 20 53 63 68 65 6d 61 20 76 61 6c 69   XML Schema vali
0760: 64 61 74 69 6f 6e 2e 3c 62 72 3e 0d 0a 49 66 20  dation.<br>..If 
0770: 66 6f 72 20 61 6e 79 20 72 65 61 73 6f 6e 20 73  for any reason s
0780: 75 63 68 20 53 63 68 65 6d 61 20 76 61 6c 69 64  uch Schema valid
0790: 61 74 69 6f 6e 20 66 61 69 6c 73 20 74 68 65 6e  ation fails then
07a0: 20 74 68 65 20 54 72 69 67 67 65 72 73 20 77 69   the Triggers wi
07b0: 6c 6c 20 72 65 6a 65 63 74 20 61 6e 79 20 61 74  ll reject any at
07c0: 74 65 6d 70 74 20 74 6f 20 69 6e 73 65 72 74 20  tempt to insert 
07d0: 74 68 65 20 6f 66 66 65 6e 64 69 6e 67 20 4d 65  the offending Me
07e0: 74 61 64 61 74 61 20 64 6f 63 75 6d 65 6e 74 2e  tadata document.
07f0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 6f 6e 20 74 68  </li>..<li>on th
0800: 65 20 6f 74 68 65 72 20 73 69 64 65 2c 20 77 68  e other side, wh
0810: 65 6e 20 3c 62 3e 72 65 6c 61 78 65 64 20 6d 6f  en <b>relaxed mo
0820: 64 65 3c 2f 62 3e 20 69 73 20 73 70 65 63 69 66  de</b> is specif
0830: 69 65 64 20 61 20 62 61 73 69 63 20 63 68 65 63  ied a basic chec
0840: 6b 20 77 69 6c 6c 20 62 65 20 70 65 72 66 6f 72  k will be perfor
0850: 6d 65 64 20 73 6f 20 74 6f 20 65 6e 73 75 72 65  med so to ensure
0860: 20 74 68 61 74 20 74 68 65 20 53 74 79 6c 69 6e   that the Stylin
0870: 67 20 64 6f 63 75 6d 65 6e 74 20 69 73 20 3c 75  g document is <u
0880: 3e 77 65 6c 6c 2d 66 6f 72 6d 65 64 3c 2f 75 3e  >well-formed</u>
0890: 2c 20 62 75 74 20 6e 6f 20 58 4d 4c 20 53 63 68  , but no XML Sch
08a0: 65 6d 61 20 76 61 6c 69 64 61 74 69 6f 6e 20 77  ema validation w
08b0: 69 6c 6c 20 6e 65 76 65 72 20 62 65 20 65 76 61  ill never be eva
08c0: 6c 75 61 74 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 2f  luated.</li>..</
08d0: 75 6c 3e 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20  ul><br>..<table 
08e0: 77 69 64 74 68 3d 22 31 30 30 25 22 20 62 67 63  width="100%" bgc
08f0: 6f 6c 6f 72 3d 22 23 66 66 66 66 63 63 22 20 63  olor="#ffffcc" c
0900: 65 6c 6c 70 61 64 64 69 6e 67 3d 22 34 22 20 63  ellpadding="4" c
0910: 65 6c 6c 73 70 61 63 69 6e 67 3d 22 31 30 22 3e  ellspacing="10">
0920: 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 75 3e 3c  ..<tr><td>..<u><
0930: 62 3e 49 6d 70 6f 72 74 61 6e 74 20 6e 6f 74 69  b>Important noti
0940: 63 65 3c 2f 62 3e 3c 2f 75 3e 3a 20 6f 6c 64 65  ce</b></u>: olde
0950: 73 74 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 3c  st versions of <
0960: 62 3e 6c 69 62 78 6d 6c 32 3c 2f 62 3e 20 61 72  b>libxml2</b> ar
0970: 65 6e 27 74 20 61 62 6c 65 20 74 6f 20 73 75 70  en't able to sup
0980: 70 6f 72 74 20 61 20 73 75 63 63 65 73 73 66 75  port a successfu
0990: 6c 20 53 63 68 65 6d 61 20 76 61 6c 69 64 61 74  l Schema validat
09a0: 69 6f 6e 20 66 6f 72 20 3c 75 3e 49 53 4f 20 4d  ion for <u>ISO M
09b0: 65 74 61 64 61 74 61 3c 2f 75 3e 20 64 6f 63 75  etadata</u> docu
09c0: 6d 65 6e 74 73 2e 0d 0a 55 73 69 6e 67 20 74 68  ments...Using th
09d0: 65 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 3c 62  e most recent <b
09e0: 3e 32 2e 39 2e 30 3c 2f 62 3e 20 76 65 72 73 69  >2.9.0</b> versi
09f0: 6f 6e 20 6f 66 20 74 68 69 73 20 6c 69 62 72 61  on of this libra
0a00: 72 79 20 73 65 65 6d 73 20 74 6f 20 62 65 20 61  ry seems to be a
0a10: 6e 20 61 62 73 6f 6c 75 74 65 20 70 72 65 2d 72  n absolute pre-r
0a20: 65 71 75 69 73 69 74 65 2e 0d 0a 3c 75 6c 3e 0d  equisite...<ul>.
0a30: 0a 3c 6c 69 3e 61 6c 6c 20 70 72 65 2d 62 75 69  .<li>all pre-bui
0a40: 6c 74 20 62 69 6e 61 72 69 65 73 20 66 6f 72 20  lt binaries for 
0a50: 57 69 6e 64 6f 77 73 20 72 65 6c 65 61 73 65 64  Windows released
0a60: 20 62 79 20 53 70 61 74 69 61 4c 69 74 65 20 69   by SpatiaLite i
0a70: 74 73 65 6c 66 20 73 75 72 65 6c 79 20 73 75 70  tself surely sup
0a80: 70 6f 72 74 20 3c 75 3e 6c 69 62 78 6d 6c 32 20  port <u>libxml2 
0a90: 32 2e 39 2e 30 3c 2f 75 3e 2c 20 61 6e 64 20 63  2.9.0</u>, and c
0aa0: 61 6e 20 62 65 20 74 68 75 73 20 73 61 66 65 6c  an be thus safel
0ab0: 79 20 75 73 65 64 20 69 6e 20 3c 75 3e 73 74 72  y used in <u>str
0ac0: 69 63 74 20 6d 6f 64 65 3c 2f 75 3e 2e 3c 2f 6c  ict mode</u>.</l
0ad0: 69 3e 0d 0a 3c 6c 69 3e 77 68 69 6c 65 20 62 75  i>..<li>while bu
0ae0: 69 6c 64 69 6e 67 20 6f 6e 20 4c 69 6e 75 78 20  ilding on Linux 
0af0: 69 74 27 73 20 76 65 72 79 20 70 72 6f 62 61 62  it's very probab
0b00: 6c 65 20 74 68 61 74 20 79 6f 75 27 6c 6c 20 65  le that you'll e
0b10: 6e 63 6f 75 6e 74 65 72 20 61 20 73 79 73 74 65  ncounter a syste
0b20: 6d 20 70 72 65 2d 70 61 63 6b 61 67 65 64 20 3c  m pre-packaged <
0b30: 75 3e 6c 69 62 78 6d 6c 32 3c 2f 75 3e 20 63 6f  u>libxml2</u> co
0b40: 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 73  rresponding to s
0b50: 6f 6d 65 20 6f 62 73 6f 6c 65 74 65 20 76 65 72  ome obsolete ver
0b60: 73 69 6f 6e 3a 20 69 6e 20 74 68 69 73 20 63 61  sion: in this ca
0b70: 73 65 20 64 75 6c 79 20 73 77 69 74 63 68 69 6e  se duly switchin
0b80: 67 20 74 6f 20 3c 75 3e 72 65 6c 61 78 65 64 20  g to <u>relaxed 
0b90: 6d 6f 64 65 3c 2f 75 3e 20 69 73 20 73 74 72 6f  mode</u> is stro
0ba0: 6e 67 6c 79 20 73 75 67 67 65 73 74 65 64 2e 3c  ngly suggested.<
0bb0: 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 2f 74  /li>..</ul>..</t
0bc0: 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65  d></tr>..</table
0bd0: 3e 0d 0a 3c 68 33 3e 74 68 65 20 49 53 4f 5f 6d  >..<h3>the ISO_m
0be0: 65 74 61 64 61 74 61 20 74 61 62 6c 65 3c 2f 68  etadata table</h
0bf0: 33 3e 0d 0a 54 68 69 73 20 74 61 62 6c 65 20 69  3>..This table i
0c00: 73 20 73 70 65 63 69 66 69 63 61 6c 6c 79 20 69  s specifically i
0c10: 6e 74 65 6e 64 65 64 20 74 6f 20 73 74 6f 72 65  ntended to store
0c20: 20 61 6c 6c 20 49 53 4f 20 4d 65 74 61 64 61 74   all ISO Metadat
0c30: 61 20 64 6f 63 75 6d 65 6e 74 73 3a 0d 0a 3c 75  a documents:..<u
0c40: 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 69 64 3c 2f 62  l>..<li><b>id</b
0c50: 3e 20 73 69 6d 70 6c 79 20 69 73 20 73 69 6d 70  > simply is simp
0c60: 6c 79 20 69 6e 74 65 6e 64 65 64 20 61 73 20 61  ly intended as a
0c70: 6e 20 69 6e 74 65 72 6e 61 6c 20 49 44 20 28 3c  n internal ID (<
0c80: 75 3e 50 72 69 6d 61 72 79 20 4b 65 79 3c 2f 75  u>Primary Key</u
0c90: 3e 29 3a 20 6e 6f 20 73 70 65 63 69 61 6c 20 6d  >): no special m
0ca0: 65 61 6e 69 6e 67 20 69 73 20 61 73 73 75 6d 65  eaning is assume
0cb0: 64 20 6f 74 68 65 72 20 74 68 61 6e 20 65 6e 73  d other than ens
0cc0: 75 72 69 6e 67 20 75 6e 69 71 75 65 6e 65 73 73  uring uniqueness
0cd0: 20 77 69 74 68 69 6e 20 74 68 65 20 44 42 20 74   within the DB t
0ce0: 61 62 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  able.</li>..<li>
0cf0: 3c 62 3e 6d 64 5f 73 63 6f 70 65 3c 2f 62 3e 20  <b>md_scope</b> 
0d00: 73 70 65 63 69 66 69 65 73 20 74 68 65 20 69 6e  specifies the in
0d10: 74 65 6e 64 65 64 20 73 63 6f 70 65 20 6f 66 20  tended scope of 
0d20: 65 61 63 68 20 4d 65 74 61 64 61 74 61 20 64 6f  each Metadata do
0d30: 63 75 6d 65 6e 74 3b 20 61 63 63 65 70 74 61 62  cument; acceptab
0d40: 6c 65 20 76 61 6c 75 65 73 20 61 72 65 3a 3c 62  le values are:<b
0d50: 72 3e 0d 0a 3c 69 3e 3c 62 3e 27 75 6e 64 65 66  r>..<i><b>'undef
0d60: 69 6e 65 64 27 3c 2f 62 3e 3c 2f 69 3e 2c 3c 69  ined'</b></i>,<i
0d70: 3e 3c 62 3e 27 66 69 65 6c 64 53 65 73 73 69 6f  ><b>'fieldSessio
0d80: 6e 27 3c 2f 62 3e 3c 2f 69 3e 2c 20 3c 69 3e 3c  n'</b></i>, <i><
0d90: 62 3e 27 63 6f 6c 6c 65 63 74 69 6f 6e 53 65 73  b>'collectionSes
0da0: 73 69 6f 6e 27 3c 2f 62 3e 3c 2f 69 3e 2c 20 3c  sion'</b></i>, <
0db0: 69 3e 3c 62 3e 27 73 65 72 69 65 73 27 3c 2f 62  i><b>'series'</b
0dc0: 3e 3c 2f 69 3e 2c 20 3c 69 3e 3c 62 3e 27 64 61  ></i>, <i><b>'da
0dd0: 74 61 73 65 74 27 3c 2f 62 3e 3c 2f 69 3e 2c 20  taset'</b></i>, 
0de0: 3c 69 3e 3c 62 3e 27 66 65 61 74 75 72 65 54 79  <i><b>'featureTy
0df0: 70 65 27 3c 2f 62 3e 3c 2f 69 3e 2c 20 3c 69 3e  pe'</b></i>, <i>
0e00: 3c 62 3e 27 66 65 61 74 75 72 65 27 3c 2f 62 3e  <b>'feature'</b>
0e10: 3c 2f 69 3e 2c 20 3c 69 3e 3c 62 3e 27 61 74 74  </i>, <i><b>'att
0e20: 72 69 62 75 74 65 54 79 70 65 27 3c 2f 62 3e 3c  ributeType'</b><
0e30: 2f 69 3e 2c 20 3c 69 3e 3c 62 3e 27 61 74 74 72  /i>, <i><b>'attr
0e40: 69 62 75 74 65 27 3c 2f 62 3e 3c 2f 69 3e 2c 20  ibute'</b></i>, 
0e50: 3c 69 3e 3c 62 3e 27 74 69 6c 65 27 3c 2f 62 3e  <i><b>'tile'</b>
0e60: 3c 2f 69 3e 2c 20 3c 69 3e 3c 62 3e 27 6d 6f 64  </i>, <i><b>'mod
0e70: 65 6c 27 3c 2f 62 3e 3c 2f 69 3e 2c 20 3c 69 3e  el'</b></i>, <i>
0e80: 3c 62 3e 27 63 61 74 61 6c 6f 67 75 65 27 3c 2f  <b>'catalogue'</
0e90: 62 3e 3c 2f 69 3e 2c 20 3c 69 3e 3c 62 3e 27 73  b></i>, <i><b>'s
0ea0: 63 68 65 6d 61 27 3c 2f 62 3e 3c 2f 69 3e 2c 20  chema'</b></i>, 
0eb0: 3c 69 3e 3c 62 3e 27 74 61 78 6f 6e 6f 6d 79 27  <i><b>'taxonomy'
0ec0: 3c 2f 62 3e 3c 2f 69 3e 2c 20 3c 69 3e 3c 62 3e  </b></i>, <i><b>
0ed0: 27 73 6f 66 74 77 61 72 65 27 3c 2f 62 3e 3c 2f  'software'</b></
0ee0: 69 3e 2c 20 3c 69 3e 3c 62 3e 27 73 65 72 76 69  i>, <i><b>'servi
0ef0: 63 65 27 3c 2f 62 3e 3c 2f 69 3e 2c 20 3c 69 3e  ce'</b></i>, <i>
0f00: 3c 62 3e 27 63 6f 6c 6c 65 63 74 69 6f 6e 48 61  <b>'collectionHa
0f10: 72 64 77 61 72 65 27 3c 2f 62 3e 3c 2f 69 3e 2c  rdware'</b></i>,
0f20: 20 3c 69 3e 3c 62 3e 27 6e 6f 6e 47 65 6f 67 72   <i><b>'nonGeogr
0f30: 61 70 68 69 63 44 61 74 61 73 65 74 27 3c 2f 62  aphicDataset'</b
0f40: 3e 3c 2f 69 3e 2c 20 3c 69 3e 3c 62 3e 27 64 69  ></i>, <i><b>'di
0f50: 6d 65 6e 73 69 6f 6e 47 72 6f 75 70 27 3c 2f 62  mensionGroup'</b
0f60: 3e 3c 2f 69 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  ></i></li>..<li>
0f70: 3c 62 3e 6d 65 74 61 64 61 74 61 3c 2f 62 3e 20  <b>metadata</b> 
0f80: 69 73 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e  is the correspon
0f90: 64 69 6e 67 20 4d 65 74 61 64 61 74 61 20 64 6f  ding Metadata do
0fa0: 63 75 6d 65 6e 74 20 28 65 78 70 65 63 74 65 64  cument (expected
0fb0: 20 74 6f 20 62 65 20 61 20 76 61 6c 69 64 20 3c   to be a valid <
0fc0: 62 3e 58 6d 6c 42 4c 4f 42 3c 2f 62 3e 20 6f 66  b>XmlBLOB</b> of
0fd0: 20 74 68 65 20 49 53 4f 20 4d 65 74 61 64 61 74   the ISO Metadat
0fe0: 61 20 74 79 70 65 29 2e 3c 2f 6c 69 3e 0d 0a 3c  a type).</li>..<
0ff0: 6c 69 3e 3c 62 3e 66 69 6c 65 49 64 3c 2f 62 3e  li><b>fileId</b>
1000: 20 61 6e 64 20 3c 62 3e 70 61 72 65 6e 74 49 64   and <b>parentId
1010: 3c 2f 62 3e 20 72 65 73 70 65 63 74 69 76 65 6c  </b> respectivel
1020: 79 20 63 6f 72 72 65 73 70 6f 6e 64 20 74 6f 20  y correspond to 
1030: 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 74 68  the values of th
1040: 65 20 3c 62 3e 26 6c 74 3b 67 6d 64 3a 66 69 6c  e <b>&lt;gmd:fil
1050: 65 49 64 65 6e 74 69 66 69 65 72 26 67 74 3b 3c  eIdentifier&gt;<
1060: 2f 62 3e 20 61 6e 64 20 3c 62 3e 26 6c 74 3b 67  /b> and <b>&lt;g
1070: 6d 64 3a 70 61 72 65 6e 74 49 64 65 6e 74 69 66  md:parentIdentif
1080: 69 65 72 26 67 74 3b 3c 2f 62 3e 20 74 61 67 73  ier&gt;</b> tags
1090: 20 69 6e 74 65 72 6e 61 6c 6c 79 20 64 65 63 6c   internally decl
10a0: 61 72 65 64 20 62 79 20 74 68 65 20 58 4d 4c 20  ared by the XML 
10b0: 64 6f 63 75 6d 65 6e 74 20 69 74 73 65 6c 66 2e  document itself.
10c0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 67 65  </li>..<li><b>ge
10d0: 6f 6d 65 74 72 79 3c 2f 62 3e 20 69 73 20 61 20  ometry</b> is a 
10e0: 3c 62 3e 4d 55 4c 54 49 50 4f 4c 59 47 4f 4e 3c  <b>MULTIPOLYGON<
10f0: 2f 62 3e 20 28 3c 75 3e 62 6f 75 6e 64 69 6e 67  /b> (<u>bounding
1100: 20 62 6f 78 3c 2f 75 3e 29 20 61 6e 64 20 63 6f   box</u>) and co
1110: 72 72 65 73 70 6f 6e 64 73 20 74 6f 20 74 68 65  rresponds to the
1120: 20 3c 62 3e 26 6c 74 3b 67 6d 64 3a 45 58 5f 47   <b>&lt;gmd:EX_G
1130: 65 6f 67 72 61 70 68 69 63 42 6f 75 6e 64 69 6e  eographicBoundin
1140: 67 42 6f 78 26 67 74 3b 3c 2f 62 3e 20 74 61 67  gBox&gt;</b> tag
1150: 28 73 29 20 69 6e 74 65 72 6e 61 6c 6c 79 20 64  (s) internally d
1160: 65 63 6c 61 72 65 64 20 62 79 20 74 68 65 20 58  eclared by the X
1170: 4d 4c 20 64 6f 63 75 6d 65 6e 74 20 69 74 73 65  ML document itse
1180: 6c 66 2e 3c 62 72 3e 0d 0a 3c 75 3e 50 6c 65 61  lf.<br>..<u>Plea
1190: 73 65 20 6e 6f 74 65 3c 2f 75 3e 3a 20 49 53 4f  se note</u>: ISO
11a0: 20 4d 65 74 61 64 61 74 61 20 63 6f 6f 72 64 69   Metadata coordi
11b0: 6e 61 74 65 73 20 61 72 65 20 61 6c 77 61 79 73  nates are always
11c0: 20 65 78 70 65 63 74 65 64 20 74 6f 20 62 65 20   expected to be 
11d0: 65 78 70 72 65 73 73 65 64 20 61 73 20 3c 75 3e  expressed as <u>
11e0: 6c 6f 6e 67 69 74 75 64 65 73 3c 2f 75 3e 20 61  longitudes</u> a
11f0: 6e 64 20 3c 75 3e 6c 61 74 69 74 75 64 65 73 3c  nd <u>latitudes<
1200: 2f 75 3e 2c 20 73 6f 20 3c 62 3e 53 52 49 44 3d  /u>, so <b>SRID=
1210: 34 33 32 36 20 3c 69 3e 57 47 53 38 34 3c 2f 69  4326 <i>WGS84</i
1220: 3e 3c 2f 62 3e 20 69 73 20 61 6c 77 61 79 73 20  ></b> is always 
1230: 61 73 73 75 6d 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c  assumed.</li>..<
1240: 2f 75 6c 3e 0d 0a 3c 68 33 3e 74 68 65 20 49 53  /ul>..<h3>the IS
1250: 4f 5f 6d 65 74 61 64 61 74 61 5f 72 65 66 65 72  O_metadata_refer
1260: 65 6e 63 65 20 74 61 62 6c 65 3c 2f 68 33 3e 0d  ence table</h3>.
1270: 0a 54 68 69 73 20 74 61 62 6c 65 20 69 73 20 73  .This table is s
1280: 70 65 63 69 66 69 63 61 6c 6c 79 20 69 6e 74 65  pecifically inte
1290: 6e 64 65 64 20 74 6f 20 72 65 70 72 65 73 65 6e  nded to represen
12a0: 74 20 61 6e 79 20 70 6f 73 73 69 62 6c 65 20 72  t any possible r
12b0: 65 66 65 72 65 6e 63 65 20 6a 6f 69 6e 69 6e 67  eference joining
12c0: 20 49 53 4f 20 4d 65 74 61 64 61 74 61 20 64 6f   ISO Metadata do
12d0: 63 75 6d 65 6e 74 73 20 61 6e 64 20 67 65 6f 67  cuments and geog
12e0: 72 61 70 68 69 63 20 66 65 61 74 75 72 65 73 20  raphic features 
12f0: 73 74 6f 72 65 64 20 77 69 74 68 69 6e 20 74 68  stored within th
1300: 65 20 73 61 6d 65 20 44 42 20 28 3c 75 3e 6c 61  e same DB (<u>la
1310: 79 65 72 73 3c 2f 75 3e 2c 20 3c 75 3e 63 6f 76  yers</u>, <u>cov
1320: 65 72 61 67 65 73 3c 2f 75 3e 2c 20 3c 75 3e 66  erages</u>, <u>f
1330: 65 61 74 75 72 65 73 3c 2f 75 3e 2c 20 3c 75 3e  eatures</u>, <u>
1340: 74 69 6c 65 73 3c 2f 75 3e 20 61 6e 64 20 73 6f  tiles</u> and so
1350: 20 6f 6e 29 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69   on):..<ul>..<li
1360: 3e 3c 62 3e 72 65 66 65 72 65 6e 63 65 5f 73 63  ><b>reference_sc
1370: 6f 70 65 3c 2f 62 3e 20 73 70 65 63 69 66 69 65  ope</b> specifie
1380: 73 20 74 68 65 20 69 6e 74 65 6e 64 65 64 20 73  s the intended s
1390: 63 6f 70 65 20 6f 66 20 65 61 63 68 20 72 65 66  cope of each ref
13a0: 65 72 65 6e 63 65 3b 20 61 63 63 65 70 74 61 62  erence; acceptab
13b0: 6c 65 20 76 61 6c 75 65 73 20 61 72 65 3a 3c 62  le values are:<b
13c0: 72 3e 0d 0a 3c 69 3e 3c 62 3e 27 74 61 62 6c 65  r>..<i><b>'table
13d0: 27 3c 2f 62 3e 3c 2f 69 3e 2c 3c 69 3e 3c 62 3e  '</b></i>,<i><b>
13e0: 27 63 6f 6c 75 6d 6e 27 3c 2f 62 3e 3c 2f 69 3e  'column'</b></i>
13f0: 2c 20 3c 69 3e 3c 62 3e 27 72 6f 77 27 3c 2f 62  , <i><b>'row'</b
1400: 3e 3c 2f 69 3e 2c 20 3c 69 3e 3c 62 3e 27 72 6f  ></i>, <i><b>'ro
1410: 77 2f 63 6f 6c 27 3c 2f 62 3e 3c 2f 69 3e 3c 2f  w/col'</b></i></
1420: 6c 69 3e 20 0d 0a 3c 6c 69 3e 3c 62 3e 74 61 62  li> ..<li><b>tab
1430: 6c 65 5f 6e 61 6d 65 3c 2f 62 3e 20 69 73 20 74  le_name</b> is t
1440: 68 65 20 6e 61 6d 65 20 6f 66 20 73 6f 6d 65 20  he name of some 
1450: 44 42 20 74 61 62 6c 65 20 28 3c 75 3e 6c 61 79  DB table (<u>lay
1460: 65 72 3c 2f 75 3e 20 6f 72 20 3c 75 3e 63 6f 76  er</u> or <u>cov
1470: 65 72 61 67 65 3c 2f 75 3e 29 2e 3c 2f 6c 69 3e  erage</u>).</li>
1480: 0d 0a 3c 6c 69 3e 3c 62 3e 63 6f 6c 75 6d 6e 5f  ..<li><b>column_
1490: 6e 61 6d 65 3c 2f 62 3e 20 69 73 20 74 68 65 20  name</b> is the 
14a0: 6e 61 6d 65 20 6f 66 20 73 6f 6d 65 20 63 6f 6c  name of some col
14b0: 75 6d 6e 20 62 65 6c 6f 6e 67 69 6e 67 20 74 6f  umn belonging to
14c0: 20 74 68 65 20 73 61 6d 65 20 74 61 62 6c 65 20   the same table 
14d0: 28 65 2e 67 2e 20 3c 75 3e 67 65 6f 6d 65 74 72  (e.g. <u>geometr
14e0: 79 3c 2f 75 3e 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c  y</u>).</li>..<l
14f0: 69 3e 3c 62 3e 72 6f 77 5f 69 64 5f 76 61 6c 75  i><b>row_id_valu
1500: 65 3c 2f 62 3e 20 63 6f 75 6c 64 20 65 76 65 6e  e</b> could even
1510: 74 75 61 6c 6c 79 20 72 65 66 65 72 65 6e 63 65  tually reference
1520: 20 61 20 73 69 6e 67 6c 65 20 72 6f 77 20 69 6e   a single row in
1530: 20 74 68 65 20 73 61 6d 65 20 74 61 62 6c 65 2e   the same table.
1540: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 74 69  </li>..<li><b>ti
1550: 6d 65 73 74 61 6d 70 3c 62 3e 20 69 73 20 69 6e  mestamp<b> is in
1560: 74 65 6e 64 65 64 20 74 6f 20 73 70 65 63 69 66  tended to specif
1570: 79 20 74 68 65 20 3c 75 3e 64 61 74 61 2d 74 69  y the <u>data-ti
1580: 6d 65 3c 2f 75 3e 20 77 68 65 6e 20 74 68 65 20  me</u> when the 
1590: 6c 61 74 65 73 74 20 63 68 61 6e 67 65 20 74 6f  latest change to
15a0: 20 74 68 65 20 72 65 66 65 72 65 6e 63 65 20 6f   the reference o
15b0: 63 63 75 72 72 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c  ccurred.</li>..<
15c0: 6c 69 3e 62 6f 74 68 20 3c 62 3e 6d 64 5f 66 69  li>both <b>md_fi
15d0: 6c 65 5f 69 64 3c 2f 62 3e 20 61 6e 64 20 3c 62  le_id</b> and <b
15e0: 3e 6d 64 5f 70 61 72 65 6e 74 5f 69 64 3c 2f 62  >md_parent_id</b
15f0: 3e 20 28 3c 75 3e 46 6f 72 65 69 67 6e 20 4b 65  > (<u>Foreign Ke
1600: 79 3c 2f 75 3e 29 20 61 72 65 20 69 6e 74 65 6e  y</u>) are inten
1610: 64 65 64 20 74 6f 20 72 65 66 65 72 65 6e 63 65  ded to reference
1620: 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69   the correspondi
1630: 6e 67 20 49 53 4f 20 4d 65 74 61 64 61 74 61 20  ng ISO Metadata 
1640: 64 6f 63 75 6d 65 6e 74 73 20 73 74 6f 72 65 64  documents stored
1650: 20 77 69 74 68 69 6e 20 74 68 65 20 3c 62 3e 49   within the <b>I
1660: 53 4f 5f 6d 65 74 61 64 61 74 61 3c 2f 62 3e 20  SO_metadata</b> 
1670: 74 61 62 6c 65 2e 3c 62 72 3e 0d 0a 3c 75 3e 50  table.<br>..<u>P
1680: 6c 65 61 73 65 20 6e 6f 74 65 20 77 65 6c 6c 3c  lease note well<
1690: 2f 75 3e 3a 20 73 75 63 68 20 72 65 66 65 72 65  /u>: such refere
16a0: 6e 63 65 73 20 61 72 65 20 66 75 6c 6c 79 20 62  nces are fully b
16b0: 61 73 65 64 20 6f 6e 20 69 6e 74 65 72 6e 61 6c  ased on internal
16c0: 20 6e 75 6d 65 72 69 63 20 49 44 73 2c 20 6e 6f   numeric IDs, no
16d0: 74 20 61 6e 20 74 68 65 20 63 6f 72 72 65 73 70  t an the corresp
16e0: 6f 6e 64 69 6e 67 20 58 4d 4c 20 74 61 67 20 76  onding XML tag v
16f0: 61 6c 75 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75  alues.</li>..</u
1700: 6c 3e 3c 62 72 3e 0d 0a 3c 68 32 3e 41 20 70 72  l><br>..<h2>A pr
1710: 61 63 74 69 63 61 6c 20 74 75 74 6f 72 69 61 6c  actical tutorial
1720: 20 62 79 20 72 65 61 6c 20 65 78 61 6d 70 6c 65   by real example
1730: 73 3c 2f 68 32 3e 0d 0a 49 6e 20 74 68 69 73 20  s</h2>..In this 
1740: 65 78 61 6d 70 6c 65 20 77 65 27 6c 6c 20 75 73  example we'll us
1750: 65 20 74 68 65 20 73 61 6d 70 6c 65 73 20 63 6f  e the samples co
1760: 6e 74 61 69 6e 65 64 20 69 6e 74 6f 20 74 68 65  ntained into the
1770: 20 3c 62 3e 78 6d 6c 2d 73 61 6d 70 6c 65 73 2f   <b>xml-samples/
1780: 69 73 6f 2d 6d 65 74 61 64 61 74 61 3c 2f 62 3e  iso-metadata</b>
1790: 20 66 6f 6c 64 65 72 2e 3c 62 72 3e 0d 0a 3c 76   folder.<br>..<v
17a0: 65 72 62 61 74 69 6d 3e 0d 0a 65 78 70 6f 72 74  erbatim>..export
17b0: 20 22 53 50 41 54 49 41 4c 49 54 45 5f 53 45 43   "SPATIALITE_SEC
17c0: 55 52 49 54 59 3d 72 65 6c 61 78 65 64 22 0d 0a  URITY=relaxed"..
17d0: 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 46 6f 72  </verbatim>..For
17e0: 20 64 69 64 61 63 74 69 63 20 73 69 6d 70 6c 69   didactic simpli
17f0: 63 69 74 79 20 77 65 27 6c 6c 20 75 73 65 20 74  city we'll use t
1800: 68 65 20 3c 75 3e 75 6e 73 61 66 65 20 53 51 4c  he <u>unsafe SQL
1810: 20 66 75 6e 63 74 69 6f 6e 73 3c 2f 75 3e 20 73   functions</u> s
1820: 75 70 70 6f 72 74 69 6e 67 20 64 69 72 65 63 74  upporting direct
1830: 20 61 63 63 65 73 73 20 74 6f 20 65 78 74 65 72   access to exter
1840: 6e 61 6c 20 66 69 6c 65 73 20 73 74 6f 72 65 64  nal files stored
1850: 20 69 6e 74 6f 20 74 68 65 20 3c 75 3e 66 69 6c   into the <u>fil
1860: 65 2d 73 79 73 74 65 6d 3c 2f 75 3e 2e 3c 62 72  e-system</u>.<br
1870: 3e 0d 0a 3c 75 3e 3c 62 3e 52 65 6d 65 6d 62 65  >..<u><b>Remembe
1880: 72 3c 2f 62 3e 3c 2f 75 3e 3a 20 79 6f 75 20 68  r</b></u>: you h
1890: 61 76 65 20 74 6f 20 65 78 70 6c 69 63 69 74 6c  ave to explicitl
18a0: 79 20 73 65 74 20 74 68 65 20 3c 62 3e 53 50 41  y set the <b>SPA
18b0: 54 49 41 4c 49 54 45 5f 53 45 43 55 52 49 54 59  TIALITE_SECURITY
18c0: 3d 72 65 6c 61 78 65 64 3c 2f 62 3e 20 65 6e 76  =relaxed</b> env
18d0: 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c  ironment variabl
18e0: 65 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 65 6e  e in order to en
18f0: 61 62 6c 65 20 61 6c 6c 20 3c 75 3e 75 6e 73 61  able all <u>unsa
1900: 66 65 3c 2f 75 3e 20 53 51 4c 20 49 6d 70 6f 72  fe</u> SQL Impor
1910: 74 2f 45 78 70 6f 72 74 20 66 75 6e 63 74 69 6f  t/Export functio
1920: 6e 73 2e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d  ns...<verbatim>.
1930: 0a 53 45 4c 45 43 54 20 43 72 65 61 74 65 49 73  .SELECT CreateIs
1940: 6f 4d 65 74 61 64 61 74 61 54 61 62 6c 65 73 28  oMetadataTables(
1950: 29 3b 0d 0a 2d 2d 2d 2d 2d 0d 0a 31 0d 0a 3c 2f  );..-----..1..</
1960: 76 65 72 62 61 74 69 6d 3e 0d 0a 41 6e 64 20 77  verbatim>..And w
1970: 65 27 6c 6c 20 73 75 70 70 6f 73 65 20 74 68 61  e'll suppose tha
1980: 74 20 74 68 65 20 49 53 4f 20 4d 65 74 61 64 61  t the ISO Metada
1990: 74 61 20 73 75 70 70 6f 72 74 69 6e 67 20 74 61  ta supporting ta
19a0: 62 6c 65 73 20 68 61 76 65 20 62 65 65 6e 20 63  bles have been c
19b0: 72 65 61 74 65 64 20 69 6e 20 3c 62 3e 73 74 72  reated in <b>str
19c0: 69 63 74 20 6d 6f 64 65 3c 2f 62 3e 2c 20 69 2e  ict mode</b>, i.
19d0: 65 2e 20 61 6c 77 61 79 73 20 72 65 71 75 69 72  e. always requir
19e0: 69 6e 67 20 61 20 73 75 63 63 65 73 73 66 75 6c  ing a successful
19f0: 20 58 4d 4c 20 53 63 68 65 6d 61 20 76 61 6c 69   XML Schema vali
1a00: 64 61 74 69 6f 6e 2e 0d 0a 3c 76 65 72 62 61 74  dation...<verbat
1a10: 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 52 65 67 69  im>..SELECT Regi
1a20: 73 74 65 72 49 73 6f 4d 65 74 61 64 61 74 61 28  sterIsoMetadata(
1a30: 20 27 64 61 74 61 73 65 74 27 2c 20 0d 0a 20 20   'dataset', ..  
1a40: 58 42 5f 43 72 65 61 74 65 28 20 58 42 5f 4c 6f  XB_Create( XB_Lo
1a50: 61 64 58 4d 4c 28 20 27 43 3a 2f 78 6d 6c 2d 73  adXML( 'C:/xml-s
1a60: 61 6d 70 6c 65 73 2f 69 73 6f 2d 6d 65 74 61 64  amples/iso-metad
1a70: 61 74 61 2f 69 6e 73 70 69 72 65 2d 64 61 74 61  ata/inspire-data
1a80: 2d 65 78 61 6d 70 6c 65 2e 78 6d 6c 27 20 29 20  -example.xml' ) 
1a90: 29 20 29 3b 0d 0a 2d 2d 2d 2d 2d 0d 0a 30 0d 0a  ) );..-----..0..
1aa0: 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 54 68 65  </verbatim>..The
1ab0: 20 3c 62 3e 52 65 67 69 73 74 65 72 49 73 6f 4d   <b>RegisterIsoM
1ac0: 65 74 61 64 61 74 61 3c 2f 62 3e 28 29 20 53 51  etadata</b>() SQ
1ad0: 4c 20 66 75 6e 63 74 69 6f 6e 20 69 6e 73 65 72  L function inser
1ae0: 74 73 20 61 20 72 65 67 69 73 74 72 61 74 69 6f  ts a registratio
1af0: 6e 20 69 6e 74 6f 20 74 68 65 20 3c 62 3e 49 53  n into the <b>IS
1b00: 4f 5f 6d 65 74 61 64 61 74 61 3c 2f 62 3e 20 74  O_metadata</b> t
1b10: 61 62 6c 65 2e 0d 0a 41 6e 79 20 61 74 74 65 6d  able...Any attem
1b20: 70 74 20 61 69 6d 65 64 20 74 6f 20 64 69 72 65  pt aimed to dire
1b30: 63 74 6c 79 20 70 65 72 66 6f 72 6d 20 61 6e 79  ctly perform any
1b40: 20 3c 62 3e 49 4e 53 45 52 54 3c 2f 62 3e 20 6f   <b>INSERT</b> o
1b50: 72 20 3c 62 3e 55 50 44 41 54 45 3c 2f 62 3e 20  r <b>UPDATE</b> 
1b60: 53 51 4c 20 73 74 61 74 65 6d 65 6e 74 20 6f 6e  SQL statement on
1b70: 20 62 65 68 61 6c 66 20 6f 66 20 49 53 4f 5f 6d   behalf of ISO_m
1b80: 65 74 61 64 61 74 61 20 69 73 20 73 74 72 6f 6e  etadata is stron
1b90: 67 6c 79 20 64 69 73 63 6f 75 72 61 67 65 64 3b  gly discouraged;
1ba0: 20 61 6c 77 61 79 73 20 75 73 69 6e 67 20 74 68   always using th
1bb0: 65 20 61 62 73 74 72 61 63 74 20 66 75 6e 63 74  e abstract funct
1bc0: 69 6f 6e 20 52 65 67 69 73 74 65 72 49 73 6f 4d  ion RegisterIsoM
1bd0: 65 74 61 64 61 74 61 28 29 20 69 73 20 77 61 72  etadata() is war
1be0: 6d 6c 79 20 72 65 63 6f 6d 6d 65 6e 64 65 64 2c  mly recommended,
1bf0: 20 61 6e 64 20 77 69 6c 6c 20 70 72 65 73 65 72   and will preser
1c00: 76 65 20 6c 6f 6e 67 2d 74 65 72 6d 20 63 6f 6d  ve long-term com
1c10: 70 61 74 69 62 69 6c 69 74 79 20 61 67 61 69 6e  patibility again
1c20: 73 74 20 73 75 62 73 65 71 75 65 6e 74 20 72 65  st subsequent re
1c30: 6c 65 61 73 65 73 2e 0d 0a 3c 75 6c 3e 0d 0a 3c  leases...<ul>..<
1c40: 6c 69 3e 74 68 65 20 3c 62 3e 52 65 67 69 73 74  li>the <b>Regist
1c50: 65 72 49 73 6f 4d 65 74 61 64 61 74 61 28 29 3c  erIsoMetadata()<
1c60: 2f 62 3e 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e  /b> SQL function
1c70: 20 69 6e 20 69 74 73 20 73 69 6d 70 6c 65 72 20   in its simpler 
1c80: 66 6f 72 6d 20 73 69 6d 70 6c 79 20 72 65 71 75  form simply requ
1c90: 69 72 65 73 20 70 61 73 73 69 6e 67 20 74 77 6f  ires passing two
1ca0: 20 61 72 67 75 6d 65 6e 74 73 3a 0d 0a 3c 75 6c   arguments:..<ul
1cb0: 3e 0d 0a 3c 6c 69 3e 74 68 65 20 66 69 72 73 74  >..<li>the first
1cc0: 20 61 72 67 75 6d 65 6e 74 20 63 6f 72 72 65 73   argument corres
1cd0: 70 6f 6e 64 20 74 6f 20 3c 62 3e 6d 64 5f 73 63  pond to <b>md_sc
1ce0: 6f 70 65 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c  ope</b>.</li>..<
1cf0: 6c 69 3e 74 68 65 20 73 65 63 6f 6e 64 20 61 72  li>the second ar
1d00: 67 75 6d 65 6e 74 20 69 73 20 65 78 70 65 63 74  gument is expect
1d10: 65 64 20 74 6f 20 62 65 20 61 6e 20 61 70 70 72  ed to be an appr
1d20: 6f 70 72 69 61 74 65 20 3c 62 3e 58 6d 6c 42 4c  opriate <b>XmlBL
1d30: 4f 42 3c 2f 62 3e 20 63 6f 6e 74 61 69 6e 69 6e  OB</b> containin
1d40: 67 20 74 68 65 20 4d 65 74 61 64 61 74 61 20 64  g the Metadata d
1d50: 65 66 69 6e 69 74 69 6f 6e 2e 3c 62 72 3e 0d 0a  efinition.<br>..
1d60: 53 6f 20 77 65 27 76 65 20 75 73 65 64 20 74 68  So we've used th
1d70: 65 20 3c 62 3e 58 42 5f 43 72 65 61 74 65 28 29  e <b>XB_Create()
1d80: 3c 2f 62 3e 20 53 51 4c 20 66 75 6e 63 74 69 6f  </b> SQL functio
1d90: 6e 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 63 72  n in order to cr
1da0: 65 61 74 65 20 61 20 76 61 6c 69 64 20 3c 62 3e  eate a valid <b>
1db0: 58 6d 6c 42 4c 4f 42 3c 2f 62 3e 3b 20 61 6e 64  XmlBLOB</b>; and
1dc0: 20 74 68 65 6e 20 69 6e 20 74 75 72 6e 20 77 65   then in turn we
1dd0: 27 76 65 20 69 6e 76 6f 6b 65 64 20 3c 62 3e 58  've invoked <b>X
1de0: 42 5f 4c 6f 61 64 58 4d 4c 28 29 3c 2f 62 3e 20  B_LoadXML()</b> 
1df0: 69 6e 20 6f 72 64 65 72 20 74 6f 20 70 72 6f 70  in order to prop
1e00: 65 72 6c 79 20 6c 6f 61 64 20 74 68 65 20 58 4d  erly load the XM
1e10: 4c 20 44 6f 63 75 6d 65 6e 74 20 66 72 6f 6d 20  L Document from 
1e20: 74 68 65 20 65 78 74 65 72 6e 61 6c 20 66 69 6c  the external fil
1e30: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f  e.</li>..</ul></
1e40: 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 41 6e 79 77  li>..</ul>..Anyw
1e50: 61 79 20 74 68 69 73 20 66 69 72 73 74 20 61 74  ay this first at
1e60: 74 65 6d 70 74 20 77 61 73 20 75 6e 73 75 63 63  tempt was unsucc
1e70: 65 73 73 66 75 6c 3a 20 77 65 27 76 65 20 67 65  essful: we've ge
1e80: 74 20 61 20 3c 62 3e 30 3c 2f 62 3e 20 72 65 73  t a <b>0</b> res
1e90: 75 6c 74 2c 20 74 68 69 73 20 6d 65 61 6e 69 6e  ult, this meanin
1ea0: 67 20 3c 75 3e 66 61 69 6c 75 72 65 3c 2f 75 3e  g <u>failure</u>
1eb0: 2e 3c 62 72 3e 0d 0a 54 68 65 72 65 20 69 73 20  .<br>..There is 
1ec0: 76 65 72 79 20 73 69 6d 70 6c 65 20 72 65 61 73  very simple reas
1ed0: 6f 6e 20 61 63 63 6f 75 6e 74 69 6e 67 20 66 6f  on accounting fo
1ee0: 72 20 74 68 69 73 20 66 61 69 6c 75 72 65 3a 20  r this failure: 
1ef0: 3c 75 3e 77 65 27 76 65 20 6d 69 73 73 65 64 20  <u>we've missed 
1f00: 74 6f 20 70 65 72 66 6f 72 6d 20 61 6e 79 20 58  to perform any X
1f10: 4d 4c 20 53 63 68 65 6d 61 20 76 61 6c 69 64 61  ML Schema valida
1f20: 74 69 6f 6e 3c 2f 75 3e 3b 20 61 6e 64 20 61 63  tion</u>; and ac
1f30: 63 6f 72 64 69 6e 67 6c 79 20 74 6f 20 74 68 69  cordingly to thi
1f40: 73 20 74 68 65 20 73 61 66 65 74 79 20 54 72 69  s the safety Tri
1f50: 67 67 65 72 20 68 61 73 20 74 68 65 6e 20 72 65  gger has then re
1f60: 6a 65 63 74 65 64 20 74 68 69 73 20 66 69 72 73  jected this firs
1f70: 74 20 61 74 74 65 6d 70 74 2e 0d 0a 3c 76 65 72  t attempt...<ver
1f80: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 52  batim>..SELECT R
1f90: 65 67 69 73 74 65 72 49 73 6f 4d 65 74 61 64 61  egisterIsoMetada
1fa0: 74 61 28 20 27 64 61 74 61 73 65 74 27 2c 20 0d  ta( 'dataset', .
1fb0: 0a 20 20 58 42 5f 43 72 65 61 74 65 28 20 58 42  .  XB_Create( XB
1fc0: 5f 4c 6f 61 64 58 4d 4c 28 20 27 43 3a 2f 78 6d  _LoadXML( 'C:/xm
1fd0: 6c 2d 73 61 6d 70 6c 65 73 2f 69 73 6f 2d 6d 65  l-samples/iso-me
1fe0: 74 61 64 61 74 61 2f 69 6e 73 70 69 72 65 2d 64  tadata/inspire-d
1ff0: 61 74 61 2d 65 78 61 6d 70 6c 65 2e 78 6d 6c 27  ata-example.xml'
2000: 20 29 2c 0d 0a 20 20 20 20 31 2c 20 31 20 29 20   ),..    1, 1 ) 
2010: 29 3b 0d 0a 2d 2d 2d 2d 2d 0d 0a 31 0d 0a 3c 2f  );..-----..1..</
2020: 76 65 72 62 61 74 69 6d 3e 0d 0a 54 68 69 73 20  verbatim>..This 
2030: 73 65 63 6f 6e 64 20 61 74 74 65 6d 70 74 20 69  second attempt i
2040: 73 20 66 69 6e 61 6c 6c 79 20 73 75 63 63 65 73  s finally succes
2050: 73 66 75 6c 2c 20 62 65 63 61 75 73 65 20 74 68  sful, because th
2060: 69 73 20 74 69 6d 65 20 77 65 27 76 65 20 63 6f  is time we've co
2070: 72 72 65 63 74 6c 79 20 69 6e 76 6f 6b 65 64 20  rrectly invoked 
2080: 3c 62 3e 58 42 5f 43 72 65 61 74 65 28 29 3c 2f  <b>XB_Create()</
2090: 62 3e 20 61 73 6b 69 6e 67 20 66 6f 72 20 66 75  b> asking for fu
20a0: 6c 6c 20 58 4d 4c 20 53 63 68 65 6d 61 20 76 61  ll XML Schema va
20b0: 6c 69 64 61 74 69 6f 6e 2e 0d 0a 3c 76 65 72 62  lidation...<verb
20c0: 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 52 65  atim>..SELECT Re
20d0: 67 69 73 74 65 72 49 73 6f 4d 65 74 61 64 61 74  gisterIsoMetadat
20e0: 61 28 20 27 64 61 74 61 73 65 74 27 2c 20 0d 0a  a( 'dataset', ..
20f0: 20 20 58 42 5f 43 72 65 61 74 65 28 20 58 42 5f    XB_Create( XB_
2100: 4c 6f 61 64 58 4d 4c 28 20 27 43 3a 2f 78 6d 6c  LoadXML( 'C:/xml
2110: 2d 73 61 6d 70 6c 65 73 2f 69 73 6f 2d 6d 65 74  -samples/iso-met
2120: 61 64 61 74 61 2f 69 6e 73 70 69 72 65 2d 64 61  adata/inspire-da
2130: 74 61 2d 65 78 61 6d 70 6c 65 2e 78 6d 6c 27 20  ta-example.xml' 
2140: 29 2c 0d 0a 20 20 20 20 31 2c 20 31 20 29 20 29  ),..    1, 1 ) )
2150: 3b 0d 0a 2d 2d 2d 2d 2d 0d 0a 30 0d 0a 3c 2f 76  ;..-----..0..</v
2160: 65 72 62 61 74 69 6d 3e 0d 0a 41 6e 79 77 61 79  erbatim>..Anyway
2170: 20 61 20 73 65 63 6f 6e 64 20 61 74 74 65 6d 70   a second attemp
2180: 74 20 74 6f 20 69 6e 73 65 72 74 20 79 65 74 20  t to insert yet 
2190: 61 6e 6f 74 68 65 72 20 74 69 6d 65 20 74 68 65  another time the
21a0: 20 73 61 6d 65 20 4d 65 74 61 64 61 74 61 20 64   same Metadata d
21b0: 6f 63 75 6d 65 6e 74 20 77 69 6c 6c 20 62 65 20  ocument will be 
21c0: 72 65 6a 65 63 74 65 64 3b 20 74 68 69 73 20 69  rejected; this i
21d0: 73 20 62 65 63 61 75 73 65 20 61 20 3c 75 3e 75  s because a <u>u
21e0: 6e 69 71 75 65 6e 65 73 73 20 63 6f 6e 73 74 72  niqueness constr
21f0: 61 69 6e 74 3c 2f 75 3e 20 66 6f 72 62 69 64 73  aint</u> forbids
2200: 20 74 6f 20 69 6e 73 65 72 74 20 74 77 6f 20 64   to insert two d
2210: 6f 63 75 6d 65 6e 74 73 20 64 65 63 6c 61 72 69  ocuments declari
2220: 6e 67 20 74 68 65 20 73 61 6d 65 20 3c 62 3e 66  ng the same <b>f
2230: 69 6c 65 49 64 3c 2f 62 3e 20 76 61 6c 75 65 2e  ileId</b> value.
2240: 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45  ..<verbatim>..SE
2250: 4c 45 43 54 20 52 65 67 69 73 74 65 72 49 73 6f  LECT RegisterIso
2260: 4d 65 74 61 64 61 74 61 28 20 27 64 61 74 61 73  Metadata( 'datas
2270: 65 74 27 2c 20 0d 0a 20 20 58 42 5f 43 72 65 61  et', ..  XB_Crea
2280: 74 65 28 20 58 42 5f 4c 6f 61 64 58 4d 4c 28 20  te( XB_LoadXML( 
2290: 27 43 3a 2f 78 6d 6c 2d 73 61 6d 70 6c 65 73 2f  'C:/xml-samples/
22a0: 69 73 6f 2d 6d 65 74 61 64 61 74 61 2f 64 62 5f  iso-metadata/db_
22b0: 74 6f 70 6f 67 72 61 66 69 63 6f 5f 69 73 6f 31  topografico_iso1
22c0: 39 31 33 39 2e 78 6d 6c 27 20 29 2c 0d 0a 20 20  9139.xml' ),..  
22d0: 20 20 31 2c 20 31 20 29 20 29 3b 0d 0a 2d 2d 2d    1, 1 ) );..---
22e0: 2d 2d 0d 0a 31 0d 0a 0d 0a 53 45 4c 45 43 54 20  --..1....SELECT 
22f0: 52 65 67 69 73 74 65 72 49 73 6f 4d 65 74 61 64  RegisterIsoMetad
2300: 61 74 61 28 20 27 64 61 74 61 73 65 74 27 2c 20  ata( 'dataset', 
2310: 0d 0a 20 20 58 42 5f 43 72 65 61 74 65 28 20 58  ..  XB_Create( X
2320: 42 5f 4c 6f 61 64 58 4d 4c 28 20 27 43 3a 2f 78  B_LoadXML( 'C:/x
2330: 6d 6c 2d 73 61 6d 70 6c 65 73 2f 69 73 6f 2d 6d  ml-samples/iso-m
2340: 65 74 61 64 61 74 61 2f 75 6e 69 74 61 5f 76 6f  etadata/unita_vo
2350: 6c 75 6d 65 74 72 69 63 61 5f 69 73 6f 31 39 31  lumetrica_iso191
2360: 33 39 2e 78 6d 6c 27 20 29 2c 0d 0a 20 20 20 20  39.xml' ),..    
2370: 31 2c 20 31 20 29 2c 20 32 20 29 3b 0d 0a 2d 2d  1, 1 ), 2 );..--
2380: 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 53 45 4c 45 43 54  ---..1....SELECT
2390: 20 52 65 67 69 73 74 65 72 49 73 6f 4d 65 74 61   RegisterIsoMeta
23a0: 64 61 74 61 28 20 27 64 61 74 61 73 65 74 27 2c  data( 'dataset',
23b0: 20 0d 0a 20 20 58 42 5f 43 72 65 61 74 65 28 20   ..  XB_Create( 
23c0: 58 42 5f 4c 6f 61 64 58 4d 4c 28 20 27 43 3a 2f  XB_LoadXML( 'C:/
23d0: 78 6d 6c 2d 73 61 6d 70 6c 65 73 2f 69 73 6f 2d  xml-samples/iso-
23e0: 6d 65 74 61 64 61 74 61 2f 75 6e 69 74 61 5f 69  metadata/unita_i
23f0: 6e 73 65 64 69 61 74 69 76 61 5f 69 73 6f 31 39  nsediativa_iso19
2400: 31 33 39 2e 78 6d 6c 27 20 29 2c 0d 0a 20 20 20  139.xml' ),..   
2410: 20 31 2c 20 31 20 29 2c 20 27 66 30 37 38 30 63   1, 1 ), 'f0780c
2420: 34 31 2d 30 32 33 64 2d 34 31 62 65 2d 39 65 64  41-023d-41be-9ed
2430: 34 2d 66 37 39 62 64 62 34 61 37 38 38 36 27 20  4-f79bdb4a7886' 
2440: 29 3b 0d 0a 2d 2d 2d 2d 2d 0d 0a 31 0d 0a 3c 2f  );..-----..1..</
2450: 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 75 3e 50 6c  verbatim>..<u>Pl
2460: 65 61 73 65 20 6e 6f 74 65 3c 2f 75 3e 3a 20 74  ease note</u>: t
2470: 68 65 20 3c 62 3e 52 65 67 69 73 74 65 72 49 73  he <b>RegisterIs
2480: 6f 4d 65 74 61 64 61 74 61 28 29 3c 2f 62 3e 20  oMetadata()</b> 
2490: 66 75 6e 63 74 69 6f 6e 20 63 61 6e 20 62 65 20  function can be 
24a0: 61 6c 73 6f 20 69 6e 76 6f 6b 65 64 20 69 6e 20  also invoked in 
24b0: 6f 72 64 65 72 20 74 6f 20 75 70 64 61 74 65 20  order to update 
24c0: 61 6e 20 61 6c 72 65 61 64 79 20 64 65 66 69 6e  an already defin
24d0: 65 64 20 4d 65 74 61 64 61 74 61 20 64 6f 63 75  ed Metadata docu
24e0: 6d 65 6e 74 3b 20 69 6e 20 74 68 69 73 20 63 61  ment; in this ca
24f0: 73 65 20 79 6f 75 20 73 69 6d 70 6c 79 20 68 61  se you simply ha
2500: 76 65 20 74 6f 20 70 61 73 73 20 74 68 65 20 63  ve to pass the c
2510: 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 3c 62 3e  orresponding <b>
2520: 69 64 3c 2f 62 3e 20 61 73 20 74 68 65 20 74 68  id</b> as the th
2530: 69 72 64 20 61 72 67 75 6d 65 6e 74 2e 3c 62 72  ird argument.<br
2540: 3e 0d 0a 41 6c 74 65 72 6e 61 74 69 76 65 6c 79  >..Alternatively
2550: 2c 20 69 66 20 74 68 65 20 4d 65 74 61 64 61 74  , if the Metadat
2560: 61 20 64 6f 63 75 6d 65 6e 74 20 74 6f 20 62 65  a document to be
2570: 20 72 65 70 6c 61 63 65 64 2f 75 70 64 61 74 65   replaced/update
2580: 64 20 64 65 63 6c 61 72 65 73 20 61 6e 20 69 6e  d declares an in
2590: 74 65 72 6e 61 6c 20 3c 62 3e 26 6c 74 3b 66 69  ternal <b>&lt;fi
25a0: 6c 65 49 64 65 6e 74 69 66 69 65 72 26 67 74 3b  leIdentifier&gt;
25b0: 3c 2f 62 3e 20 74 61 67 20 76 61 6c 75 65 2c 20  </b> tag value, 
25c0: 79 6f 75 20 63 61 6e 20 70 61 73 73 20 74 68 65  you can pass the
25d0: 20 3c 62 3e 66 69 6c 65 49 44 3c 2f 62 3e 20 76   <b>fileID</b> v
25e0: 61 6c 75 65 20 61 73 20 74 68 65 20 74 68 69 72  alue as the thir
25f0: 64 20 61 72 67 75 6d 65 6e 74 2e 3c 62 72 3e 0d  d argument.<br>.
2600: 0a 49 6e 20 61 6e 79 20 63 61 73 65 20 62 6f 74  .In any case bot
2610: 68 20 3c 62 3e 66 69 6c 65 49 64 3c 2f 62 3e 20  h <b>fileId</b> 
2620: 61 6e 64 20 3c 62 3e 70 61 72 65 6e 74 49 64 3c  and <b>parentId<
2630: 2f 62 3e 20 77 69 6c 6c 20 62 65 20 63 6f 72 72  /b> will be corr
2640: 65 63 74 6c 79 20 75 70 64 61 74 65 64 20 73 6f  ectly updated so
2650: 20 74 6f 20 65 78 61 63 74 6c 79 20 63 6f 72 72   to exactly corr
2660: 65 73 70 6f 6e 64 20 74 6f 20 74 68 65 20 69 6e  espond to the in
2670: 74 65 72 6e 61 6c 20 74 61 67 73 20 64 65 63 6c  ternal tags decl
2680: 61 72 65 64 20 77 69 74 68 69 6e 20 74 68 65 20  ared within the 
2690: 58 4d 4c 20 64 6f 63 75 6d 65 6e 74 73 20 69 74  XML documents it
26a0: 73 65 6c 66 3b 20 79 6f 75 20 63 61 6e 20 73 61  self; you can sa
26b0: 66 65 6c 79 20 72 65 6c 79 20 6f 6e 20 74 68 69  fely rely on thi
26c0: 73 2c 20 62 65 63 61 75 73 65 20 61 20 63 6f 75  s, because a cou
26d0: 70 6c 65 20 6f 66 20 54 72 69 67 67 65 72 73 20  ple of Triggers 
26e0: 77 69 6c 6c 20 61 6c 77 61 79 73 20 74 61 6b 65  will always take
26f0: 20 63 61 72 65 20 74 6f 20 65 6e 73 75 72 65 20   care to ensure 
2700: 61 20 73 74 72 69 63 74 20 63 6f 72 72 65 73 70  a strict corresp
2710: 6f 6e 64 65 6e 63 65 2e 3c 62 72 3e 3c 62 72 3e  ondence.<br><br>
2720: 0d 0a 3c 68 72 3e 0d 0a 3c 76 65 72 62 61 74 69  ..<hr>..<verbati
2730: 6d 3e 0d 0a 53 45 4c 45 43 54 20 2a 0d 0a 46 52  m>..SELECT *..FR
2740: 4f 4d 20 49 53 4f 5f 6d 65 74 61 64 61 74 61 5f  OM ISO_metadata_
2750: 76 69 65 77 3b 0d 0a 3c 2f 76 65 72 62 61 74 69  view;..</verbati
2760: 6d 3e 0d 0a 3c 74 61 62 6c 65 20 62 6f 72 64 65  m>..<table borde
2770: 72 3d 22 31 22 20 63 65 6c 6c 73 70 61 63 69 6e  r="1" cellspacin
2780: 67 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 69 6e  g="4" cellpaddin
2790: 67 3d 22 34 22 3e 0d 0a 3c 74 72 3e 3c 74 68 3e  g="4">..<tr><th>
27a0: 69 64 3c 2f 74 68 3e 3c 74 68 3e 6d 64 5f 73 63  id</th><th>md_sc
27b0: 6f 70 65 3c 2f 74 68 3e 3c 74 68 3e 74 69 74 6c  ope</th><th>titl
27c0: 65 3c 2f 74 68 3e 3c 74 68 3e 61 62 73 74 72 61  e</th><th>abstra
27d0: 63 74 3c 2f 74 68 3e 0d 0a 3c 74 68 3e 67 65 6f  ct</th>..<th>geo
27e0: 6d 65 74 72 79 3c 2f 74 68 3e 3c 74 68 3e 66 69  metry</th><th>fi
27f0: 6c 65 49 64 65 6e 74 69 66 69 65 72 3c 2f 74 68  leIdentifier</th
2800: 3e 3c 74 68 3e 70 61 72 65 6e 74 49 64 65 6e 74  ><th>parentIdent
2810: 69 66 69 65 72 3c 2f 74 68 3e 3c 74 68 3e 6d 65  ifier</th><th>me
2820: 74 61 64 61 74 61 3c 2f 74 68 3e 3c 74 68 3e 73  tadata</th><th>s
2830: 63 68 65 6d 61 5f 76 61 6c 69 64 61 74 65 64 3c  chema_validated<
2840: 2f 74 68 3e 3c 74 68 3e 6d 65 74 61 64 61 74 61  /th><th>metadata
2850: 5f 73 63 68 65 6d 61 5f 75 72 69 3c 2f 74 68 3e  _schema_uri</th>
2860: 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 61  </tr>..<tr><td a
2870: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 30 3c 2f  lign="right">0</
2880: 74 64 3e 3c 74 64 3e 75 6e 64 65 66 69 6e 65 64  td><td>undefined
2890: 3c 2f 74 64 3e 3c 74 64 3e 4e 55 4c 4c 3c 2f 74  </td><td>NULL</t
28a0: 64 3e 3c 74 64 3e 4e 55 4c 4c 3c 2f 74 64 3e 0d  d><td>NULL</td>.
28b0: 0a 3c 74 64 3e 4e 55 4c 4c 3c 2f 74 64 3e 3c 74  .<td>NULL</td><t
28c0: 64 3e 4e 55 4c 4c 3c 2f 74 64 3e 3c 74 64 3e 4e  d>NULL</td><td>N
28d0: 55 4c 4c 3c 2f 74 64 3e 3c 74 64 3e 42 4c 4f 42  ULL</td><td>BLOB
28e0: 20 73 7a 3d 34 20 55 4e 4b 4e 4f 57 4e 20 74 79   sz=4 UNKNOWN ty
28f0: 70 65 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e  pe</td><td align
2900: 3d 22 72 69 67 68 74 22 3e 2d 31 3c 2f 74 64 3e  ="right">-1</td>
2910: 3c 74 64 3e 4e 55 4c 4c 3c 2f 74 64 3e 3c 2f 74  <td>NULL</td></t
2920: 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 61 6c 69 67  r>..<tr><td alig
2930: 6e 3d 22 72 69 67 68 74 22 3e 31 3c 2f 74 64 3e  n="right">1</td>
2940: 3c 74 64 3e 64 61 74 61 73 65 74 3c 2f 74 64 3e  <td>dataset</td>
2950: 0d 0a 3c 74 64 3e 49 6d 61 67 65 32 30 30 30 20  ..<td>Image2000 
2960: 50 72 6f 64 75 63 74 20 31 20 28 6e 6c 32 29 20  Product 1 (nl2) 
2970: 4d 75 6c 74 69 73 70 65 63 74 72 61 6c 3c 2f 74  Multispectral</t
2980: 64 3e 0d 0a 3c 74 64 3e 49 4d 41 47 45 32 30 30  d>..<td>IMAGE200
2990: 30 20 70 72 6f 64 75 63 74 20 31 20 69 6e 64 69  0 product 1 indi
29a0: 76 69 64 75 61 6c 20 6f 72 74 68 6f 72 65 63 74  vidual orthorect
29b0: 69 66 69 65 64 20 73 63 65 6e 65 73 20 2e 2e 2e  ified scenes ...
29c0: 3c 2f 74 64 3e 0d 0a 3c 74 64 3e 42 4c 4f 42 20  </td>..<td>BLOB 
29d0: 73 7a 3d 31 34 31 20 47 45 4f 4d 45 54 52 59 3c  sz=141 GEOMETRY<
29e0: 2f 74 64 3e 3c 74 64 3e 30 32 39 30 39 37 66 64  /td><td>029097fd
29f0: 2d 32 65 66 32 2d 34 38 37 63 2d 61 35 63 61 2d  -2ef2-487c-a5ca-
2a00: 36 65 63 37 61 33 64 62 61 63 35 33 3c 2f 74 64  6ec7a3dbac53</td
2a10: 3e 0d 0a 3c 74 64 3e 4e 55 4c 4c 3c 2f 74 64 3e  >..<td>NULL</td>
2a20: 3c 74 64 3e 58 6d 6c 42 4c 4f 42 2d 49 53 4f 6d  <td>XmlBLOB-ISOm
2a30: 65 74 61 64 61 74 61 20 73 7a 3d 34 34 32 33 20  etadata sz=4423 
2a40: 28 58 4d 4c 73 7a 3d 31 38 30 32 36 29 20 53 63  (XMLsz=18026) Sc
2a50: 68 65 6d 61 56 61 6c 69 64 61 74 65 64 3c 2f 74  hemaValidated</t
2a60: 64 3e 0d 0a 3c 74 64 20 61 6c 69 67 6e 3d 22 72  d>..<td align="r
2a70: 69 67 68 74 22 3e 31 3c 2f 74 64 3e 0d 0a 3c 74  ight">1</td>..<t
2a80: 64 3e 68 74 74 70 3a 2f 2f 73 63 68 65 6d 61 73  d>http://schemas
2a90: 2e 6f 70 65 6e 67 69 73 2e 6e 65 74 2f 69 73 6f  .opengis.net/iso
2aa0: 2f 31 39 31 33 39 2f 32 30 30 36 30 35 30 34 2f  /19139/20060504/
2ab0: 67 6d 64 2f 67 6d 64 2e 78 73 64 3c 2f 74 64 3e  gmd/gmd.xsd</td>
2ac0: 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 61  </tr>..<tr><td a
2ad0: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 32 3c 2f  lign="right">2</
2ae0: 74 64 3e 3c 74 64 3e 64 61 74 61 73 65 74 3c 2f  td><td>dataset</
2af0: 74 64 3e 3c 74 64 3e 55 6e 69 74 61 27 20 49 6e  td><td>Unita' In
2b00: 73 65 64 69 61 74 69 76 61 3c 2f 74 64 3e 0d 0a  sediativa</td>..
2b10: 3c 74 64 3e 41 72 65 65 20 61 64 69 62 69 74 65  <td>Aree adibite
2b20: 20 61 6c 6c 27 69 6e 73 74 61 6c 6c 61 7a 69 6f   all'installazio
2b30: 6e 65 20 2e 2e 2e 3c 2f 74 64 3e 0d 0a 3c 74 64  ne ...</td>..<td
2b40: 3e 42 4c 4f 42 20 73 7a 3d 31 34 31 20 47 45 4f  >BLOB sz=141 GEO
2b50: 4d 45 54 52 59 3c 2f 74 64 3e 3c 74 64 3e 63 64  METRY</td><td>cd
2b60: 37 36 63 39 61 32 2d 38 31 33 38 2d 34 65 37 65  76c9a2-8138-4e7e
2b70: 2d 61 64 36 62 2d 32 65 31 30 35 63 33 37 65 36  -ad6b-2e105c37e6
2b80: 35 63 3c 2f 74 64 3e 0d 0a 3c 74 64 3e 63 63 32  5c</td>..<td>cc2
2b90: 37 64 38 38 35 2d 32 37 39 35 2d 34 39 39 38 2d  7d885-2795-4998-
2ba0: 39 62 61 65 2d 36 66 36 38 37 32 62 31 38 31 63  9bae-6f6872b181c
2bb0: 65 3c 2f 74 64 3e 0d 0a 3c 74 64 3e 58 6d 6c 42  e</td>..<td>XmlB
2bc0: 4c 4f 42 2d 49 53 4f 6d 65 74 61 64 61 74 61 20  LOB-ISOmetadata 
2bd0: 73 7a 3d 37 33 35 35 20 28 58 4d 4c 73 7a 3d 35  sz=7355 (XMLsz=5
2be0: 38 30 39 38 29 20 53 63 68 65 6d 61 56 61 6c 69  8098) SchemaVali
2bf0: 64 61 74 65 64 3c 2f 74 64 3e 0d 0a 3c 74 64 20  dated</td>..<td 
2c00: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 3c  align="right">1<
2c10: 2f 74 64 3e 3c 74 64 3e 68 74 74 70 3a 2f 2f 77  /td><td>http://w
2c20: 77 77 2e 69 73 6f 74 63 32 31 31 2e 6f 72 67 2f  ww.isotc211.org/
2c30: 32 30 30 35 2f 67 6d 64 2f 67 6d 64 2e 78 73 64  2005/gmd/gmd.xsd
2c40: 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61  </td></tr>..</ta
2c50: 62 6c 65 3e 3c 62 72 3e 0d 0a 54 68 65 20 3c 62  ble><br>..The <b
2c60: 3e 49 53 4f 5f 6d 65 74 61 64 61 74 61 3c 2f 62  >ISO_metadata</b
2c70: 3e 20 74 61 62 6c 65 20 69 73 20 73 75 70 70 6f  > table is suppo
2c80: 72 74 65 64 20 62 79 20 61 20 63 6f 72 72 65 73  rted by a corres
2c90: 70 6f 6e 64 69 6e 67 20 56 49 45 57 20 28 6e 6f  ponding VIEW (no
2ca0: 74 20 73 75 72 70 72 69 73 69 6e 67 6c 79 29 20  t surprisingly) 
2cb0: 6e 61 6d 65 64 20 3c 62 3e 49 53 4f 5f 6d 65 74  named <b>ISO_met
2cc0: 61 64 61 74 61 5f 76 69 65 77 3c 2f 62 3e 2e 3c  adata_view</b>.<
2cd0: 62 72 3e 0d 0a 3c 75 3e 50 6c 65 61 73 65 20 6e  br>..<u>Please n
2ce0: 6f 74 65 3c 2f 75 3e 3a 20 61 20 3c 75 3e 64 65  ote</u>: a <u>de
2cf0: 66 61 75 6c 74 20 72 6f 77 3c 2f 75 3e 20 69 64  fault row</u> id
2d00: 65 6e 74 69 66 69 65 64 20 62 79 20 3c 62 3e 69  entified by <b>i
2d10: 64 3d 30 3c 2f 62 3e 20 69 73 20 61 6c 77 61 79  d=0</b> is alway
2d20: 73 20 64 65 66 69 6e 65 64 20 69 6e 20 74 68 65  s defined in the
2d30: 20 3c 62 3e 49 53 4f 5f 6d 65 74 61 64 61 74 61   <b>ISO_metadata
2d40: 3c 2f 62 3e 20 74 61 62 6c 65 20 28 62 65 69 6e  </b> table (bein
2d50: 67 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20  g automatically 
2d60: 63 72 65 61 74 65 64 20 62 79 20 3c 62 3e 43 72  created by <b>Cr
2d70: 65 61 74 65 49 73 6f 4d 65 74 61 64 61 74 61 28  eateIsoMetadata(
2d80: 29 3c 2f 62 3e 29 3b 20 69 74 73 20 69 6e 74 65  )</b>); its inte
2d90: 6e 64 65 64 20 73 63 6f 70 65 20 69 73 20 74 68  nded scope is th
2da0: 65 20 6f 6e 65 20 74 6f 20 64 65 66 69 6e 65 20  e one to define 
2db0: 6b 69 6e 64 2d 6f 66 20 3c 75 3e 75 6e 69 76 65  kind-of <u>unive
2dc0: 72 73 61 6c 2d 70 6c 61 63 65 68 6f 6c 64 65 72  rsal-placeholder
2dd0: 3c 2f 75 3e 20 61 6c 6c 6f 77 69 6e 67 20 74 6f  </u> allowing to
2de0: 20 64 65 66 69 6e 65 20 3c 75 3e 75 6e 64 65 66   define <u>undef
2df0: 69 6e 65 64 2f 75 6e 6b 6e 6f 77 6e 3c 2f 75 3e  ined/unknown</u>
2e00: 20 6d 65 74 61 64 61 74 61 20 72 65 66 65 72 65   metadata refere
2e10: 6e 63 65 73 20 73 74 69 6c 6c 20 70 72 65 73 65  nces still prese
2e20: 72 76 69 6e 67 20 66 75 6c 6c 20 72 65 6c 61 74  rving full relat
2e30: 69 6f 6e 61 6c 20 69 6e 74 65 67 72 69 74 79 2e  ional integrity.
2e40: 3c 62 72 3e 3c 62 72 3e 0d 0a 49 66 20 79 6f 75  <br><br>..If you
2e50: 20 61 72 65 20 63 75 72 69 6f 75 73 20 65 6e 6f   are curious eno
2e60: 75 67 68 2c 20 79 6f 75 27 6c 6c 20 71 75 69 63  ugh, you'll quic
2e70: 6b 6c 79 20 64 69 73 63 6f 76 65 72 20 74 68 61  kly discover tha
2e80: 74 20 74 68 69 73 20 56 49 45 57 20 65 78 61 63  t this VIEW exac
2e90: 74 6c 79 20 63 6f 72 72 65 73 70 6f 6e 64 73 20  tly corresponds 
2ea0: 74 6f 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20  to the original 
2eb0: 74 61 62 6c 65 2c 20 61 6e 64 20 74 68 61 74 20  table, and that 
2ec0: 69 74 73 20 61 64 64 65 64 20 76 61 6c 75 65 73  its added values
2ed0: 20 69 73 20 69 6e 20 74 68 61 74 20 66 75 72 74   is in that furt
2ee0: 68 65 72 20 3c 62 3e 74 69 74 6c 65 3c 2f 62 3e  her <b>title</b>
2ef0: 2c 20 3c 62 3e 61 62 73 74 72 61 63 74 3c 2f 62  , <b>abstract</b
2f00: 3e 2c 20 3c 62 3e 67 65 6f 6d 65 74 72 79 28 2a  >, <b>geometry(*
2f10: 29 3c 2f 62 3e 2c 20 3c 62 3e 66 69 6c 65 49 64  )</b>, <b>fileId
2f20: 28 2a 29 3c 2f 62 3e 2c 20 3c 62 3e 70 61 72 65  (*)</b>, <b>pare
2f30: 6e 74 49 64 28 2a 29 3c 2f 62 3e 2c 20 3c 62 3e  ntId(*)</b>, <b>
2f40: 73 63 68 65 6d 61 5f 76 61 6c 69 64 61 74 65 64  schema_validated
2f50: 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 6d 65 74 61  </b> and <b>meta
2f60: 64 61 74 61 5f 73 63 68 65 6d 61 5f 75 72 69 3c  data_schema_uri<
2f70: 2f 62 3e 20 63 6f 6c 75 6d 6e 73 20 61 72 65 20  /b> columns are 
2f80: 6d 61 64 65 20 69 6d 6d 65 64 69 61 74 65 6c 79  made immediately
2f90: 20 61 76 61 69 6c 61 62 6c 65 2e 3c 62 72 3e 0d   available.<br>.
2fa0: 0a 3c 75 3e 28 2a 29 50 6c 65 61 73 65 20 6e 6f  .<u>(*)Please no
2fb0: 74 65 3c 2f 75 3e 3a 20 74 68 65 20 3c 62 3e 67  te</u>: the <b>g
2fc0: 65 6f 6d 65 74 72 79 3c 2f 62 3e 2c 20 3c 62 3e  eometry</b>, <b>
2fd0: 66 69 6c 65 49 64 3c 2f 62 3e 20 61 6e 64 20 3c  fileId</b> and <
2fe0: 62 3e 70 61 72 65 6e 74 49 64 3c 2f 62 3e 20 63  b>parentId</b> c
2ff0: 6f 6c 75 6d 6e 73 20 61 72 65 20 61 6c 77 61 79  olumns are alway
3000: 73 20 64 69 72 65 63 74 6c 79 20 65 78 70 6f 73  s directly expos
3010: 65 64 20 69 6e 20 74 68 65 20 62 61 73 65 20 74  ed in the base t
3020: 61 62 6c 65 3b 20 61 6c 6c 20 74 68 65 6d 20 61  able; all them a
3030: 72 65 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 73  re immediately s
3040: 65 74 20 62 79 20 61 70 70 72 6f 70 72 69 61 74  et by appropriat
3050: 65 20 3c 62 3e 54 72 69 67 67 65 72 73 3c 2f 62  e <b>Triggers</b
3060: 3e 2c 20 73 6f 20 74 6f 20 61 6c 77 61 79 73 20  >, so to always 
3070: 63 6f 72 72 65 73 70 6f 6e 64 20 74 6f 20 74 68  correspond to th
3080: 65 20 61 63 74 75 61 6c 20 74 61 67 2d 76 61 6c  e actual tag-val
3090: 75 65 73 20 69 6e 74 65 72 6e 61 6c 6c 79 20 64  ues internally d
30a0: 65 63 6c 61 72 65 64 20 62 79 20 74 68 65 20 58  eclared by the X
30b0: 4d 4c 20 64 6f 63 75 6d 65 6e 74 20 69 74 73 65  ML document itse
30c0: 6c 66 2e 3c 62 72 3e 0d 0a 54 68 65 20 66 6f 6c  lf.<br>..The fol
30d0: 6c 6f 77 69 6e 67 20 53 51 4c 20 66 75 6e 63 74  lowing SQL funct
30e0: 69 6f 6e 73 2c 20 6f 6e 63 65 20 69 6e 76 6f 6b  ions, once invok
30f0: 65 64 20 6f 6e 20 62 65 68 61 6c 66 20 6f 66 20  ed on behalf of 
3100: 74 68 65 20 58 6d 6c 42 4c 4f 42 20 70 61 79 6c  the XmlBLOB payl
3110: 6f 61 64 20 28 3c 62 3e 6d 65 74 61 64 61 74 61  oad (<b>metadata
3120: 3c 2f 62 3e 29 2c 20 77 69 6c 6c 20 69 6d 6d 65  </b>), will imme
3130: 64 69 61 74 65 6c 79 20 65 78 74 72 61 63 74 20  diately extract 
3140: 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e  the correspondin
3150: 67 20 76 61 6c 75 65 73 20 66 72 6f 6d 20 77 69  g values from wi
3160: 74 68 69 6e 20 74 68 65 20 58 4d 4c 20 64 6f 63  thin the XML doc
3170: 75 6d 65 6e 74 3a 20 3c 62 3e 58 42 5f 47 65 74  ument: <b>XB_Get
3180: 54 69 74 6c 65 28 29 3c 2f 62 3e 2c 20 3c 62 3e  Title()</b>, <b>
3190: 58 42 5f 47 65 74 41 62 73 74 72 61 63 74 28 29  XB_GetAbstract()
31a0: 3c 2f 62 3e 2c 20 3c 62 3e 58 42 5f 47 65 74 47  </b>, <b>XB_GetG
31b0: 65 6f 6d 65 74 72 79 28 29 3c 2f 62 3e 2c 20 3c  eometry()</b>, <
31c0: 62 3e 58 42 5f 47 65 74 46 69 6c 65 49 64 28 29  b>XB_GetFileId()
31d0: 3c 2f 62 3e 2c 20 3c 62 3e 58 42 5f 47 65 74 50  </b>, <b>XB_GetP
31e0: 61 72 65 6e 74 49 64 28 29 3c 2f 62 3e 2c 20 3c  arentId()</b>, <
31f0: 62 3e 58 42 5f 49 73 53 63 68 65 6d 61 56 61 6c  b>XB_IsSchemaVal
3200: 69 64 61 74 65 64 28 29 3c 2f 62 3e 20 61 6e 64  idated()</b> and
3210: 20 3c 62 3e 58 42 5f 47 65 74 53 63 68 65 6d 61   <b>XB_GetSchema
3220: 55 52 49 28 29 3c 2f 62 3e 2e 3c 62 72 3e 3c 62  URI()</b>.<br><b
3230: 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 33 3e 61 64  r>..<hr>..<h3>ad
3240: 76 61 6e 63 65 64 20 53 51 4c 20 66 75 6e 63 74  vanced SQL funct
3250: 69 6f 6e 73 20 73 75 70 70 6f 72 74 69 6e 67 20  ions supporting 
3260: 49 53 4f 20 4d 65 74 61 64 61 74 61 3c 2f 68 33  ISO Metadata</h3
3270: 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53  >..<verbatim>..S
3280: 45 4c 45 43 54 20 47 65 74 49 73 6f 4d 65 74 61  ELECT GetIsoMeta
3290: 64 61 74 61 49 64 28 20 27 63 64 37 36 63 39 61  dataId( 'cd76c9a
32a0: 32 2d 38 31 33 38 2d 34 65 37 65 2d 61 64 36 62  2-8138-4e7e-ad6b
32b0: 2d 32 65 31 30 35 63 33 37 65 36 35 63 27 20 29  -2e105c37e65c' )
32c0: 3b 0d 0a 2d 2d 2d 2d 2d 0d 0a 32 0d 0a 3c 2f 76  ;..-----..2..</v
32d0: 65 72 62 61 74 69 6d 3e 0d 0a 54 68 65 20 3c 62  erbatim>..The <b
32e0: 3e 47 65 74 49 73 6f 4d 65 74 61 64 61 74 61 49  >GetIsoMetadataI
32f0: 64 28 29 3c 2f 62 3e 20 53 51 4c 20 66 75 6e 63  d()</b> SQL func
3300: 74 69 6f 6e 20 77 69 6c 6c 20 72 65 74 75 72 6e  tion will return
3310: 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 3c 62   the internal <b
3320: 3e 69 64 3c 2f 62 3e 20 76 61 6c 75 65 20 63 6f  >id</b> value co
3330: 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 73  rresponding to s
3340: 6f 6d 65 20 3c 62 3e 66 69 6c 65 49 64 3c 2f 62  ome <b>fileId</b
3350: 3e 3b 20 69 66 20 6e 6f 20 63 6f 72 72 65 73 70  >; if no corresp
3360: 6f 6e 64 69 6e 67 20 4d 65 74 61 64 61 74 61 20  onding Metadata 
3370: 64 6f 63 75 6d 65 6e 74 20 65 78 69 73 74 73 2c  document exists,
3380: 20 74 68 65 6e 20 3c 62 3e 5a 45 52 4f 3c 2f 62   then <b>ZERO</b
3390: 3e 20 77 69 6c 6c 20 62 65 20 72 65 74 75 72 6e  > will be return
33a0: 65 64 2e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d  ed...<verbatim>.
33b0: 0a 55 50 44 41 54 45 20 49 53 4f 5f 6d 65 74 61  .UPDATE ISO_meta
33c0: 64 61 74 61 0d 0a 53 45 54 20 6d 65 74 61 64 61  data..SET metada
33d0: 74 61 20 3d 20 58 42 5f 53 65 74 50 61 72 65 6e  ta = XB_SetParen
33e0: 74 49 64 20 28 20 6d 65 74 61 64 61 74 61 20 2c  tId ( metadata ,
33f0: 20 27 6e 65 77 2d 70 61 72 65 6e 74 2d 69 64 27   'new-parent-id'
3400: 20 29 0d 0a 57 48 45 52 45 20 69 64 20 3d 20 32   )..WHERE id = 2
3410: 3b 0d 0a 2d 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 55  ;..-----..1....U
3420: 50 44 41 54 45 20 49 53 4f 5f 6d 65 74 61 64 61  PDATE ISO_metada
3430: 74 61 0d 0a 53 45 54 20 6d 65 74 61 64 61 74 61  ta..SET metadata
3440: 20 3d 20 58 42 5f 53 65 74 50 61 72 65 6e 74 49   = XB_SetParentI
3450: 64 20 28 20 6d 65 74 61 64 61 74 61 20 2c 20 27  d ( metadata , '
3460: 61 6e 6f 74 68 65 72 2d 70 61 72 65 6e 74 2d 69  another-parent-i
3470: 64 27 20 29 0d 0a 57 48 45 52 45 20 69 64 20 3d  d' )..WHERE id =
3480: 20 47 65 74 49 73 6f 4d 65 74 61 64 61 74 61 49   GetIsoMetadataI
3490: 64 28 20 27 63 64 37 36 63 39 61 32 2d 38 31 33  d( 'cd76c9a2-813
34a0: 38 2d 34 65 37 65 2d 61 64 36 62 2d 32 65 31 30  8-4e7e-ad6b-2e10
34b0: 35 63 33 37 65 36 35 63 27 20 29 3b 0d 0a 2d 2d  5c37e65c' );..--
34c0: 2d 2d 2d 0d 0a 31 0d 0a 3c 2f 76 65 72 62 61 74  ---..1..</verbat
34d0: 69 6d 3e 0d 0a 54 68 65 20 3c 62 3e 58 42 5f 53  im>..The <b>XB_S
34e0: 65 74 46 69 6c 65 49 64 28 29 3c 2f 62 3e 20 61  etFileId()</b> a
34f0: 6e 64 20 3c 62 3e 58 42 5f 53 65 74 50 61 72 65  nd <b>XB_SetPare
3500: 6e 74 49 64 28 29 3c 2f 62 3e 20 53 51 4c 20 66  ntId()</b> SQL f
3510: 75 6e 63 74 69 6f 6e 73 20 61 72 65 20 72 65 73  unctions are res
3520: 70 65 63 74 69 76 65 6c 79 20 69 6e 74 65 6e 64  pectively intend
3530: 65 64 20 74 6f 20 63 68 61 6e 67 65 20 74 68 65  ed to change the
3540: 20 3c 62 3e 26 6c 74 3b 66 69 6c 65 49 64 65 6e   <b>&lt;fileIden
3550: 74 69 66 69 65 72 26 67 74 3b 3c 2f 62 3e 20 6f  tifier&gt;</b> o
3560: 72 20 3c 62 3e 26 6c 74 3b 70 61 72 65 6e 74 49  r <b>&lt;parentI
3570: 64 65 6e 74 69 66 69 65 72 26 67 74 3b 3c 2f 62  dentifier&gt;</b
3580: 3e 20 74 61 67 20 76 61 6c 75 65 73 20 69 6e 74  > tag values int
3590: 65 72 6e 61 6c 6c 79 20 64 65 63 6c 61 72 65 64  ernally declared
35a0: 20 77 69 74 68 69 6e 20 74 68 65 20 58 4d 4c 20   within the XML 
35b0: 64 6f 63 75 6d 65 6e 74 20 69 74 73 65 6c 66 3b  document itself;
35c0: 20 74 68 65 20 73 75 70 70 6f 72 74 69 6e 67 20   the supporting 
35d0: 3c 62 3e 54 72 69 67 67 65 72 73 3c 2f 62 3e 20  <b>Triggers</b> 
35e0: 77 69 6c 6c 20 74 68 65 6e 20 74 61 6b 65 20 63  will then take c
35f0: 61 72 65 20 74 6f 20 69 6d 6d 65 64 69 61 74 65  are to immediate
3600: 6c 79 20 6d 61 6b 65 20 76 69 73 69 62 6c 65 20  ly make visible 
3610: 74 68 69 73 20 63 68 61 6e 67 65 20 69 6e 20 74  this change in t
3620: 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67  he corresponding
3630: 20 74 61 62 6c 65 2f 63 6f 6c 75 6d 6e 20 76 61   table/column va
3640: 6c 75 65 73 2e 3c 62 72 3e 0d 0a 3c 75 3e 50 6c  lues.<br>..<u>Pl
3650: 65 61 73 65 20 6e 6f 74 65 3c 2f 75 3e 3a 20 0d  ease note</u>: .
3660: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6e  .<ul>..<li>the n
3670: 65 77 20 58 6d 6c 42 4c 4f 42 20 6f 62 6a 65 63  ew XmlBLOB objec
3680: 74 20 28 74 68 65 20 6f 6e 65 20 63 6f 6e 74 61  t (the one conta
3690: 69 6e 69 6e 67 20 74 68 65 20 6d 6f 64 69 66 69  ining the modifi
36a0: 65 64 20 69 64 65 6e 74 69 66 69 65 72 29 20 72  ed identifier) r
36b0: 65 74 75 72 6e 65 64 20 62 79 20 74 68 65 73 65  eturned by these
36c0: 20 66 75 6e 63 74 69 6f 6e 73 20 77 69 6c 6c 20   functions will 
36d0: 73 75 70 70 6f 72 74 20 3c 62 3e 63 6f 6d 70 72  support <b>compr
36e0: 65 73 73 69 6f 6e 3c 2f 62 3e 20 61 6e 64 20 3c  ession</b> and <
36f0: 62 3e 73 63 68 65 6d 61 20 76 61 6c 69 64 61 74  b>schema validat
3700: 69 6f 6e 3c 2f 62 3e 20 65 78 61 63 74 6c 79 20  ion</b> exactly 
3710: 61 73 20 64 65 66 69 6e 65 64 20 62 79 20 74 68  as defined by th
3720: 65 20 69 6e 70 75 74 20 58 6d 6c 42 4c 4f 42 2e  e input XmlBLOB.
3730: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 73 65  </li>..<li>these
3740: 20 66 75 6e 63 74 69 6f 6e 73 20 73 69 6d 70 6c   functions simpl
3750: 79 20 61 6c 6c 6f 77 20 74 6f 20 3c 75 3e 63 68  y allow to <u>ch
3760: 61 6e 67 65 2f 6d 6f 64 69 66 79 3c 2f 75 3e 20  ange/modify</u> 
3770: 61 6e 20 61 6c 72 65 61 64 79 20 64 65 66 69 6e  an already defin
3780: 65 64 20 58 4d 4c 20 74 61 67 20 76 61 6c 75 65  ed XML tag value
3790: 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c  .</li>..</ul>..<
37a0: 76 65 72 62 61 74 69 6d 3e 0d 0a 55 50 44 41 54  verbatim>..UPDAT
37b0: 45 20 49 53 4f 5f 6d 65 74 61 64 61 74 61 0d 0a  E ISO_metadata..
37c0: 53 45 54 20 6d 65 74 61 64 61 74 61 20 3d 20 58  SET metadata = X
37d0: 42 5f 41 64 64 50 61 72 65 6e 74 49 64 20 28 20  B_AddParentId ( 
37e0: 6d 65 74 61 64 61 74 61 20 2c 20 43 72 65 61 74  metadata , Creat
37f0: 65 55 55 49 44 28 29 20 2c 20 0d 0a 20 20 20 20  eUUID() , ..    
3800: 27 67 6d 64 27 20 2c 20 27 68 74 74 70 3a 2f 2f  'gmd' , 'http://
3810: 77 77 77 2e 69 73 6f 74 63 32 31 31 2e 6f 72 67  www.isotc211.org
3820: 2f 32 30 30 35 2f 67 6d 64 27 20 2c 20 0d 0a 20  /2005/gmd' , .. 
3830: 20 20 20 27 67 63 6f 27 20 2c 20 27 68 74 74 70     'gco' , 'http
3840: 3a 2f 2f 77 77 77 2e 69 73 6f 74 63 32 31 31 2e  ://www.isotc211.
3850: 6f 72 67 2f 32 30 30 35 2f 67 63 6f 27 20 29 0d  org/2005/gco' ).
3860: 0a 57 48 45 52 45 20 69 64 20 3d 20 31 3b 0d 0a  .WHERE id = 1;..
3870: 2d 2d 2d 2d 2d 0d 0a 31 0d 0a 3c 2f 76 65 72 62  -----..1..</verb
3880: 61 74 69 6d 3e 0d 0a 54 68 65 20 3c 62 3e 58 42  atim>..The <b>XB
3890: 5f 41 64 64 46 69 6c 65 49 64 28 29 3c 2f 62 3e  _AddFileId()</b>
38a0: 20 61 6e 64 20 3c 62 3e 58 42 5f 41 64 64 50 61   and <b>XB_AddPa
38b0: 72 65 6e 74 49 64 28 29 3c 2f 62 3e 20 53 51 4c  rentId()</b> SQL
38c0: 20 66 75 6e 63 74 69 6f 6e 73 20 61 72 65 20 72   functions are r
38d0: 65 73 70 65 63 74 69 76 65 6c 79 20 69 6e 74 65  espectively inte
38e0: 6e 64 65 64 20 74 6f 20 69 6e 73 65 72 74 20 61  nded to insert a
38f0: 20 3c 62 3e 26 6c 74 3b 66 69 6c 65 49 64 65 6e   <b>&lt;fileIden
3900: 74 69 66 69 65 72 26 67 74 3b 3c 2f 62 3e 20 3c  tifier&gt;</b> <
3910: 62 3e 26 6c 74 3b 70 61 72 65 6e 74 49 64 65 6e  b>&lt;parentIden
3920: 74 69 66 69 65 72 26 67 74 3b 3c 2f 62 3e 20 74  tifier&gt;</b> t
3930: 61 67 20 76 61 6c 75 65 73 20 69 6e 74 65 72 6e  ag values intern
3940: 61 6c 6c 79 20 64 65 63 6c 61 72 65 64 20 77 69  ally declared wi
3950: 74 68 69 6e 20 74 68 65 20 58 4d 4c 20 64 6f 63  thin the XML doc
3960: 75 6d 65 6e 74 20 69 74 73 65 6c 66 3b 20 74 68  ument itself; th
3970: 65 20 73 75 70 70 6f 72 74 69 6e 67 20 3c 62 3e  e supporting <b>
3980: 54 72 69 67 67 65 72 73 3c 2f 62 3e 20 77 69 6c  Triggers</b> wil
3990: 6c 20 74 68 65 6e 20 74 61 6b 65 20 63 61 72 65  l then take care
39a0: 20 74 6f 20 69 6d 6d 65 64 69 61 74 65 6c 79 20   to immediately 
39b0: 6d 61 6b 65 20 76 69 73 69 62 6c 65 20 74 68 69  make visible thi
39c0: 73 20 63 68 61 6e 67 65 20 69 6e 20 74 68 65 20  s change in the 
39d0: 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 61  corresponding ta
39e0: 62 6c 65 2f 63 6f 6c 75 6d 6e 20 76 61 6c 75 65  ble/column value
39f0: 73 2e 3c 62 72 3e 0d 0a 3c 75 3e 50 6c 65 61 73  s.<br>..<u>Pleas
3a00: 65 20 6e 6f 74 65 3c 2f 75 3e 3a 20 0d 0a 3c 75  e note</u>: ..<u
3a10: 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6e 65 77 20  l>..<li>the new 
3a20: 58 6d 6c 42 4c 4f 42 20 6f 62 6a 65 63 74 20 28  XmlBLOB object (
3a30: 74 68 65 20 6f 6e 65 20 63 6f 6e 74 61 69 6e 69  the one containi
3a40: 6e 67 20 74 68 65 20 6d 6f 64 69 66 69 65 64 20  ng the modified 
3a50: 69 64 65 6e 74 69 66 69 65 72 29 20 72 65 74 75  identifier) retu
3a60: 72 6e 65 64 20 62 79 20 74 68 65 73 65 20 66 75  rned by these fu
3a70: 6e 63 74 69 6f 6e 73 20 77 69 6c 6c 20 73 75 70  nctions will sup
3a80: 70 6f 72 74 20 3c 62 3e 63 6f 6d 70 72 65 73 73  port <b>compress
3a90: 69 6f 6e 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 73  ion</b> and <b>s
3aa0: 63 68 65 6d 61 20 76 61 6c 69 64 61 74 69 6f 6e  chema validation
3ab0: 3c 2f 62 3e 20 65 78 61 63 74 6c 79 20 61 73 20  </b> exactly as 
3ac0: 64 65 66 69 6e 65 64 20 62 79 20 74 68 65 20 69  defined by the i
3ad0: 6e 70 75 74 20 58 6d 6c 42 4c 4f 42 2e 3c 2f 6c  nput XmlBLOB.</l
3ae0: 69 3e 0d 0a 3c 6c 69 3e 74 68 65 73 65 20 66 75  i>..<li>these fu
3af0: 6e 63 74 69 6f 6e 73 20 73 69 6d 70 6c 79 20 61  nctions simply a
3b00: 6c 6c 6f 77 20 74 6f 20 3c 75 3e 69 6e 73 65 72  llow to <u>inser
3b10: 74 3c 2f 75 3e 20 61 20 6e 65 77 20 28 6e 6f 74  t</u> a new (not
3b20: 20 61 6c 72 65 61 64 79 20 64 65 66 69 6e 65 64   already defined
3b30: 29 20 58 4d 4c 20 74 61 67 20 76 61 6c 75 65 2e  ) XML tag value.
3b40: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 73 20 79 6f  </li>..<li>as yo
3b50: 75 20 63 61 6e 20 65 61 73 69 6c 79 20 6e 6f 74  u can easily not
3b60: 69 63 65 2c 20 74 68 65 20 3c 62 3e 58 42 5f 41  ice, the <b>XB_A
3b70: 64 64 3f 3f 49 64 28 29 3c 2f 62 3e 20 66 75 6e  dd??Id()</b> fun
3b80: 63 74 69 6f 6e 73 20 72 65 71 75 69 72 65 20 6d  ctions require m
3b90: 6f 72 65 20 61 72 67 75 6d 65 6e 74 73 20 74 68  ore arguments th
3ba0: 61 6e 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e  an the correspon
3bb0: 64 69 6e 67 20 3c 62 3e 58 42 5f 53 65 74 3f 3f  ding <b>XB_Set??
3bc0: 49 64 28 29 3c 2f 62 3e 20 66 75 6e 63 74 69 6f  Id()</b> functio
3bd0: 6e 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74  ns:..<ul>..<li>t
3be0: 68 69 72 64 20 61 6e 64 20 66 6f 75 72 74 68 20  hird and fourth 
3bf0: 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20 65 78  arguments are ex
3c00: 70 65 63 74 65 64 20 74 6f 20 73 70 65 63 69 66  pected to specif
3c10: 79 20 74 68 65 20 3c 75 3e 6e 61 6d 65 73 70 61  y the <u>namespa
3c20: 63 65 3c 2f 75 3e 20 74 6f 20 62 65 20 61 64 6f  ce</u> to be ado
3c30: 70 74 65 64 20 66 6f 72 20 74 68 65 20 3c 62 3e  pted for the <b>
3c40: 26 6c 74 3b 66 69 6c 65 49 64 65 6e 74 69 66 69  &lt;fileIdentifi
3c50: 65 72 26 67 74 3b 3c 2f 62 3e 20 6f 72 20 3c 62  er&gt;</b> or <b
3c60: 3e 26 6c 74 3b 70 61 72 65 6e 74 49 64 65 6e 74  >&lt;parentIdent
3c70: 69 66 69 65 72 26 67 74 3b 3c 2f 62 3e 20 58 4d  ifier&gt;</b> XM
3c80: 4c 20 74 61 67 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c  L tags.</li>..<l
3c90: 69 3e 66 69 66 74 68 20 61 6e 64 20 73 69 78 74  i>fifth and sixt
3ca0: 68 20 61 72 67 75 6d 65 6e 74 73 20 70 6c 61 79  h arguments play
3cb0: 20 65 78 61 63 74 6c 79 20 74 68 65 20 73 61 6d   exactly the sam
3cc0: 65 20 69 64 65 6e 74 69 63 61 6c 20 72 6f 6c 65  e identical role
3cd0: 2c 20 74 68 69 73 20 74 69 6d 65 20 64 65 66 69  , this time defi
3ce0: 6e 69 6e 67 20 74 68 65 20 3c 75 3e 6e 61 6d 65  ning the <u>name
3cf0: 73 70 61 63 65 3c 2f 75 3e 20 74 6f 20 62 65 20  space</u> to be 
3d00: 61 64 6f 70 74 65 64 20 66 6f 72 20 74 68 65 20  adopted for the 
3d10: 3c 62 3e 26 6c 74 3b 43 68 61 72 61 63 74 65 72  <b>&lt;Character
3d20: 53 74 72 69 6e 67 26 67 74 3b 3c 2f 62 3e 20 58  String&gt;</b> X
3d30: 4d 4c 20 74 61 67 2e 3c 2f 6c 69 3e 0d 0a 3c 6c  ML tag.</li>..<l
3d40: 69 3e 61 6c 6c 20 74 68 65 73 65 20 61 72 67 75  i>all these argu
3d50: 6d 65 6e 74 73 20 63 6f 75 6c 64 20 62 65 20 73  ments could be s
3d60: 65 74 20 74 6f 20 3c 62 3e 4e 55 4c 4c 3c 2f 62  et to <b>NULL</b
3d70: 3e 20 77 68 65 6e 20 61 70 70 72 6f 70 72 69 61  > when appropria
3d80: 74 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c  te.</li>..</ul><
3d90: 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 75 3e  /li>..</ul>..<u>
3da0: 52 65 6d 65 6d 62 65 72 3c 2f 75 3e 3a 0d 0a 3c  Remember</u>:..<
3db0: 75 6c 3e 0d 0a 3c 6c 69 3e 61 6e 20 3c 75 3e 58  ul>..<li>an <u>X
3dc0: 4d 4c 20 6e 61 6d 65 73 70 61 63 65 3c 2f 75 3e  ML namespace</u>
3dd0: 20 69 73 20 61 6c 77 61 79 73 20 69 64 65 6e 74   is always ident
3de0: 69 66 69 65 64 20 62 79 20 61 6e 20 3c 75 3e 55  ified by an <u>U
3df0: 52 4c 3c 2f 75 3e 20 61 6e 64 20 6d 61 79 20 65  RL</u> and may e
3e00: 76 65 6e 74 75 61 6c 6c 79 20 62 65 20 61 73 73  ventually be ass
3e10: 6f 63 69 61 74 65 64 20 74 6f 20 61 20 3c 75 3e  ociated to a <u>
3e20: 70 72 65 66 69 78 3c 2f 75 3e 2e 3c 62 72 3e 0d  prefix</u>.<br>.
3e30: 0a 53 6f 2c 20 61 73 73 75 6d 69 6e 67 20 74 68  .So, assuming th
3e40: 61 74 20 61 20 3c 62 3e 67 63 6f 3c 2f 62 3e 20  at a <b>gco</b> 
3e50: 6e 61 6d 65 73 70 61 63 65 20 69 73 20 61 6c 72  namespace is alr
3e60: 65 61 64 79 20 64 65 66 69 6e 65 64 20 69 6e 20  eady defined in 
3e70: 74 68 65 20 74 61 72 67 65 74 20 58 4d 4c 20 64  the target XML d
3e80: 6f 63 75 6d 65 6e 74 20 28 2e 2e 2e 20 3c 62 3e  ocument (... <b>
3e90: 78 6d 6c 6e 73 3a 67 63 6f 3d 22 68 74 74 70 3a  xmlns:gco="http:
3ea0: 2f 2f 77 77 77 2e 69 73 6f 74 63 32 31 31 2e 6f  //www.isotc211.o
3eb0: 72 67 2f 32 30 30 35 2f 67 63 6f 22 3c 2f 62 3e  rg/2005/gco"</b>
3ec0: 20 2e 2e 2e 29 2c 20 79 6f 75 20 63 61 6e 20 73   ...), you can s
3ed0: 69 6d 70 6c 79 20 70 61 73 73 20 3c 62 3e 27 67  imply pass <b>'g
3ee0: 63 6f 27 2c 20 4e 55 4c 4c 3c 2f 62 3e 20 28 6f  co', NULL</b> (o
3ef0: 72 20 3c 62 3e 4e 55 4c 4c 2c 20 27 68 74 74 70  r <b>NULL, 'http
3f00: 3a 2f 2f 77 77 77 2e 69 73 6f 74 63 32 31 31 2e  ://www.isotc211.
3f10: 6f 72 67 2f 32 30 30 35 2f 67 63 6f 27 3c 2f 62  org/2005/gco'</b
3f20: 3e 29 20 61 73 20 74 68 65 20 66 69 66 74 68 20  >) as the fifth 
3f30: 61 6e 64 20 73 69 78 74 68 20 61 72 67 75 6d 65  and sixth argume
3f40: 6e 74 73 2c 20 61 6e 64 20 69 6e 20 62 6f 74 68  nts, and in both
3f50: 20 63 61 73 65 73 20 61 20 3c 62 3e 26 6c 74 3b   cases a <b>&lt;
3f60: 67 63 6f 3a 43 68 61 72 61 63 74 65 72 53 74 72  gco:CharacterStr
3f70: 69 6e 67 26 67 74 3b 3c 2f 62 3e 20 58 4d 4c 20  ing&gt;</b> XML 
3f80: 74 61 67 20 77 69 6c 6c 20 62 65 20 63 72 65 61  tag will be crea
3f90: 74 65 64 2c 20 62 65 63 61 75 73 65 20 79 6f 75  ted, because you
3fa0: 20 63 61 6e 20 72 65 66 65 72 65 6e 63 65 20 61   can reference a
3fb0: 6e 20 61 6c 72 65 61 64 79 20 64 65 66 69 6e 65  n already define
3fc0: 64 20 6e 61 6d 65 73 70 61 63 65 20 62 79 20 3c  d namespace by <
3fd0: 75 3e 70 72 65 66 69 78 3c 2f 75 3e 20 6f 72 20  u>prefix</u> or 
3fe0: 62 79 20 3c 75 3e 55 52 4c 3c 2f 75 3e 20 69 6e  by <u>URL</u> in
3ff0: 64 69 66 66 65 72 65 6e 74 6c 79 2e 3c 2f 6c 69  differently.</li
4000: 3e 0d 0a 3c 6c 69 3e 69 66 20 61 20 73 6f 20 63  >..<li>if a so c
4010: 61 6c 6c 65 64 20 3c 75 3e 64 65 66 61 75 6c 74  alled <u>default
4020: 20 6e 61 6d 65 73 70 61 63 65 3c 2f 75 3e 20 69   namespace</u> i
4030: 73 20 61 6c 72 65 61 64 79 20 64 65 66 69 6e 65  s already define
4040: 64 20 69 6e 20 74 68 65 20 74 61 72 67 65 74 20  d in the target 
4050: 58 4d 4c 20 64 6f 63 75 6d 65 6e 74 20 28 2e 2e  XML document (..
4060: 2e 20 3c 62 3e 78 6d 6c 6e 73 3d 22 68 74 74 70  . <b>xmlns="http
4070: 3a 2f 2f 77 77 77 2e 69 73 6f 74 63 32 31 31 2e  ://www.isotc211.
4080: 6f 72 67 2f 32 30 30 35 2f 67 6d 64 22 3c 2f 62  org/2005/gmd"</b
4090: 3e 20 2e 2e 2e 29 2c 20 79 6f 75 20 63 61 6e 20  > ...), you can 
40a0: 73 69 6d 70 6c 79 20 70 61 73 73 20 3c 62 3e 27  simply pass <b>'
40b0: 67 6d 64 27 2c 20 4e 55 4c 4c 3c 2f 62 3e 20 28  gmd', NULL</b> (
40c0: 6f 72 20 3c 62 3e 4e 55 4c 4c 2c 20 27 68 74 74  or <b>NULL, 'htt
40d0: 70 3a 2f 2f 77 77 77 2e 69 73 6f 74 63 32 31 31  p://www.isotc211
40e0: 2e 6f 72 67 2f 32 30 30 35 2f 67 6d 64 27 3c 2f  .org/2005/gmd'</
40f0: 62 3e 2c 20 6f 72 20 65 6c 73 65 20 3c 62 3e 4e  b>, or else <b>N
4100: 55 4c 4c 2c 20 4e 55 4c 4c 3c 2f 62 3e 29 20 61  ULL, NULL</b>) a
4110: 73 20 74 68 65 20 66 6f 75 72 74 68 20 61 6e 64  s the fourth and
4120: 20 66 69 66 74 68 20 61 72 67 75 6d 65 6e 74 73   fifth arguments
4130: 2c 20 61 6e 64 20 69 6e 20 61 6e 79 20 63 61 73  , and in any cas
4140: 65 20 61 20 3c 62 3e 26 6c 74 3b 66 69 6c 65 49  e a <b>&lt;fileI
4150: 64 65 6e 74 69 66 69 65 72 26 67 74 3b 3c 2f 62  dentifier&gt;</b
4160: 3e 20 58 4d 4c 20 74 61 67 20 28 6e 6f 20 70 72  > XML tag (no pr
4170: 65 66 69 78 29 20 77 69 6c 6c 20 62 65 20 63 72  efix) will be cr
4180: 65 61 74 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  eated.</li>..<li
4190: 3e 61 6e 79 77 61 79 3a 20 61 6c 77 61 79 73 20  >anyway: always 
41a0: 70 61 73 73 69 6e 67 20 61 20 66 75 6c 6c 20 71  passing a full q
41b0: 75 61 6c 69 66 69 65 64 20 6e 61 6d 65 73 70 61  ualified namespa
41c0: 63 65 20 28 65 78 70 6c 69 63 69 74 6c 79 20 73  ce (explicitly s
41d0: 70 65 63 69 66 79 69 6e 67 20 62 6f 74 68 20 3c  pecifying both <
41e0: 75 3e 70 72 65 66 69 78 3c 2f 75 3e 20 61 6e 64  u>prefix</u> and
41f0: 20 3c 75 3e 55 52 4c 3c 2f 75 3e 29 20 69 73 20   <u>URL</u>) is 
4200: 73 75 72 65 6c 79 20 62 65 74 74 65 72 20 61 6e  surely better an
4210: 64 20 61 76 6f 69 64 73 20 6d 61 6e 79 20 70 6f  d avoids many po
4220: 73 73 69 62 6c 65 20 70 69 74 66 61 6c 6c 73 3b  ssible pitfalls;
4230: 20 69 6e 20 74 68 69 73 20 63 61 73 65 20 61 6e   in this case an
4240: 20 61 70 70 72 6f 70 72 69 61 74 65 20 3c 62 3e   appropriate <b>
4250: 78 6d 6c 6e 73 3c 2f 62 3e 20 64 65 63 6c 61 72  xmlns</b> declar
4260: 61 74 69 6f 6e 20 77 69 6c 6c 20 62 65 20 61 75  ation will be au
4270: 74 6f 6d 61 74 69 63 61 6c 6c 79 20 69 6e 73 65  tomatically inse
4280: 72 74 65 64 20 69 6e 74 6f 20 74 68 65 20 58 4d  rted into the XM
4290: 4c 20 64 6f 63 75 6d 65 6e 74 2e 3c 2f 6c 69 3e  L document.</li>
42a0: 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 68 72  ..</ul><br>..<hr
42b0: 3e 0d 0a 3c 68 33 3e 4d 65 74 61 64 61 74 61 20  >..<h3>Metadata 
42c0: 72 65 66 65 72 65 6e 63 65 73 3c 2f 68 33 3e 0d  references</h3>.
42d0: 0a 41 20 76 65 72 79 20 63 6f 6d 6d 6f 6e 20 6d  .A very common m
42e0: 69 73 63 6f 6e 63 65 70 74 69 6f 6e 20 61 62 6f  isconception abo
42f0: 75 74 20 6d 65 74 61 64 61 74 61 20 69 73 20 74  ut metadata is t
4300: 68 65 20 6f 6e 65 20 62 61 73 65 64 20 6f 6e 20  he one based on 
4310: 74 68 69 73 20 66 61 6c 73 65 20 61 73 73 75 6d  this false assum
4320: 70 74 69 6f 6e 3a 20 3c 69 3e 3c 62 3e 31 20 6c  ption: <i><b>1 l
4330: 61 79 65 72 3c 2f 62 3e 3c 2f 69 3e 20 3d 20 3c  ayer</b></i> = <
4340: 69 3e 3c 62 3e 31 20 6d 65 74 61 64 61 74 61 20  i><b>1 metadata 
4350: 64 6f 63 75 6d 65 6e 74 3c 2f 62 3e 3c 2f 69 3e  document</b></i>
4360: 2e 3c 62 72 3e 0d 0a 52 65 61 6c 69 74 79 20 69  .<br>..Reality i
4370: 73 20 6d 75 63 68 20 6d 6f 72 65 20 63 6f 6d 70  s much more comp
4380: 6c 65 78 20 74 68 61 6e 20 74 68 69 73 2c 20 61  lex than this, a
4390: 6e 64 20 68 61 70 70 69 6c 79 20 65 6e 6f 75 67  nd happily enoug
43a0: 68 20 3c 75 3e 49 53 4f 20 31 39 31 31 35 3c 2f  h <u>ISO 19115</
43b0: 75 3e 20 64 65 66 69 6e 65 73 20 61 20 73 6f 70  u> defines a sop
43c0: 68 69 73 74 69 63 61 74 65 64 20 3c 75 3e 68 69  histicated <u>hi
43d0: 65 72 61 72 63 68 69 63 61 6c 20 6d 6f 64 65 6c  erarchical model
43e0: 3c 2f 75 3e 2c 20 62 61 73 65 64 20 6f 6e 20 3c  </u>, based on <
43f0: 62 3e 70 61 72 65 6e 74 2f 63 68 69 6c 64 3c 2f  b>parent/child</
4400: 62 3e 20 63 68 61 69 6e 73 20 6f 66 20 49 53 4f  b> chains of ISO
4410: 20 4d 65 74 61 64 61 74 61 20 64 6f 63 75 6d 65   Metadata docume
4420: 6e 74 73 2e 3c 62 72 3e 0d 0a 59 6f 75 20 63 61  nts.<br>..You ca
4430: 6e 20 6c 65 61 72 6e 20 6d 6f 72 65 20 61 62 6f  n learn more abo
4440: 75 74 20 61 6c 6c 20 74 68 69 73 20 62 79 20 72  ut all this by r
4450: 65 61 64 69 6e 67 20 74 68 65 20 61 70 70 72 6f  eading the appro
4460: 70 72 69 61 74 65 20 3c 61 20 68 72 65 66 3d 22  priate <a href="
4470: 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61  https://www.gaia
4480: 2d 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c  -gis.it/fossil/l
4490: 69 62 73 70 61 74 69 61 6c 69 74 65 2f 77 69 6b  ibspatialite/wik
44a0: 69 3f 6e 61 6d 65 3d 4d 65 74 61 64 61 74 61 2b  i?name=Metadata+
44b0: 72 65 66 65 72 65 6e 63 65 73 22 3e 57 69 6b 69  references">Wiki
44c0: 20 70 61 67 65 3c 2f 61 3e 3c 62 72 3e 3c 62 72   page</a><br><br
44d0: 3e 0d 0a 3c 68 72 3e 3c 62 72 3e 0d 0a 62 61 63  >..<hr><br>..bac
44e0: 6b 20 74 6f 20 58 6d 6c 42 6c 6f 62 20 3c 61 20  k to XmlBlob <a 
44f0: 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77 77  href="https://ww
4500: 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 66 6f  w.gaia-gis.it/fo
4510: 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 61 6c 69  ssil/libspatiali
4520: 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 58 6d 6c  te/wiki?name=Xml
4530: 42 6c 6f 62 2b 61 6e 64 2b 56 69 72 74 75 61 6c  Blob+and+Virtual
4540: 58 50 61 74 68 22 3e 6d 61 69 6e 20 70 61 67 65  XPath">main page
4550: 3c 2f 61 3e 0a 5a 20 31 34 65 65 30 31 30 36 63  </a>.Z 14ee0106c
4560: 62 64 37 37 35 32 34 34 36 32 66 32 61 38 33 62  bd77524462f2a83b
4570: 35 39 61 32 64 38 37 0a                          59a2d87.