![Page 1: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/1.jpg)
EWD 3トレーニング・コース #20
Global ストレージの JavaScript 用の抽
象化 (a) DocumentNode オブジェクトM/Gateway Developments Ltd.
Rob Tweed訳 : 日本ダイナシステム株式会社 嶋 芳成
![Page 2: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/2.jpg)
2
基本コンセプト
2016/9/11 EWD 3 トレーニング・コース #20
![Page 3: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/3.jpg)
グローバルを表現する階層図
2016/9/11 EWD 3 トレーニング・コース #20 3
myGlobal("a")=123myGlobal("b","c1")="foo"myGlobal("b","c2")="foo2"myGlobal("d","e1","f1")="bar1"myGlobal("d","e1","f2")="bar2"myGlobal("d","e2","f1")="bar1"myGlobal("d","e2","f2")="bar2"myGlobal("d","e2","f3")="bar3"
myGlobal"a" 123"b"
"c1" "foo"
"c2" "foo2"
"d"
"e1"
"e2"
"f1" "bar1"
"f2" "bar2""f1" "bar1"
"f2" "bar2"
"f3" "bar3"
![Page 4: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/4.jpg)
2016/9/11 EWD 3 トレーニング・コース #20 4
Global 節の木構造と JavaScript オブジェクトとの 1 対 1 の対応
myGlobal("a")=123myGlobal("b","c1")="foo"myGlobal("b","c2")="foo2"myGlobal("d","e1","f1")="bar1"myGlobal("d","e1","f2")="bar2"myGlobal("d","e2","f1")="bar1"myGlobal("d","e2","f2")="bar2"myGlobal("d","e2","f3")="bar3"
myGlobal = { a: 123, b: { c1: 'foo', c2: 'foo2' } d: { e1: { f1: 'bar1', f2: 'bar2' } e2: { f1: 'bar1', f2: 'bar2', f3: 'bar3' } }}
![Page 5: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/5.jpg)
2016/9/11 EWD 3 トレーニング・コース #20 5
Global 節と JavaScript オブジェクトとの 1 対1 の対応
myGlobal("a")=123myGlobal("b","c1")="foo"myGlobal("b","c2")="foo2"myGlobal("d","e1","f1")="bar1"myGlobal("d","e1","f2")="bar2"myGlobal("d","e2","f1")="bar1"myGlobal("d","e2","f2")="bar2"myGlobal("d","e2","f3")="bar3"
myGlobal = { a: 123, b: { c1: 'foo', c2: 'foo2' } d: { e1: { f1: 'bar1', f2: 'bar2' } e2: { f1: 'bar1', f2: 'bar2', f3: 'bar3' } }}
添え字 プロパティ
![Page 6: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/6.jpg)
6
• グローバル節
myGlobal("d","e2","f3")
• JavaScript オブジェクト
myGlobal.d.e2.f3
2016/9/11 EWD 3 トレーニング・コース #20
Global 節と JavaScript オブジェクトとの 1 対1 の対応
![Page 7: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/7.jpg)
7
• グローバル節
myGlobal("d","e2","f3")
• JavaScript オブジェクト
myGlobal.d.e2.f3
2016/9/11 EWD 3 トレーニング・コース #20
Global 節と JavaScript オブジェクトとの 1 対1 の対応
しかし ...
JavaScript オブジェクトはメモリー上にあり、グローバル節はディスク上にあり永続的です
![Page 8: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/8.jpg)
8
• グローバル節
myGlobal("d","e2","f3")
• JavaScript オブジェクト
myGlobal.d.e2.f3
2016/9/11 EWD 3 トレーニング・コース #20
Global 節と JavaScript オブジェクトとの 1 対1 の対応
グローバル節の抽象化を、永続的なJavaScript オブジェクトにすることができるでしょうか ?
![Page 9: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/9.jpg)
ewd-document-store• Global ストレージの JavaScript 用抽象化
https://github.com/robtweed/ewd-document-store
• 基本的な cache.node API の上に搭載されます
2016/9/11 EWD 3 トレーニング・コース #20 9
![Page 10: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/10.jpg)
ewd-document-store• Global ストレージの JavaScript 用抽象化
https://github.com/robtweed/ewd-document-store
• 基本的な cache.node API の上に搭載されます• ewd-xpress のワーカーの中に自動的に読み込まれま
す
2016/9/11 EWD 3 トレーニング・コース #20 10
![Page 11: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/11.jpg)
ewd-document-store• Global ストレージの JavaScript 用抽象化
https://github.com/robtweed/ewd-document-store
• 基本的な cache.node API の上に搭載されます• ewd-xpress のワーカーの中に自動的に読み込まれま
す• ewd-xpress 内では this.documentStore でアクセ
スできます
2016/9/11 EWD 3 トレーニング・コース #20 11
![Page 12: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/12.jpg)
ewd-document-store• Global ストレージの JavaScript 用抽象化
https://github.com/robtweed/ewd-document-store
• 基本的な cache.node API の上に搭載されます• ewd-xpress のワーカーの中に自動的に読み込まれま
す• ewd-xpress 内では this.documentStore でアクセ
スできます• テストとデバッグのために、それだけ ( スタンドアロ
ン ) でも利用可能です
2016/9/11 EWD 3 トレーニング・コース #20 12
![Page 13: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/13.jpg)
ewd-document-store• Global ストレージの JavaScript 用抽象化
• テストの枠組みの中で用いる• 次のサンプルを見てください
c:\ewd3\node_modules\ewd-qoper8-cahce\node_modules\ewd-document-store\lib\tests\CacheStandalone.js
2016/9/11 EWD 3 トレーニング・コース #20 13
![Page 14: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/14.jpg)
14
CacheStandalone.js を編集するvar DocumentStore = require('ewd-document-store');var interface = require('cache');var db = new interface.cache();console.log('db: ' * JSON.stringify(db));// 次のパラメータをあなたの Caché システムに合わせて変更してくださいvar ok = db.open({ path: '/opt/cache/mgr', username: '_SYSTEM', password: 'SYS', namespace: 'USER'});console.log('ok: ' + JSON.stringify(ok));var documentStore = new DocumentStore(db);console.log(db.version());var rob = new documentStore.DocumentNode('rob');
2016/9/11 EWD 3 トレーニング・コース #20
![Page 15: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/15.jpg)
15
CacheStandalone.js を編集するvar DocumentStore = require('ewd-qoper8-cache/node_modules/ewd-document-store');var interface = require('cache');var db = new interface.cache();console.log('db: ' * JSON.stringify(db));// 次のパラメータをあなたの Caché システムに合わせて変更してくださいvar ok = db.open({ path: 'c:\\InterSystems\\Cache2015-2\mgr', username: '_SYSTEM', password: 'SYS', namespace: 'USER'});console.log('ok: ' + JSON.stringify(ok));var documentStore = new DocumentStore(db);console.log(db.version());var rob = new documentStore.DocumentNode('rob');
2016/9/11 EWD 3 トレーニング・コース #20
![Page 16: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/16.jpg)
16
c:\ewd3\docStoreTest.js として保存var DocumentStore = require('ewd-qoper8-cache/node_modules/ewd-document-store');var interface = require('cache');var db = new interface.cache();console.log('db: ' * JSON.stringify(db));// 次のパラメータをあなたの Caché システムに合わせて変更してくださいvar ok = db.open({ path: 'c:\\InterSystems\\Cache2015-2\mgr', username: '_SYSTEM', password: 'SYS', namespace: 'USER'});console.log('ok: ' + JSON.stringify(ok));var documentStore = new DocumentStore(db);console.log(db.version());var rob = new documentStore.DocumentNode('rob');
2016/9/11 EWD 3 トレーニング・コース #20
![Page 17: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/17.jpg)
17
実行する
cd \ewd3node docStoreTest
2016/9/11 EWD 3 トレーニング・コース #20
![Page 18: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/18.jpg)
18
実行する
cd \ewd3node docStoreTest
• これで、 DocumentNode オブジェクトを用いた一連のサンプルを実行します• これを、あなたのテスト用の基本的な枠組み
として利用することができます
2016/9/11 EWD 3 トレーニング・コース #20
![Page 19: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/19.jpg)
19
あなたのテストの枠組みに合わせてくださいvar DocumentStore = require('ewd-qoper8-cache/node_modules/ewd-document-store');var interface = require('cache');var db = new interface.cache();
var ok = db.open({ path: 'c:\\InterSystems\\Cache2015-2\mgr', username: '_SYSTEM', password: 'SYS', namespace: 'USER'});
var documentStore = new DocumentStore(db);
// ここ先をすべて削除して置き換えてください// documentStore を用いると、あなたのデータベースへの抽象化されたインターフェースが利用できます
// これを用いて、この後のサンプルを試してください// this.documentStore を、 documentStrore に置き換えるだけです
2016/9/11 EWD 3 トレーニング・コース #20
![Page 20: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/20.jpg)
20
DocumentNode オブジェクト
2016/9/11 EWD 3 トレーニング・コース #20
![Page 21: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/21.jpg)
21
DocumentNode オブジェクトvar dnode = new documentStore.DocumentNode(name, subscripts);
スタンドアロンのテストの枠組みを用いるとき
2016/9/11 EWD 3 トレーニング・コース #20
![Page 22: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/22.jpg)
22
DocumentNode オブジェクトvar dnode = new this.documentStore.DocumentNode(name, subscripts);
ewd-xpres を用いるとき
2016/9/11 EWD 3 トレーニング・コース #20
![Page 23: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/23.jpg)
23
DocumentNode オブジェクトvar dnode = new this.documentStore.DocumentNode(name, subscripts);
document store の階層構造の中の1つの節 ( ノード ) を表します
この時点では、それが物理的に存在するかどうかは分かりません
すなわち、これは節 ( ノード ) を生成しません
2016/9/11 EWD 3 トレーニング・コース #20
![Page 24: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/24.jpg)
24
DocumentNode オブジェクトvar dnode = new this.documentStore.DocumentNode(name, subscripts);
document store の階層構造の中の1つの節 ( ノード ) を表します
この時点では、それが物理的に存在するかどうかは分かりません
すなわち、これは節 ( ノード ) を生成しません
その節を表すオブジェクトのインスタンスと、その節を操作しアクセスするための、それに付随する一群のメソッドとプロパティを生成します
2016/9/11 EWD 3 トレーニング・コース #20
![Page 25: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/25.jpg)
25
DocumentNode オブジェクトvar dnode = new this.documentStore.DocumentNode('myDoc', ['d','e2']);
これは、 mydoc("d","e2") を表します
2016/9/11 EWD 3 トレーニング・コース #20
![Page 26: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/26.jpg)
26
DocumentNode オブジェクトvar dnode = new this.documentStore.DocumentNode('myDoc', ['d','e2']);
これは、 mydoc("d","e2") を表します
生成 : dnode.value = 'foo2';
2016/9/11 EWD 3 トレーニング・コース #20
![Page 27: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/27.jpg)
27
DocumentNode オブジェクトvar dnode = new this.documentStore.DocumentNode('myDoc', ['d','e2']);
これは、 mydoc("d","e2") を表します
生成 : dnode.value = 'foo2'; 取得 : var x = dnode.value;
2016/9/11 EWD 3 トレーニング・コース #20
![Page 28: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/28.jpg)
28
DocumentNode オブジェクトvar dnode = new this.documentStore.DocumentNode('myDoc', ['d','e2']);
これは、 mydoc("d","e2") を表します
生成 : dnode.value = 'foo2'; 取得 : var x = dnode.value;
value は読み書きできるプロパティです
2016/9/11 EWD 3 トレーニング・コース #20
![Page 29: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/29.jpg)
29
DocumentNode オブジェクトvar dnode = new this.documentStore.DocumentNode('myDoc', ['d','e2']);
これは、 mydoc("d","e2") を表します
生成 : dnode.value = 'foo2'; 取得 : var x = dnode.value; 削除 : dnode.delete();
2016/9/11 EWD 3 トレーニング・コース #20
![Page 30: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/30.jpg)
30
DocumentNode オブジェクトvar dnode = new this.documentStore.DocumentNode('myDoc', ['d','e2']);
これは、 mydoc("d","e2") を表します
生成 : dnode.value = 'foo2'; 取得 : var x = dnode.value; 削除 : dnode.delete();
注意 : delete は、操作中の Global ストレージの木構造の中の、この節の下に付いている DocumentNode もすべて一緒に削除します
2016/9/11 EWD 3 トレーニング・コース #20
![Page 31: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/31.jpg)
31
DocumentNode オブジェクトvar dnode = new this.documentStore.DocumentNode('myDoc', ['d','e2']);
これは、 mydoc("d","e2") を表します
生成 : dnode.value = 'foo2'; 取得 : var x = dnode.value; 削除 : dnode.delete(); 存在 ? var exists = dnode.exists; // true|
false
2016/9/11 EWD 3 トレーニング・コース #20
![Page 32: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/32.jpg)
32
Global 節と JavaScript オブジェクトmyDoc("a")=123myDoc("b","c1")="foo"myDoc("b","c2")="foo2"myDoc("d","e1","f1")="bar1"myDoc("d","e1","f2")="bar2"myDoc("d","e2","f1")="bar1"myDoc("d","e2","f2")="bar2"myDoc("d","e2","f3")="bar3"
var dnode = new this.documentStore.DocumentNode('myDoc', ['d']);
2016/9/11 EWD 3 トレーニング・コース #20
![Page 33: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/33.jpg)
33
Global 節と JavaScript オブジェクトmyDoc("a")=123myDoc("b","c1")="foo"myDoc("b","c2")="foo2"myDoc("d","e1","f1")="bar1"myDoc("d","e1","f2")="bar2"myDoc("d","e2","f1")="bar1"myDoc("d","e2","f2")="bar2"myDoc("d","e2","f3")="bar3"
var dnode = new this.documentStore.DocumentNode('myDoc', ['d']);
dnode.hasChildren // true
dnode.hasValue // false
dnode.exists // true
2016/9/11 EWD 3 トレーニング・コース #20
![Page 34: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/34.jpg)
34
Global 節と JavaScript オブジェクトmyDoc("a")=123myDoc("b","c1")="foo"myDoc("b","c2")="foo2"myDoc("d","e1","f1")="bar1"myDoc("d","e1","f2")="bar2"myDoc("d","e2","f1")="bar1"myDoc("d","e2","f2")="bar2"myDoc("d","e2","f3")="bar3"
var dnode = new this.documentStore.DocumentNode('myDoc', ['d', 'e2']);
dnode.hasChildren // true
dnode.hasValue // false
dnode.exists // true
2016/9/11 EWD 3 トレーニング・コース #20
![Page 35: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/35.jpg)
35
Global 節と JavaScript オブジェクトmyDoc("a")=123myDoc("b","c1")="foo"myDoc("b","c2")="foo2"myDoc("d","e1","f1")="bar1"myDoc("d","e1","f2")="bar2"myDoc("d","e2","f1")="bar1"myDoc("d","e2","f2")="bar2"myDoc("d","e2","f3")="bar3"
var dnode = new this.documentStore.DocumentNode('myDoc', ['d', 'e2', 'f3']);
dnode.hasChildren // false
dnode.hasValue // true
dnode.exists // true
2016/9/11 EWD 3 トレーニング・コース #20
![Page 36: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/36.jpg)
36
Global 節と JavaScript オブジェクトmyDoc("a")=123myDoc("b","c1")="foo"myDoc("b","c2")="foo2"myDoc("d","e1","f1")="bar1"myDoc("d","e1","f2")="bar2"myDoc("d","e2","f1")="bar1"myDoc("d","e2","f2")="bar2"myDoc("d","e2","f3")="bar3"
var dnode = new this.documentStore.DocumentNode('myDoc', ['d', 'e2', 'f4']);
dnode.hasChildren // false
dnode.hasValue // false
dnode.exists // false
その節が物理的に存在しなくても、それに対応する DocumentNode オブジェクトは定義可能です
2016/9/11 EWD 3 トレーニング・コース #20
![Page 37: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/37.jpg)
37
Global 節と JavaScript オブジェクトmyDoc("a")=123myDoc("b","c1")="foo"myDoc("b","c2")="foo2"myDoc("d","e1","f1")="bar1"myDoc("d","e1","f2")="bar2"myDoc("d","e2","f1")="bar1"myDoc("d","e2","f2")="bar2"myDoc("d","e2","f3")="bar3"
var dnode = new this.documentStore.DocumentNode('myDoc', ['d', 'e2', 'f3']);
dnode.name // f3 節の名前 === グローバルの最後の添字 です
dnode.parent // myDoc("d","e2")
これは DocumentNode オブジェクトを返します
2016/9/11 EWD 3 トレーニング・コース #20
![Page 38: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/38.jpg)
38
Global 節と JavaScript オブジェクトmyDoc("a")=123myDoc("b","c1")="foo"myDoc("b","c2")="foo2"myDoc("d","e1","f1")="bar1"myDoc("d","e1","f2")="bar2"myDoc("d","e2","f1")="bar1"myDoc("d","e2","f2")="bar2"myDoc("d","e2","f3")="bar3"
var dnode = new this.documentStore.DocumentNode('myDoc', ['d', 'e2']);
dnode.firstChild // myDoc("d","e2","f1")
dnode.lastChild // myDoc("d","e2","f3")
dnode.previousSibling // myDoc("d","e1")
dnode.nextSibling // undefined
2016/9/11 EWD 3 トレーニング・コース #20
DocumentNodeオブジェクト
![Page 39: EWD 3トレーニングコース#20 GlobalストレージのJavaScript用抽象化-(a)DocumentNodeオブジェクト](https://reader030.vdocuments.pub/reader030/viewer/2022021502/589d1b4a1a28ab61128b66f5/html5/thumbnails/39.jpg)
39
DocumentNode オブジェクト
• これについては、このコースのこれ以降のパートでさらに説明します
• さらに詳細については、以下を参照してください
http://gradvs1.mgateway.com/download/ewd-document-store.pdf
2016/9/11 EWD 3 トレーニング・コース #20