source: fmts/trunk/kids/FILEMAN_TRIPLE_STORE_1T12.KID@ 1613

Last change on this file since 1613 was 1539, checked in by Sam Habiel, 12 years ago

Proper KIDS build + Routines

File size: 131.5 KB
Line 
1KIDS Distribution saved on Sep 26, 2012@11:18:36
2Fileman Triple Store
3**KIDS**:FILEMAN TRIPLE STORE 1.0^
4
5**INSTALL NAME**
6FILEMAN TRIPLE STORE 1.0
7"BLD",8490,0)
8FILEMAN TRIPLE STORE 1.0^FILEMAN TRIPLE STORE^0^3120926^y
9"BLD",8490,1,0)
10^^1^1^3120926^
11"BLD",8490,1,1,0)
12Version 1.0
13"BLD",8490,4,0)
14^9.64PA^172.201^2
15"BLD",8490,4,172.101,0)
16172.101
17"BLD",8490,4,172.101,222)
18y^y^f^^^^n
19"BLD",8490,4,172.201,0)
20172.201
21"BLD",8490,4,172.201,222)
22y^y^f^^^^n
23"BLD",8490,4,"B",172.101,172.101)
24
25"BLD",8490,4,"B",172.201,172.201)
26
27"BLD",8490,6.3)
2811
29"BLD",8490,"ABPKG")
30n
31"BLD",8490,"KRN",0)
32^9.67PA^779.2^20
33"BLD",8490,"KRN",.4,0)
34.4
35"BLD",8490,"KRN",.4,"NM",0)
36^9.68A^1^1
37"BLD",8490,"KRN",.4,"NM",1,0)
38C0X PRINT GRAPH FILE #172.101^172.101^0
39"BLD",8490,"KRN",.4,"NM","B","C0X PRINT GRAPH FILE #172.101",1)
40
41"BLD",8490,"KRN",.401,0)
42.401
43"BLD",8490,"KRN",.402,0)
44.402
45"BLD",8490,"KRN",.403,0)
46.403
47"BLD",8490,"KRN",.5,0)
48.5
49"BLD",8490,"KRN",.84,0)
50.84
51"BLD",8490,"KRN",3.6,0)
523.6
53"BLD",8490,"KRN",3.8,0)
543.8
55"BLD",8490,"KRN",9.2,0)
569.2
57"BLD",8490,"KRN",9.8,0)
589.8
59"BLD",8490,"KRN",9.8,"NM",0)
60^9.68A^8^8
61"BLD",8490,"KRN",9.8,"NM",1,0)
62C0XMAIN^^0^B115393527
63"BLD",8490,"KRN",9.8,"NM",2,0)
64C0XF2N^^0^B367797666
65"BLD",8490,"KRN",9.8,"NM",3,0)
66C0XTEST^^0^B14490662
67"BLD",8490,"KRN",9.8,"NM",4,0)
68C0XINIT^^0^B21176787
69"BLD",8490,"KRN",9.8,"NM",5,0)
70C0XUTIL^^0^B11676522
71"BLD",8490,"KRN",9.8,"NM",6,0)
72C0XTKSB^^0^B17753558
73"BLD",8490,"KRN",9.8,"NM",7,0)
74C0XRDF^^0^B9306574
75"BLD",8490,"KRN",9.8,"NM",8,0)
76C0XGET1^^0^B237497267
77"BLD",8490,"KRN",9.8,"NM","B","C0XF2N",2)
78
79"BLD",8490,"KRN",9.8,"NM","B","C0XGET1",8)
80
81"BLD",8490,"KRN",9.8,"NM","B","C0XINIT",4)
82
83"BLD",8490,"KRN",9.8,"NM","B","C0XMAIN",1)
84
85"BLD",8490,"KRN",9.8,"NM","B","C0XRDF",7)
86
87"BLD",8490,"KRN",9.8,"NM","B","C0XTEST",3)
88
89"BLD",8490,"KRN",9.8,"NM","B","C0XTKSB",6)
90
91"BLD",8490,"KRN",9.8,"NM","B","C0XUTIL",5)
92
93"BLD",8490,"KRN",19,0)
9419
95"BLD",8490,"KRN",19.1,0)
9619.1
97"BLD",8490,"KRN",101,0)
98101
99"BLD",8490,"KRN",409.61,0)
100409.61
101"BLD",8490,"KRN",771,0)
102771
103"BLD",8490,"KRN",779.2,0)
104779.2
105"BLD",8490,"KRN",870,0)
106870
107"BLD",8490,"KRN",8989.51,0)
1088989.51
109"BLD",8490,"KRN",8989.52,0)
1108989.52
111"BLD",8490,"KRN",8994,0)
1128994
113"BLD",8490,"KRN","B",.4,.4)
114
115"BLD",8490,"KRN","B",.401,.401)
116
117"BLD",8490,"KRN","B",.402,.402)
118
119"BLD",8490,"KRN","B",.403,.403)
120
121"BLD",8490,"KRN","B",.5,.5)
122
123"BLD",8490,"KRN","B",.84,.84)
124
125"BLD",8490,"KRN","B",3.6,3.6)
126
127"BLD",8490,"KRN","B",3.8,3.8)
128
129"BLD",8490,"KRN","B",9.2,9.2)
130
131"BLD",8490,"KRN","B",9.8,9.8)
132
133"BLD",8490,"KRN","B",19,19)
134
135"BLD",8490,"KRN","B",19.1,19.1)
136
137"BLD",8490,"KRN","B",101,101)
138
139"BLD",8490,"KRN","B",409.61,409.61)
140
141"BLD",8490,"KRN","B",771,771)
142
143"BLD",8490,"KRN","B",779.2,779.2)
144
145"BLD",8490,"KRN","B",870,870)
146
147"BLD",8490,"KRN","B",8989.51,8989.51)
148
149"BLD",8490,"KRN","B",8989.52,8989.52)
150
151"BLD",8490,"KRN","B",8994,8994)
152
153"BLD",8490,"QUES",0)
154^9.62^^
155"BLD",8490,"REQB",0)
156^9.611^^
157"FIA",172.101)
158C0X TRIPLE
159"FIA",172.101,0)
160^C0X(101,
161"FIA",172.101,0,0)
162172.101I
163"FIA",172.101,0,1)
164y^y^f^^^^n
165"FIA",172.101,0,10)
166
167"FIA",172.101,0,11)
168
169"FIA",172.101,0,"RLRO")
170
171"FIA",172.101,0,"VR")
1721.0^FILEMAN TRIPLE STORE
173"FIA",172.101,172.101)
1740
175"FIA",172.101,172.1011)
1760
177"FIA",172.201)
178C0X STRING
179"FIA",172.201,0)
180^C0X(201,
181"FIA",172.201,0,0)
182172.201
183"FIA",172.201,0,1)
184y^y^f^^^^n
185"FIA",172.201,0,10)
186
187"FIA",172.201,0,11)
188
189"FIA",172.201,0,"RLRO")
190
191"FIA",172.201,0,"VR")
1921.0^FILEMAN TRIPLE STORE
193"FIA",172.201,172.201)
1940
195"FIA",172.201,172.2011)
1960
197"IX",172.101,172.101,"G",0)
198172.101^G^REGULAR INDEX OF THE GRAPH FIELD^R^^F^IR^I^172.101^^^^^LS
199"IX",172.101,172.101,"G",1)
200S ^C0X(101,"G",X,DA)=""
201"IX",172.101,172.101,"G",2)
202K ^C0X(101,"G",X,DA)
203"IX",172.101,172.101,"G",2.5)
204K ^C0X(101,"G")
205"IX",172.101,172.101,"G",11.1,0)
206^.114IA^1^1
207"IX",172.101,172.101,"G",11.1,1,0)
2081^F^172.101^.02^^1^F
209"IX",172.101,172.101,"G",11.1,1,3)
210
211"IX",172.101,172.101,"GOPS",0)
212172.101^GOPS^GRAPH ONLY OBJECT PREDICATE SUBJECT^R^^R^IR^I^172.101^^^^^LS
213"IX",172.101,172.101,"GOPS",1)
214S ^C0X(101,"GOPS",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)=""
215"IX",172.101,172.101,"GOPS",2)
216K ^C0X(101,"GOPS",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)
217"IX",172.101,172.101,"GOPS",2.5)
218K ^C0X(101,"GOPS")
219"IX",172.101,172.101,"GOPS",11.1,0)
220^.114IA^4^4
221"IX",172.101,172.101,"GOPS",11.1,1,0)
2221^F^172.101^.02^240^1^F
223"IX",172.101,172.101,"GOPS",11.1,1,3)
224
225"IX",172.101,172.101,"GOPS",11.1,2,0)
2262^F^172.101^.05^240^2^F
227"IX",172.101,172.101,"GOPS",11.1,2,3)
228
229"IX",172.101,172.101,"GOPS",11.1,3,0)
2303^F^172.101^.04^240^3^F
231"IX",172.101,172.101,"GOPS",11.1,3,3)
232
233"IX",172.101,172.101,"GOPS",11.1,4,0)
2344^F^172.101^.03^240^4^F
235"IX",172.101,172.101,"GOPS",11.1,4,3)
236
237"IX",172.101,172.101,"GOSP",0)
238172.101^GOSP^GRAPH ONLY OBJECT SUBJECT PREDICATE^R^^R^IR^I^172.101^^^^^LS
239"IX",172.101,172.101,"GOSP",1)
240S ^C0X(101,"GOSP",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)=""
241"IX",172.101,172.101,"GOSP",2)
242K ^C0X(101,"GOSP",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)
243"IX",172.101,172.101,"GOSP",2.5)
244K ^C0X(101,"GOSP")
245"IX",172.101,172.101,"GOSP",11.1,0)
246^.114IA^4^4
247"IX",172.101,172.101,"GOSP",11.1,1,0)
2481^F^172.101^.02^240^1^F
249"IX",172.101,172.101,"GOSP",11.1,1,3)
250
251"IX",172.101,172.101,"GOSP",11.1,2,0)
2522^F^172.101^.05^240^2^F
253"IX",172.101,172.101,"GOSP",11.1,2,3)
254
255"IX",172.101,172.101,"GOSP",11.1,3,0)
2563^F^172.101^.03^240^3^F
257"IX",172.101,172.101,"GOSP",11.1,3,3)
258
259"IX",172.101,172.101,"GOSP",11.1,4,0)
2604^F^172.101^.04^240^4^F
261"IX",172.101,172.101,"GOSP",11.1,4,3)
262
263"IX",172.101,172.101,"GPSO",0)
264172.101^GPSO^GRAPH ONLY PREDICATE SUBJECT OBJECT^R^^R^IR^I^172.101^^^^^LS
265"IX",172.101,172.101,"GPSO",1)
266S ^C0X(101,"GPSO",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)=""
267"IX",172.101,172.101,"GPSO",2)
268K ^C0X(101,"GPSO",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)
269"IX",172.101,172.101,"GPSO",2.5)
270K ^C0X(101,"GPSO")
271"IX",172.101,172.101,"GPSO",11.1,0)
272^.114IA^4^4
273"IX",172.101,172.101,"GPSO",11.1,1,0)
2741^F^172.101^.02^240^1^F
275"IX",172.101,172.101,"GPSO",11.1,1,3)
276
277"IX",172.101,172.101,"GPSO",11.1,2,0)
2782^F^172.101^.04^240^2^F
279"IX",172.101,172.101,"GPSO",11.1,2,3)
280
281"IX",172.101,172.101,"GPSO",11.1,3,0)
2823^F^172.101^.03^240^3^F
283"IX",172.101,172.101,"GPSO",11.1,3,3)
284
285"IX",172.101,172.101,"GPSO",11.1,4,0)
2864^F^172.101^.05^240^4^F
287"IX",172.101,172.101,"GPSO",11.1,4,3)
288
289"IX",172.101,172.101,"GSPO",0)
290172.101^GSPO^GROUP ONLY SUBJECT PREDICATE OBJECT^R^^R^IR^I^172.101^^^^^LS
291"IX",172.101,172.101,"GSPO",1)
292S ^C0X(101,"GSPO",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)=""
293"IX",172.101,172.101,"GSPO",2)
294K ^C0X(101,"GSPO",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)
295"IX",172.101,172.101,"GSPO",2.5)
296K ^C0X(101,"GSPO")
297"IX",172.101,172.101,"GSPO",11.1,0)
298^.114IA^4^4
299"IX",172.101,172.101,"GSPO",11.1,1,0)
3001^F^172.101^.02^240^1^F
301"IX",172.101,172.101,"GSPO",11.1,1,3)
302
303"IX",172.101,172.101,"GSPO",11.1,2,0)
3042^F^172.101^.03^240^2^F
305"IX",172.101,172.101,"GSPO",11.1,2,3)
306
307"IX",172.101,172.101,"GSPO",11.1,3,0)
3083^F^172.101^.04^240^3^F
309"IX",172.101,172.101,"GSPO",11.1,3,3)
310
311"IX",172.101,172.101,"GSPO",11.1,4,0)
3124^F^172.101^.05^240^4^F
313"IX",172.101,172.101,"GSPO",11.1,4,3)
314
315"IX",172.101,172.101,"OPS",0)
316172.101^OPS^REGULAR INDEX OF OBJECT PREDICATE SUBJECT^R^^R^IR^I^172.101^^^^^LS
317"IX",172.101,172.101,"OPS",1)
318S ^C0X(101,"OPS",X(1),X(2),X(3),DA)=""
319"IX",172.101,172.101,"OPS",2)
320K ^C0X(101,"OPS",X(1),X(2),X(3),DA)
321"IX",172.101,172.101,"OPS",2.5)
322K ^C0X(101,"OPS")
323"IX",172.101,172.101,"OPS",11.1,0)
324^.114IA^3^3
325"IX",172.101,172.101,"OPS",11.1,1,0)
3261^F^172.101^.05^^1^F
327"IX",172.101,172.101,"OPS",11.1,1,3)
328
329"IX",172.101,172.101,"OPS",11.1,2,0)
3302^F^172.101^.04^^2^F
331"IX",172.101,172.101,"OPS",11.1,2,3)
332
333"IX",172.101,172.101,"OPS",11.1,3,0)
3343^F^172.101^.03^^3^F
335"IX",172.101,172.101,"OPS",11.1,3,3)
336
337"IX",172.101,172.101,"OSP",0)
338172.101^OSP^REGULAR INDEX OF OBJECT SUBJECT PREDICATE^R^^R^IR^I^172.101^^^^^LS
339"IX",172.101,172.101,"OSP",1)
340S ^C0X(101,"OSP",X(1),X(2),X(3),DA)=""
341"IX",172.101,172.101,"OSP",2)
342K ^C0X(101,"OSP",X(1),X(2),X(3),DA)
343"IX",172.101,172.101,"OSP",2.5)
344K ^C0X(101,"OSP")
345"IX",172.101,172.101,"OSP",11.1,0)
346^.114IA^3^3
347"IX",172.101,172.101,"OSP",11.1,1,0)
3481^F^172.101^.05^^1^F
349"IX",172.101,172.101,"OSP",11.1,1,3)
350
351"IX",172.101,172.101,"OSP",11.1,2,0)
3522^F^172.101^.03^^2^F
353"IX",172.101,172.101,"OSP",11.1,2,3)
354
355"IX",172.101,172.101,"OSP",11.1,3,0)
3563^F^172.101^.04^^3^F
357"IX",172.101,172.101,"OSP",11.1,3,3)
358
359"IX",172.101,172.101,"PSO",0)
360172.101^PSO^REGULAR INDEX OF PREDICATE SUBJECT OBJECT^R^^R^IR^I^172.101^^^^^LS
361"IX",172.101,172.101,"PSO",1)
362S ^C0X(101,"PSO",X(1),X(2),X(3),DA)=""
363"IX",172.101,172.101,"PSO",2)
364K ^C0X(101,"PSO",X(1),X(2),X(3),DA)
365"IX",172.101,172.101,"PSO",2.5)
366K ^C0X(101,"PSO")
367"IX",172.101,172.101,"PSO",11.1,0)
368^.114IA^3^3
369"IX",172.101,172.101,"PSO",11.1,1,0)
3701^F^172.101^.04^^1^F
371"IX",172.101,172.101,"PSO",11.1,1,3)
372
373"IX",172.101,172.101,"PSO",11.1,2,0)
3742^F^172.101^.03^^2^F
375"IX",172.101,172.101,"PSO",11.1,2,3)
376
377"IX",172.101,172.101,"PSO",11.1,3,0)
3783^F^172.101^.05^^3^F
379"IX",172.101,172.101,"PSO",11.1,3,3)
380
381"IX",172.101,172.101,"SPO",0)
382172.101^SPO^REGULAR INDEX OF SUBJECT PREDICATE OBJECT^R^^R^IR^I^172.101^^^^^LS
383"IX",172.101,172.101,"SPO",1)
384S ^C0X(101,"SPO",X(1),X(2),X(3),DA)=""
385"IX",172.101,172.101,"SPO",2)
386K ^C0X(101,"SPO",X(1),X(2),X(3),DA)
387"IX",172.101,172.101,"SPO",2.5)
388K ^C0X(101,"SPO")
389"IX",172.101,172.101,"SPO",11.1,0)
390^.114IA^3^3
391"IX",172.101,172.101,"SPO",11.1,1,0)
3921^F^172.101^.03^^1^F
393"IX",172.101,172.101,"SPO",11.1,1,3)
394
395"IX",172.101,172.101,"SPO",11.1,2,0)
3962^F^172.101^.04^^2^F
397"IX",172.101,172.101,"SPO",11.1,2,3)
398
399"IX",172.101,172.101,"SPO",11.1,3,0)
4003^F^172.101^.05^^3^F
401"IX",172.101,172.101,"SPO",11.1,3,3)
402
403"IX",172.201,172.201,"B",0)
404172.201^B^regular B index for strings to support long strings^R^^F^IR^I^172.201^^^^^LS
405"IX",172.201,172.201,"B",1)
406S ^C0X(201,"B",$E(X,1,240),DA)=""
407"IX",172.201,172.201,"B",2)
408K ^C0X(201,"B",$E(X,1,240),DA)
409"IX",172.201,172.201,"B",2.5)
410K ^C0X(201,"B")
411"IX",172.201,172.201,"B",11.1,0)
412^.114IA^1^1
413"IX",172.201,172.201,"B",11.1,1,0)
4141^F^172.201^.01^240^1^F
415"KRN",.4,1513,-1)
4160^1
417"KRN",.4,1513,0)
418C0X PRINT GRAPH^3111207.1727^@^172.101^^@^3120605
419"KRN",.4,1513,"F",1)
420.03;W25;S~.04;C28;W25~.05;C54;W24~
421"KRN",.4,1513,"H")
422C0X TRIPLE LIST
423"MBREQ")
4240
425"ORD",5,.4)
426.4;5;;;EDEOUT^DIFROMSO(.4,DA,"",XPDA);FPRE^DIFROMSI(.4,"",XPDA);EPRE^DIFROMSI(.4,DA,$E("N",$G(XPDNEW)),XPDA,"",OLDA);;EPOST^DIFROMSI(.4,DA,"",XPDA);DEL^DIFROMSK(.4,"",%)
427"ORD",5,.4,0)
428PRINT TEMPLATE
429"PKG",219,-1)
4301^1
431"PKG",219,0)
432FILEMAN TRIPLE STORE^C0X^Triple Store based on Fileman
433"PKG",219,20,0)
434^9.402P^^
435"PKG",219,22,0)
436^9.49I^1^1
437"PKG",219,22,1,0)
4381.0^3120926
439"PKG",219,22,1,1,0)
440^^1^1^3120926
441"PKG",219,22,1,1,1,0)
442Version 1.0
443"PKG",219,"DEV")
444GPL/WV
445"PKG",219,"VERSION")
4461.0
447"QUES","XPF1",0)
448Y
449"QUES","XPF1","??")
450^D REP^XPDH
451"QUES","XPF1","A")
452Shall I write over your |FLAG| File
453"QUES","XPF1","B")
454YES
455"QUES","XPF1","M")
456D XPF1^XPDIQ
457"QUES","XPF2",0)
458Y
459"QUES","XPF2","??")
460^D DTA^XPDH
461"QUES","XPF2","A")
462Want my data |FLAG| yours
463"QUES","XPF2","B")
464YES
465"QUES","XPF2","M")
466D XPF2^XPDIQ
467"QUES","XPI1",0)
468YO
469"QUES","XPI1","??")
470^D INHIBIT^XPDH
471"QUES","XPI1","A")
472Want KIDS to INHIBIT LOGONs during the install
473"QUES","XPI1","B")
474NO
475"QUES","XPI1","M")
476D XPI1^XPDIQ
477"QUES","XPM1",0)
478PO^VA(200,:EM
479"QUES","XPM1","??")
480^D MG^XPDH
481"QUES","XPM1","A")
482Enter the Coordinator for Mail Group '|FLAG|'
483"QUES","XPM1","B")
484
485"QUES","XPM1","M")
486D XPM1^XPDIQ
487"QUES","XPO1",0)
488Y
489"QUES","XPO1","??")
490^D MENU^XPDH
491"QUES","XPO1","A")
492Want KIDS to Rebuild Menu Trees Upon Completion of Install
493"QUES","XPO1","B")
494NO
495"QUES","XPO1","M")
496D XPO1^XPDIQ
497"QUES","XPZ1",0)
498Y
499"QUES","XPZ1","??")
500^D OPT^XPDH
501"QUES","XPZ1","A")
502Want to DISABLE Scheduled Options, Menu Options, and Protocols
503"QUES","XPZ1","B")
504NO
505"QUES","XPZ1","M")
506D XPZ1^XPDIQ
507"QUES","XPZ2",0)
508Y
509"QUES","XPZ2","??")
510^D RTN^XPDH
511"QUES","XPZ2","A")
512Want to MOVE routines to other CPUs
513"QUES","XPZ2","B")
514NO
515"QUES","XPZ2","M")
516D XPZ2^XPDIQ
517"RTN")
5188
519"RTN","C0XF2N")
5200^2^B367797666
521"RTN","C0XF2N",1,0)
522C0XF2N ; GPL - Fileman Triples entry point routine ;10/13/11 17:05
523"RTN","C0XF2N",2,0)
524 ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11
525"RTN","C0XF2N",3,0)
526 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU
527"RTN","C0XF2N",4,0)
528 ;General Public License See attached copy of the License.
529"RTN","C0XF2N",5,0)
530 ;
531"RTN","C0XF2N",6,0)
532 ;This program is free software; you can redistribute it and/or modify
533"RTN","C0XF2N",7,0)
534 ;it under the terms of the GNU General Public License as published by
535"RTN","C0XF2N",8,0)
536 ;the Free Software Foundation; either version 2 of the License, or
537"RTN","C0XF2N",9,0)
538 ;(at your option) any later version.
539"RTN","C0XF2N",10,0)
540 ;
541"RTN","C0XF2N",11,0)
542 ;This program is distributed in the hope that it will be useful,
543"RTN","C0XF2N",12,0)
544 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
545"RTN","C0XF2N",13,0)
546 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
547"RTN","C0XF2N",14,0)
548 ;GNU General Public License for more details.
549"RTN","C0XF2N",15,0)
550 ;
551"RTN","C0XF2N",16,0)
552 ;You should have received a copy of the GNU General Public License along
553"RTN","C0XF2N",17,0)
554 ;with this program; if not, write to the Free Software Foundation, Inc.,
555"RTN","C0XF2N",18,0)
556 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
557"RTN","C0XF2N",19,0)
558 ;
559"RTN","C0XF2N",20,0)
560 Q
561"RTN","C0XF2N",21,0)
562 ;
563"RTN","C0XF2N",22,0)
564 ; This is based on C0XMAIN but experiments with a fast load for triples
565"RTN","C0XF2N",23,0)
566 ; that will write directly to the fileman global
567"RTN","C0XF2N",24,0)
568 ; The file 172.101 is a F2N design style for triples, which means
569"RTN","C0XF2N",25,0)
570 ; that it is a Flat file with no subfiles, all fields at the root
571"RTN","C0XF2N",26,0)
572 ; ... it is a "2" file solution which means all strings are stored in
573"RTN","C0XF2N",27,0)
574 ; ... strings file and pointed to by the triples file
575"RTN","C0XF2N",28,0)
576 ; ... it is an N file because it has generated Node IDs instead of
577"RTN","C0XF2N",29,0)
578 ; ... DINUM which would use the IEN for the Node ID.
579"RTN","C0XF2N",30,0)
580 ; gpl 11/04/2011
581"RTN","C0XF2N",31,0)
582 ;
583"RTN","C0XF2N",32,0)
584INITFARY(ZFARY) ; INITIALIZE FILE NUMBERS AND OTHER USEFUL THINGS
585"RTN","C0XF2N",33,0)
586 ; FOR THE DEFAULT TRIPLE STORE. USE OTHER VALUES FOR SUPPORTING ADDITIONAL
587"RTN","C0XF2N",34,0)
588 ; TRIPLE STORES
589"RTN","C0XF2N",35,0)
590 I $D(@ZFARY) Q ; ALREADY INITIALIZED
591"RTN","C0XF2N",36,0)
592 S @ZFARY@("C0XTFN")=172.101 ; TRIPLES FILE NUMBER
593"RTN","C0XF2N",37,0)
594 S @ZFARY@("C0XSFN")=172.201 ; TRIPLES STRINGS FILE NUMBER
595"RTN","C0XF2N",38,0)
596 S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME
597"RTN","C0XF2N",39,0)
598 S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME
599"RTN","C0XF2N",40,0)
600 S @ZFARY@("C0XDIR")="/home/glilly/fmts/trunk/samples/smart-new/"
601"RTN","C0XF2N",41,0)
602 S @ZFARY@("BLKLOAD")=1 ; this file supports block load
603"RTN","C0XF2N",42,0)
604 S @ZFARY@("FMTSSTYLE")="F2N" ; fileman style
605"RTN","C0XF2N",43,0)
606 S @ZFARY@("REPLYFMT")="JSON"
607"RTN","C0XF2N",44,0)
608 D USEFARY(ZFARY)
609"RTN","C0XF2N",45,0)
610 Q
611"RTN","C0XF2N",46,0)
612 ;
613"RTN","C0XF2N",47,0)
614USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY
615"RTN","C0XF2N",48,0)
616 N ZI S ZI=""
617"RTN","C0XF2N",49,0)
618 F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D
619"RTN","C0XF2N",50,0)
620 . ;N ZX
621"RTN","C0XF2N",51,0)
622 . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_""""
623"RTN","C0XF2N",52,0)
624 . ;W !,ZX
625"RTN","C0XF2N",53,0)
626 . X ZX
627"RTN","C0XF2N",54,0)
628 Q
629"RTN","C0XF2N",55,0)
630 ;
631"RTN","C0XF2N",56,0)
632FILEIN ; INTERACTIVE ENTRY POINT FOR OPTION TO READ IN A FILE
633"RTN","C0XF2N",57,0)
634 I '$D(C0XFARY) D INITFARY("C0XFARY")
635"RTN","C0XF2N",58,0)
636 D USEFARY("C0XFARY")
637"RTN","C0XF2N",59,0)
638 S DIR(0)="F^3:240"
639"RTN","C0XF2N",60,0)
640 S DIR("A")="File Directory"
641"RTN","C0XF2N",61,0)
642 S DIR("B")=C0XDIR
643"RTN","C0XF2N",62,0)
644 D ^DIR
645"RTN","C0XF2N",63,0)
646 I Y="^" Q ;
647"RTN","C0XF2N",64,0)
648 S C0XDIR=Y
649"RTN","C0XF2N",65,0)
650 S C0XFARY("C0XDIR")=Y
651"RTN","C0XF2N",66,0)
652 S DIR(0)="F^3:240"
653"RTN","C0XF2N",67,0)
654 S DIR("A")="File Name"
655"RTN","C0XF2N",68,0)
656 I '$D(C0XFN) S DIR("B")="qds.rdf"
657"RTN","C0XF2N",69,0)
658 E S DIR("B")=C0XFN
659"RTN","C0XF2N",70,0)
660 D ^DIR
661"RTN","C0XF2N",71,0)
662 I Y="" Q ;
663"RTN","C0XF2N",72,0)
664 I Y="^" Q ;
665"RTN","C0XF2N",73,0)
666 S C0XFN=Y
667"RTN","C0XF2N",74,0)
668 D IMPORT(C0XFN,C0XDIR,,"C0XFARY")
669"RTN","C0XF2N",75,0)
670 K C0XFDA
671"RTN","C0XF2N",76,0)
672 Q
673"RTN","C0XF2N",77,0)
674 ;
675"RTN","C0XF2N",78,0)
676IMPORT(FNAME,INDIR,INURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD
677"RTN","C0XF2N",79,0)
678 ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE
679"RTN","C0XF2N",80,0)
680 ; NODE NAME OF THE TEXT TRIPLE
681"RTN","C0XF2N",81,0)
682 ; INDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR)
683"RTN","C0XF2N",82,0)
684 ; INURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE
685"RTN","C0XF2N",83,0)
686 ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE
687"RTN","C0XF2N",84,0)
688 I '$D(FARY) D ;
689"RTN","C0XF2N",85,0)
690 . D INITFARY("C0XFARY")
691"RTN","C0XF2N",86,0)
692 . S FARY="C0XFARY"
693"RTN","C0XF2N",87,0)
694 D USEFARY(FARY)
695"RTN","C0XF2N",88,0)
696 N ZD,ZTMP
697"RTN","C0XF2N",89,0)
698 I '$D(INDIR) S INDIR=C0XDIR ; DIRECTORY OF THE RDF FILE
699"RTN","C0XF2N",90,0)
700 I $G(INURL)="" D ;
701"RTN","C0XF2N",91,0)
702 . ;N ZN2 S ZN2=$P(FNAME,".",1)_"_"_$P(FNAME,".",2) ; REMOVE THE DOT
703"RTN","C0XF2N",92,0)
704 . ;S INURL=FDIR_ZN2
705"RTN","C0XF2N",93,0)
706 . S INURL=INDIR_FNAME
707"RTN","C0XF2N",94,0)
708 N ZTMP
709"RTN","C0XF2N",95,0)
710 S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE
711"RTN","C0XF2N",96,0)
712 K @ZTMP ; MAKE SURE IT'S CLEAR
713"RTN","C0XF2N",97,0)
714 S C0XSTART=$$NOW^XLFDT
715"RTN","C0XF2N",98,0)
716 W !,"STARTED: ",C0XSTART
717"RTN","C0XF2N",99,0)
718 W !,"READING IN: ",FNAME
719"RTN","C0XF2N",100,0)
720 I '$$FILEREAD(ZTMP,INDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS
721"RTN","C0XF2N",101,0)
722 . W !,"ERROR READING FILE: ",INDIR,FNAME
723"RTN","C0XF2N",102,0)
724 S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT
725"RTN","C0XF2N",103,0)
726 W !,$O(@ZRDF@(""),-1)," LINES READ"
727"RTN","C0XF2N",104,0)
728 D INSRDF(ZRDF,INURL,FARY) ; IMPORT AND PROCESS THE RDF
729"RTN","C0XF2N",105,0)
730 K INURL
731"RTN","C0XF2N",106,0)
732 K C0XFDA
733"RTN","C0XF2N",107,0)
734 ;K ^TMP("MXMLDOM",$J)
735"RTN","C0XF2N",108,0)
736 Q
737"RTN","C0XF2N",109,0)
738 ;
739"RTN","C0XF2N",110,0)
740WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT
741"RTN","C0XF2N",111,0)
742 ;
743"RTN","C0XF2N",112,0)
744 I '$D(FARY) D ;
745"RTN","C0XF2N",113,0)
746 . D INITFARY("C0XFARY")
747"RTN","C0XF2N",114,0)
748 . S FARY="C0XFARY"
749"RTN","C0XF2N",115,0)
750 D USEFARY(FARY)
751"RTN","C0XF2N",116,0)
752 ;N ZLOC,ZTMP
753"RTN","C0XF2N",117,0)
754 K ZTMP
755"RTN","C0XF2N",118,0)
756 S ZLOC=$NA(^TMP("C0X","WGET",$J))
757"RTN","C0XF2N",119,0)
758 K @ZLOC
759"RTN","C0XF2N",120,0)
760 S C0XSTART=$$NOW^XLFDT
761"RTN","C0XF2N",121,0)
762 W !,"STARTED: ",C0XSTART
763"RTN","C0XF2N",122,0)
764 W !,"DOWNLOADING: ",ZURL
765"RTN","C0XF2N",123,0)
766 S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP)
767"RTN","C0XF2N",124,0)
768 M @ZLOC=ZTMP
769"RTN","C0XF2N",125,0)
770 S C0XLINES=$O(@ZLOC@(""),-1)
771"RTN","C0XF2N",126,0)
772 W !,C0XLINES," LINES READ"
773"RTN","C0XF2N",127,0)
774 S C0XDLC=$$NOW^XLFDT ; DOWNLOAD COMPLETE
775"RTN","C0XF2N",128,0)
776 W !,"DOWNLOAD COMPLETE AT ",C0XDLC
777"RTN","C0XF2N",129,0)
778 S C0XDIFF=$$FMDIFF^XLFDT(C0XDLC,C0XSTART,2)
779"RTN","C0XF2N",130,0)
780 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
781"RTN","C0XF2N",131,0)
782 I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XLINES/C0XDIFF,".")," LINES PER SEC"
783"RTN","C0XF2N",132,0)
784 D INSRDF(ZLOC,ZURL,FARY)
785"RTN","C0XF2N",133,0)
786 Q
787"RTN","C0XF2N",134,0)
788 ;
789"RTN","C0XF2N",135,0)
790INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS
791"RTN","C0XF2N",136,0)
792 ; ZRDF IS PASSED BY NAME
793"RTN","C0XF2N",137,0)
794 I '$D(FARY) D ;
795"RTN","C0XF2N",138,0)
796 . D INITFARY("C0XFARY")
797"RTN","C0XF2N",139,0)
798 . S FARY="C0XFARY"
799"RTN","C0XF2N",140,0)
800 D USEFARY(FARY)
801"RTN","C0XF2N",141,0)
802 S BATCNT=0 ; BATCH COUNTER
803"RTN","C0XF2N",142,0)
804 S BATMAX=10000 ; TRY BATCHES OF THIS SIZE
805"RTN","C0XF2N",143,0)
806 N ZGRAPH,ZSUBJECT
807"RTN","C0XF2N",144,0)
808 S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME
809"RTN","C0XF2N",145,0)
810 S ZSUBJECT=$$ANONS() ; RANDOM ANOYMOUS SUBJECT
811"RTN","C0XF2N",146,0)
812 D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY)
813"RTN","C0XF2N",147,0)
814 N ZTXTNM
815"RTN","C0XF2N",148,0)
816 S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE
817"RTN","C0XF2N",149,0)
818 D ADD(ZGRAPH,ZSUBJECT,"fmts:fileSource",ZTXTNM,FARY)
819"RTN","C0XF2N",150,0)
820 D ADD(ZGRAPH,ZSUBJECT,"fmts:fileTag",$$name2tag(ZNAME),FARY)
821"RTN","C0XF2N",151,0)
822 D SWUPDIE(.C0XFDA) ; TRY IT OUT
823"RTN","C0XF2N",152,0)
824 K C0XCNT ;RESET FOR NEXT TIME
825"RTN","C0XF2N",153,0)
826 D STORETXT(ZRDF,ZTXTNM,FARY)
827"RTN","C0XF2N",154,0)
828 W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:fileSource ",ZTXTNM
829"RTN","C0XF2N",155,0)
830 D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF
831"RTN","C0XF2N",156,0)
832 Q
833"RTN","C0XF2N",157,0)
834 ;
835"RTN","C0XF2N",158,0)
836name2tag(zname) ; extrinsic which returns a tag derived from a name
837"RTN","C0XF2N",159,0)
838 ; /home/vista/project.xml ==> project
839"RTN","C0XF2N",160,0)
840 q $p($re($p($re(zname),"/")),".")
841"RTN","C0XF2N",161,0)
842 ;
843"RTN","C0XF2N",162,0)
844STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME
845"RTN","C0XF2N",163,0)
846 ;
847"RTN","C0XF2N",164,0)
848 I '$D(FARY) D ;
849"RTN","C0XF2N",165,0)
850 . D INITFARY("C0XFARY")
851"RTN","C0XF2N",166,0)
852 . S FARY="C0XFARY"
853"RTN","C0XF2N",167,0)
854 D USEFARY(FARY)
855"RTN","C0XF2N",168,0)
856 N ZIEN
857"RTN","C0XF2N",169,0)
858 S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN
859"RTN","C0XF2N",170,0)
860 D CLEAN^DILF
861"RTN","C0XF2N",171,0)
862 K ZERR
863"RTN","C0XF2N",172,0)
864 D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR")
865"RTN","C0XF2N",173,0)
866 I $D(ZERR) D Q ;
867"RTN","C0XF2N",174,0)
868 . W !,"ERROR CREATING WORD PROCESSING FIELD"
869"RTN","C0XF2N",175,0)
870 . S C0XERR="ERROR CREATING WORD PROCESSING FIELD"
871"RTN","C0XF2N",176,0)
872 . D ^%ZTER ; error trap
873"RTN","C0XF2N",177,0)
874 Q
875"RTN","C0XF2N",178,0)
876 ;
877"RTN","C0XF2N",179,0)
878GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT
879"RTN","C0XF2N",180,0)
880 ; ZRTN IS PASSED BY REFERENCE
881"RTN","C0XF2N",181,0)
882 I '$D(FARY) D ;
883"RTN","C0XF2N",182,0)
884 . D INITFARY("C0XFARY")
885"RTN","C0XF2N",183,0)
886 . S FARY="C0XFARY"
887"RTN","C0XF2N",184,0)
888 D USEFARY(FARY)
889"RTN","C0XF2N",185,0)
890 N ZIEN
891"RTN","C0XF2N",186,0)
892 S ZIEN=$$IENOF(ZNAME)
893"RTN","C0XF2N",187,0)
894 S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN")
895"RTN","C0XF2N",188,0)
896 Q
897"RTN","C0XF2N",189,0)
898 ;
899"RTN","C0XF2N",190,0)
900WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL
901"RTN","C0XF2N",191,0)
902 ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING
903"RTN","C0XF2N",192,0)
904 I '$D(FARY) D ;
905"RTN","C0XF2N",193,0)
906 . D INITFARY("C0XFARY")
907"RTN","C0XF2N",194,0)
908 . S FARY="C0XFARY"
909"RTN","C0XF2N",195,0)
910 D USEFARY(FARY)
911"RTN","C0XF2N",196,0)
912 N ZIEN
913"RTN","C0XF2N",197,0)
914 S ZIEN=$$IENOF(ZNAME)
915"RTN","C0XF2N",198,0)
916 Q $NA(@C0XSN@(ZIEN,1))
917"RTN","C0XF2N",199,0)
918 ;
919"RTN","C0XF2N",200,0)
920FILEREAD(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH
921"RTN","C0XF2N",201,0)
922 ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT
923"RTN","C0XF2N",202,0)
924 ; IE ^TMP("C0X","FILEIN",1)
925"RTN","C0XF2N",203,0)
926 ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1
927"RTN","C0XF2N",204,0)
928 ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH
929"RTN","C0XF2N",205,0)
930 S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL)
931"RTN","C0XF2N",206,0)
932 Q OK
933"RTN","C0XF2N",207,0)
934 ;
935"RTN","C0XF2N",208,0)
936TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE
937"RTN","C0XF2N",209,0)
938 S ZIN=$NA(^TMP("C0X",12226,"FILEIN"))
939"RTN","C0XF2N",210,0)
940 S ZGRAPH="/test/rdfFile"
941"RTN","C0XF2N",211,0)
942 S ZM="/test/rdfFile/meta"
943"RTN","C0XF2N",212,0)
944 D PROCESS(.G,ZIN,ZGRAPH,ZM)
945"RTN","C0XF2N",213,0)
946 Q
947"RTN","C0XF2N",214,0)
948 ;
949"RTN","C0XF2N",215,0)
950VISTAOWL ;
951"RTN","C0XF2N",216,0)
952 S ZRDF=$NA(^TMP("C0X",542,"FILEIN"))
953"RTN","C0XF2N",217,0)
954 S ZNAME="/home/glilly/vistaowl/VistAOWL.owl"
955"RTN","C0XF2N",218,0)
956 S ZGRAPH="_:G431590209"
957"RTN","C0XF2N",219,0)
958 S FARY="C0XFARY"
959"RTN","C0XF2N",220,0)
960 D INITFARY(FARY)
961"RTN","C0XF2N",221,0)
962 S C0XDOCID=1
963"RTN","C0XF2N",222,0)
964 S BATCNT=0
965"RTN","C0XF2N",223,0)
966 S BATMAX=10000
967"RTN","C0XF2N",224,0)
968 D PROCESS(.G,ZRDF,ZGRAPH,ZNAME,FARY)
969"RTN","C0XF2N",225,0)
970 Q
971"RTN","C0XF2N",226,0)
972 ;
973"RTN","C0XF2N",227,0)
974PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE
975"RTN","C0XF2N",228,0)
976 ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING
977"RTN","C0XF2N",229,0)
978 ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE
979"RTN","C0XF2N",230,0)
980 ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS
981"RTN","C0XF2N",231,0)
982 ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA
983"RTN","C0XF2N",232,0)
984 ;
985"RTN","C0XF2N",233,0)
986 I '$D(FARY) D ;
987"RTN","C0XF2N",234,0)
988 . D INITFARY("C0XFARY")
989"RTN","C0XF2N",235,0)
990 . S FARY="C0XFARY"
991"RTN","C0XF2N",236,0)
992 D USEFARY(FARY)
993"RTN","C0XF2N",237,0)
994 ;N BATCNT
995"RTN","C0XF2N",238,0)
996 ;N BATMAX
997"RTN","C0XF2N",239,0)
998 ; -- first parse the rdf file with the MXML parser
999"RTN","C0XF2N",240,0)
1000 ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML
1001"RTN","C0XF2N",241,0)
1002 S C0XDLC2=$$NOW^XLFDT ; START OF PARSE
1003"RTN","C0XF2N",242,0)
1004 I @ZRDF@(1)'["<?xml" D Q ;
1005"RTN","C0XF2N",243,0)
1006 . K @ZRDF ; don't need the input buffer
1007"RTN","C0XF2N",244,0)
1008 . W !,"Not an XML file"
1009"RTN","C0XF2N",245,0)
1010 S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W") ;
1011"RTN","C0XF2N",246,0)
1012 ;B
1013"RTN","C0XF2N",247,0)
1014 K @ZRDF ; DON'T NEED INPUT BUFFER ANYMORE
1015"RTN","C0XF2N",248,0)
1016 ; -- assign the MXLM dom global name to ZDOM
1017"RTN","C0XF2N",249,0)
1018 S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID))
1019"RTN","C0XF2N",250,0)
1020 ;S ZDOM=$NA(^TMP("MXMLDOM",16850,C0XDOCID)) ;VISTAOWL DOM
1021"RTN","C0XF2N",251,0)
1022 S C0XNODE=$O(@ZDOM@(""),-1)
1023"RTN","C0XF2N",252,0)
1024 W !,C0XNODE," XML NODES PARSED"
1025"RTN","C0XF2N",253,0)
1026 S C0XPRS=$$NOW^XLFDT ; PARSE COMPLETE
1027"RTN","C0XF2N",254,0)
1028 W !,"PARSE COMPLETE AT ",C0XPRS
1029"RTN","C0XF2N",255,0)
1030 S C0XDIFF=$$FMDIFF^XLFDT(C0XPRS,C0XDLC2,2)
1031"RTN","C0XF2N",256,0)
1032 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
1033"RTN","C0XF2N",257,0)
1034 I C0XDIFF'=0 D ;
1035"RTN","C0XF2N",258,0)
1036 . W !," APPROXIMATELY ",$P(C0XNODE/C0XDIFF,".")," NODES PER SECOND"
1037"RTN","C0XF2N",259,0)
1038 ; -- populate the metagraph to point to the graph with status unfinished
1039"RTN","C0XF2N",260,0)
1040 S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT
1041"RTN","C0XF2N",261,0)
1042 I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH
1043"RTN","C0XF2N",262,0)
1044 D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH
1045"RTN","C0XF2N",263,0)
1046 D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished
1047"RTN","C0XF2N",264,0)
1048 W !,"INSERTING GRAPH: ",ZGRF
1049"RTN","C0XF2N",265,0)
1050 ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT")
1051"RTN","C0XF2N",266,0)
1052 S C0XDATE=$$NOW^XLFDT
1053"RTN","C0XF2N",267,0)
1054 D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY)
1055"RTN","C0XF2N",268,0)
1056 D SWUPDIE(.C0XFDA) ; commit the metagraph changes to the triple store
1057"RTN","C0XF2N",269,0)
1058 ; --
1059"RTN","C0XF2N",270,0)
1060 ; -- pull out the vocabularies in the RDF statement. marked with xmlns:
1061"RTN","C0XF2N",271,0)
1062 ; -- put them in a local variable for quick reference
1063"RTN","C0XF2N",272,0)
1064 ; -- TODO: create a graph for vocabularies and validate incoming against it
1065"RTN","C0XF2N",273,0)
1066 ;
1067"RTN","C0XF2N",274,0)
1068 S C0XVOC=""
1069"RTN","C0XF2N",275,0)
1070 N ZI,ZJ,ZK S ZI=""
1071"RTN","C0XF2N",276,0)
1072 F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns
1073"RTN","C0XF2N",277,0)
1074 . S ZVOC=$P(ZI,"xmlns:",2)
1075"RTN","C0XF2N",278,0)
1076 . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI))
1077"RTN","C0XF2N",279,0)
1078 I $D(DEBUG) D ;
1079"RTN","C0XF2N",280,0)
1080 . W !,"VOCABS:"
1081"RTN","C0XF2N",281,0)
1082 . N ZZ S ZZ=""
1083"RTN","C0XF2N",282,0)
1084 . F S ZZ=$O(C0XVOC(ZZ)) Q:ZZ="" W !,ZZ,":",C0XVOC(ZZ)
1085"RTN","C0XF2N",283,0)
1086 ;
1087"RTN","C0XF2N",284,0)
1088 ; -- look for children called rdf:Description. quit if none. not an rdf file
1089"RTN","C0XF2N",285,0)
1090 ;
1091"RTN","C0XF2N",286,0)
1092 S C0XTYPE("rdf:Description")=1
1093"RTN","C0XF2N",287,0)
1094 S C0XTYPE("owl:ObjectProperty")=1
1095"RTN","C0XF2N",288,0)
1096 S C0XTYPE("owl:Ontology")=1
1097"RTN","C0XF2N",289,0)
1098 S C0XTYPE("owl:Class")=1
1099"RTN","C0XF2N",290,0)
1100 S C0XTYPE("rdfs:subClassOf")=1
1101"RTN","C0XF2N",291,0)
1102 S C0XTYPE("rdf:RDF")=1
1103"RTN","C0XF2N",292,0)
1104 S ZI=$O(@ZDOM@(1,"C",""))
1105"RTN","C0XF2N",293,0)
1106 I '$G(C0XTYPE(@ZDOM@(1,"C",ZI))) D ;Q ; not an rdf file
1107"RTN","C0XF2N",294,0)
1108 . W !,"Unusual RDF file ",@ZDOM@(1,"C",ZI)
1109"RTN","C0XF2N",295,0)
1110 . ;W !,"Error. Not an RDF file. Cannot process."
1111"RTN","C0XF2N",296,0)
1112 . D SHOW(1)
1113"RTN","C0XF2N",297,0)
1114 ;
1115"RTN","C0XF2N",298,0)
1116 ; -- now process the rdf description children
1117"RTN","C0XF2N",299,0)
1118 ;
1119"RTN","C0XF2N",300,0)
1120 S ZI=""
1121"RTN","C0XF2N",301,0)
1122 S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate
1123"RTN","C0XF2N",302,0)
1124 F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ;
1125"RTN","C0XF2N",303,0)
1126 . ; -- we are skipping any child that is not rdf:Description
1127"RTN","C0XF2N",304,0)
1128 . ; -- TODO: check to see if this is right in general
1129"RTN","C0XF2N",305,0)
1130 . ;
1131"RTN","C0XF2N",306,0)
1132 . IF '$G(C0XTYPE(@ZDOM@(1,"C",ZI))) D Q ;
1133"RTN","C0XF2N",307,0)
1134 . . W !,"SKIPPING NODE: ",ZI
1135"RTN","C0XF2N",308,0)
1136 . ; -- now looking for the subject for the triples
1137"RTN","C0XF2N",309,0)
1138 . S ZX=$G(@ZDOM@(ZI,"A","rdf:about"))
1139"RTN","C0XF2N",310,0)
1140 . I ZX'="" D ; we have the subject
1141"RTN","C0XF2N",311,0)
1142 . . ;W " about: ",ZX
1143"RTN","C0XF2N",312,0)
1144 . . S C0XSUB=ZX
1145"RTN","C0XF2N",313,0)
1146 . E D ;
1147"RTN","C0XF2N",314,0)
1148 . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject
1149"RTN","C0XF2N",315,0)
1150 . . I ZX'="" D ;
1151"RTN","C0XF2N",316,0)
1152 . . . S C0XSUB=ZX
1153"RTN","C0XF2N",317,0)
1154 . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT
1155"RTN","C0XF2N",318,0)
1156 . ;
1157"RTN","C0XF2N",319,0)
1158 . ; -- we now have the subject. the children of this node have the rest
1159"RTN","C0XF2N",320,0)
1160 . ;
1161"RTN","C0XF2N",321,0)
1162 . S ZJ="" ; for the children of the rdf:Description nodes
1163"RTN","C0XF2N",322,0)
1164 . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child
1165"RTN","C0XF2N",323,0)
1166 . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix
1167"RTN","C0XF2N",324,0)
1168 . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space
1169"RTN","C0XF2N",325,0)
1170 . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix
1171"RTN","C0XF2N",326,0)
1172 . . I C0XPRE[":" D ; expand using vocabulary
1173"RTN","C0XF2N",327,0)
1174 . . . N ZB,ZA
1175"RTN","C0XF2N",328,0)
1176 . . . S ZB=$P(C0XPRE,":",1)
1177"RTN","C0XF2N",329,0)
1178 . . . S ZA=$P(C0XPRE,":",2)
1179"RTN","C0XF2N",330,0)
1180 . . . I $G(C0XVOC(ZB))'="" D ;
1181"RTN","C0XF2N",331,0)
1182 . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded
1183"RTN","C0XF2N",332,0)
1184 . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object
1185"RTN","C0XF2N",333,0)
1186 . . I ZY'="" D Q ;
1187"RTN","C0XF2N",334,0)
1188 . . . S C0XOBJ=$$EXT^C0XUTIL(ZY) ; object
1189"RTN","C0XF2N",335,0)
1190 . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple
1191"RTN","C0XF2N",336,0)
1192 . . ; -- this is an else because of the quit above
1193"RTN","C0XF2N",337,0)
1194 . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object
1195"RTN","C0XF2N",338,0)
1196 . . I ZX'="" D Q ; got one
1197"RTN","C0XF2N",339,0)
1198 . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject
1199"RTN","C0XF2N",340,0)
1200 . . . ; without change... this could be foolish .. look at it again later
1201"RTN","C0XF2N",341,0)
1202 . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
1203"RTN","C0XF2N",342,0)
1204 . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here
1205"RTN","C0XF2N",343,0)
1206 . . I C0XOBJ="" D Q ; not a happy situation
1207"RTN","C0XF2N",344,0)
1208 . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ
1209"RTN","C0XF2N",345,0)
1210 . . S C0XOBJ=$$EXT^C0XUTIL(C0XOBJ) ; might be namespaced
1211"RTN","C0XF2N",346,0)
1212 . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
1213"RTN","C0XF2N",347,0)
1214 S C0XTRP=$$NOW^XLFDT ; PARSE COMPLETE
1215"RTN","C0XF2N",348,0)
1216 W !,"TRIPLES COMPLETE AT ",C0XTRP
1217"RTN","C0XF2N",349,0)
1218 S C0XDIFF=$$FMDIFF^XLFDT(C0XTRP,C0XPRS,2)
1219"RTN","C0XF2N",350,0)
1220 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
1221"RTN","C0XF2N",351,0)
1222 I C0XDIFF'=0 D ;
1223"RTN","C0XF2N",352,0)
1224 . W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
1225"RTN","C0XF2N",353,0)
1226 W !,"INSERTING ",C0XCNT," TRIPLES"
1227"RTN","C0XF2N",354,0)
1228 I $D(C0XFDA) D ;
1229"RTN","C0XF2N",355,0)
1230 . I $G(BLKLOAD) D ;
1231"RTN","C0XF2N",356,0)
1232 . . D BULKLOAD(.C0XFDA)
1233"RTN","C0XF2N",357,0)
1234 . E D ;
1235"RTN","C0XF2N",358,0)
1236 . . D UPDIE(.C0XFDA) ; commit the updates to the file
1237"RTN","C0XF2N",359,0)
1238 ; next, mark the graph as finished
1239"RTN","C0XF2N",360,0)
1240 S C0XINS=$$NOW^XLFDT ; PARSE COMPLETE
1241"RTN","C0XF2N",361,0)
1242 W !,"INSERTION COMPLETE AT ",C0XPRS
1243"RTN","C0XF2N",362,0)
1244 S C0XDIFF=$$FMDIFF^XLFDT(C0XINS,C0XTRP,2)
1245"RTN","C0XF2N",363,0)
1246 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
1247"RTN","C0XF2N",364,0)
1248 I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," NODES PER SECOND"
1249"RTN","C0XF2N",365,0)
1250 S C0XEND=$$NOW^XLFDT
1251"RTN","C0XF2N",366,0)
1252 W !," ENDED AT: ",C0XEND
1253"RTN","C0XF2N",367,0)
1254 S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2)
1255"RTN","C0XF2N",368,0)
1256 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
1257"RTN","C0XF2N",369,0)
1258 I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
1259"RTN","C0XF2N",370,0)
1260 Q
1261"RTN","C0XF2N",371,0)
1262 ;
1263"RTN","C0XF2N",372,0)
1264SHOW(ZN) ;
1265"RTN","C0XF2N",373,0)
1266 I '$D(C0XJOB) S C0XJOB=$J
1267"RTN","C0XF2N",374,0)
1268 N ZD
1269"RTN","C0XF2N",375,0)
1270 S ZD=$NA(^TMP("MXMLDOM",C0XJOB,1,ZN))
1271"RTN","C0XF2N",376,0)
1272 W ZD,"=",@ZD
1273"RTN","C0XF2N",377,0)
1274 F S ZD=$Q(@ZD) Q:$QS(ZD,4)'=ZN W !,ZD,"=",@ZD
1275"RTN","C0XF2N",378,0)
1276 ;ZWR ^TMP("MXMLDOM",C0XJOB,1,ZN,*)
1277"RTN","C0XF2N",379,0)
1278 Q
1279"RTN","C0XF2N",380,0)
1280 ;
1281"RTN","C0XF2N",381,0)
1282ANONS() ; RETURNS AN ANONOMOUS SUBJECT
1283"RTN","C0XF2N",382,0)
1284 Q "iDPsDPss"_$$LKY9
1285"RTN","C0XF2N",383,0)
1286 ;
1287"RTN","C0XF2N",384,0)
1288NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED
1289"RTN","C0XF2N",385,0)
1290 ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT
1291"RTN","C0XF2N",386,0)
1292 ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN
1293"RTN","C0XF2N",387,0)
1294 S NGRAPH="G"_$$LKY9
1295"RTN","C0XF2N",388,0)
1296 S NMETA=NGRAPH_"A"
1297"RTN","C0XF2N",389,0)
1298 Q
1299"RTN","C0XF2N",390,0)
1300 ;
1301"RTN","C0XF2N",391,0)
1302STARTADD ; INITIALIZE C0XFDA AND BATCNT
1303"RTN","C0XF2N",392,0)
1304 K C0XFDA
1305"RTN","C0XF2N",393,0)
1306 K BATCNT
1307"RTN","C0XF2N",394,0)
1308 Q
1309"RTN","C0XF2N",395,0)
1310 ;
1311"RTN","C0XF2N",396,0)
1312ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT
1313"RTN","C0XF2N",397,0)
1314 ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE
1315"RTN","C0XF2N",398,0)
1316 I '$D(FARY) D ;
1317"RTN","C0XF2N",399,0)
1318 . D INITFARY("C0XFARY")
1319"RTN","C0XF2N",400,0)
1320 . S FARY="C0XFARY"
1321"RTN","C0XF2N",401,0)
1322 D USEFARY(FARY)
1323"RTN","C0XF2N",402,0)
1324 I '$D(C0XCNT) S C0XCNT=0
1325"RTN","C0XF2N",403,0)
1326 N ZNODE
1327"RTN","C0XF2N",404,0)
1328 S ZNODE="N"_$$LKY17
1329"RTN","C0XF2N",405,0)
1330 N ZNARY ; GET READY TO CALL IENOFA
1331"RTN","C0XF2N",406,0)
1332 I (ZG="")!(ZS="")!(ZP="")!(ZO="") D Q ;
1333"RTN","C0XF2N",407,0)
1334 . I $G(DEBUG) W !,"Error Empty String ZG:"_ZG_" ZS:"_ZS_" ZP:"_ZP_" ZO"_ZO
1335"RTN","C0XF2N",408,0)
1336 S ZNARY("ZG",ZG)=""
1337"RTN","C0XF2N",409,0)
1338 S ZNARY("ZS",ZS)=""
1339"RTN","C0XF2N",410,0)
1340 S ZNARY("ZP",ZP)=""
1341"RTN","C0XF2N",411,0)
1342 S ZNARY("ZO",ZO)=""
1343"RTN","C0XF2N",412,0)
1344 D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS
1345"RTN","C0XF2N",413,0)
1346 ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN
1347"RTN","C0XF2N",414,0)
1348 ;S ZSIEN=$$IENOF(ZS)
1349"RTN","C0XF2N",415,0)
1350 ;S ZPIEN=$$IENOF(ZP)
1351"RTN","C0XF2N",416,0)
1352 ;S ZOIEN=$$IENOF(ZO)
1353"RTN","C0XF2N",417,0)
1354 ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED
1355"RTN","C0XF2N",418,0)
1356 I '$D(BATCNT) S BATCNT=0
1357"RTN","C0XF2N",419,0)
1358 S BATCNT=BATCNT+1
1359"RTN","C0XF2N",420,0)
1360 S C0XCNT=C0XCNT+1
1361"RTN","C0XF2N",421,0)
1362 I $G(BLKLOAD)=1 D ; we are using bulk load
1363"RTN","C0XF2N",422,0)
1364 . S C0XFDA(C0XTFN,BATCNT,.01)=ZNODE
1365"RTN","C0XF2N",423,0)
1366 . S C0XFDA(C0XTFN,BATCNT,.02)=$O(ZIENS("IEN","ZG",""))
1367"RTN","C0XF2N",424,0)
1368 . S C0XFDA(C0XTFN,BATCNT,.03)=$O(ZIENS("IEN","ZS",""))
1369"RTN","C0XF2N",425,0)
1370 . S C0XFDA(C0XTFN,BATCNT,.04)=$O(ZIENS("IEN","ZP",""))
1371"RTN","C0XF2N",426,0)
1372 . S C0XFDA(C0XTFN,BATCNT,.05)=$O(ZIENS("IEN","ZO",""))
1373"RTN","C0XF2N",427,0)
1374 E D ;
1375"RTN","C0XF2N",428,0)
1376 . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.01)=ZNODE
1377"RTN","C0XF2N",429,0)
1378 . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.02)=$O(ZIENS("IEN","ZG",""))
1379"RTN","C0XF2N",430,0)
1380 . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.03)=$O(ZIENS("IEN","ZS",""))
1381"RTN","C0XF2N",431,0)
1382 . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.04)=$O(ZIENS("IEN","ZP",""))
1383"RTN","C0XF2N",432,0)
1384 . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.05)=$O(ZIENS("IEN","ZO",""))
1385"RTN","C0XF2N",433,0)
1386 I '$D(BATMAX) S BATMAX=10000
1387"RTN","C0XF2N",434,0)
1388 I BATCNT=BATMAX D ; BATCH IS DONE
1389"RTN","C0XF2N",435,0)
1390 . I $G(BLKLOAD) D ; bulk load
1391"RTN","C0XF2N",436,0)
1392 . . D BULKLOAD(.C0XFDA) ; bulk load the batch
1393"RTN","C0XF2N",437,0)
1394 . E D ; no bulk load
1395"RTN","C0XF2N",438,0)
1396 . . D UPDIE(.C0XFDA)
1397"RTN","C0XF2N",439,0)
1398 . K C0XFDA
1399"RTN","C0XF2N",440,0)
1400 . S BATCNT=0 ; RESET COUNTER
1401"RTN","C0XF2N",441,0)
1402 ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE
1403"RTN","C0XF2N",442,0)
1404 Q
1405"RTN","C0XF2N",443,0)
1406 ;
1407"RTN","C0XF2N",444,0)
1408LKY5() ;EXTRINIC THAT RETURNS A RANDOM 5 DIGIT NUMBER. USED FOR GENERATING
1409"RTN","C0XF2N",445,0)
1410 ; UNIQUE NODE AND GRAPH NAMES
1411"RTN","C0XF2N",446,0)
1412 N ZN,ZI
1413"RTN","C0XF2N",447,0)
1414 S ZN=""
1415"RTN","C0XF2N",448,0)
1416 F ZI=1:1:5 D ;
1417"RTN","C0XF2N",449,0)
1418 . S ZN=ZN_$R(10)
1419"RTN","C0XF2N",450,0)
1420 Q ZN
1421"RTN","C0XF2N",451,0)
1422 ;
1423"RTN","C0XF2N",452,0)
1424LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
1425"RTN","C0XF2N",453,0)
1426 ; UNIQUE NODE AND GRAPH NAMES
1427"RTN","C0XF2N",454,0)
1428 N ZN,ZI
1429"RTN","C0XF2N",455,0)
1430 S ZN=""
1431"RTN","C0XF2N",456,0)
1432 F ZI=1:1:9 D ;
1433"RTN","C0XF2N",457,0)
1434 . S ZN=ZN_$R(10)
1435"RTN","C0XF2N",458,0)
1436 Q ZN
1437"RTN","C0XF2N",459,0)
1438 ;
1439"RTN","C0XF2N",460,0)
1440LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
1441"RTN","C0XF2N",461,0)
1442 ; UNIQUE NODE AND GRAPH NAMES
1443"RTN","C0XF2N",462,0)
1444 N ZN,ZI
1445"RTN","C0XF2N",463,0)
1446 S ZN=""
1447"RTN","C0XF2N",464,0)
1448 F ZI=1:1:17 D ;
1449"RTN","C0XF2N",465,0)
1450 . S ZN=ZN_$R(10)
1451"RTN","C0XF2N",466,0)
1452 Q ZN
1453"RTN","C0XF2N",467,0)
1454 ;
1455"RTN","C0XF2N",468,0)
1456 ; these routines add the string if it is not found
1457"RTN","C0XF2N",469,0)
1458 ;
1459"RTN","C0XF2N",470,0)
1460IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE
1461"RTN","C0XF2N",471,0)
1462 I '$D(FARY) D ;
1463"RTN","C0XF2N",472,0)
1464 . D INITFARY("C0XFARY")
1465"RTN","C0XF2N",473,0)
1466 . S FARY="C0XFARY"
1467"RTN","C0XF2N",474,0)
1468 N ZIEN
1469"RTN","C0XF2N",475,0)
1470 I $G(ZSTRING)="" Q "" ; NO STRING
1471"RTN","C0XF2N",476,0)
1472 S ZIEN=$O(@C0XSN@("B",ZSTRING,""))
1473"RTN","C0XF2N",477,0)
1474 I ZIEN="" D ;
1475"RTN","C0XF2N",478,0)
1476 . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING
1477"RTN","C0XF2N",479,0)
1478 . D UPDIE(.C0XFDA2)
1479"RTN","C0XF2N",480,0)
1480 . S ZIEN=$O(@C0XSN@("B",ZSTRING,""))
1481"RTN","C0XF2N",481,0)
1482 . K C0XFDA2
1483"RTN","C0XF2N",482,0)
1484 Q ZIEN
1485"RTN","C0XF2N",483,0)
1486 ;
1487"RTN","C0XF2N",484,0)
1488IENOFA(ZOUTARY,INARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE
1489"RTN","C0XF2N",485,0)
1490 ; OR ADD THEM IF
1491"RTN","C0XF2N",486,0)
1492 ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE
1493"RTN","C0XF2N",487,0)
1494 ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")=""
1495"RTN","C0XF2N",488,0)
1496 ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)=""
1497"RTN","C0XF2N",489,0)
1498 I '$D(FARY) D ;
1499"RTN","C0XF2N",490,0)
1500 . D INITFARY("C0XFARY")
1501"RTN","C0XF2N",491,0)
1502 . S FARY="C0XFARY"
1503"RTN","C0XF2N",492,0)
1504 K ZOUTARY ; START WITH CLEAN RESULTS
1505"RTN","C0XF2N",493,0)
1506 K C0XFDA2 ; USE A SEPARATE FDA FOR THIS
1507"RTN","C0XF2N",494,0)
1508 I '$D(C0XVOC) D VOCINIT^C0XUTIL
1509"RTN","C0XF2N",495,0)
1510 N ZINARY
1511"RTN","C0XF2N",496,0)
1512 N ZI S ZI=""
1513"RTN","C0XF2N",497,0)
1514 F S ZI=$O(INARY(ZI)) Q:ZI="" D ;
1515"RTN","C0XF2N",498,0)
1516 . N ZK
1517"RTN","C0XF2N",499,0)
1518 . S ZK=$O(INARY(ZI,""))
1519"RTN","C0XF2N",500,0)
1520 . S ZINARY($$EXT^C0XUTIL(ZI),$$EXT^C0XUTIL(ZK))=""
1521"RTN","C0XF2N",501,0)
1522 N ZV,ZIEN,ABORT
1523"RTN","C0XF2N",502,0)
1524 S ABORT=0
1525"RTN","C0XF2N",503,0)
1526 N ZCNT S ZCNT=0
1527"RTN","C0XF2N",504,0)
1528 F S ZI=$O(ZINARY(ZI)) Q:(ZI="")!+ABORT D ; LOOK FOR MISSING STRINGS
1529"RTN","C0XF2N",505,0)
1530 . S ZV=$O(ZINARY(ZI,""))
1531"RTN","C0XF2N",506,0)
1532 . I ZV="" S ABORT=1 Q ; abandon quad -- missing an entry
1533"RTN","C0XF2N",507,0)
1534 . I ZV["^" S ZV=$TR(ZV,"^","|")
1535"RTN","C0XF2N",508,0)
1536 . I $O(@C0XSN@("B",ZV,""))="" D ;
1537"RTN","C0XF2N",509,0)
1538 . . S ZCNT=ZCNT+1
1539"RTN","C0XF2N",510,0)
1540 . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV
1541"RTN","C0XF2N",511,0)
1542 I +ABORT Q ;
1543"RTN","C0XF2N",512,0)
1544 I $D(C0XFDA2) D ;
1545"RTN","C0XF2N",513,0)
1546 . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS
1547"RTN","C0XF2N",514,0)
1548 . K C0XFDA2 ; CLEAN UP
1549"RTN","C0XF2N",515,0)
1550 F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOW GET ALL IENS
1551"RTN","C0XF2N",516,0)
1552 . S ZV=$O(ZINARY(ZI,""))
1553"RTN","C0XF2N",517,0)
1554 . I ZV["^" S ZV=$TR(ZV,"^","|")
1555"RTN","C0XF2N",518,0)
1556 . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW
1557"RTN","C0XF2N",519,0)
1558 . I ZIEN="" D ;
1559"RTN","C0XF2N",520,0)
1560 . . W !,"ERROR ADDING STRING: ",ZV
1561"RTN","C0XF2N",521,0)
1562 . . B
1563"RTN","C0XF2N",522,0)
1564 . S ZOUTARY("IEN",ZI,ZIEN)=""
1565"RTN","C0XF2N",523,0)
1566 Q
1567"RTN","C0XF2N",524,0)
1568 ;
1569"RTN","C0XF2N",525,0)
1570ADDINN(ZG,ZS,ZARY) ; ADD IF NOT NULL
1571"RTN","C0XF2N",526,0)
1572 ; ZG IS THE GRAPH NAME, PASSED BY VALUE
1573"RTN","C0XF2N",527,0)
1574 ; ZS IS THE SUBJECT, PASSED BY VALUE
1575"RTN","C0XF2N",528,0)
1576 ; ZARY IS AN ARRAY, PASSED BY REFERENCE OF THE PREDICATE AND OBJECT
1577"RTN","C0XF2N",529,0)
1578 ; FORMAT IS ZARY(PRED)=OBJ
1579"RTN","C0XF2N",530,0)
1580 N ZI S ZI=""
1581"RTN","C0XF2N",531,0)
1582 F S ZI=$O(ZARY(ZI)) Q:ZI="" D ;
1583"RTN","C0XF2N",532,0)
1584 . ;I ZARY(ZI)="" S ZARY(ZI)="NULL"
1585"RTN","C0XF2N",533,0)
1586 . I ZARY(ZI)'="" D ;
1587"RTN","C0XF2N",534,0)
1588 . . D ADD^C0XF2N(ZG,ZS,ZI,ZARY(ZI))
1589"RTN","C0XF2N",535,0)
1590 . . I $D(DEBUG) W !,"ADDING",ZI," ",ZARY(ZI)
1591"RTN","C0XF2N",536,0)
1592 ;ZWR ZARY
1593"RTN","C0XF2N",537,0)
1594 Q
1595"RTN","C0XF2N",538,0)
1596 ;
1597"RTN","C0XF2N",539,0)
1598BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101
1599"RTN","C0XF2N",540,0)
1600 ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE
1601"RTN","C0XF2N",541,0)
1602 ; QUITS IF FILE IS NOT 172.101
1603"RTN","C0XF2N",542,0)
1604 ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1
1605"RTN","C0XF2N",543,0)
1606 ; QUITS IF FIRST ENTRY IS NOT IENS 1
1607"RTN","C0XF2N",544,0)
1608 ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES
1609"RTN","C0XF2N",545,0)
1610 ; ZBFDA IS PASSED BY REFERENCE
1611"RTN","C0XF2N",546,0)
1612 ;
1613"RTN","C0XF2N",547,0)
1614 ; -- reserves a block of iens from file 172.101 by locking the zero node
1615"RTN","C0XF2N",548,0)
1616 ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3
1617"RTN","C0XF2N",549,0)
1618 ; -- then unlocking to minimize the duration of the lock
1619"RTN","C0XF2N",550,0)
1620 ;
1621"RTN","C0XF2N",551,0)
1622 I $D(DEBUG) W !,"USING BULKLOAD"
1623"RTN","C0XF2N",552,0)
1624 I '$D(ZBFDA) Q ; EMPTY FDA
1625"RTN","C0XF2N",553,0)
1626 I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE
1627"RTN","C0XF2N",554,0)
1628 N ZCNT,ZP3,ZP4
1629"RTN","C0XF2N",555,0)
1630 ; -- find the number of nodes to insert
1631"RTN","C0XF2N",556,0)
1632 S ZCNT=$O(ZBFDA(172.101,""),-1)
1633"RTN","C0XF2N",557,0)
1634 I ZCNT="" D Q ;
1635"RTN","C0XF2N",558,0)
1636 . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT"
1637"RTN","C0XF2N",559,0)
1638 . B
1639"RTN","C0XF2N",560,0)
1640 ; -- lock the zero node and reserve a block of iens to insert
1641"RTN","C0XF2N",561,0)
1642 I $D(DEBUG) W !,"LOCKING ZERO NODE"
1643"RTN","C0XF2N",562,0)
1644 LOCK +^C0X(101,0)
1645"RTN","C0XF2N",563,0)
1646 S ZP3=$P(^C0X(101,0),U,3)
1647"RTN","C0XF2N",564,0)
1648 S ZP4=$P(^C0X(101,0),U,4)
1649"RTN","C0XF2N",565,0)
1650 S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1
1651"RTN","C0XF2N",566,0)
1652 S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1
1653"RTN","C0XF2N",567,0)
1654 LOCK -^C0X(101,0)
1655"RTN","C0XF2N",568,0)
1656 N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE
1657"RTN","C0XF2N",569,0)
1658 S ZBASE=ZP3 ; the last ien in the file
1659"RTN","C0XF2N",570,0)
1660 I $D(DEBUG) W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT
1661"RTN","C0XF2N",571,0)
1662 I $D(DEBUG) W !,$$NOW^XLFDT
1663"RTN","C0XF2N",572,0)
1664 S ZI=""
1665"RTN","C0XF2N",573,0)
1666 F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ;
1667"RTN","C0XF2N",574,0)
1668 . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name
1669"RTN","C0XF2N",575,0)
1670 . I ZN="" D BLKERR Q ;
1671"RTN","C0XF2N",576,0)
1672 . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer
1673"RTN","C0XF2N",577,0)
1674 . I ZG="" D BLKERR Q ;
1675"RTN","C0XF2N",578,0)
1676 . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer
1677"RTN","C0XF2N",579,0)
1678 . I ZS="" D BLKERR Q ;
1679"RTN","C0XF2N",580,0)
1680 . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer
1681"RTN","C0XF2N",581,0)
1682 . I ZP="" D BLKERR Q ;
1683"RTN","C0XF2N",582,0)
1684 . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer
1685"RTN","C0XF2N",583,0)
1686 . I ZO="" D BLKERR Q ;
1687"RTN","C0XF2N",584,0)
1688 . S ZIEN=ZI+ZBASE ; the new ien
1689"RTN","C0XF2N",585,0)
1690 . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node
1691"RTN","C0XF2N",586,0)
1692 . D INDEX(ZIEN,ZN,ZG,ZS,ZP,ZO)
1693"RTN","C0XF2N",587,0)
1694 Q
1695"RTN","C0XF2N",588,0)
1696 ;
1697"RTN","C0XF2N",589,0)
1698INDEX(ZIEN,ZN,ZG,ZS,ZP,ZO) ; HARD SET THE INDEX FOR ONE ENTRY
1699"RTN","C0XF2N",590,0)
1700 S ^C0X(101,"B",ZN,ZIEN)="" ; the B index
1701"RTN","C0XF2N",591,0)
1702 S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index
1703"RTN","C0XF2N",592,0)
1704 S ^C0X(101,"SPO",ZS,ZP,ZO,ZIEN)=""
1705"RTN","C0XF2N",593,0)
1706 S ^C0X(101,"SOP",ZS,ZO,ZP,ZIEN)=""
1707"RTN","C0XF2N",594,0)
1708 S ^C0X(101,"OPS",ZO,ZP,ZS,ZIEN)=""
1709"RTN","C0XF2N",595,0)
1710 S ^C0X(101,"OSP",ZO,ZS,ZP,ZIEN)=""
1711"RTN","C0XF2N",596,0)
1712 S ^C0X(101,"PSO",ZP,ZS,ZO,ZIEN)=""
1713"RTN","C0XF2N",597,0)
1714 S ^C0X(101,"POS",ZP,ZO,ZS,ZIEN)=""
1715"RTN","C0XF2N",598,0)
1716 S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS,ZIEN)=""
1717"RTN","C0XF2N",599,0)
1718 S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP,ZIEN)=""
1719"RTN","C0XF2N",600,0)
1720 S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO,ZIEN)=""
1721"RTN","C0XF2N",601,0)
1722 S ^C0X(101,"GPOS",ZG,ZP,ZO,ZS,ZIEN)=""
1723"RTN","C0XF2N",602,0)
1724 S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO,ZIEN)=""
1725"RTN","C0XF2N",603,0)
1726 S ^C0X(101,"GSOP",ZG,ZS,ZO,ZP,ZIEN)=""
1727"RTN","C0XF2N",604,0)
1728 Q
1729"RTN","C0XF2N",605,0)
1730 ;
1731"RTN","C0XF2N",606,0)
1732REINDEX ; REINDEX THE ^C0X(101, TRIPLE STORE
1733"RTN","C0XF2N",607,0)
1734 K ^C0X(101,"B")
1735"RTN","C0XF2N",608,0)
1736 K ^C0X(101,"G")
1737"RTN","C0XF2N",609,0)
1738 K ^C0X(101,"SPO")
1739"RTN","C0XF2N",610,0)
1740 K ^C0X(101,"SOP")
1741"RTN","C0XF2N",611,0)
1742 K ^C0X(101,"OPS")
1743"RTN","C0XF2N",612,0)
1744 K ^C0X(101,"OSP")
1745"RTN","C0XF2N",613,0)
1746 K ^C0X(101,"PSO")
1747"RTN","C0XF2N",614,0)
1748 K ^C0X(101,"POS")
1749"RTN","C0XF2N",615,0)
1750 K ^C0X(101,"GOPS")
1751"RTN","C0XF2N",616,0)
1752 K ^C0X(101,"GOSP")
1753"RTN","C0XF2N",617,0)
1754 K ^C0X(101,"GPSO")
1755"RTN","C0XF2N",618,0)
1756 K ^C0X(101,"GPOS")
1757"RTN","C0XF2N",619,0)
1758 K ^C0X(101,"GSPO")
1759"RTN","C0XF2N",620,0)
1760 K ^C0X(101,"GSOP")
1761"RTN","C0XF2N",621,0)
1762 N ZIEN,ZZ
1763"RTN","C0XF2N",622,0)
1764 S ZIEN=0
1765"RTN","C0XF2N",623,0)
1766 F S ZIEN=$O(^C0X(101,ZIEN)) Q:+ZIEN=0 D ; FOR EACH NODE
1767"RTN","C0XF2N",624,0)
1768 . S ZZ=$G(^C0X(101,ZIEN,0))
1769"RTN","C0XF2N",625,0)
1770 . I ZZ="" D Q ;
1771"RTN","C0XF2N",626,0)
1772 . . W !,"ERROR REINDEXING NODE ",ZI
1773"RTN","C0XF2N",627,0)
1774 . S ZN=$P(ZZ,"^",1)
1775"RTN","C0XF2N",628,0)
1776 . S ZG=$P(ZZ,"^",2)
1777"RTN","C0XF2N",629,0)
1778 . S ZS=$P(ZZ,"^",3)
1779"RTN","C0XF2N",630,0)
1780 . S ZP=$P(ZZ,"^",4)
1781"RTN","C0XF2N",631,0)
1782 . S ZO=$P(ZZ,"^",5)
1783"RTN","C0XF2N",632,0)
1784 . D INDEX(ZIEN,ZN,ZG,ZS,ZP,ZO)
1785"RTN","C0XF2N",633,0)
1786 Q
1787"RTN","C0XF2N",634,0)
1788 ;
1789"RTN","C0XF2N",635,0)
1790BLKERR ;
1791"RTN","C0XF2N",636,0)
1792 W !,"ERROR IN BULK LOAD"
1793"RTN","C0XF2N",637,0)
1794 S C0XERR="ERROR IN BULK LOAD"
1795"RTN","C0XF2N",638,0)
1796 S C0XLOC=ZBFDA(ZI)
1797"RTN","C0XF2N",639,0)
1798 D ^%ZTER ; report the error
1799"RTN","C0XF2N",640,0)
1800 B
1801"RTN","C0XF2N",641,0)
1802 Q
1803"RTN","C0XF2N",642,0)
1804 ;
1805"RTN","C0XF2N",643,0)
1806DELGRAPH(ZGRF,FARY) ; delete a graph from the triplestore
1807"RTN","C0XF2N",644,0)
1808 ; (doesn't delete strings)
1809"RTN","C0XF2N",645,0)
1810 ;
1811"RTN","C0XF2N",646,0)
1812 I '$D(FARY) D ;
1813"RTN","C0XF2N",647,0)
1814 . D INITFARY("C0XFARY")
1815"RTN","C0XF2N",648,0)
1816 . S FARY="C0XFARY"
1817"RTN","C0XF2N",649,0)
1818 D USEFARY(FARY)
1819"RTN","C0XF2N",650,0)
1820 N ZGRAPH
1821"RTN","C0XF2N",651,0)
1822 D TING(.ZGRAPH,ZGRF,FARY)
1823"RTN","C0XF2N",652,0)
1824 I '$D(ZGRAPH) D Q ;
1825"RTN","C0XF2N",653,0)
1826 . I $D(DEBUG) W !,"NO TRIPLES IN GRAPH"
1827"RTN","C0XF2N",654,0)
1828 K C0XFDA
1829"RTN","C0XF2N",655,0)
1830 N ZI S ZI=""
1831"RTN","C0XF2N",656,0)
1832 F S ZI=$O(ZGRAPH(ZI)) Q:ZI="" D ;
1833"RTN","C0XF2N",657,0)
1834 . S C0XFDA(C0XTFN,ZI_",",.01)="@"
1835"RTN","C0XF2N",658,0)
1836 D UPDIE(.C0XFDA)
1837"RTN","C0XF2N",659,0)
1838 Q
1839"RTN","C0XF2N",660,0)
1840 ;
1841"RTN","C0XF2N",661,0)
1842TING(ZRTN,ZGRF,FARY) ; return the iens for graph ZGRF
1843"RTN","C0XF2N",662,0)
1844 ; ZRTN is passed by reference
1845"RTN","C0XF2N",663,0)
1846 I '$D(FARY) D ;
1847"RTN","C0XF2N",664,0)
1848 . D INITFARY("C0XFARY")
1849"RTN","C0XF2N",665,0)
1850 . S FARY="C0XFARY"
1851"RTN","C0XF2N",666,0)
1852 D USEFARY(FARY)
1853"RTN","C0XF2N",667,0)
1854 K ZRTN
1855"RTN","C0XF2N",668,0)
1856 N ZI,ZG S ZI=""
1857"RTN","C0XF2N",669,0)
1858 S ZG=$$IENOF^C0XGET1(ZGRF)
1859"RTN","C0XF2N",670,0)
1860 I ZG="" D Q ;
1861"RTN","C0XF2N",671,0)
1862 . I $D(DEBUG) W !,"ERROR GRAPH NOT FOUND"
1863"RTN","C0XF2N",672,0)
1864 I '$D(@C0XTN@("G",ZG)) Q ;
1865"RTN","C0XF2N",673,0)
1866 F S ZI=$O(@C0XTN@("G",ZG,ZI)) Q:ZI="" D ;
1867"RTN","C0XF2N",674,0)
1868 . S ZRTN(ZI)=""
1869"RTN","C0XF2N",675,0)
1870 Q
1871"RTN","C0XF2N",676,0)
1872 ;
1873"RTN","C0XF2N",677,0)
1874SWUPDIE(ZFDA) ; SWITCH BETWEEN UPDIE AND BULKLOAD
1875"RTN","C0XF2N",678,0)
1876 I $G(BLKLOAD)=1 D ; bulk load
1877"RTN","C0XF2N",679,0)
1878 . D BULKLOAD(.ZFDA) ; bulk load the batch
1879"RTN","C0XF2N",680,0)
1880 E D ; no bulk load
1881"RTN","C0XF2N",681,0)
1882 . D UPDIE(.ZFDA)
1883"RTN","C0XF2N",682,0)
1884 K ZFDA
1885"RTN","C0XF2N",683,0)
1886 Q
1887"RTN","C0XF2N",684,0)
1888 ;
1889"RTN","C0XF2N",685,0)
1890UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
1891"RTN","C0XF2N",686,0)
1892 ; ZFDA IS PASSED BY REFERENCE
1893"RTN","C0XF2N",687,0)
1894 ;ZWR ZFDA
1895"RTN","C0XF2N",688,0)
1896 ;B
1897"RTN","C0XF2N",689,0)
1898 K ZERR
1899"RTN","C0XF2N",690,0)
1900 D CLEAN^DILF
1901"RTN","C0XF2N",691,0)
1902 D UPDATE^DIE("","ZFDA","","ZERR")
1903"RTN","C0XF2N",692,0)
1904 I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST,
1905"RTN","C0XF2N",693,0)
1906 ; INVOKE THE ERROR TRAP IF TASKED
1907"RTN","C0XF2N",694,0)
1908 ;. W "ERROR",!
1909"RTN","C0XF2N",695,0)
1910 ;. ZWR ZERR
1911"RTN","C0XF2N",696,0)
1912 ;. B
1913"RTN","C0XF2N",697,0)
1914 K ZFDA
1915"RTN","C0XF2N",698,0)
1916 Q
1917"RTN","C0XF2N",699,0)
1918 ;
1919"RTN","C0XGET1")
19200^8^B237497267
1921"RTN","C0XGET1",1,0)
1922C0XGET1 ; GPL - Fileman Triples entry point routine ;1/12/12 17:05
1923"RTN","C0XGET1",2,0)
1924 ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11
1925"RTN","C0XGET1",3,0)
1926 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU
1927"RTN","C0XGET1",4,0)
1928 ;General Public License See attached copy of the License.
1929"RTN","C0XGET1",5,0)
1930 ;
1931"RTN","C0XGET1",6,0)
1932 ;This program is free software; you can redistribute it and/or modify
1933"RTN","C0XGET1",7,0)
1934 ;it under the terms of the GNU General Public License as published by
1935"RTN","C0XGET1",8,0)
1936 ;the Free Software Foundation; either version 2 of the License, or
1937"RTN","C0XGET1",9,0)
1938 ;(at your option) any later version.
1939"RTN","C0XGET1",10,0)
1940 ;
1941"RTN","C0XGET1",11,0)
1942 ;This program is distributed in the hope that it will be useful,
1943"RTN","C0XGET1",12,0)
1944 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
1945"RTN","C0XGET1",13,0)
1946 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1947"RTN","C0XGET1",14,0)
1948 ;GNU General Public License for more details.
1949"RTN","C0XGET1",15,0)
1950 ;
1951"RTN","C0XGET1",16,0)
1952 ;You should have received a copy of the GNU General Public License along
1953"RTN","C0XGET1",17,0)
1954 ;with this program; if not, write to the Free Software Foundation, Inc.,
1955"RTN","C0XGET1",18,0)
1956 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1957"RTN","C0XGET1",19,0)
1958 ;
1959"RTN","C0XGET1",20,0)
1960 Q
1961"RTN","C0XGET1",21,0)
1962 ;
1963"RTN","C0XGET1",22,0)
1964LSSUBJ(RTN,ZSUBJ,C0XFARY) ; LIST NODES WITH SUBJECT ZSUBJ
1965"RTN","C0XGET1",23,0)
1966 ;
1967"RTN","C0XGET1",24,0)
1968 I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY")
1969"RTN","C0XGET1",25,0)
1970 D USEFARY^C0XF2N("C0XFARY")
1971"RTN","C0XGET1",26,0)
1972 Q
1973"RTN","C0XGET1",27,0)
1974 ;
1975"RTN","C0XGET1",28,0)
1976graph(sub,pred,obj,form,fary) ; extrinsic which returns a graph name
1977"RTN","C0XGET1",29,0)
1978 I '$D(fary) D ;
1979"RTN","C0XGET1",30,0)
1980 . S fary="C0XFARY"
1981"RTN","C0XGET1",31,0)
1982 . D INITFARY^C0XF2N(fary)
1983"RTN","C0XGET1",32,0)
1984 D USEFARY^C0XF2N(fary)
1985"RTN","C0XGET1",33,0)
1986 k triplertn ; start with a clean return
1987"RTN","C0XGET1",34,0)
1988 n zsub,zpred,zobj,zgraph,tmprtn
1989"RTN","C0XGET1",35,0)
1990 s zsub=$$IENOF($$EXT^C0XUTIL($g(sub)),fary) ; ien of subject
1991"RTN","C0XGET1",36,0)
1992 s zpred=$$IENOF($$EXT^C0XUTIL($g(pred)),fary) ; ien of predicate
1993"RTN","C0XGET1",37,0)
1994 s zobj=$$IENOF($$EXT^C0XUTIL($g(obj)),fary) ; ien of object
1995"RTN","C0XGET1",38,0)
1996 s zgraph=$$IENOF($g(graph),fary) ; ien of graph
1997"RTN","C0XGET1",39,0)
1998 I $G(DEBUG) W !,"s:",zsub," p:",zpred," o:",zobj
1999"RTN","C0XGET1",40,0)
2000 d trip(.tmprtn,zsub,zpred,zobj,zgraph,fary)
2001"RTN","C0XGET1",41,0)
2002 n ztmp
2003"RTN","C0XGET1",42,0)
2004 d trip(.ztmp,$g(sub),$g(pred),$g(obj),"",$g(fary))
2005"RTN","C0XGET1",43,0)
2006 n zi,zg,zrtn
2007"RTN","C0XGET1",44,0)
2008 s zi=$o(tmprtn(""))
2009"RTN","C0XGET1",45,0)
2010 s zg=$$GET1^DIQ(C0XTFN,zi,.02,"E") ;
2011"RTN","C0XGET1",46,0)
2012 i zg="" q ""
2013"RTN","C0XGET1",47,0)
2014 s zrtn=zg
2015"RTN","C0XGET1",48,0)
2016 i $o(tmprtn(zi))'="" d
2017"RTN","C0XGET1",49,0)
2018 . s zrtn=""
2019"RTN","C0XGET1",50,0)
2020 q zrtn
2021"RTN","C0XGET1",51,0)
2022 ;
2023"RTN","C0XGET1",52,0)
2024GRAPHS(RTN,C0XFARY) ; LIST ALL GRAPHS
2025"RTN","C0XGET1",53,0)
2026 ;
2027"RTN","C0XGET1",54,0)
2028 I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY")
2029"RTN","C0XGET1",55,0)
2030 D USEFARY^C0XF2N("C0XFARY")
2031"RTN","C0XGET1",56,0)
2032 N ZI S ZI=""
2033"RTN","C0XGET1",57,0)
2034 F S ZI=$O(@C0XTN@("G",ZI)) Q:ZI="" D ;
2035"RTN","C0XGET1",58,0)
2036 . S RTN(ZI,$$STR(ZI))=""
2037"RTN","C0XGET1",59,0)
2038 Q
2039"RTN","C0XGET1",60,0)
2040 ;
2041"RTN","C0XGET1",61,0)
2042STR(ZIN,C0XFARY) ; EXTRINSIC RETURNS A STRING
2043"RTN","C0XGET1",62,0)
2044 I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY")
2045"RTN","C0XGET1",63,0)
2046 Q $$GET1^DIQ(C0XSFN,ZIN,.01,"E")
2047"RTN","C0XGET1",64,0)
2048 ;
2049"RTN","C0XGET1",65,0)
2050SPO(ZRTN,ZNODE,C0XFARY)
2051"RTN","C0XGET1",66,0)
2052 I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY")
2053"RTN","C0XGET1",67,0)
2054 N ZI S ZI=$$NXT(.ZRTN)
2055"RTN","C0XGET1",68,0)
2056 S ZRTN(ZI,"S")=$$S(ZNODE)
2057"RTN","C0XGET1",69,0)
2058 S ZRTN(ZI,"P")=$$P(ZNODE)
2059"RTN","C0XGET1",70,0)
2060 S ZRTN(ZI,"O")=$$O(ZNODE)
2061"RTN","C0XGET1",71,0)
2062 Q
2063"RTN","C0XGET1",72,0)
2064 ;
2065"RTN","C0XGET1",73,0)
2066S(ZNODE,C0XFARY) ; EXTRINSIC RETURNING THE SUBJECT
2067"RTN","C0XGET1",74,0)
2068 Q $$STR($$GET1^DIQ(C0XTFN,ZNODE,.03,"I")) ;
2069"RTN","C0XGET1",75,0)
2070 ;
2071"RTN","C0XGET1",76,0)
2072P(ZNODE,C0XFARY) ; EXTRINSIC RETURNING THE PREDICATE
2073"RTN","C0XGET1",77,0)
2074 Q $$STR($$GET1^DIQ(C0XTFN,ZNODE,.04,"I")) ;
2075"RTN","C0XGET1",78,0)
2076 ;
2077"RTN","C0XGET1",79,0)
2078O(ZNODE,C0XFARY) ; EXTRINSIC RETURNING THE OBJECT
2079"RTN","C0XGET1",80,0)
2080 Q $$STR($$GET1^DIQ(C0XTFN,ZNODE,.05,"I")) ;
2081"RTN","C0XGET1",81,0)
2082 ;
2083"RTN","C0XGET1",82,0)
2084NXT(ZRTN) ;EXTRINSIC FOR THE NEXT NODE IN ARRAY ZRTN, PASSED BY REF
2085"RTN","C0XGET1",83,0)
2086 I '$D(ZRTN) S ZRTN=""
2087"RTN","C0XGET1",84,0)
2088 Q $O(ZRTN(""),-1)+1
2089"RTN","C0XGET1",85,0)
2090 ;
2091"RTN","C0XGET1",86,0)
2092SING(ZRTN,ZG) ; SUBJECTS IN GRAPH
2093"RTN","C0XGET1",87,0)
2094 ;
2095"RTN","C0XGET1",88,0)
2096 I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY")
2097"RTN","C0XGET1",89,0)
2098 I '$D(ZRTN) S ZRTN=""
2099"RTN","C0XGET1",90,0)
2100 N ZI,ZN S ZI=""
2101"RTN","C0XGET1",91,0)
2102 F S ZI=$O(@C0XTN@("GSPO",ZG,ZI)) Q:ZI="" D ;
2103"RTN","C0XGET1",92,0)
2104 . S ZRTN($$NXT(.ZRTN),"S")=$$STR(ZI)
2105"RTN","C0XGET1",93,0)
2106 Q
2107"RTN","C0XGET1",94,0)
2108 ;
2109"RTN","C0XGET1",95,0)
2110qparse(qrtn,zquery) ; parses the query
2111"RTN","C0XGET1",96,0)
2112 ; want this to be able to handle the WHERE clause of SPARQL eventually
2113"RTN","C0XGET1",97,0)
2114 ;
2115"RTN","C0XGET1",98,0)
2116 n q1,q2,q3,qq
2117"RTN","C0XGET1",99,0)
2118 ;s qq=$tr(zquery," ","^")
2119"RTN","C0XGET1",100,0)
2120 s qq=query ; really want to remove whitespace here
2121"RTN","C0XGET1",101,0)
2122 s q1=$p(qq," ",1)
2123"RTN","C0XGET1",102,0)
2124 i q1["?" s q1=""
2125"RTN","C0XGET1",103,0)
2126 s q2=$p(qq," ",2)
2127"RTN","C0XGET1",104,0)
2128 i q2["?" s q2=""
2129"RTN","C0XGET1",105,0)
2130 s q3=$p(qq," ",3)
2131"RTN","C0XGET1",106,0)
2132 i q3["?" s q3=""
2133"RTN","C0XGET1",107,0)
2134 s qrtn(1)=q1_"^"_q2_"^"_q3 ; more lines to come later
2135"RTN","C0XGET1",108,0)
2136 q
2137"RTN","C0XGET1",109,0)
2138 ;
2139"RTN","C0XGET1",110,0)
2140getGraph(zrtn,zgrf,form) ; get all triples in graph zgrf
2141"RTN","C0XGET1",111,0)
2142 ; forms planned: "rdf" "json" "array" "turtle" "triples" "raw"
2143"RTN","C0XGET1",112,0)
2144 ; forms supported: "rdf" "json" "array" "raw"
2145"RTN","C0XGET1",113,0)
2146 I '$D(form) S form="rdf"
2147"RTN","C0XGET1",114,0)
2148 N ZIENS,ZTRIP
2149"RTN","C0XGET1",115,0)
2150 D TING^C0XF2N(.ZIENS,zgrf)
2151"RTN","C0XGET1",116,0)
2152 I '$D(ZIENS) Q ;
2153"RTN","C0XGET1",117,0)
2154 D ien2tary(.ZTRIP,"ZIENS")
2155"RTN","C0XGET1",118,0)
2156 I form="json" d jsonout(.zrtn,.ZTRIP) q ; what follows is else
2157"RTN","C0XGET1",119,0)
2158 i form="rdf" d rdfout^C0XRDF(.zrtn,.ZTRIP) q ;
2159"RTN","C0XGET1",120,0)
2160 i form="array" d arrayout^C0XGET1(.zrtn,.ZTRIP) q ;
2161"RTN","C0XGET1",121,0)
2162 i form="raw" d rawout^C0XGET1(.zrtn,.ZTRIP) q ;
2163"RTN","C0XGET1",122,0)
2164 W !,"Form not supported: ",form
2165"RTN","C0XGET1",123,0)
2166 Q
2167"RTN","C0XGET1",124,0)
2168 ;
2169"RTN","C0XGET1",125,0)
2170rpctrip(rtn,query,limit,offset) ; rpc to access triples with a query
2171"RTN","C0XGET1",126,0)
2172 ;
2173"RTN","C0XGET1",127,0)
2174 n zoff,zlim,zcount,zq
2175"RTN","C0XGET1",128,0)
2176 k rtn
2177"RTN","C0XGET1",129,0)
2178 i '$d(limit) s limit=250
2179"RTN","C0XGET1",130,0)
2180 i '$d(offset) s offset=0
2181"RTN","C0XGET1",131,0)
2182 d qparse(.zq,query) ; parse the query
2183"RTN","C0XGET1",132,0)
2184 n qsub,qpred,qobj,qtmp
2185"RTN","C0XGET1",133,0)
2186 W !,zq(1)
2187"RTN","C0XGET1",134,0)
2188 s qsub=$p(zq(1),"^",1)
2189"RTN","C0XGET1",135,0)
2190 s qpred=$p(zq(1),"^",2)
2191"RTN","C0XGET1",136,0)
2192 s qobj=$p(zq(1),"^",3)
2193"RTN","C0XGET1",137,0)
2194 d triples(.qtmp,qsub,qpred,qobj)
2195"RTN","C0XGET1",138,0)
2196 f zcount=offset+1:1:offset+limit q:'$d(qtmp(zcount)) d ;
2197"RTN","C0XGET1",139,0)
2198 . s rtn(zcount)=qtmp(zcount)
2199"RTN","C0XGET1",140,0)
2200 q
2201"RTN","C0XGET1",141,0)
2202 ;
2203"RTN","C0XGET1",142,0)
2204triples(triplertn,sub,pred,obj,graph,form,fary) ; returns triples
2205"RTN","C0XGET1",143,0)
2206 I '$D(fary) D ;
2207"RTN","C0XGET1",144,0)
2208 . D INITFARY^C0XF2N("C0XFARY")
2209"RTN","C0XGET1",145,0)
2210 . S fary="C0XFARY"
2211"RTN","C0XGET1",146,0)
2212 D USEFARY^C0XF2N(fary)
2213"RTN","C0XGET1",147,0)
2214 I '$D(form) S form="json"
2215"RTN","C0XGET1",148,0)
2216 k triplertn ; start with a clean return
2217"RTN","C0XGET1",149,0)
2218 n zsub,zpred,zobj,zgraph,tmprtn
2219"RTN","C0XGET1",150,0)
2220 s zsub=$$IENOF($$EXT^C0XUTIL($g(sub)),fary) ; ien of subject
2221"RTN","C0XGET1",151,0)
2222 s zpred=$$IENOF($$EXT^C0XUTIL($g(pred)),fary) ; ien of predicate
2223"RTN","C0XGET1",152,0)
2224 s zobj=$$IENOF($$EXT^C0XUTIL($g(obj)),fary) ; ien of object
2225"RTN","C0XGET1",153,0)
2226 s zgraph=$$IENOF($g(graph),fary) ; ien of graph
2227"RTN","C0XGET1",154,0)
2228 I $G(DEBUG) W !,"s:",zsub," p:",zpred," o:",zobj
2229"RTN","C0XGET1",155,0)
2230 d trip(.tmprtn,zsub,zpred,zobj,zgraph,fary)
2231"RTN","C0XGET1",156,0)
2232 d ien2tary(.zrary,"tmprtn") ; convert to triples
2233"RTN","C0XGET1",157,0)
2234 ;
2235"RTN","C0XGET1",158,0)
2236 i form="json" d jsonout(.triplertn,.zrary) q ; what follows is 'else'
2237"RTN","C0XGET1",159,0)
2238 i form="rdf" d rdfout^C0XRDF(.triplertn,.zrary) q ;
2239"RTN","C0XGET1",160,0)
2240 i form="array" d arrayout(.triplertn,.zrary) q ;
2241"RTN","C0XGET1",161,0)
2242 i form="raw" d rawout(.triplertn,.zrary) q ;
2243"RTN","C0XGET1",162,0)
2244 w !,"form not supported: ",form
2245"RTN","C0XGET1",163,0)
2246 q
2247"RTN","C0XGET1",164,0)
2248 ;
2249"RTN","C0XGET1",165,0)
2250subjects(listrtn,pred,obj,graph,form,fary) ; return list of subjects
2251"RTN","C0XGET1",166,0)
2252 d onelist("S",,$g(pred),$g(obj),$g(fary)) ;subjects
2253"RTN","C0XGET1",167,0)
2254 q
2255"RTN","C0XGET1",168,0)
2256 ;
2257"RTN","C0XGET1",169,0)
2258subject(pred,obj,graph,form,fary) ; extrinsic which returns the first
2259"RTN","C0XGET1",170,0)
2260 ; multiple of return from subjects - returns null if more than one
2261"RTN","C0XGET1",171,0)
2262 ; subjects(.G,sub,pred)
2263"RTN","C0XGET1",172,0)
2264 ; G("nodeID:1234") ==> "nodeID:1234"
2265"RTN","C0XGET1",173,0)
2266 n zin,zrtn
2267"RTN","C0XGET1",174,0)
2268 d subjects(.zin,$g(pred),$g(obj),$g(form),$g(fary))
2269"RTN","C0XGET1",175,0)
2270 s zrtn=$o(zin(""))
2271"RTN","C0XGET1",176,0)
2272 i $o(zin(zrtn))'="" s zrtn=""
2273"RTN","C0XGET1",177,0)
2274 q zrtn
2275"RTN","C0XGET1",178,0)
2276 ;
2277"RTN","C0XGET1",179,0)
2278preds(listrtn,sub,obj,graph,form,fary) ; return list of subjects
2279"RTN","C0XGET1",180,0)
2280 d onelist("P",$g(sub),,$g(obj),$g(fary)) ;subjects
2281"RTN","C0XGET1",181,0)
2282 q
2283"RTN","C0XGET1",182,0)
2284 ;
2285"RTN","C0XGET1",183,0)
2286objects(listrtn,sub,pred,graph,form,fary) ; return list of subjects
2287"RTN","C0XGET1",184,0)
2288 d onelist("O",$g(sub),$g(pred),"",$g(fary)) ;subjects
2289"RTN","C0XGET1",185,0)
2290 q
2291"RTN","C0XGET1",186,0)
2292 ;
2293"RTN","C0XGET1",187,0)
2294object(sub,pred,graph,form,fary) ; extrinsic which returns the first
2295"RTN","C0XGET1",188,0)
2296 ; multiple of return from objects - returns null if more than one
2297"RTN","C0XGET1",189,0)
2298 ; objects(.G,sub,pred)
2299"RTN","C0XGET1",190,0)
2300 ; G("location") ==> "location"
2301"RTN","C0XGET1",191,0)
2302 n zin,zrtn
2303"RTN","C0XGET1",192,0)
2304 d objects(.zin,$g(sub),$g(pred),$g(form),$g(fary))
2305"RTN","C0XGET1",193,0)
2306 s zrtn=$o(zin(""))
2307"RTN","C0XGET1",194,0)
2308 i $o(zin(zrtn))'="" s zrtn=""
2309"RTN","C0XGET1",195,0)
2310 q zrtn
2311"RTN","C0XGET1",196,0)
2312 ;
2313"RTN","C0XGET1",197,0)
2314onelist(zw,sub,pred,obj,fary) ; returns list
2315"RTN","C0XGET1",198,0)
2316 ; zw is S P or O depending on what should be returned
2317"RTN","C0XGET1",199,0)
2318 I $g(fary)="" D ;
2319"RTN","C0XGET1",200,0)
2320 . D INITFARY^C0XF2N("C0XFARY")
2321"RTN","C0XGET1",201,0)
2322 . S fary="C0XFARY"
2323"RTN","C0XGET1",202,0)
2324 D USEFARY^C0XF2N(fary)
2325"RTN","C0XGET1",203,0)
2326 I '$D(form) S form="json"
2327"RTN","C0XGET1",204,0)
2328 k listrtn ; start with a clean return
2329"RTN","C0XGET1",205,0)
2330 n zsub,zpred,zobj,zgraph,tmprtn
2331"RTN","C0XGET1",206,0)
2332 s zsub=$$IENOF($$EXT^C0XUTIL($g(sub)),fary) ; ien of sub
2333"RTN","C0XGET1",207,0)
2334 s zpred=$$IENOF($$EXT^C0XUTIL($g(pred)),fary) ; ien of pred
2335"RTN","C0XGET1",208,0)
2336 s zobj=$$IENOF($$EXT^C0XUTIL($g(obj)),fary) ; ien of obj
2337"RTN","C0XGET1",209,0)
2338 s zgraph=$$IENOF($g(graph),fary) ; ien of graph
2339"RTN","C0XGET1",210,0)
2340 I $G(DEBUG) W !,"s:",zsub," p:",zpred," o:",zobj
2341"RTN","C0XGET1",211,0)
2342 n c0xflag,zi,zx,zt
2343"RTN","C0XGET1",212,0)
2344 s zt=$na(^C0X(101)) ;
2345"RTN","C0XGET1",213,0)
2346 s c0xflag=$$mask(zsub,zpred,zobj) ; get mask flags
2347"RTN","C0XGET1",214,0)
2348 k tmprtn
2349"RTN","C0XGET1",215,0)
2350 n itbl,ii,ix
2351"RTN","C0XGET1",216,0)
2352 s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"OSP") ; no constraint
2353"RTN","C0XGET1",217,0)
2354 s itbl("I000",ii)="d zip(.tmprtn,zt,zi)"
2355"RTN","C0XGET1",218,0)
2356 s ii=$s(zw="S":"OSP",zw="P":"OPS",zw="O":"OSP") ; obj constraint
2357"RTN","C0XGET1",219,0)
2358 s ix=$s(zw="O":"d just(zobj)",1:"d zip1(.tmprtn,zt,zi,zobj)")
2359"RTN","C0XGET1",220,0)
2360 s itbl("I001",ii)=ix
2361"RTN","C0XGET1",221,0)
2362 s ii=$s(zw="S":"PSO",zw="P":"POS",zw="O":"POS") ; pred constraint
2363"RTN","C0XGET1",222,0)
2364 s ix=$s(zw="P":"d just(zpred)",1:"d zip1(.tmprtn,zt,zi,zpred)")
2365"RTN","C0XGET1",223,0)
2366 s itbl("I010",ii)=ix
2367"RTN","C0XGET1",224,0)
2368 s ii=$s(zw="S":"POS",zw="P":"OPS",zw="O":"OSP") ; pred + obj constraint
2369"RTN","C0XGET1",225,0)
2370 s ix=$s(zw="S":"d zip2(.tmprtn,zt,zi,zpred,zobj)",zw="P":"d just(zpred)",zw="O":"d just(zobj)",1:"d just(zobj)")
2371"RTN","C0XGET1",226,0)
2372 s itbl("I011",ii)=ix
2373"RTN","C0XGET1",227,0)
2374 s ii=$s(zw="S":"SPO",zw="P":"SPO",zw="O":"SOP") ; sub constraint
2375"RTN","C0XGET1",228,0)
2376 s ix=$s(zw="S":"d just(zsub)",1:"d zip1(.tmprtn,zt,zi,zsub)")
2377"RTN","C0XGET1",229,0)
2378 s itbl("I100",ii)=ix
2379"RTN","C0XGET1",230,0)
2380 s ii=$s(zw="S":"SPO",zw="P":"SOP",zw="O":"OSP") ; sub + obj constraint
2381"RTN","C0XGET1",231,0)
2382 s ix=$s(zw="P":"d zip2(.tmprtn,zt,zi,zsub,zobj)",zw="S":"d just(zsub)",zw="O":"d just(zobj)",1:"d just(zobj)")
2383"RTN","C0XGET1",232,0)
2384 s itbl("I101",ii)=ix
2385"RTN","C0XGET1",233,0)
2386 s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"SPO") ; sub + pred constraint
2387"RTN","C0XGET1",234,0)
2388 s ix=$s(zw="O":"d zip2(.tmprtn,zt,zi,zsub,zpred)",zw="S":"d just(zsub)",zw="P":"d just(zpred)",1:"d just(zsub)")
2389"RTN","C0XGET1",235,0)
2390 s itbl("I110",ii)=ix
2391"RTN","C0XGET1",236,0)
2392 s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"OSP") ; sub + pred + obj constraint
2393"RTN","C0XGET1",237,0)
2394 s ix=$s(zw="O":"d just(zobj)",zw="S":"d just(zsub)",zw="P":"d just(zpred)",1:"d just(zsub)")
2395"RTN","C0XGET1",238,0)
2396 s itbl("I111",ii)=ix
2397"RTN","C0XGET1",239,0)
2398 ; end itbl definition
2399"RTN","C0XGET1",240,0)
2400 ;
2401"RTN","C0XGET1",241,0)
2402 s zi=$o(itbl(c0xflag,"")) ; find index to use
2403"RTN","C0XGET1",242,0)
2404 s zx=itbl(c0xflag,zi) ; executable instruction to run
2405"RTN","C0XGET1",243,0)
2406 ;i $g(ngraph)'="" s zi="G"_zi ; this is wrong.. don't do graphs yet
2407"RTN","C0XGET1",244,0)
2408 i $g(DEBUG) w !,c0xflag," ",zw," ",zt," ",zi," ",zx,!
2409"RTN","C0XGET1",245,0)
2410 ;zwr itbl
2411"RTN","C0XGET1",246,0)
2412 x zx
2413"RTN","C0XGET1",247,0)
2414 k listrtn
2415"RTN","C0XGET1",248,0)
2416 d strings(.listrtn,"tmprtn") ; convert pointer to strings
2417"RTN","C0XGET1",249,0)
2418 q
2419"RTN","C0XGET1",250,0)
2420 ;
2421"RTN","C0XGET1",251,0)
2422just(zin) ; add one element to tmprtn
2423"RTN","C0XGET1",252,0)
2424 s tmprtn(zin)=""
2425"RTN","C0XGET1",253,0)
2426 q
2427"RTN","C0XGET1",254,0)
2428 ;
2429"RTN","C0XGET1",255,0)
2430zip(zrtn,zt,zi) ; pull out just the first element of the index
2431"RTN","C0XGET1",256,0)
2432 ;
2433"RTN","C0XGET1",257,0)
2434 n zii s zii=""
2435"RTN","C0XGET1",258,0)
2436 f s zii=$o(@zt@(zi,zii)) q:zii="" d ;
2437"RTN","C0XGET1",259,0)
2438 . s zrtn(zii)=""
2439"RTN","C0XGET1",260,0)
2440 q
2441"RTN","C0XGET1",261,0)
2442 ;
2443"RTN","C0XGET1",262,0)
2444zip1(zrtn,zt,zi,zn) ; pull out just the first element of the index
2445"RTN","C0XGET1",263,0)
2446 ;
2447"RTN","C0XGET1",264,0)
2448 n zii s zii=""
2449"RTN","C0XGET1",265,0)
2450 f s zii=$o(@zt@(zi,zn,zii)) q:zii="" d ;
2451"RTN","C0XGET1",266,0)
2452 . s zrtn(zii)=""
2453"RTN","C0XGET1",267,0)
2454 q
2455"RTN","C0XGET1",268,0)
2456 ;
2457"RTN","C0XGET1",269,0)
2458zip2(zrtn,zt,zi,zn,zn1) ; pull out just the first element of the index
2459"RTN","C0XGET1",270,0)
2460 ;
2461"RTN","C0XGET1",271,0)
2462 n zii s zii=""
2463"RTN","C0XGET1",272,0)
2464 f s zii=$o(@zt@(zi,zn,zn1,zii)) q:zii="" d ;
2465"RTN","C0XGET1",273,0)
2466 . s zrtn(zii)=""
2467"RTN","C0XGET1",274,0)
2468 q
2469"RTN","C0XGET1",275,0)
2470 ;
2471"RTN","C0XGET1",276,0)
2472arrayout(rtn,zary) ; output an array of triples
2473"RTN","C0XGET1",277,0)
2474 ;
2475"RTN","C0XGET1",278,0)
2476 s zrsub=""
2477"RTN","C0XGET1",279,0)
2478 s zcnt=1
2479"RTN","C0XGET1",280,0)
2480 f s zrsub=$o(zary(zrsub)) q:zrsub="" d ; organized by subject
2481"RTN","C0XGET1",281,0)
2482 . s zzz=""
2483"RTN","C0XGET1",282,0)
2484 . f s zzz=$o(zary(zrsub,zzz)) q:zzz="" d ; pred and obj
2485"RTN","C0XGET1",283,0)
2486 . . s rtn(zcnt)=zrsub_"^"_zzz
2487"RTN","C0XGET1",284,0)
2488 . . s zcnt=zcnt+1
2489"RTN","C0XGET1",285,0)
2490 q
2491"RTN","C0XGET1",286,0)
2492 ;
2493"RTN","C0XGET1",287,0)
2494rawout(rtn,zary) ; output a mumps array of triples
2495"RTN","C0XGET1",288,0)
2496 ;
2497"RTN","C0XGET1",289,0)
2498 s zrsub=""
2499"RTN","C0XGET1",290,0)
2500 ;s zcnt=1
2501"RTN","C0XGET1",291,0)
2502 f s zrsub=$o(zary(zrsub)) q:zrsub="" d ; organized by subject
2503"RTN","C0XGET1",292,0)
2504 . s zzz=""
2505"RTN","C0XGET1",293,0)
2506 . f s zzz=$o(zary(zrsub,zzz)) q:zzz="" d ; pred and obj
2507"RTN","C0XGET1",294,0)
2508 . . s rtn(zrsub,$p(zzz,"^",1))=$p(zzz,"^",2)
2509"RTN","C0XGET1",295,0)
2510 . . ;s zcnt=zcnt+1
2511"RTN","C0XGET1",296,0)
2512 q
2513"RTN","C0XGET1",297,0)
2514 ;
2515"RTN","C0XGET1",298,0)
2516strings(zrary,zinary) ; convert pointers to strings
2517"RTN","C0XGET1",299,0)
2518 ;
2519"RTN","C0XGET1",300,0)
2520 k zrary
2521"RTN","C0XGET1",301,0)
2522 n zzz s zzz=""
2523"RTN","C0XGET1",302,0)
2524 f s zzz=$o(@zinary@(zzz)) q:zzz="" d ;
2525"RTN","C0XGET1",303,0)
2526 . n zs
2527"RTN","C0XGET1",304,0)
2528 . ;s zs=$$GET1^DIQ(C0XSFN,zzz_",",.01)
2529"RTN","C0XGET1",305,0)
2530 . s zs=$$NSP^C0XUTIL(zzz) ; get namespaced string
2531"RTN","C0XGET1",306,0)
2532 . q:zs=""
2533"RTN","C0XGET1",307,0)
2534 . s zrary(zs)="" ;
2535"RTN","C0XGET1",308,0)
2536 q
2537"RTN","C0XGET1",309,0)
2538 ;
2539"RTN","C0XGET1",310,0)
2540ien2tary(zrary,zinary) ; zinary is an array of iens passed by name
2541"RTN","C0XGET1",311,0)
2542 ; zrary is passed by reference and is return array of triples
2543"RTN","C0XGET1",312,0)
2544 ; format zrary(zsub,"zpred^zobj")=""
2545"RTN","C0XGET1",313,0)
2546 ;
2547"RTN","C0XGET1",314,0)
2548 k zrary ; start out clean
2549"RTN","C0XGET1",315,0)
2550 n zzz,zrsub,zrpred,zrobj,zgraph,zcnt
2551"RTN","C0XGET1",316,0)
2552 s zzz=""
2553"RTN","C0XGET1",317,0)
2554 f s zzz=$o(@zinary@(zzz)) q:zzz="" d ;
2555"RTN","C0XGET1",318,0)
2556 . s zrsub=$$GET1^DIQ(C0XTFN,zzz_",",.03,"E")
2557"RTN","C0XGET1",319,0)
2558 . s zrpred=$$GET1^DIQ(C0XTFN,zzz_",",.04,"E")
2559"RTN","C0XGET1",320,0)
2560 . s zrobj=$$GET1^DIQ(C0XTFN,zzz_",",.05,"E")
2561"RTN","C0XGET1",321,0)
2562 . s zrgraph=$$GET1^DIQ(C0XTFN,zzz_",",.02,"E")
2563"RTN","C0XGET1",322,0)
2564 . s zrary(zrsub,zrpred_"^"_zrobj)=""
2565"RTN","C0XGET1",323,0)
2566 q
2567"RTN","C0XGET1",324,0)
2568 ;
2569"RTN","C0XGET1",325,0)
2570jsonout(jout,zary) ;
2571"RTN","C0XGET1",326,0)
2572 d REPLYSTART^FMQLJSON("jout")
2573"RTN","C0XGET1",327,0)
2574 d LISTSTART^FMQLJSON("jout","results")
2575"RTN","C0XGET1",328,0)
2576 n zi s zi=""
2577"RTN","C0XGET1",329,0)
2578 f s zi=$o(zary(zi)) q:zi="" d ; for each subject
2579"RTN","C0XGET1",330,0)
2580 . n zii s zii=""
2581"RTN","C0XGET1",331,0)
2582 . D DICTSTART^FMQLJSON("jout",zi)
2583"RTN","C0XGET1",332,0)
2584 . f s zii=$o(zary(zi,zii)) q:zii="" d ; for each pred^obj pair
2585"RTN","C0XGET1",333,0)
2586 . . d DASSERT^FMQLJSON("jout",$p(zii,"^",1),$p(zii,"^",2))
2587"RTN","C0XGET1",334,0)
2588 . D DICTEND^FMQLJSON("jout")
2589"RTN","C0XGET1",335,0)
2590 d LISTEND^FMQLJSON("jout")
2591"RTN","C0XGET1",336,0)
2592 d REPLYEND^FMQLJSON("jout")
2593"RTN","C0XGET1",337,0)
2594 q
2595"RTN","C0XGET1",338,0)
2596 ;
2597"RTN","C0XGET1",339,0)
2598mask(zsub,zpred,zobj) ; function to return mask information
2599"RTN","C0XGET1",340,0)
2600 ; about the inputs ie I100 for just a subject and no pred or obj
2601"RTN","C0XGET1",341,0)
2602 n zf1,zf2,zf3,zflag
2603"RTN","C0XGET1",342,0)
2604 s zf1=$s($g(zsub)="":0,1:1)
2605"RTN","C0XGET1",343,0)
2606 s zf2=$s($g(zpred)="":0,1:1)
2607"RTN","C0XGET1",344,0)
2608 s zf3=$s($g(zobj)="":0,1:1)
2609"RTN","C0XGET1",345,0)
2610 s zflag="I"_zf1_zf2_zf3
2611"RTN","C0XGET1",346,0)
2612 q zflag
2613"RTN","C0XGET1",347,0)
2614 ;
2615"RTN","C0XGET1",348,0)
2616trip(triprtn,nsub,npred,nobj,ngraph,fary) ; returns triples iens
2617"RTN","C0XGET1",349,0)
2618 ; nsub,npred,nobj are all optional
2619"RTN","C0XGET1",350,0)
2620 ; graf is also optional, and will limit the search to a particular ngraph
2621"RTN","C0XGET1",351,0)
2622 ; fary is which triple store (not implemented yet)
2623"RTN","C0XGET1",352,0)
2624 n c0xflag,zi,zx,zt
2625"RTN","C0XGET1",353,0)
2626 s zt=$na(^C0X(101)) ;
2627"RTN","C0XGET1",354,0)
2628 s c0xflag=$$mask(nsub,npred,nobj) ; get mask flags
2629"RTN","C0XGET1",355,0)
2630 n itbl
2631"RTN","C0XGET1",356,0)
2632 s itbl("I000","SPO")="d do3(.triprtn,zt,zi)"
2633"RTN","C0XGET1",357,0)
2634 s itbl("I001","OSP")="d do2(.triprtn,zt,zi,nobj)"
2635"RTN","C0XGET1",358,0)
2636 s itbl("I010","PSO")="d do2(.triprtn,zt,zi,npred)"
2637"RTN","C0XGET1",359,0)
2638 s itbl("I011","POS")="d do1(.triprtn,zt,zi,npred,nobj)"
2639"RTN","C0XGET1",360,0)
2640 s itbl("I100","SPO")="d do2(.triprtn,zt,zi,nsub)"
2641"RTN","C0XGET1",361,0)
2642 s itbl("I101","SOP")="d do1(.triprtn,zt,zi,nsub,nobj)"
2643"RTN","C0XGET1",362,0)
2644 s itbl("I110","SPO")="d do1(.triprtn,zt,zi,nsub,npred)"
2645"RTN","C0XGET1",363,0)
2646 s itbl("I111","SPO")="d do0(.triprtn,zt,zi,nsub,npred,nobj)"
2647"RTN","C0XGET1",364,0)
2648 s zi=$o(itbl(c0xflag,""))
2649"RTN","C0XGET1",365,0)
2650 s zx=itbl(c0xflag,zi) ; executable instruction to run
2651"RTN","C0XGET1",366,0)
2652 i $g(ngraph)'="" s zi="G"_zi
2653"RTN","C0XGET1",367,0)
2654 i $g(DEBUG) w !,zx
2655"RTN","C0XGET1",368,0)
2656 x zx
2657"RTN","C0XGET1",369,0)
2658 q
2659"RTN","C0XGET1",370,0)
2660 ;
2661"RTN","C0XGET1",371,0)
2662do0(dortn,zt,zi,z1,z2,z3)
2663"RTN","C0XGET1",372,0)
2664 ; looking for only one triple
2665"RTN","C0XGET1",373,0)
2666 n zz
2667"RTN","C0XGET1",374,0)
2668 s zz=$o(@zt@(zi,z1,z2,z3,""))
2669"RTN","C0XGET1",375,0)
2670 i zz'="" s dortn(zz)=""
2671"RTN","C0XGET1",376,0)
2672 q
2673"RTN","C0XGET1",377,0)
2674 ;
2675"RTN","C0XGET1",378,0)
2676do1(dortn,zt,zi,z1,z2) ; have 2, looking for one
2677"RTN","C0XGET1",379,0)
2678 n zr,zx1
2679"RTN","C0XGET1",380,0)
2680 s zx1=""
2681"RTN","C0XGET1",381,0)
2682 f s zx1=$o(@zt@(zi,z1,z2,zx1)) q:zx1="" d ;
2683"RTN","C0XGET1",382,0)
2684 . s zr=$o(@zt@(zi,z1,z2,zx1,""))
2685"RTN","C0XGET1",383,0)
2686 . s dortn(zr)=""
2687"RTN","C0XGET1",384,0)
2688 q
2689"RTN","C0XGET1",385,0)
2690 ;
2691"RTN","C0XGET1",386,0)
2692do2(dortn,zt,zi,z1) ; have one, looking for 2
2693"RTN","C0XGET1",387,0)
2694 n zr,zx1,zx2
2695"RTN","C0XGET1",388,0)
2696 s (zx1,zx2)=""
2697"RTN","C0XGET1",389,0)
2698 f s zx1=$o(@zt@(zi,z1,zx1)) q:zx1="" d ;
2699"RTN","C0XGET1",390,0)
2700 . f s zx2=$o(@zt@(zi,z1,zx1,zx2)) q:zx2="" d ;
2701"RTN","C0XGET1",391,0)
2702 . . s zr=$o(@zt@(zi,z1,zx1,zx2,""))
2703"RTN","C0XGET1",392,0)
2704 . . s dortn(zr)=""
2705"RTN","C0XGET1",393,0)
2706 q
2707"RTN","C0XGET1",394,0)
2708 ;
2709"RTN","C0XGET1",395,0)
2710do3(dortn,zt,zi) ; have none, looking for three
2711"RTN","C0XGET1",396,0)
2712 n zr,zx1,zx2,zx3
2713"RTN","C0XGET1",397,0)
2714 s (zx1,zx2,zx3)=""
2715"RTN","C0XGET1",398,0)
2716 f s zx1=$o(@zt@(zi,zx1)) q:zx1="" d ;
2717"RTN","C0XGET1",399,0)
2718 . f s zx2=$o(@zt@(zi,zx1,zx2)) q:zx2="" d ;
2719"RTN","C0XGET1",400,0)
2720 . . f s zx3=$o(@zt@(zi,zx1,zx2,zx3)) q:zx3="" d ;
2721"RTN","C0XGET1",401,0)
2722 . . . s zr=$o(@zt@(zi,zx1,zx2,zx3,""))
2723"RTN","C0XGET1",402,0)
2724 . . . s dortn(zr)=""
2725"RTN","C0XGET1",403,0)
2726 q
2727"RTN","C0XGET1",404,0)
2728 ;
2729"RTN","C0XGET1",405,0)
2730IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE
2731"RTN","C0XGET1",406,0)
2732 I '$D(FARY) D ;
2733"RTN","C0XGET1",407,0)
2734 . D INITFARY^C0XF2N("C0XFARY")
2735"RTN","C0XGET1",408,0)
2736 . S FARY="C0XFARY"
2737"RTN","C0XGET1",409,0)
2738 N ZIEN
2739"RTN","C0XGET1",410,0)
2740 I $G(ZSTRING)="" Q "" ; NO STRING
2741"RTN","C0XGET1",411,0)
2742 S ZIEN=$O(@C0XSN@("B",$$EXT^C0XUTIL(ZSTRING),""))
2743"RTN","C0XGET1",412,0)
2744 I ZIEN="" S ZIEN=-1
2745"RTN","C0XGET1",413,0)
2746 Q ZIEN
2747"RTN","C0XGET1",414,0)
2748 ;
2749"RTN","C0XGET1",415,0)
2750IENOFA(ZOUTARY,INARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE
2751"RTN","C0XGET1",416,0)
2752 ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)=""
2753"RTN","C0XGET1",417,0)
2754 I '$D(FARY) D ;
2755"RTN","C0XGET1",418,0)
2756 . D INITFARY^C0XF2N("C0XFARY")
2757"RTN","C0XGET1",419,0)
2758 . S FARY="C0XFARY"
2759"RTN","C0XGET1",420,0)
2760 K ZOUTARY ; START WITH CLEAN RESULTS
2761"RTN","C0XGET1",421,0)
2762 K C0XFDA2 ; USE A SEPARATE FDA FOR THIS
2763"RTN","C0XGET1",422,0)
2764 I '$D(C0XVOC) D VOCINIT^C0XUTIL
2765"RTN","C0XGET1",423,0)
2766 N ZINARY
2767"RTN","C0XGET1",424,0)
2768 N ZI S ZI=""
2769"RTN","C0XGET1",425,0)
2770 F S ZI=$O(INARY(ZI)) Q:ZI="" D ;
2771"RTN","C0XGET1",426,0)
2772 . N ZK
2773"RTN","C0XGET1",427,0)
2774 . S ZK=$O(INARY(ZI,""))
2775"RTN","C0XGET1",428,0)
2776 . S ZINARY($$EXT^C0XUTIL(ZI),$$EXT^C0XUTIL(ZK))=""
2777"RTN","C0XGET1",429,0)
2778 N ZV,ZIEN
2779"RTN","C0XGET1",430,0)
2780 N ZCNT S ZCNT=0
2781"RTN","C0XGET1",431,0)
2782 F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS
2783"RTN","C0XGET1",432,0)
2784 . S ZV=$O(ZINARY(ZI,""))
2785"RTN","C0XGET1",433,0)
2786 . I ZV["^" S ZV=$TR(ZV,"^","|")
2787"RTN","C0XGET1",434,0)
2788 F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOW GET ALL IENS
2789"RTN","C0XGET1",435,0)
2790 . S ZV=$O(ZINARY(ZI,""))
2791"RTN","C0XGET1",436,0)
2792 . I ZV["^" S ZV=$TR(ZV,"^","|")
2793"RTN","C0XGET1",437,0)
2794 . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW
2795"RTN","C0XGET1",438,0)
2796 . I ZIEN="" S ZOUTARY("IEN",ZI)=""
2797"RTN","C0XGET1",439,0)
2798 . E S ZOUTARY("IEN",ZI,ZIEN)=""
2799"RTN","C0XGET1",440,0)
2800 Q
2801"RTN","C0XGET1",441,0)
2802 ;
2803"RTN","C0XGET1",442,0)
2804output(zwhat,zfname,zdir) ; function to write an array to a host file
2805"RTN","C0XGET1",443,0)
2806 ; if zdir is ommitted, will output to the CCR directory
2807"RTN","C0XGET1",444,0)
2808 ; ^TMP("C0CCCR","ODIR")
2809"RTN","C0XGET1",445,0)
2810 ; if fname is ommitted, will output yyyy-mm-dd-hh-mm-ss-C0XOUT.out
2811"RTN","C0XGET1",446,0)
2812 ; zwhat is passed by name
2813"RTN","C0XGET1",447,0)
2814 ;
2815"RTN","C0XGET1",448,0)
2816 i '$d(zdir) s zdir=$G(^TMP("C0CCCR","ODIR"))
2817"RTN","C0XGET1",449,0)
2818 i '$d(zfname) d ;
2819"RTN","C0XGET1",450,0)
2820 . s zfname=$$FMTE^XLFDT($$NOW^XLFDT,7)
2821"RTN","C0XGET1",451,0)
2822 . s zfname=$tr(zfname,"/","-")
2823"RTN","C0XGET1",452,0)
2824 . s zfname=$tr(zfname,"@","-")
2825"RTN","C0XGET1",453,0)
2826 . s zfname=$tr(zfname,":","-")
2827"RTN","C0XGET1",454,0)
2828 . s zfname=zfname_".out"
2829"RTN","C0XGET1",455,0)
2830 i $e(zwhat,1,1)'="^" d ; not a global
2831"RTN","C0XGET1",456,0)
2832 . k ^TMP("C0XOUT",$J)
2833"RTN","C0XGET1",457,0)
2834 . m ^TMP("C0XOUT",$J)=@zwhat
2835"RTN","C0XGET1",458,0)
2836 . s zwhat=$na(^TMP("C0XOUT",$J,1))
2837"RTN","C0XGET1",459,0)
2838 n zout s zout=""
2839"RTN","C0XGET1",460,0)
2840 s zout=$$OUTPUT^C0CXPATH(zwhat,zfname,zdir)
2841"RTN","C0XGET1",461,0)
2842 K ^TMP("C0XOUT",$J)
2843"RTN","C0XGET1",462,0)
2844 Q zout
2845"RTN","C0XGET1",463,0)
2846 ;
2847"RTN","C0XGET1",464,0)
2848tagText(ztag) ; extrinsic which returns the location of the text
2849"RTN","C0XGET1",465,0)
2850 ; associated with ztag
2851"RTN","C0XGET1",466,0)
2852 n zs,zo
2853"RTN","C0XGET1",467,0)
2854 s zs=$$subject("fmts:fileTag",ztag)
2855"RTN","C0XGET1",468,0)
2856 i zs="" d q "" ;
2857"RTN","C0XGET1",469,0)
2858 . w !,"error, tag is either missing or there are more than one ",ztag
2859"RTN","C0XGET1",470,0)
2860 s zo=$$object(zs,"fmts:fileSource")
2861"RTN","C0XGET1",471,0)
2862 i zo="" d q "" ;
2863"RTN","C0XGET1",472,0)
2864 . w !,"error, tag source not found ",zs
2865"RTN","C0XGET1",473,0)
2866 w !,zo
2867"RTN","C0XGET1",474,0)
2868 q $$WHERETXT^C0XF2N(zo)
2869"RTN","C0XGET1",475,0)
2870 ;
2871"RTN","C0XGET1",476,0)
2872tagRoot(ztag) ; extrinsic which returns the root for graphs and subjects
2873"RTN","C0XGET1",477,0)
2874 ; associated with ztag
2875"RTN","C0XGET1",478,0)
2876 n zs,zo
2877"RTN","C0XGET1",479,0)
2878 s zs=$$subject("fmts:fileTag",ztag)
2879"RTN","C0XGET1",480,0)
2880 i zs="" d q "" ;
2881"RTN","C0XGET1",481,0)
2882 . w !,"error, tag is either missing or there are more than one ",ztag
2883"RTN","C0XGET1",482,0)
2884 s zo=$$object(zs,"fmts:root")
2885"RTN","C0XGET1",483,0)
2886 i zo="" d q "" ;
2887"RTN","C0XGET1",484,0)
2888 . w !,"error, root not found ",zs
2889"RTN","C0XGET1",485,0)
2890 ;w !,zo
2891"RTN","C0XGET1",486,0)
2892 q zo
2893"RTN","C0XGET1",487,0)
2894 ;
2895"RTN","C0XINIT")
28960^4^B21176787
2897"RTN","C0XINIT",1,0)
2898C0XINIT ; GPL - Fileman Triples initialization routine ;10/13/11 17:05
2899"RTN","C0XINIT",2,0)
2900 ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11
2901"RTN","C0XINIT",3,0)
2902 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU
2903"RTN","C0XINIT",4,0)
2904 ;General Public License See attached copy of the License.
2905"RTN","C0XINIT",5,0)
2906 ;
2907"RTN","C0XINIT",6,0)
2908 ;This program is free software; you can redistribute it and/or modify
2909"RTN","C0XINIT",7,0)
2910 ;it under the terms of the GNU General Public License as published by
2911"RTN","C0XINIT",8,0)
2912 ;the Free Software Foundation; either version 2 of the License, or
2913"RTN","C0XINIT",9,0)
2914 ;(at your option) any later version.
2915"RTN","C0XINIT",10,0)
2916 ;
2917"RTN","C0XINIT",11,0)
2918 ;This program is distributed in the hope that it will be useful,
2919"RTN","C0XINIT",12,0)
2920 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
2921"RTN","C0XINIT",13,0)
2922 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2923"RTN","C0XINIT",14,0)
2924 ;GNU General Public License for more details.
2925"RTN","C0XINIT",15,0)
2926 ;
2927"RTN","C0XINIT",16,0)
2928 ;You should have received a copy of the GNU General Public License along
2929"RTN","C0XINIT",17,0)
2930 ;with this program; if not, write to the Free Software Foundation, Inc.,
2931"RTN","C0XINIT",18,0)
2932 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2933"RTN","C0XINIT",19,0)
2934 ;
2935"RTN","C0XINIT",20,0)
2936 Q
2937"RTN","C0XINIT",21,0)
2938 ;
2939"RTN","C0XINIT",22,0)
2940CLEAR ; DELETE THE FILESTORE
2941"RTN","C0XINIT",23,0)
2942 K ^C0X(101)
2943"RTN","C0XINIT",24,0)
2944 K ^C0X(201)
2945"RTN","C0XINIT",25,0)
2946 S ^C0X(101,0)="C0X TRIPLE^172.101I^^"
2947"RTN","C0XINIT",26,0)
2948 S ^C0X(201,0)="C0X STRING^172.201I^^"
2949"RTN","C0XINIT",27,0)
2950 Q
2951"RTN","C0XINIT",28,0)
2952 ;
2953"RTN","C0XINIT",29,0)
2954INIT ; INITIALIZE THE TRIPLE STORE - THIS DELETES THE GLOBALS AND
2955"RTN","C0XINIT",30,0)
2956 ; START ALL OVER... USE WITH CAUTION
2957"RTN","C0XINIT",31,0)
2958 ;
2959"RTN","C0XINIT",32,0)
2960 ; -- we should be more sophisticated here.. at least warn the user
2961"RTN","C0XINIT",33,0)
2962 ; -- and give them a chance to cancel
2963"RTN","C0XINIT",34,0)
2964 ;
2965"RTN","C0XINIT",35,0)
2966 D CLEAR ; DELETE THE TRIPLESTORE
2967"RTN","C0XINIT",36,0)
2968 ;
2969"RTN","C0XINIT",37,0)
2970 ; -- we are assuming that FARY is set up properly in C0XF2N
2971"RTN","C0XINIT",38,0)
2972 ; -- with repect to the default directory and the defaut fileman files
2973"RTN","C0XINIT",39,0)
2974 ; -- here's what it is now: "/home/vista/gpl/fmts/trunk/samples/"
2975"RTN","C0XINIT",40,0)
2976 ; -- that means that all the sample files will look like:
2977"RTN","C0XINIT",41,0)
2978 ; --- qds/QDS_0001.rdf
2979"RTN","C0XINIT",42,0)
2980 ; --- smart-rdf-in/small.rdf
2981"RTN","C0XINIT",43,0)
2982 ;
2983"RTN","C0XINIT",44,0)
2984 S FARY="C0XFARY"
2985"RTN","C0XINIT",45,0)
2986 D INITFARY^C0XF2N(FARY)
2987"RTN","C0XINIT",46,0)
2988 D USEFARY^C0XF2N(FARY)
2989"RTN","C0XINIT",47,0)
2990 S C0XFARY("C0XDIR")="/home/vista/gpl/fmts/trunk/samples/smart-rdf-in/" ;
2991"RTN","C0XINIT",48,0)
2992 D USEFARY^C0XF2N(FARY)
2993"RTN","C0XINIT",49,0)
2994 S SMART(1)="cole-susan.rdf"
2995"RTN","C0XINIT",50,0)
2996 S SMART(2)="jones-cynthia.rdf"
2997"RTN","C0XINIT",51,0)
2998 S SMART(3)="small.rdf"
2999"RTN","C0XINIT",52,0)
3000 S SMART(4)="collins-frank.rdf"
3001"RTN","C0XINIT",53,0)
3002 S SMART(5)="kelly-david.rdf"
3003"RTN","C0XINIT",54,0)
3004 S SMART(6)="smith-maria.rdf"
3005"RTN","C0XINIT",55,0)
3006 S SMART(7)="ford-shirley.rdf"
3007"RTN","C0XINIT",56,0)
3008 S SMART(8)="morgan-jason.rdf"
3009"RTN","C0XINIT",57,0)
3010 S SMART(9)="west-lisa.rdf"
3011"RTN","C0XINIT",58,0)
3012 S SMART(10)="gracia-paul.rdf"
3013"RTN","C0XINIT",59,0)
3014 S SMART(11)="reed-richard.rdf"
3015"RTN","C0XINIT",60,0)
3016 S SMART(12)="west-sandra.rdf"
3017"RTN","C0XINIT",61,0)
3018 S SMART(13)="jackson-jessica.rdf"
3019"RTN","C0XINIT",62,0)
3020 S SMART(14)="small-allergies.rdf"
3021"RTN","C0XINIT",63,0)
3022 S SMART(15)="white-patricia.rdf"
3023"RTN","C0XINIT",64,0)
3024 N ZI S ZI=""
3025"RTN","C0XINIT",65,0)
3026 F S ZI=$O(SMART(ZI)) Q:ZI="" D ; for each smart file
3027"RTN","C0XINIT",66,0)
3028 . D IMPORT^C0XF2N(SMART(ZI),C0XDIR,,FARY) ; import to the triplestore
3029"RTN","C0XINIT",67,0)
3030 S FARY="C0XFARY"
3031"RTN","C0XINIT",68,0)
3032 S C0XFARY("C0XDIR")="/home/vista/gpl/fmts/trunk/samples/qds/"
3033"RTN","C0XINIT",69,0)
3034 D USEFARY^C0XF2N(FARY)
3035"RTN","C0XINIT",70,0)
3036 D IMPORT^C0XF2N("QDS_0001.rdf",C0XDIR,,FARY)
3037"RTN","C0XINIT",71,0)
3038 D IMPORT^C0XF2N("QDS_0028b.rdf",C0XDIR,,FARY)
3039"RTN","C0XINIT",72,0)
3040 D IMPORT^C0XF2N("QDS_0052.rdf",C0XDIR,,FARY)
3041"RTN","C0XINIT",73,0)
3042 D IMPORT^C0XF2N("QDS_0073.rdf",C0XDIR,,FARY)
3043"RTN","C0XINIT",74,0)
3044 D IMPORT^C0XF2N("QDS_0385.rdf",C0XDIR,,FARY)
3045"RTN","C0XINIT",75,0)
3046 D IMPORT^C0XF2N("QDS_0002.rdf",C0XDIR,,FARY)
3047"RTN","C0XINIT",76,0)
3048 D IMPORT^C0XF2N("QDS_0031.rdf",C0XDIR,,FARY)
3049"RTN","C0XINIT",77,0)
3050 D IMPORT^C0XF2N("QDS_0055.rdf",C0XDIR,,FARY)
3051"RTN","C0XINIT",78,0)
3052 D IMPORT^C0XF2N("QDS_0074.rdf",C0XDIR,,FARY)
3053"RTN","C0XINIT",79,0)
3054 D IMPORT^C0XF2N("QDS_0387.rdf",C0XDIR,,FARY)
3055"RTN","C0XINIT",80,0)
3056 D IMPORT^C0XF2N("QDS_0004.rdf",C0XDIR,,FARY)
3057"RTN","C0XINIT",81,0)
3058 D IMPORT^C0XF2N("QDS_0032.rdf",C0XDIR,,FARY)
3059"RTN","C0XINIT",82,0)
3060 D IMPORT^C0XF2N("QDS_0056.rdf",C0XDIR,,FARY)
3061"RTN","C0XINIT",83,0)
3062 D IMPORT^C0XF2N("QDS_0075.rdf",C0XDIR,,FARY)
3063"RTN","C0XINIT",84,0)
3064 D IMPORT^C0XF2N("QDS_0389.rdf",C0XDIR,,FARY)
3065"RTN","C0XINIT",85,0)
3066 D IMPORT^C0XF2N("QDS_0012.rdf",C0XDIR,,FARY)
3067"RTN","C0XINIT",86,0)
3068 D IMPORT^C0XF2N("QDS_0033.rdf",C0XDIR,,FARY)
3069"RTN","C0XINIT",87,0)
3070 D IMPORT^C0XF2N("QDS_0059.rdf",C0XDIR,,FARY)
3071"RTN","C0XINIT",88,0)
3072 D IMPORT^C0XF2N("QDS_0081.rdf",C0XDIR,,FARY)
3073"RTN","C0XINIT",89,0)
3074 D IMPORT^C0XF2N("QDS_0421.rdf",C0XDIR,,FARY)
3075"RTN","C0XINIT",90,0)
3076 D IMPORT^C0XF2N("QDS_0013.rdf",C0XDIR,,FARY)
3077"RTN","C0XINIT",91,0)
3078 D IMPORT^C0XF2N("QDS_0034.rdf",C0XDIR,,FARY)
3079"RTN","C0XINIT",92,0)
3080 D IMPORT^C0XF2N("QDS_0061.rdf",C0XDIR,,FARY)
3081"RTN","C0XINIT",93,0)
3082 D IMPORT^C0XF2N("QDS_0083.rdf",C0XDIR,,FARY)
3083"RTN","C0XINIT",94,0)
3084 D IMPORT^C0XF2N("QDS_0575.rdf",C0XDIR,,FARY)
3085"RTN","C0XINIT",95,0)
3086 D IMPORT^C0XF2N("QDS_0014.rdf",C0XDIR,,FARY)
3087"RTN","C0XINIT",96,0)
3088 D IMPORT^C0XF2N("QDS_0036.rdf",C0XDIR,,FARY)
3089"RTN","C0XINIT",97,0)
3090 D IMPORT^C0XF2N("QDS_0062.rdf",C0XDIR,,FARY)
3091"RTN","C0XINIT",98,0)
3092 D IMPORT^C0XF2N("QDS_0084.rdf",C0XDIR,,FARY)
3093"RTN","C0XINIT",99,0)
3094 D IMPORT^C0XF2N("QDS_0018.rdf",C0XDIR,,FARY)
3095"RTN","C0XINIT",100,0)
3096 D IMPORT^C0XF2N("QDS_0038.rdf",C0XDIR,,FARY)
3097"RTN","C0XINIT",101,0)
3098 D IMPORT^C0XF2N("QDS_0064.rdf",C0XDIR,,FARY)
3099"RTN","C0XINIT",102,0)
3100 D IMPORT^C0XF2N("QDS_0086.rdf",C0XDIR,,FARY)
3101"RTN","C0XINIT",103,0)
3102 D IMPORT^C0XF2N("QDS_0024.rdf",C0XDIR,,FARY)
3103"RTN","C0XINIT",104,0)
3104 D IMPORT^C0XF2N("QDS_0041.rdf",C0XDIR,,FARY)
3105"RTN","C0XINIT",105,0)
3106 D IMPORT^C0XF2N("QDS_0067.rdf",C0XDIR,,FARY)
3107"RTN","C0XINIT",106,0)
3108 D IMPORT^C0XF2N("QDS_0088.rdf",C0XDIR,,FARY)
3109"RTN","C0XINIT",107,0)
3110 D IMPORT^C0XF2N("QDS_0027.rdf",C0XDIR,,FARY)
3111"RTN","C0XINIT",108,0)
3112 D IMPORT^C0XF2N("QDS_0043.rdf",C0XDIR,,FARY)
3113"RTN","C0XINIT",109,0)
3114 D IMPORT^C0XF2N("QDS_0068.rdf",C0XDIR,,FARY)
3115"RTN","C0XINIT",110,0)
3116 D IMPORT^C0XF2N("QDS_0089.rdf",C0XDIR,,FARY)
3117"RTN","C0XINIT",111,0)
3118 D IMPORT^C0XF2N("QDS_0028a.rdf",C0XDIR,,FARY)
3119"RTN","C0XINIT",112,0)
3120 D IMPORT^C0XF2N("QDS_0047.rdf",C0XDIR,,FARY)
3121"RTN","C0XINIT",113,0)
3122 D IMPORT^C0XF2N("QDS_0070.rdf",C0XDIR,,FARY)
3123"RTN","C0XINIT",114,0)
3124 D IMPORT^C0XF2N("QDS_0105.rdf",C0XDIR,,FARY)
3125"RTN","C0XINIT",115,0)
3126 ;D IMPORT^C0XF2N("qds.rdf",C0XDIR,,FARY)
3127"RTN","C0XINIT",116,0)
3128 Q
3129"RTN","C0XINIT",117,0)
3130 ;
3131"RTN","C0XMAIN")
31320^1^B115393527
3133"RTN","C0XMAIN",1,0)
3134C0XMAIN ; GPL - Fileman Triples entry point routine ;10/13/11 17:05
3135"RTN","C0XMAIN",2,0)
3136 ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11
3137"RTN","C0XMAIN",3,0)
3138 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU
3139"RTN","C0XMAIN",4,0)
3140 ;General Public License See attached copy of the License.
3141"RTN","C0XMAIN",5,0)
3142 ;
3143"RTN","C0XMAIN",6,0)
3144 ;This program is free software; you can redistribute it and/or modify
3145"RTN","C0XMAIN",7,0)
3146 ;it under the terms of the GNU General Public License as published by
3147"RTN","C0XMAIN",8,0)
3148 ;the Free Software Foundation; either version 2 of the License, or
3149"RTN","C0XMAIN",9,0)
3150 ;(at your option) any later version.
3151"RTN","C0XMAIN",10,0)
3152 ;
3153"RTN","C0XMAIN",11,0)
3154 ;This program is distributed in the hope that it will be useful,
3155"RTN","C0XMAIN",12,0)
3156 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
3157"RTN","C0XMAIN",13,0)
3158 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3159"RTN","C0XMAIN",14,0)
3160 ;GNU General Public License for more details.
3161"RTN","C0XMAIN",15,0)
3162 ;
3163"RTN","C0XMAIN",16,0)
3164 ;You should have received a copy of the GNU General Public License along
3165"RTN","C0XMAIN",17,0)
3166 ;with this program; if not, write to the Free Software Foundation, Inc.,
3167"RTN","C0XMAIN",18,0)
3168 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
3169"RTN","C0XMAIN",19,0)
3170 ;
3171"RTN","C0XMAIN",20,0)
3172 Q
3173"RTN","C0XMAIN",21,0)
3174 ;
3175"RTN","C0XMAIN",22,0)
3176INITFARY(ZFARY) ; INITIALIZE FILE NUMBERS AND OTHER USEFUL THINGS
3177"RTN","C0XMAIN",23,0)
3178 ; FOR THE DEFAULT TRIPLE STORE. USE OTHER VALUES FOR SUPPORTING ADDITIONAL
3179"RTN","C0XMAIN",24,0)
3180 ; TRIPLE STORES
3181"RTN","C0XMAIN",25,0)
3182 S @ZFARY@("C0XTFN")=172.101 ; TRIPLES FILE NUMBER
3183"RTN","C0XMAIN",26,0)
3184 S @ZFARY@("C0XSFN")=172.201 ; TRIPLES STRINGS FILE NUMBER
3185"RTN","C0XMAIN",27,0)
3186 S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME
3187"RTN","C0XMAIN",28,0)
3188 S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME
3189"RTN","C0XMAIN",29,0)
3190 ;S @ZFARY@("C0XDIR")="/home/glilly/all_smart_patient_data/smart-rdf/"
3191"RTN","C0XMAIN",30,0)
3192 S @ZFARY@("C0XDIR")="/home/george/fmts/trunk/samples/"
3193"RTN","C0XMAIN",31,0)
3194 D USEFARY(ZFARY)
3195"RTN","C0XMAIN",32,0)
3196 Q
3197"RTN","C0XMAIN",33,0)
3198 ;
3199"RTN","C0XMAIN",34,0)
3200USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY
3201"RTN","C0XMAIN",35,0)
3202 N ZI S ZI=""
3203"RTN","C0XMAIN",36,0)
3204 F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D
3205"RTN","C0XMAIN",37,0)
3206 . ;N ZX
3207"RTN","C0XMAIN",38,0)
3208 . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_""""
3209"RTN","C0XMAIN",39,0)
3210 . ;W !,ZX
3211"RTN","C0XMAIN",40,0)
3212 . X ZX
3213"RTN","C0XMAIN",41,0)
3214 Q
3215"RTN","C0XMAIN",42,0)
3216 ;
3217"RTN","C0XMAIN",43,0)
3218IMPORT(FNAME,FDIR,FURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD
3219"RTN","C0XMAIN",44,0)
3220 ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE
3221"RTN","C0XMAIN",45,0)
3222 ; NODE NAME OF THE TEXT TRIPLE
3223"RTN","C0XMAIN",46,0)
3224 ; FDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR)
3225"RTN","C0XMAIN",47,0)
3226 ; FURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE
3227"RTN","C0XMAIN",48,0)
3228 ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE
3229"RTN","C0XMAIN",49,0)
3230 I '$D(FARY) D ;
3231"RTN","C0XMAIN",50,0)
3232 . D INITFARY("C0XFARY")
3233"RTN","C0XMAIN",51,0)
3234 . S FARY="C0XFARY"
3235"RTN","C0XMAIN",52,0)
3236 D USEFARY(FARY)
3237"RTN","C0XMAIN",53,0)
3238 N ZD,ZTMP
3239"RTN","C0XMAIN",54,0)
3240 I '$D(FDIR) S FDIR=C0XDIR ; DIRECTORY OF THE RDF FILE
3241"RTN","C0XMAIN",55,0)
3242 I '$D(FURL) D ;
3243"RTN","C0XMAIN",56,0)
3244 . N ZN2 S ZN2=$TR(FNAME,".","_") ; REMOVE THE DOT FROM THE NAME
3245"RTN","C0XMAIN",57,0)
3246 . S FURL=FDIR_ZN2
3247"RTN","C0XMAIN",58,0)
3248 N ZTMP
3249"RTN","C0XMAIN",59,0)
3250 S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE
3251"RTN","C0XMAIN",60,0)
3252 K @ZTMP ; MAKE SURE IT'S CLEAR
3253"RTN","C0XMAIN",61,0)
3254 S C0XSTART=$$NOW^XLFDT
3255"RTN","C0XMAIN",62,0)
3256 W !,"STARTED: ",C0XSTART
3257"RTN","C0XMAIN",63,0)
3258 W !,"READING IN: ",FNAME
3259"RTN","C0XMAIN",64,0)
3260 I '$$FILEIN(ZTMP,FDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS
3261"RTN","C0XMAIN",65,0)
3262 . W !,"ERROR READING FILE: ",FDIR,FNAME
3263"RTN","C0XMAIN",66,0)
3264 S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT
3265"RTN","C0XMAIN",67,0)
3266 W !,$O(@ZRDF@(""),-1)," LINES READ"
3267"RTN","C0XMAIN",68,0)
3268 D INSRDF(ZRDF,FURL,FARY) ; IMPORT AND PROCESS THE RDF
3269"RTN","C0XMAIN",69,0)
3270 Q
3271"RTN","C0XMAIN",70,0)
3272 ;
3273"RTN","C0XMAIN",71,0)
3274WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT
3275"RTN","C0XMAIN",72,0)
3276 ;
3277"RTN","C0XMAIN",73,0)
3278 I '$D(FARY) D ;
3279"RTN","C0XMAIN",74,0)
3280 . D INITFARY("C0XFARY")
3281"RTN","C0XMAIN",75,0)
3282 . S FARY="C0XFARY"
3283"RTN","C0XMAIN",76,0)
3284 D USEFARY(FARY)
3285"RTN","C0XMAIN",77,0)
3286 ;N ZLOC,ZTMP
3287"RTN","C0XMAIN",78,0)
3288 K ZTMP
3289"RTN","C0XMAIN",79,0)
3290 S ZLOC=$NA(^TMP("C0X","WGET",$J))
3291"RTN","C0XMAIN",80,0)
3292 S C0XSTART=$$NOW^XLFDT
3293"RTN","C0XMAIN",81,0)
3294 W !,"STARTED: ",C0XSTART
3295"RTN","C0XMAIN",82,0)
3296 W !,"DOWNLOADING: ",ZURL
3297"RTN","C0XMAIN",83,0)
3298 S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP)
3299"RTN","C0XMAIN",84,0)
3300 M @ZLOC=ZTMP
3301"RTN","C0XMAIN",85,0)
3302 W !,$O(@ZLOC@(""),-1)," LINES READ"
3303"RTN","C0XMAIN",86,0)
3304 D INSRDF(ZLOC,ZURL,FARY)
3305"RTN","C0XMAIN",87,0)
3306 Q
3307"RTN","C0XMAIN",88,0)
3308 ;
3309"RTN","C0XMAIN",89,0)
3310INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS
3311"RTN","C0XMAIN",90,0)
3312 ; ZRDF IS PASSED BY NAME
3313"RTN","C0XMAIN",91,0)
3314 I '$D(FARY) D ;
3315"RTN","C0XMAIN",92,0)
3316 . D INITFARY("C0XFARY")
3317"RTN","C0XMAIN",93,0)
3318 . S FARY="C0XFARY"
3319"RTN","C0XMAIN",94,0)
3320 D USEFARY(FARY)
3321"RTN","C0XMAIN",95,0)
3322 N ZGRAPH,ZSUBJECT
3323"RTN","C0XMAIN",96,0)
3324 S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME
3325"RTN","C0XMAIN",97,0)
3326 S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT
3327"RTN","C0XMAIN",98,0)
3328 D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY)
3329"RTN","C0XMAIN",99,0)
3330 N ZTXTNM
3331"RTN","C0XMAIN",100,0)
3332 S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE
3333"RTN","C0XMAIN",101,0)
3334 D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY)
3335"RTN","C0XMAIN",102,0)
3336 D UPDIE(.C0XFDA) ; TRY IT OUT
3337"RTN","C0XMAIN",103,0)
3338 K C0XCNT ;RESET FOR NEXT TIME
3339"RTN","C0XMAIN",104,0)
3340 D STORETXT(ZRDF,ZTXTNM,FARY)
3341"RTN","C0XMAIN",105,0)
3342 W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM
3343"RTN","C0XMAIN",106,0)
3344 D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF
3345"RTN","C0XMAIN",107,0)
3346 Q
3347"RTN","C0XMAIN",108,0)
3348 ;
3349"RTN","C0XMAIN",109,0)
3350STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME
3351"RTN","C0XMAIN",110,0)
3352 ;
3353"RTN","C0XMAIN",111,0)
3354 I '$D(FARY) D ;
3355"RTN","C0XMAIN",112,0)
3356 . D INITFARY("C0XFARY")
3357"RTN","C0XMAIN",113,0)
3358 . S FARY="C0XFARY"
3359"RTN","C0XMAIN",114,0)
3360 D USEFARY(FARY)
3361"RTN","C0XMAIN",115,0)
3362 N ZIEN
3363"RTN","C0XMAIN",116,0)
3364 S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN
3365"RTN","C0XMAIN",117,0)
3366 D CLEAN^DILF
3367"RTN","C0XMAIN",118,0)
3368 K ZERR
3369"RTN","C0XMAIN",119,0)
3370 D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR")
3371"RTN","C0XMAIN",120,0)
3372 I $D(ZERR) D ;
3373"RTN","C0XMAIN",121,0)
3374 . ZWR ZERR
3375"RTN","C0XMAIN",122,0)
3376 Q
3377"RTN","C0XMAIN",123,0)
3378 ;
3379"RTN","C0XMAIN",124,0)
3380GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT
3381"RTN","C0XMAIN",125,0)
3382 ; ZRTN IS PASSED BY REFERENCE
3383"RTN","C0XMAIN",126,0)
3384 I '$D(FARY) D ;
3385"RTN","C0XMAIN",127,0)
3386 . D INITFARY("C0XFARY")
3387"RTN","C0XMAIN",128,0)
3388 . S FARY="C0XFARY"
3389"RTN","C0XMAIN",129,0)
3390 D USEFARY(FARY)
3391"RTN","C0XMAIN",130,0)
3392 N ZIEN
3393"RTN","C0XMAIN",131,0)
3394 S ZIEN=$$IENOF(ZNAME)
3395"RTN","C0XMAIN",132,0)
3396 S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN")
3397"RTN","C0XMAIN",133,0)
3398 Q
3399"RTN","C0XMAIN",134,0)
3400 ;
3401"RTN","C0XMAIN",135,0)
3402WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL
3403"RTN","C0XMAIN",136,0)
3404 ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING
3405"RTN","C0XMAIN",137,0)
3406 I '$D(FARY) D ;
3407"RTN","C0XMAIN",138,0)
3408 . D INITFARY("C0XFARY")
3409"RTN","C0XMAIN",139,0)
3410 . S FARY="C0XFARY"
3411"RTN","C0XMAIN",140,0)
3412 D USEFARY(FARY)
3413"RTN","C0XMAIN",141,0)
3414 N ZIEN
3415"RTN","C0XMAIN",142,0)
3416 S ZIEN=$$IENOF(ZNAME)
3417"RTN","C0XMAIN",143,0)
3418 Q $NA(@C0XSN@(ZIEN,1))
3419"RTN","C0XMAIN",144,0)
3420 ;
3421"RTN","C0XMAIN",145,0)
3422FILEIN(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH
3423"RTN","C0XMAIN",146,0)
3424 ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT
3425"RTN","C0XMAIN",147,0)
3426 ; IE ^TMP("C0X","FILEIN",1)
3427"RTN","C0XMAIN",148,0)
3428 ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1
3429"RTN","C0XMAIN",149,0)
3430 ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH
3431"RTN","C0XMAIN",150,0)
3432 S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL)
3433"RTN","C0XMAIN",151,0)
3434 Q OK
3435"RTN","C0XMAIN",152,0)
3436 ;
3437"RTN","C0XMAIN",153,0)
3438TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE
3439"RTN","C0XMAIN",154,0)
3440 S ZIN=$NA(^TMP("C0X",12226,"FILEIN"))
3441"RTN","C0XMAIN",155,0)
3442 S ZGRAPH="/test/rdfFile"
3443"RTN","C0XMAIN",156,0)
3444 S ZM="/test/rdfFile/meta"
3445"RTN","C0XMAIN",157,0)
3446 D PROCESS(.G,ZIN,ZGRAPH,ZM)
3447"RTN","C0XMAIN",158,0)
3448 Q
3449"RTN","C0XMAIN",159,0)
3450 ;
3451"RTN","C0XMAIN",160,0)
3452PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE
3453"RTN","C0XMAIN",161,0)
3454 ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING
3455"RTN","C0XMAIN",162,0)
3456 ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE
3457"RTN","C0XMAIN",163,0)
3458 ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS
3459"RTN","C0XMAIN",164,0)
3460 ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA
3461"RTN","C0XMAIN",165,0)
3462 ;
3463"RTN","C0XMAIN",166,0)
3464 I '$D(FARY) D ;
3465"RTN","C0XMAIN",167,0)
3466 . D INITFARY("C0XFARY")
3467"RTN","C0XMAIN",168,0)
3468 . S FARY="C0XFARY"
3469"RTN","C0XMAIN",169,0)
3470 D USEFARY(FARY)
3471"RTN","C0XMAIN",170,0)
3472 ; -- first parse the rdf file with the MXML parser
3473"RTN","C0XMAIN",171,0)
3474 ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML
3475"RTN","C0XMAIN",172,0)
3476 S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W")
3477"RTN","C0XMAIN",173,0)
3478 ; -- assign the MXLM dom global name to ZDOM
3479"RTN","C0XMAIN",174,0)
3480 S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID))
3481"RTN","C0XMAIN",175,0)
3482 W !,$O(@ZDOM@(""),-1)," XML NODES PARSED"
3483"RTN","C0XMAIN",176,0)
3484 ; -- populate the metagraph to point to the graph with status unfinished
3485"RTN","C0XMAIN",177,0)
3486 S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT
3487"RTN","C0XMAIN",178,0)
3488 I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH
3489"RTN","C0XMAIN",179,0)
3490 D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH
3491"RTN","C0XMAIN",180,0)
3492 D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished
3493"RTN","C0XMAIN",181,0)
3494 ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT")
3495"RTN","C0XMAIN",182,0)
3496 S C0XDATE=$$NOW^XLFDT
3497"RTN","C0XMAIN",183,0)
3498 D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY)
3499"RTN","C0XMAIN",184,0)
3500 D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store
3501"RTN","C0XMAIN",185,0)
3502 ; --
3503"RTN","C0XMAIN",186,0)
3504 ; -- pull out the vocabularies in the RDF statement. marked with xmlns:
3505"RTN","C0XMAIN",187,0)
3506 ; -- put them in a local variable for quick reference
3507"RTN","C0XMAIN",188,0)
3508 ; -- TODO: create a graph for vocabularies and validate incoming against it
3509"RTN","C0XMAIN",189,0)
3510 ;
3511"RTN","C0XMAIN",190,0)
3512 S C0XVOC=""
3513"RTN","C0XMAIN",191,0)
3514 N ZI,ZJ,ZK S ZI=""
3515"RTN","C0XMAIN",192,0)
3516 F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns
3517"RTN","C0XMAIN",193,0)
3518 . S ZVOC=$P(ZI,"xmlns:",2)
3519"RTN","C0XMAIN",194,0)
3520 . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI))
3521"RTN","C0XMAIN",195,0)
3522 ;W !,"VOCABS:" ZWR C0XVOC
3523"RTN","C0XMAIN",196,0)
3524 ;
3525"RTN","C0XMAIN",197,0)
3526 ; -- look for children called rdf:Description. quit if none. not an rdf file
3527"RTN","C0XMAIN",198,0)
3528 ;
3529"RTN","C0XMAIN",199,0)
3530 S ZI=$O(@ZDOM@(1,"C",""))
3531"RTN","C0XMAIN",200,0)
3532 I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file
3533"RTN","C0XMAIN",201,0)
3534 . W !,"Error. Not an RDF file. Cannot process."
3535"RTN","C0XMAIN",202,0)
3536 ;
3537"RTN","C0XMAIN",203,0)
3538 ; -- now process the rdf description children
3539"RTN","C0XMAIN",204,0)
3540 ;
3541"RTN","C0XMAIN",205,0)
3542 S ZI=""
3543"RTN","C0XMAIN",206,0)
3544 S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate
3545"RTN","C0XMAIN",207,0)
3546 F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ;
3547"RTN","C0XMAIN",208,0)
3548 . ; -- we are skipping any child that is not rdf:Description
3549"RTN","C0XMAIN",209,0)
3550 . ; -- TODO: check to see if this is right in general
3551"RTN","C0XMAIN",210,0)
3552 . ;
3553"RTN","C0XMAIN",211,0)
3554 . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ;
3555"RTN","C0XMAIN",212,0)
3556 . . W !,"SKIPPING NODE: ",ZI
3557"RTN","C0XMAIN",213,0)
3558 . ; -- now looking for the subject for the triples
3559"RTN","C0XMAIN",214,0)
3560 . S ZX=$G(@ZDOM@(ZI,"A","rdf:about"))
3561"RTN","C0XMAIN",215,0)
3562 . I ZX'="" D ; we have the subject
3563"RTN","C0XMAIN",216,0)
3564 . . ;W " about: ",ZX
3565"RTN","C0XMAIN",217,0)
3566 . . S C0XSUB=ZX
3567"RTN","C0XMAIN",218,0)
3568 . E D ;
3569"RTN","C0XMAIN",219,0)
3570 . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject
3571"RTN","C0XMAIN",220,0)
3572 . . I ZX'="" D ;
3573"RTN","C0XMAIN",221,0)
3574 . . . S C0XSUB=ZX
3575"RTN","C0XMAIN",222,0)
3576 . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT
3577"RTN","C0XMAIN",223,0)
3578 . ;
3579"RTN","C0XMAIN",224,0)
3580 . ; -- we now have the subject. the children of this node have the rest
3581"RTN","C0XMAIN",225,0)
3582 . ;
3583"RTN","C0XMAIN",226,0)
3584 . S ZJ="" ; for the children of the rdf:Description nodes
3585"RTN","C0XMAIN",227,0)
3586 . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child
3587"RTN","C0XMAIN",228,0)
3588 . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix
3589"RTN","C0XMAIN",229,0)
3590 . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space
3591"RTN","C0XMAIN",230,0)
3592 . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix
3593"RTN","C0XMAIN",231,0)
3594 . . I C0XPRE[":" D ; expand using vocabulary
3595"RTN","C0XMAIN",232,0)
3596 . . . N ZB,ZA
3597"RTN","C0XMAIN",233,0)
3598 . . . S ZB=$P(C0XPRE,":",1)
3599"RTN","C0XMAIN",234,0)
3600 . . . S ZA=$P(C0XPRE,":",2)
3601"RTN","C0XMAIN",235,0)
3602 . . . I $G(C0XVOC(ZB))'="" D ;
3603"RTN","C0XMAIN",236,0)
3604 . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded
3605"RTN","C0XMAIN",237,0)
3606 . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object
3607"RTN","C0XMAIN",238,0)
3608 . . I ZY'="" D Q ;
3609"RTN","C0XMAIN",239,0)
3610 . . . S C0XOBJ=ZY ; object
3611"RTN","C0XMAIN",240,0)
3612 . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple
3613"RTN","C0XMAIN",241,0)
3614 . . ; -- this is an else because of the quit above
3615"RTN","C0XMAIN",242,0)
3616 . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object
3617"RTN","C0XMAIN",243,0)
3618 . . I ZX'="" D Q ; got one
3619"RTN","C0XMAIN",244,0)
3620 . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject
3621"RTN","C0XMAIN",245,0)
3622 . . . ; without change... this could be foolish .. look at it again later
3623"RTN","C0XMAIN",246,0)
3624 . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
3625"RTN","C0XMAIN",247,0)
3626 . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here
3627"RTN","C0XMAIN",248,0)
3628 . . I C0XOBJ="" D Q ; not a happy situation
3629"RTN","C0XMAIN",249,0)
3630 . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ
3631"RTN","C0XMAIN",250,0)
3632 . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
3633"RTN","C0XMAIN",251,0)
3634 W !,"INSERTING ",C0XCNT," TRIPLES"
3635"RTN","C0XMAIN",252,0)
3636 D UPDIE(.C0XFDA) ; commit the updates to the file
3637"RTN","C0XMAIN",253,0)
3638 ; next, mark the graph as finished
3639"RTN","C0XMAIN",254,0)
3640 S C0XEND=$$NOW^XLFDT
3641"RTN","C0XMAIN",255,0)
3642 W !," ENDED AT: ",C0XEND
3643"RTN","C0XMAIN",256,0)
3644 S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2)
3645"RTN","C0XMAIN",257,0)
3646 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
3647"RTN","C0XMAIN",258,0)
3648 W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
3649"RTN","C0XMAIN",259,0)
3650 Q
3651"RTN","C0XMAIN",260,0)
3652 ;
3653"RTN","C0XMAIN",261,0)
3654SHOW(ZN) ;
3655"RTN","C0XMAIN",262,0)
3656 ZWR ^TMP("MXMLDOM",$J,1,ZN,*)
3657"RTN","C0XMAIN",263,0)
3658 Q
3659"RTN","C0XMAIN",264,0)
3660 ;
3661"RTN","C0XMAIN",265,0)
3662ANONS() ; RETURNS AN ANONOMOUS SUBJECT
3663"RTN","C0XMAIN",266,0)
3664 Q "_S:"_$$LKY9
3665"RTN","C0XMAIN",267,0)
3666 ;
3667"RTN","C0XMAIN",268,0)
3668NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED
3669"RTN","C0XMAIN",269,0)
3670 ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT
3671"RTN","C0XMAIN",270,0)
3672 ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN
3673"RTN","C0XMAIN",271,0)
3674 S NGRAPH="G"_$$LKY9
3675"RTN","C0XMAIN",272,0)
3676 S NMETA=NGRAPH_"A"
3677"RTN","C0XMAIN",273,0)
3678 Q
3679"RTN","C0XMAIN",274,0)
3680 ;
3681"RTN","C0XMAIN",275,0)
3682ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT
3683"RTN","C0XMAIN",276,0)
3684 ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE
3685"RTN","C0XMAIN",277,0)
3686 I '$D(FARY) D ;
3687"RTN","C0XMAIN",278,0)
3688 . D INITFARY("C0XFARY")
3689"RTN","C0XMAIN",279,0)
3690 . S FARY="C0XFARY"
3691"RTN","C0XMAIN",280,0)
3692 D USEFARY(FARY)
3693"RTN","C0XMAIN",281,0)
3694 I '$D(C0XCNT) S C0XCNT=0
3695"RTN","C0XMAIN",282,0)
3696 N ZNODE
3697"RTN","C0XMAIN",283,0)
3698 S ZNODE="N"_$$LKY17
3699"RTN","C0XMAIN",284,0)
3700 N ZNARY ; GET READY TO CALL IENOFA
3701"RTN","C0XMAIN",285,0)
3702 S ZNARY("ZG",ZG)=""
3703"RTN","C0XMAIN",286,0)
3704 S ZNARY("ZS",ZS)=""
3705"RTN","C0XMAIN",287,0)
3706 S ZNARY("ZP",ZP)=""
3707"RTN","C0XMAIN",288,0)
3708 S ZNARY("ZO",ZO)=""
3709"RTN","C0XMAIN",289,0)
3710 D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS
3711"RTN","C0XMAIN",290,0)
3712 ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN
3713"RTN","C0XMAIN",291,0)
3714 ;S ZSIEN=$$IENOF(ZS)
3715"RTN","C0XMAIN",292,0)
3716 ;S ZPIEN=$$IENOF(ZP)
3717"RTN","C0XMAIN",293,0)
3718 ;S ZOIEN=$$IENOF(ZO)
3719"RTN","C0XMAIN",294,0)
3720 ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED
3721"RTN","C0XMAIN",295,0)
3722 S C0XCNT=C0XCNT+1
3723"RTN","C0XMAIN",296,0)
3724 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE
3725"RTN","C0XMAIN",297,0)
3726 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG",""))
3727"RTN","C0XMAIN",298,0)
3728 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS",""))
3729"RTN","C0XMAIN",299,0)
3730 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP",""))
3731"RTN","C0XMAIN",300,0)
3732 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO",""))
3733"RTN","C0XMAIN",301,0)
3734 ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE
3735"RTN","C0XMAIN",302,0)
3736 Q
3737"RTN","C0XMAIN",303,0)
3738 ;
3739"RTN","C0XMAIN",304,0)
3740LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
3741"RTN","C0XMAIN",305,0)
3742 ; UNIQUE NODE AND GRAPH NAMES
3743"RTN","C0XMAIN",306,0)
3744 N ZN,ZI
3745"RTN","C0XMAIN",307,0)
3746 S ZN=""
3747"RTN","C0XMAIN",308,0)
3748 F ZI=1:1:9 D ;
3749"RTN","C0XMAIN",309,0)
3750 . S ZN=ZN_$R(10)
3751"RTN","C0XMAIN",310,0)
3752 Q ZN
3753"RTN","C0XMAIN",311,0)
3754 ;
3755"RTN","C0XMAIN",312,0)
3756LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
3757"RTN","C0XMAIN",313,0)
3758 ; UNIQUE NODE AND GRAPH NAMES
3759"RTN","C0XMAIN",314,0)
3760 N ZN,ZI
3761"RTN","C0XMAIN",315,0)
3762 S ZN=""
3763"RTN","C0XMAIN",316,0)
3764 F ZI=1:1:17 D ;
3765"RTN","C0XMAIN",317,0)
3766 . S ZN=ZN_$R(10)
3767"RTN","C0XMAIN",318,0)
3768 Q ZN
3769"RTN","C0XMAIN",319,0)
3770 ;
3771"RTN","C0XMAIN",320,0)
3772IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE
3773"RTN","C0XMAIN",321,0)
3774 I '$D(FARY) D ;
3775"RTN","C0XMAIN",322,0)
3776 . D INITFARY("C0XFARY")
3777"RTN","C0XMAIN",323,0)
3778 . S FARY="C0XFARY"
3779"RTN","C0XMAIN",324,0)
3780 N ZIEN
3781"RTN","C0XMAIN",325,0)
3782 S ZIEN=$O(@C0XSN@("B",ZSTRING,""))
3783"RTN","C0XMAIN",326,0)
3784 I ZIEN="" D ;
3785"RTN","C0XMAIN",327,0)
3786 . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING
3787"RTN","C0XMAIN",328,0)
3788 . D UPDIE(.C0XFDA2)
3789"RTN","C0XMAIN",329,0)
3790 . S ZIEN=$O(@C0XSN@("B",ZSTRING,""))
3791"RTN","C0XMAIN",330,0)
3792 . K C0XFDA2
3793"RTN","C0XMAIN",331,0)
3794 Q ZIEN
3795"RTN","C0XMAIN",332,0)
3796 ;
3797"RTN","C0XMAIN",333,0)
3798IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE
3799"RTN","C0XMAIN",334,0)
3800 ; OR ADD THEM IF
3801"RTN","C0XMAIN",335,0)
3802 ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE
3803"RTN","C0XMAIN",336,0)
3804 ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")=""
3805"RTN","C0XMAIN",337,0)
3806 ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)=""
3807"RTN","C0XMAIN",338,0)
3808 I '$D(FARY) D ;
3809"RTN","C0XMAIN",339,0)
3810 . D INITFARY("C0XFARY")
3811"RTN","C0XMAIN",340,0)
3812 . S FARY="C0XFARY"
3813"RTN","C0XMAIN",341,0)
3814 K ZOUTARY ; START WITH CLEAN RESULTS
3815"RTN","C0XMAIN",342,0)
3816 K C0XFDA2 ; USE A SEPARATE FDA FOR THIS
3817"RTN","C0XMAIN",343,0)
3818 N ZI S ZI=""
3819"RTN","C0XMAIN",344,0)
3820 N ZV,ZIEN
3821"RTN","C0XMAIN",345,0)
3822 N ZCNT S ZCNT=0
3823"RTN","C0XMAIN",346,0)
3824 F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS
3825"RTN","C0XMAIN",347,0)
3826 . S ZV=$O(ZINARY(ZI,""))
3827"RTN","C0XMAIN",348,0)
3828 . I $O(@C0XSN@("B",ZV,""))="" D ;
3829"RTN","C0XMAIN",349,0)
3830 . . S ZCNT=ZCNT+1
3831"RTN","C0XMAIN",350,0)
3832 . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV
3833"RTN","C0XMAIN",351,0)
3834 I $D(C0XFDA2) D ;
3835"RTN","C0XMAIN",352,0)
3836 . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS
3837"RTN","C0XMAIN",353,0)
3838 . K C0XFDA2 ; CLEAN UP
3839"RTN","C0XMAIN",354,0)
3840 F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS
3841"RTN","C0XMAIN",355,0)
3842 . S ZV=$O(ZINARY(ZI,""))
3843"RTN","C0XMAIN",356,0)
3844 . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW
3845"RTN","C0XMAIN",357,0)
3846 . I ZIEN="" D ;
3847"RTN","C0XMAIN",358,0)
3848 . . W !,"ERROR ADDING STRING: ",ZV
3849"RTN","C0XMAIN",359,0)
3850 . . B
3851"RTN","C0XMAIN",360,0)
3852 . S ZOUTARY("IEN",ZI,ZIEN)=""
3853"RTN","C0XMAIN",361,0)
3854 Q
3855"RTN","C0XMAIN",362,0)
3856 ;
3857"RTN","C0XMAIN",363,0)
3858UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
3859"RTN","C0XMAIN",364,0)
3860 ; ZFDA IS PASSED BY REFERENCE
3861"RTN","C0XMAIN",365,0)
3862 ;ZWR ZFDA
3863"RTN","C0XMAIN",366,0)
3864 ;B
3865"RTN","C0XMAIN",367,0)
3866 K ZERR
3867"RTN","C0XMAIN",368,0)
3868 D CLEAN^DILF
3869"RTN","C0XMAIN",369,0)
3870 D UPDATE^DIE("","ZFDA","","ZERR")
3871"RTN","C0XMAIN",370,0)
3872 I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST,
3873"RTN","C0XMAIN",371,0)
3874 ; INVOKE THE ERROR TRAP IF TASKED
3875"RTN","C0XMAIN",372,0)
3876 ;. W "ERROR",!
3877"RTN","C0XMAIN",373,0)
3878 ;. ZWR ZERR
3879"RTN","C0XMAIN",374,0)
3880 ;. B
3881"RTN","C0XMAIN",375,0)
3882 K ZFDA
3883"RTN","C0XMAIN",376,0)
3884 Q
3885"RTN","C0XMAIN",377,0)
3886 ;
3887"RTN","C0XRDF")
38880^7^B9306574
3889"RTN","C0XRDF",1,0)
3890C0XRDF ; GPL - Fileman Triples RDF out ;11/07/11 17:05
3891"RTN","C0XRDF",2,0)
3892 ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11
3893"RTN","C0XRDF",3,0)
3894 ;Copyright 2012 George Lilly. Licensed under the terms of the GNU
3895"RTN","C0XRDF",4,0)
3896 ;General Public License See attached copy of the License.
3897"RTN","C0XRDF",5,0)
3898 ;
3899"RTN","C0XRDF",6,0)
3900 ;This program is free software; you can redistribute it and/or modify
3901"RTN","C0XRDF",7,0)
3902 ;it under the terms of the GNU General Public License as published by
3903"RTN","C0XRDF",8,0)
3904 ;the Free Software Foundation; either version 2 of the License, or
3905"RTN","C0XRDF",9,0)
3906 ;(at your option) any later version.
3907"RTN","C0XRDF",10,0)
3908 ;
3909"RTN","C0XRDF",11,0)
3910 ;This program is distributed in the hope that it will be useful,
3911"RTN","C0XRDF",12,0)
3912 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
3913"RTN","C0XRDF",13,0)
3914 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3915"RTN","C0XRDF",14,0)
3916 ;GNU General Public License for more details.
3917"RTN","C0XRDF",15,0)
3918 ;
3919"RTN","C0XRDF",16,0)
3920 ;You should have received a copy of the GNU General Public License along
3921"RTN","C0XRDF",17,0)
3922 ;with this program; if not, write to the Free Software Foundation, Inc.,
3923"RTN","C0XRDF",18,0)
3924 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
3925"RTN","C0XRDF",19,0)
3926 ;
3927"RTN","C0XRDF",20,0)
3928 Q
3929"RTN","C0XRDF",21,0)
3930 ;
3931"RTN","C0XRDF",22,0)
3932REPLYSTART(ZARY);
3933"RTN","C0XRDF",23,0)
3934 D ADD(ZARY,"<?xml version=""1.0"" encoding=""UTF-8""?>")
3935"RTN","C0XRDF",24,0)
3936 D ADD(ZARY,"<rdf:RDF xmlns:rdf=""http://www.w3.org/1999/02/22-rdf-syntax-ns#"">")
3937"RTN","C0XRDF",25,0)
3938 Q
3939"RTN","C0XRDF",26,0)
3940 ;
3941"RTN","C0XRDF",27,0)
3942LISTSTART(ZARY,ZNAM)
3943"RTN","C0XRDF",28,0)
3944 Q
3945"RTN","C0XRDF",29,0)
3946 ;
3947"RTN","C0XRDF",30,0)
3948DICTSTART(ZARY,ZSUB)
3949"RTN","C0XRDF",31,0)
3950 I ZSUB["http" D Q ;
3951"RTN","C0XRDF",32,0)
3952 . D ADD(ZARY,"<rdf:Description rdf:about="""_ZSUB_""">")
3953"RTN","C0XRDF",33,0)
3954 I $E(ZSUB,1,1)="/" D Q ;
3955"RTN","C0XRDF",34,0)
3956 . D ADD(ZARY,"<rdf:Description rdf:about="""_ZSUB_""">")
3957"RTN","C0XRDF",35,0)
3958 D ADD(ZARY,"<rdf:Description rdf:nodeID="""_ZSUB_""">")
3959"RTN","C0XRDF",36,0)
3960 Q
3961"RTN","C0XRDF",37,0)
3962 ;
3963"RTN","C0XRDF",38,0)
3964DASSERT(ZARY,ZPRED,ZOBJ)
3965"RTN","C0XRDF",39,0)
3966 I ZPRED[":" D Q ;
3967"RTN","C0XRDF",40,0)
3968 . I ZPRED="rdf:type" D Q ;
3969"RTN","C0XRDF",41,0)
3970 . . D ADD(ZARY,"<rdf:type rdf:resource="""_$$EXT^C0XUTIL(ZOBJ)_"""/>")
3971"RTN","C0XRDF",42,0)
3972 . N ZA,ZB,ZC
3973"RTN","C0XRDF",43,0)
3974 . S ZA=$P(ZPRED,":",1)
3975"RTN","C0XRDF",44,0)
3976 . S ZB=$P(ZPRED,":",2)
3977"RTN","C0XRDF",45,0)
3978 . I $E(ZB,1,1)="/" D ;
3979"RTN","C0XRDF",46,0)
3980 . . S ZB=$P(ZB,"/",2) ; handling gpltest:/note situations
3981"RTN","C0XRDF",47,0)
3982 . S ZC=C0XVOC(ZA)
3983"RTN","C0XRDF",48,0)
3984 . I ZOBJ["nodeID:" D Q ;
3985"RTN","C0XRDF",49,0)
3986 . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:nodeID="""_$$EXT^C0XUTIL(ZOBJ)_"""/>")
3987"RTN","C0XRDF",50,0)
3988 . S ZOBJ=$$EXT^C0XUTIL(ZOBJ)
3989"RTN","C0XRDF",51,0)
3990 . I ZOBJ["http" D Q ;
3991"RTN","C0XRDF",52,0)
3992 . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:resource="""_ZOBJ_"""/>")
3993"RTN","C0XRDF",53,0)
3994 . I $E(ZOBJ,1,1)="/" D Q ;
3995"RTN","C0XRDF",54,0)
3996 . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:resource="""_ZOBJ_"""/>")
3997"RTN","C0XRDF",55,0)
3998 . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""">"_$$EXT^C0XUTIL(ZOBJ)_"</"_ZB_">")
3999"RTN","C0XRDF",56,0)
4000 Q
4001"RTN","C0XRDF",57,0)
4002 ;
4003"RTN","C0XRDF",58,0)
4004DICTEND(ZARY)
4005"RTN","C0XRDF",59,0)
4006 D ADD(ZARY,"</rdf:Description>")
4007"RTN","C0XRDF",60,0)
4008 Q
4009"RTN","C0XRDF",61,0)
4010 ;
4011"RTN","C0XRDF",62,0)
4012LISTEND(ZARY)
4013"RTN","C0XRDF",63,0)
4014 Q
4015"RTN","C0XRDF",64,0)
4016 ;
4017"RTN","C0XRDF",65,0)
4018REPLYEND(ZARY)
4019"RTN","C0XRDF",66,0)
4020 D ADD(ZARY,"</rdf:RDF>")
4021"RTN","C0XRDF",67,0)
4022 Q
4023"RTN","C0XRDF",68,0)
4024 ;
4025"RTN","C0XRDF",69,0)
4026ADD(ZARY,ZELE)
4027"RTN","C0XRDF",70,0)
4028 N ZI
4029"RTN","C0XRDF",71,0)
4030 I '$D(ZARY) S @ZARY@(1)=ZELE Q ;
4031"RTN","C0XRDF",72,0)
4032 S ZI=$O(@ZARY@(""),-1)
4033"RTN","C0XRDF",73,0)
4034 S @ZARY@(ZI+1)=ZELE
4035"RTN","C0XRDF",74,0)
4036 Q
4037"RTN","C0XRDF",75,0)
4038 ;
4039"RTN","C0XRDF",76,0)
4040rdfout(rdfout,zary) ;
4041"RTN","C0XRDF",77,0)
4042 d REPLYSTART("rdfout")
4043"RTN","C0XRDF",78,0)
4044 d LISTSTART("rdfout","results")
4045"RTN","C0XRDF",79,0)
4046 n zi s zi=""
4047"RTN","C0XRDF",80,0)
4048 f s zi=$o(zary(zi)) q:zi="" d ; for each subject
4049"RTN","C0XRDF",81,0)
4050 . n zii s zii=""
4051"RTN","C0XRDF",82,0)
4052 . D DICTSTART("rdfout",$$EXT^C0XUTIL(zi))
4053"RTN","C0XRDF",83,0)
4054 . f s zii=$o(zary(zi,zii)) q:zii="" d ; for each pred^obj pair
4055"RTN","C0XRDF",84,0)
4056 . . d DASSERT("rdfout",$p(zii,"^",1),$p(zii,"^",2))
4057"RTN","C0XRDF",85,0)
4058 . D DICTEND("rdfout")
4059"RTN","C0XRDF",86,0)
4060 d LISTEND("rdfout")
4061"RTN","C0XRDF",87,0)
4062 d REPLYEND("rdfout")
4063"RTN","C0XRDF",88,0)
4064 q
4065"RTN","C0XRDF",89,0)
4066 ;
4067"RTN","C0XTEST")
40680^3^B14490662
4069"RTN","C0XTEST",1,0)
4070C0XTEST ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05
4071"RTN","C0XTEST",2,0)
4072 ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11
4073"RTN","C0XTEST",3,0)
4074 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU
4075"RTN","C0XTEST",4,0)
4076 ;General Public License See attached copy of the License.
4077"RTN","C0XTEST",5,0)
4078 ;
4079"RTN","C0XTEST",6,0)
4080 ;This program is free software; you can redistribute it and/or modify
4081"RTN","C0XTEST",7,0)
4082 ;it under the terms of the GNU General Public License as published by
4083"RTN","C0XTEST",8,0)
4084 ;the Free Software Foundation; either version 2 of the License, or
4085"RTN","C0XTEST",9,0)
4086 ;(at your option) any later version.
4087"RTN","C0XTEST",10,0)
4088 ;
4089"RTN","C0XTEST",11,0)
4090 ;This program is distributed in the hope that it will be useful,
4091"RTN","C0XTEST",12,0)
4092 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
4093"RTN","C0XTEST",13,0)
4094 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4095"RTN","C0XTEST",14,0)
4096 ;GNU General Public License for more details.
4097"RTN","C0XTEST",15,0)
4098 ;
4099"RTN","C0XTEST",16,0)
4100 ;You should have received a copy of the GNU General Public License along
4101"RTN","C0XTEST",17,0)
4102 ;with this program; if not, write to the Free Software Foundation, Inc.,
4103"RTN","C0XTEST",18,0)
4104 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4105"RTN","C0XTEST",19,0)
4106 ;
4107"RTN","C0XTEST",20,0)
4108 Q
4109"RTN","C0XTEST",21,0)
4110 ;
4111"RTN","C0XTEST",22,0)
4112EN ; run the test
4113"RTN","C0XTEST",23,0)
4114 ;
4115"RTN","C0XTEST",24,0)
4116 k C0XFDA ; clear the node variable
4117"RTN","C0XTEST",25,0)
4118 i '$d(^C0X(101,0)) d ; global doesn't exist
4119"RTN","C0XTEST",26,0)
4120 . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1"
4121"RTN","C0XTEST",27,0)
4122 n zg
4123"RTN","C0XTEST",28,0)
4124 S zg="_:G"_$$LKY9 ; all nodes are in the same graph
4125"RTN","C0XTEST",29,0)
4126 n zi
4127"RTN","C0XTEST",30,0)
4128 f zi=1:1:100000 d ; try a test of 10000 nodes
4129"RTN","C0XTEST",31,0)
4130 . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name
4131"RTN","C0XTEST",32,0)
4132 . s C0XFDA(172.101,zi,.02)=zg
4133"RTN","C0XTEST",33,0)
4134 . s C0XFDA(172.101,zi,.03)=$R(100000)
4135"RTN","C0XTEST",34,0)
4136 . s C0XFDA(172.101,zi,.04)=$R(100000)
4137"RTN","C0XTEST",35,0)
4138 . s C0XFDA(172.101,zi,.05)=$R(100000)
4139"RTN","C0XTEST",36,0)
4140 S C0XST=$$NOW^XLFDT ; start of the insertion test
4141"RTN","C0XTEST",37,0)
4142 W !,"INSERTION STARTS AT ",C0XST,!
4143"RTN","C0XTEST",38,0)
4144 d BULKLOAD(.C0XFDA)
4145"RTN","C0XTEST",39,0)
4146 s C0XEND=$$NOW^XLFDT ; end of the insertion test
4147"RTN","C0XTEST",40,0)
4148 W !,"INSERTION ENDS AT ",C0XEND
4149"RTN","C0XTEST",41,0)
4150 S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XST,2)
4151"RTN","C0XTEST",42,0)
4152 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
4153"RTN","C0XTEST",43,0)
4154 I C0XDIFF>0 W !," APPROXIMATELY ",$P(100000/C0XDIFF,".")," NODES PER SECOND"
4155"RTN","C0XTEST",44,0)
4156 q
4157"RTN","C0XTEST",45,0)
4158 ;
4159"RTN","C0XTEST",46,0)
4160LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
4161"RTN","C0XTEST",47,0)
4162 ; UNIQUE NODE AND GRAPH NAMES
4163"RTN","C0XTEST",48,0)
4164 N ZN,ZI
4165"RTN","C0XTEST",49,0)
4166 S ZN=""
4167"RTN","C0XTEST",50,0)
4168 F ZI=1:1:9 D ;
4169"RTN","C0XTEST",51,0)
4170 . S ZN=ZN_$R(10)
4171"RTN","C0XTEST",52,0)
4172 Q ZN
4173"RTN","C0XTEST",53,0)
4174 ;
4175"RTN","C0XTEST",54,0)
4176LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
4177"RTN","C0XTEST",55,0)
4178 ; UNIQUE NODE AND GRAPH NAMES
4179"RTN","C0XTEST",56,0)
4180 N ZN,ZI
4181"RTN","C0XTEST",57,0)
4182 S ZN=""
4183"RTN","C0XTEST",58,0)
4184 F ZI=1:1:17 D ;
4185"RTN","C0XTEST",59,0)
4186 . S ZN=ZN_$R(10)
4187"RTN","C0XTEST",60,0)
4188 Q ZN
4189"RTN","C0XTEST",61,0)
4190 ;
4191"RTN","C0XTEST",62,0)
4192BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101
4193"RTN","C0XTEST",63,0)
4194 ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE
4195"RTN","C0XTEST",64,0)
4196 ; QUITS IF FILE IS NOT 172.101
4197"RTN","C0XTEST",65,0)
4198 ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1
4199"RTN","C0XTEST",66,0)
4200 ; QUITS IF FIRST ENTRY IS NOT IENS 1
4201"RTN","C0XTEST",67,0)
4202 ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES
4203"RTN","C0XTEST",68,0)
4204 ; ZBFDA IS PASSED BY REFERENCE
4205"RTN","C0XTEST",69,0)
4206 ;
4207"RTN","C0XTEST",70,0)
4208 ; -- reserves a block of iens from file 172.101 by locking the zero node
4209"RTN","C0XTEST",71,0)
4210 ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3
4211"RTN","C0XTEST",72,0)
4212 ; -- then unlocking to minimize the duration of the lock
4213"RTN","C0XTEST",73,0)
4214 ;
4215"RTN","C0XTEST",74,0)
4216 W !,"USING BULKLOAD"
4217"RTN","C0XTEST",75,0)
4218 I '$D(ZBFDA) Q ; EMPTY FDA
4219"RTN","C0XTEST",76,0)
4220 I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE
4221"RTN","C0XTEST",77,0)
4222 N ZCNT,ZP3,ZP4
4223"RTN","C0XTEST",78,0)
4224 ; -- find the number of nodes to insert
4225"RTN","C0XTEST",79,0)
4226 S ZCNT=$O(ZBFDA(172.101,""),-1)
4227"RTN","C0XTEST",80,0)
4228 I ZCNT="" D Q ;
4229"RTN","C0XTEST",81,0)
4230 . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT"
4231"RTN","C0XTEST",82,0)
4232 . B
4233"RTN","C0XTEST",83,0)
4234 ; -- lock the zero node and reserve a block of iens to insert
4235"RTN","C0XTEST",84,0)
4236 W !,"LOCKING ZERO NODE"
4237"RTN","C0XTEST",85,0)
4238 LOCK +^C0X(101,0)
4239"RTN","C0XTEST",86,0)
4240 S ZP3=$P(^C0X(101,0),U,3)
4241"RTN","C0XTEST",87,0)
4242 S ZP4=$P(^C0X(101,0),U,4)
4243"RTN","C0XTEST",88,0)
4244 S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1
4245"RTN","C0XTEST",89,0)
4246 S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1
4247"RTN","C0XTEST",90,0)
4248 LOCK -^C0X(101,0)
4249"RTN","C0XTEST",91,0)
4250 N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE
4251"RTN","C0XTEST",92,0)
4252 S ZBASE=ZP3 ; the last ien in the file
4253"RTN","C0XTEST",93,0)
4254 W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT
4255"RTN","C0XTEST",94,0)
4256 W !,$$NOW^XLFDT
4257"RTN","C0XTEST",95,0)
4258 S ZI=""
4259"RTN","C0XTEST",96,0)
4260 F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ;
4261"RTN","C0XTEST",97,0)
4262 . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name
4263"RTN","C0XTEST",98,0)
4264 . I ZN="" D BLKERR Q ;
4265"RTN","C0XTEST",99,0)
4266 . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer
4267"RTN","C0XTEST",100,0)
4268 . I ZG="" D BLKERR Q ;
4269"RTN","C0XTEST",101,0)
4270 . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer
4271"RTN","C0XTEST",102,0)
4272 . I ZS="" D BLKERR Q ;
4273"RTN","C0XTEST",103,0)
4274 . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer
4275"RTN","C0XTEST",104,0)
4276 . I ZP="" D BLKERR Q ;
4277"RTN","C0XTEST",105,0)
4278 . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer
4279"RTN","C0XTEST",106,0)
4280 . I ZO="" D BLKERR Q ;
4281"RTN","C0XTEST",107,0)
4282 . S ZIEN=ZI+ZBASE ; the new ien
4283"RTN","C0XTEST",108,0)
4284 . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node
4285"RTN","C0XTEST",109,0)
4286 . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index
4287"RTN","C0XTEST",110,0)
4288 . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index
4289"RTN","C0XTEST",111,0)
4290 . S ^C0X(101,"SPO",ZS,ZP,ZO)=""
4291"RTN","C0XTEST",112,0)
4292 . S ^C0X(101,"SOP",ZS,ZO,ZP)=""
4293"RTN","C0XTEST",113,0)
4294 . S ^C0X(101,"OPS",ZO,ZP,ZS)=""
4295"RTN","C0XTEST",114,0)
4296 . S ^C0X(101,"OSP",ZO,ZS,ZP)=""
4297"RTN","C0XTEST",115,0)
4298 . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)=""
4299"RTN","C0XTEST",116,0)
4300 . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)=""
4301"RTN","C0XTEST",117,0)
4302 . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)=""
4303"RTN","C0XTEST",118,0)
4304 . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)=""
4305"RTN","C0XTEST",119,0)
4306 Q
4307"RTN","C0XTEST",120,0)
4308 ;
4309"RTN","C0XTEST",121,0)
4310BLKERR ;
4311"RTN","C0XTEST",122,0)
4312 W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI)
4313"RTN","C0XTEST",123,0)
4314 B
4315"RTN","C0XTEST",124,0)
4316 Q
4317"RTN","C0XTEST",125,0)
4318 ;
4319"RTN","C0XTKSB")
43200^6^B17753558
4321"RTN","C0XTKSB",1,0)
4322C0XTESTKSB ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05
4323"RTN","C0XTKSB",2,0)
4324 ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11
4325"RTN","C0XTKSB",3,0)
4326 ; KSB - modified to fix a minor bug and to use;;;;;Build 10
4327"RTN","C0XTKSB",4,0)
4328 ; high resolution time if routines available ; 11/19/11 1410 EST
4329"RTN","C0XTKSB",5,0)
4330 ;;0.1;C0X;nopatch;noreleasedate;Build 1
4331"RTN","C0XTKSB",6,0)
4332 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU
4333"RTN","C0XTKSB",7,0)
4334 ;General Public License See attached copy of the License.
4335"RTN","C0XTKSB",8,0)
4336 ;
4337"RTN","C0XTKSB",9,0)
4338 ;This program is free software; you can redistribute it and/or modify
4339"RTN","C0XTKSB",10,0)
4340 ;it under the terms of the GNU General Public License as published by
4341"RTN","C0XTKSB",11,0)
4342 ;the Free Software Foundation; either version 2 of the License, or
4343"RTN","C0XTKSB",12,0)
4344 ;(at your option) any later version.
4345"RTN","C0XTKSB",13,0)
4346 ;
4347"RTN","C0XTKSB",14,0)
4348 ;This program is distributed in the hope that it will be useful,
4349"RTN","C0XTKSB",15,0)
4350 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
4351"RTN","C0XTKSB",16,0)
4352 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4353"RTN","C0XTKSB",17,0)
4354 ;GNU General Public License for more details.
4355"RTN","C0XTKSB",18,0)
4356 ;
4357"RTN","C0XTKSB",19,0)
4358 ;You should have received a copy of the GNU General Public License along
4359"RTN","C0XTKSB",20,0)
4360 ;with this program; if not, write to the Free Software Foundation, Inc.,
4361"RTN","C0XTKSB",21,0)
4362 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4363"RTN","C0XTKSB",22,0)
4364 ;
4365"RTN","C0XTKSB",23,0)
4366 Q
4367"RTN","C0XTKSB",24,0)
4368 ;
4369"RTN","C0XTKSB",25,0)
4370EN ; run the test
4371"RTN","C0XTKSB",26,0)
4372 ;
4373"RTN","C0XTKSB",27,0)
4374 k C0XFDA ; clear the node variable
4375"RTN","C0XTKSB",28,0)
4376 s U="^" ; initialization - Bhaskar 20111119
4377"RTN","C0XTKSB",29,0)
4378 i '$d(^C0X(101,0)) d ; global doesn't exist
4379"RTN","C0XTKSB",30,0)
4380 . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1"
4381"RTN","C0XTKSB",31,0)
4382 n zg
4383"RTN","C0XTKSB",32,0)
4384 S zg="_:G"_$$LKY9 ; all nodes are in the same graph
4385"RTN","C0XTKSB",33,0)
4386 n zi
4387"RTN","C0XTKSB",34,0)
4388 f zi=1:1:10000 d ; try a test of 10000 nodes
4389"RTN","C0XTKSB",35,0)
4390 . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name
4391"RTN","C0XTKSB",36,0)
4392 . s C0XFDA(172.101,zi,.02)=zg
4393"RTN","C0XTKSB",37,0)
4394 . s C0XFDA(172.101,zi,.03)=$R(100000)
4395"RTN","C0XTKSB",38,0)
4396 . s C0XFDA(172.101,zi,.04)=$R(100000)
4397"RTN","C0XTKSB",39,0)
4398 . s C0XFDA(172.101,zi,.05)=$R(100000)
4399"RTN","C0XTKSB",40,0)
4400 S C0XST=$$H ; start of the insertion test
4401"RTN","C0XTKSB",41,0)
4402 W !,"INSERTION STARTS AT ",$ZDATE(C0XST,"YEAR-MM-DD:24:60:SS"),!
4403"RTN","C0XTKSB",42,0)
4404 d BULKLOAD(.C0XFDA)
4405"RTN","C0XTKSB",43,0)
4406 s C0XEND=$$H ; end of the insertion test
4407"RTN","C0XTKSB",44,0)
4408 W !,"INSERTION ENDS AT ",$ZDATE(C0XEND,"YEAR-MM-DD:24:60:SS")
4409"RTN","C0XTKSB",45,0)
4410 S C0XDIFF=(86400*($P(C0XEND,",",1)-$P(C0XST,",",1)))+$P(C0XEND,",",2)-$P(C0XST,",",2)
4411"RTN","C0XTKSB",46,0)
4412 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
4413"RTN","C0XTKSB",47,0)
4414 W !
4415"RTN","C0XTKSB",48,0)
4416 W:C0XDIFF>0 " APPROXIMATELY ",$FN(10000/C0XDIFF,",",0)," NODES PER SECOND",!
4417"RTN","C0XTKSB",49,0)
4418 q
4419"RTN","C0XTKSB",50,0)
4420 ;
4421"RTN","C0XTKSB",51,0)
4422LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
4423"RTN","C0XTKSB",52,0)
4424 ; UNIQUE NODE AND GRAPH NAMES
4425"RTN","C0XTKSB",53,0)
4426 N ZN,ZI
4427"RTN","C0XTKSB",54,0)
4428 S ZN=""
4429"RTN","C0XTKSB",55,0)
4430 F ZI=1:1:9 D ;
4431"RTN","C0XTKSB",56,0)
4432 . S ZN=ZN_$R(10)
4433"RTN","C0XTKSB",57,0)
4434 Q ZN
4435"RTN","C0XTKSB",58,0)
4436 ;
4437"RTN","C0XTKSB",59,0)
4438LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
4439"RTN","C0XTKSB",60,0)
4440 ; UNIQUE NODE AND GRAPH NAMES
4441"RTN","C0XTKSB",61,0)
4442 N ZN,ZI
4443"RTN","C0XTKSB",62,0)
4444 S ZN=""
4445"RTN","C0XTKSB",63,0)
4446 F ZI=1:1:17 D ;
4447"RTN","C0XTKSB",64,0)
4448 . S ZN=ZN_$R(10)
4449"RTN","C0XTKSB",65,0)
4450 Q ZN
4451"RTN","C0XTKSB",66,0)
4452 ;
4453"RTN","C0XTKSB",67,0)
4454BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101
4455"RTN","C0XTKSB",68,0)
4456 ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE
4457"RTN","C0XTKSB",69,0)
4458 ; QUITS IF FILE IS NOT 172.101
4459"RTN","C0XTKSB",70,0)
4460 ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1
4461"RTN","C0XTKSB",71,0)
4462 ; QUITS IF FIRST ENTRY IS NOT IENS 1
4463"RTN","C0XTKSB",72,0)
4464 ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES
4465"RTN","C0XTKSB",73,0)
4466 ; ZBFDA IS PASSED BY REFERENCE
4467"RTN","C0XTKSB",74,0)
4468 ;
4469"RTN","C0XTKSB",75,0)
4470 ; -- reserves a block of iens from file 172.101 by locking the zero node
4471"RTN","C0XTKSB",76,0)
4472 ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3
4473"RTN","C0XTKSB",77,0)
4474 ; -- then unlocking to minimize the duration of the lock
4475"RTN","C0XTKSB",78,0)
4476 ;
4477"RTN","C0XTKSB",79,0)
4478 W !,"USING BULKLOAD"
4479"RTN","C0XTKSB",80,0)
4480 I '$D(ZBFDA) Q ; EMPTY FDA
4481"RTN","C0XTKSB",81,0)
4482 I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE
4483"RTN","C0XTKSB",82,0)
4484 N ZCNT,ZP3,ZP4
4485"RTN","C0XTKSB",83,0)
4486 ; -- find the number of nodes to insert
4487"RTN","C0XTKSB",84,0)
4488 S ZCNT=$O(ZBFDA(172.101,""),-1)
4489"RTN","C0XTKSB",85,0)
4490 I ZCNT="" D Q ;
4491"RTN","C0XTKSB",86,0)
4492 . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT"
4493"RTN","C0XTKSB",87,0)
4494 . B
4495"RTN","C0XTKSB",88,0)
4496 ; -- lock the zero node and reserve a block of iens to insert
4497"RTN","C0XTKSB",89,0)
4498 W !,"LOCKING ZERO NODE"
4499"RTN","C0XTKSB",90,0)
4500 LOCK +^C0X(101,0)
4501"RTN","C0XTKSB",91,0)
4502 S ZP3=$P(^C0X(101,0),U,3)
4503"RTN","C0XTKSB",92,0)
4504 S ZP4=$P(^C0X(101,0),U,4)
4505"RTN","C0XTKSB",93,0)
4506 S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1
4507"RTN","C0XTKSB",94,0)
4508 S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1
4509"RTN","C0XTKSB",95,0)
4510 LOCK -^C0X(101,0)
4511"RTN","C0XTKSB",96,0)
4512 N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE
4513"RTN","C0XTKSB",97,0)
4514 S ZBASE=ZP3 ; the last ien in the file
4515"RTN","C0XTKSB",98,0)
4516 W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT
4517"RTN","C0XTKSB",99,0)
4518 W !,$ZDATE($$H,"YEAR-MM-DD:24:60:SS")
4519"RTN","C0XTKSB",100,0)
4520 S ZI=""
4521"RTN","C0XTKSB",101,0)
4522 F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ;
4523"RTN","C0XTKSB",102,0)
4524 . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name
4525"RTN","C0XTKSB",103,0)
4526 . I ZN="" D BLKERR Q ;
4527"RTN","C0XTKSB",104,0)
4528 . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer
4529"RTN","C0XTKSB",105,0)
4530 . I ZG="" D BLKERR Q ;
4531"RTN","C0XTKSB",106,0)
4532 . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer
4533"RTN","C0XTKSB",107,0)
4534 . I ZS="" D BLKERR Q ;
4535"RTN","C0XTKSB",108,0)
4536 . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer
4537"RTN","C0XTKSB",109,0)
4538 . I ZP="" D BLKERR Q ;
4539"RTN","C0XTKSB",110,0)
4540 . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer
4541"RTN","C0XTKSB",111,0)
4542 . I ZO="" D BLKERR Q ;
4543"RTN","C0XTKSB",112,0)
4544 . S ZIEN=ZI+ZBASE ; the new ien
4545"RTN","C0XTKSB",113,0)
4546 . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node
4547"RTN","C0XTKSB",114,0)
4548 . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index
4549"RTN","C0XTKSB",115,0)
4550 . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index
4551"RTN","C0XTKSB",116,0)
4552 . S ^C0X(101,"SPO",ZS,ZP,ZO)=""
4553"RTN","C0XTKSB",117,0)
4554 . S ^C0X(101,"SOP",ZS,ZO,ZP)=""
4555"RTN","C0XTKSB",118,0)
4556 . S ^C0X(101,"OPS",ZO,ZP,ZS)=""
4557"RTN","C0XTKSB",119,0)
4558 . S ^C0X(101,"OSP",ZO,ZS,ZP)=""
4559"RTN","C0XTKSB",120,0)
4560 . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)=""
4561"RTN","C0XTKSB",121,0)
4562 . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)=""
4563"RTN","C0XTKSB",122,0)
4564 . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)=""
4565"RTN","C0XTKSB",123,0)
4566 . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)=""
4567"RTN","C0XTKSB",124,0)
4568 Q
4569"RTN","C0XTKSB",125,0)
4570 ;
4571"RTN","C0XTKSB",126,0)
4572BLKERR ;
4573"RTN","C0XTKSB",127,0)
4574 W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI)
4575"RTN","C0XTKSB",128,0)
4576 B
4577"RTN","C0XTKSB",129,0)
4578 Q
4579"RTN","C0XTKSB",130,0)
4580 ;
4581"RTN","C0XTKSB",131,0)
4582H()
4583"RTN","C0XTKSB",132,0)
4584 quit:$length($ztrnlnm("GTMXC_posix"))&$length($text(zhorolog^%POSIX)) $$zhorolog^%POSIX quit $horolog
4585"RTN","C0XUTIL")
45860^5^B11676522
4587"RTN","C0XUTIL",1,0)
4588C0XUTIL ; GPL - Fileman Triples utilities ;11/07/11 17:05
4589"RTN","C0XUTIL",2,0)
4590 ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11
4591"RTN","C0XUTIL",3,0)
4592 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU
4593"RTN","C0XUTIL",4,0)
4594 ;General Public License See attached copy of the License.
4595"RTN","C0XUTIL",5,0)
4596 ;
4597"RTN","C0XUTIL",6,0)
4598 ;This program is free software; you can redistribute it and/or modify
4599"RTN","C0XUTIL",7,0)
4600 ;it under the terms of the GNU General Public License as published by
4601"RTN","C0XUTIL",8,0)
4602 ;the Free Software Foundation; either version 2 of the License, or
4603"RTN","C0XUTIL",9,0)
4604 ;(at your option) any later version.
4605"RTN","C0XUTIL",10,0)
4606 ;
4607"RTN","C0XUTIL",11,0)
4608 ;This program is distributed in the hope that it will be useful,
4609"RTN","C0XUTIL",12,0)
4610 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
4611"RTN","C0XUTIL",13,0)
4612 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4613"RTN","C0XUTIL",14,0)
4614 ;GNU General Public License for more details.
4615"RTN","C0XUTIL",15,0)
4616 ;
4617"RTN","C0XUTIL",16,0)
4618 ;You should have received a copy of the GNU General Public License along
4619"RTN","C0XUTIL",17,0)
4620 ;with this program; if not, write to the Free Software Foundation, Inc.,
4621"RTN","C0XUTIL",18,0)
4622 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4623"RTN","C0XUTIL",19,0)
4624 ;
4625"RTN","C0XUTIL",20,0)
4626 Q
4627"RTN","C0XUTIL",21,0)
4628 ;
4629"RTN","C0XUTIL",22,0)
4630NSP(ZX) ; OUTPUT TRANSFORM EXTRINSIC
4631"RTN","C0XUTIL",23,0)
4632 ;
4633"RTN","C0XUTIL",24,0)
4634 N ZR
4635"RTN","C0XUTIL",25,0)
4636 ; I WOULD REALLY LIKE TO NOT HAVE THE FILE NUMBER HARD CODED HERE
4637"RTN","C0XUTIL",26,0)
4638 ; ANYONE KNOW HOW I COULD DO THAT? :) GPL
4639"RTN","C0XUTIL",27,0)
4640 S ZR=$$GET1^DIQ(172.201,ZX_",",.01)
4641"RTN","C0XUTIL",28,0)
4642 I '$D(C0XNSP) S C0XNSP=1 ; DEFAULT ON
4643"RTN","C0XUTIL",29,0)
4644 I C0XNSP=0 Q ZR ; SWITCHED OFF
4645"RTN","C0XUTIL",30,0)
4646 I '$D(C0XVOC) D VOCINIT ; INITIALIZE THE VOCABULARIES
4647"RTN","C0XUTIL",31,0)
4648 N ZI,ZJ,ZK S ZI=""
4649"RTN","C0XUTIL",32,0)
4650 N DONE S DONE=0
4651"RTN","C0XUTIL",33,0)
4652 F S ZI=$O(C0XVOC(ZI)) Q:(DONE=1)!(ZI="") D ;
4653"RTN","C0XUTIL",34,0)
4654 . ;W !,ZI
4655"RTN","C0XUTIL",35,0)
4656 . S ZJ=C0XVOC(ZI)
4657"RTN","C0XUTIL",36,0)
4658 . S ZK=$P(ZR,ZJ,2)
4659"RTN","C0XUTIL",37,0)
4660 . ;W !,"ZK=",ZK
4661"RTN","C0XUTIL",38,0)
4662 . I ZK'="" D ; BINGO
4663"RTN","C0XUTIL",39,0)
4664 . . S ZR=ZI_":"_ZK
4665"RTN","C0XUTIL",40,0)
4666 . . S DONE=1
4667"RTN","C0XUTIL",41,0)
4668 Q ZR
4669"RTN","C0XUTIL",42,0)
4670 ;
4671"RTN","C0XUTIL",43,0)
4672VOCINIT ; INITIALIZE VOCABULARIES
4673"RTN","C0XUTIL",44,0)
4674 S C0XVOC("dcterms")="http://purl.org/dc/terms/"
4675"RTN","C0XUTIL",45,0)
4676 S C0XVOC("rdf")="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
4677"RTN","C0XUTIL",46,0)
4678 S C0XVOC("sp")="http://smartplatforms.org/terms#"
4679"RTN","C0XUTIL",47,0)
4680 S C0XVOC("qds")="http://cms.gov/pqri/qds/"
4681"RTN","C0XUTIL",48,0)
4682 S C0XVOC("smart")="http://sandbox-api.smartplatforms.org/records/"
4683"RTN","C0XUTIL",49,0)
4684 S C0XVOC("snomed")="http://purl.bioontology.org/ontology/SNOMEDCT/"
4685"RTN","C0XUTIL",50,0)
4686 S C0XVOC("icd9")="http://purl.bioontology.org/ontology/ICD9/"
4687"RTN","C0XUTIL",51,0)
4688 S C0XVOC("rxnorm")="http://purl.bioontology.org/ontology/RXNORM/"
4689"RTN","C0XUTIL",52,0)
4690 S C0XVOC("loinc")="http://purl.bioontology.org/ontology/LNC/"
4691"RTN","C0XUTIL",53,0)
4692 S C0XVOC("file")="/home/glilly/fmts/trunk/samples/"
4693"RTN","C0XUTIL",54,0)
4694 S C0XVOC("foaf")="http://xmlns.com/foaf/0.1/"
4695"RTN","C0XUTIL",55,0)
4696 S C0XVOC("skos")="http://www.w3.org/2004/02/skos/core#"
4697"RTN","C0XUTIL",56,0)
4698 S C0XVOC("gpl")="http://georgetriples.org/"
4699"RTN","C0XUTIL",57,0)
4700 S C0XVOC("cg")="http://datasets.caregraf.org/"
4701"RTN","C0XUTIL",58,0)
4702 S C0XVOC("mv")="http://metavista.name/foundation#"
4703"RTN","C0XUTIL",59,0)
4704 S C0XVOC("rdfs")="http://www.w3.org/2000/01/rdf-schema#"
4705"RTN","C0XUTIL",60,0)
4706 S C0XVOC("vistaSmart")="https://smart2.vistaewd.net/vista/smart/records/"
4707"RTN","C0XUTIL",61,0)
4708 S C0XVOC("vmu")="http://vista.org/mu/"
4709"RTN","C0XUTIL",62,0)
4710 S C0XVOC("vq")="http://vista.org/quality/"
4711"RTN","C0XUTIL",63,0)
4712 S C0XVOC("nodeID")="iDPsDPss"
4713"RTN","C0XUTIL",64,0)
4714 S C0XVOC("fmts")="http://glilly.net/fmts#"
4715"RTN","C0XUTIL",65,0)
4716 S C0XVOC("oro")="http://oro.com/vista/sage" ;change to get URL from system
4717"RTN","C0XUTIL",66,0)
4718 S C0XVOC("sage")="http://oro.com/sage/schema#"
4719"RTN","C0XUTIL",67,0)
4720 S C0XVOC("v")="http://www.w3.org/2006/vcard/ns#"
4721"RTN","C0XUTIL",68,0)
4722 Q
4723"RTN","C0XUTIL",69,0)
4724 ;
4725"RTN","C0XUTIL",70,0)
4726EXT(C0XIN) ; EXTRINSIC WHICH EXPANDS NAMESPACES
4727"RTN","C0XUTIL",71,0)
4728 ; SO skos:xxx would return http://www.w3.org/2004/02/skos/core#xxx
4729"RTN","C0XUTIL",72,0)
4730 N C0XPRE
4731"RTN","C0XUTIL",73,0)
4732 S C0XPRE=C0XIN
4733"RTN","C0XUTIL",74,0)
4734 I '$D(C0XVOC) D VOCINIT ; INITIALIZE NAME SPACE TABLE
4735"RTN","C0XUTIL",75,0)
4736 I C0XPRE[":" D ; expand using vocabulary
4737"RTN","C0XUTIL",76,0)
4738 . N ZB,ZA
4739"RTN","C0XUTIL",77,0)
4740 . S ZB=$P(C0XPRE,":",1)
4741"RTN","C0XUTIL",78,0)
4742 . S ZA=$P(C0XPRE,":",2)
4743"RTN","C0XUTIL",79,0)
4744 . I $G(C0XVOC(ZB))'="" D ;
4745"RTN","C0XUTIL",80,0)
4746 . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded
4747"RTN","C0XUTIL",81,0)
4748 Q C0XPRE
4749"RTN","C0XUTIL",82,0)
4750 ;
4751"SEC","^DIC",172.101,172.101,0,"AUDIT")
4752@
4753"SEC","^DIC",172.101,172.101,0,"DD")
4754@
4755"SEC","^DIC",172.101,172.101,0,"DEL")
4756@
4757"SEC","^DIC",172.101,172.101,0,"LAYGO")
4758@
4759"SEC","^DIC",172.101,172.101,0,"RD")
4760@
4761"SEC","^DIC",172.101,172.101,0,"WR")
4762@
4763"SEC","^DIC",172.201,172.201,0,"AUDIT")
4764@
4765"SEC","^DIC",172.201,172.201,0,"DD")
4766@
4767"SEC","^DIC",172.201,172.201,0,"DEL")
4768@
4769"SEC","^DIC",172.201,172.201,0,"LAYGO")
4770@
4771"SEC","^DIC",172.201,172.201,0,"RD")
4772@
4773"SEC","^DIC",172.201,172.201,0,"WR")
4774@
4775"VER")
47768.0^22.0
4777"^DD",172.101,172.101,0)
4778FIELD^^.05^6
4779"^DD",172.101,172.101,0,"DDA")
4780N
4781"^DD",172.101,172.101,0,"DT")
47823111013
4783"^DD",172.101,172.101,0,"ID",.02)
4784S %I=Y,Y=$S('$D(^(0)):"",$D(^C0X(201,+$P(^(0),U,2),0))#2:$P(^(0),U,1),1:""),C=$P(^DD(172.201,.01,0),U,2) D Y^DIQ:Y]"" W " ",Y,@("$E("_DIC_"%I,0),0)") S Y=%I K %I
4785"^DD",172.101,172.101,0,"ID",.03)
4786S %I=Y,Y=$S('$D(^(0)):"",$D(^C0X(201,+$P(^(0),U,3),0))#2:$P(^(0),U,1),1:""),C=$P(^DD(172.201,.01,0),U,2) D Y^DIQ:Y]"" W " ",Y,@("$E("_DIC_"%I,0),0)") S Y=%I K %I
4787"^DD",172.101,172.101,0,"ID",.04)
4788S %I=Y,Y=$S('$D(^(0)):"",$D(^C0X(201,+$P(^(0),U,4),0))#2:$P(^(0),U,1),1:""),C=$P(^DD(172.201,.01,0),U,2) D Y^DIQ:Y]"" W " ",Y,@("$E("_DIC_"%I,0),0)") S Y=%I K %I
4789"^DD",172.101,172.101,0,"ID",.05)
4790S %I=Y,Y=$S('$D(^(0)):"",$D(^C0X(201,+$P(^(0),U,5),0))#2:$P(^(0),U,1),1:""),C=$P(^DD(172.201,.01,0),U,2) D Y^DIQ:Y]"" W " ",Y,@("$E("_DIC_"%I,0),0)") S Y=%I K %I
4791"^DD",172.101,172.101,0,"IX","B",172.101,.01)
4792
4793"^DD",172.101,172.101,0,"NM","C0X TRIPLE")
4794
4795"^DD",172.101,172.101,.01,0)
4796NODEID^RF^^0;1^K:$L(X)>30!($L(X)<3)!'(X'?1P.E) X
4797"^DD",172.101,172.101,.01,.1)
4798TRIPLE NODE ID
4799"^DD",172.101,172.101,.01,1,0)
4800^.1
4801"^DD",172.101,172.101,.01,1,1,0)
4802172.101^B
4803"^DD",172.101,172.101,.01,1,1,1)
4804S ^C0X(101,"B",$E(X,1,30),DA)=""
4805"^DD",172.101,172.101,.01,1,1,2)
4806K ^C0X(101,"B",$E(X,1,30),DA)
4807"^DD",172.101,172.101,.01,3)
4808Answer must be 3-30 characters in length
4809"^DD",172.101,172.101,.01,"DT")
48103111013
4811"^DD",172.101,172.101,.02,0)
4812GRAPH^P172.201O^C0X(201,^0;2^Q
4813"^DD",172.101,172.101,.02,.1)
4814TRIPLE GRAPH
4815"^DD",172.101,172.101,.02,2)
4816S Y(0)=Y S Y=$$NSP^C0XUTIL(Y)
4817"^DD",172.101,172.101,.02,2.1)
4818S Y=$$NSP^C0XUTIL(Y)
4819"^DD",172.101,172.101,.02,3)
4820Answer must be 3-240 characters in length
4821"^DD",172.101,172.101,.02,"DT")
48223111207
4823"^DD",172.101,172.101,.03,0)
4824SUBJECT^P172.201O^C0X(201,^0;3^Q
4825"^DD",172.101,172.101,.03,.1)
4826TRIPLE SUBJECT
4827"^DD",172.101,172.101,.03,2)
4828S Y(0)=Y S Y=$$NSP^C0XUTIL(Y)
4829"^DD",172.101,172.101,.03,2.1)
4830S Y=$$NSP^C0XUTIL(Y)
4831"^DD",172.101,172.101,.03,"DT")
48323111207
4833"^DD",172.101,172.101,.04,0)
4834PREDICATE^P172.201O^C0X(201,^0;4^Q
4835"^DD",172.101,172.101,.04,.1)
4836TRIPLE PREDICATE
4837"^DD",172.101,172.101,.04,2)
4838S Y(0)=Y S Y=$$NSP^C0XUTIL(Y)
4839"^DD",172.101,172.101,.04,2.1)
4840S Y=$$NSP^C0XUTIL(Y)
4841"^DD",172.101,172.101,.04,"DT")
48423111207
4843"^DD",172.101,172.101,.05,0)
4844OBJECT^P172.201O^C0X(201,^0;5^Q
4845"^DD",172.101,172.101,.05,.1)
4846TRIPLE OBJECT
4847"^DD",172.101,172.101,.05,2)
4848S Y(0)=Y S Y=$$NSP^C0XUTIL(Y)
4849"^DD",172.101,172.101,.05,2.1)
4850S Y=$$NSP^C0XUTIL(Y)
4851"^DD",172.101,172.101,.05,"DT")
48523111207
4853"^DD",172.101,172.101,1,0)
4854EVENTS^172.1011V^^1;0
4855"^DD",172.101,172.1011,0)
4856EVENTS SUB-FIELD^^.01^1
4857"^DD",172.101,172.1011,0,"DT")
48583110510
4859"^DD",172.101,172.1011,0,"IX","B",172.1011,.01)
4860
4861"^DD",172.101,172.1011,0,"NM","EVENTS")
4862
4863"^DD",172.101,172.1011,0,"UP")
4864172.101
4865"^DD",172.101,172.1011,.01,0)
4866EVENTS^V^^0;1^
4867"^DD",172.101,172.1011,.01,.1)
4868PATIENT CLINICAL EVENTS
4869"^DD",172.101,172.1011,.01,1,0)
4870^.1
4871"^DD",172.101,172.1011,.01,1,1,0)
4872172.1011^B
4873"^DD",172.101,172.1011,.01,1,1,1)
4874S ^C0CXREF(DA(1),1,"B",$E(X,1,30),DA)=""
4875"^DD",172.101,172.1011,.01,1,1,2)
4876K ^C0CXREF(DA(1),1,"B",$E(X,1,30),DA)
4877"^DD",172.101,172.1011,.01,1,1,3)
4878Required for Variable Pointer
4879"^DD",172.101,172.1011,.01,"DT")
48803110510
4881"^DD",172.101,172.1011,.01,"V",0)
4882^.12P^^3
4883"^DD",172.101,172.1011,.01,"V",1,0)
488455^MEDICATIONS^1^M^n^y
4885"^DD",172.101,172.1011,.01,"V",1,1)
4886
4887"^DD",172.101,172.1011,.01,"V",1,2)
4888
4889"^DD",172.101,172.1011,.01,"V",2,0)
48909000011^PATIENT PROBLEM^2^P^n^y
4891"^DD",172.101,172.1011,.01,"V",2,1)
4892
4893"^DD",172.101,172.1011,.01,"V",2,2)
4894
4895"^DD",172.101,172.1011,.01,"V",3,0)
489669^PATIENT LAB ORDER^3^L^n^y
4897"^DD",172.201,172.201,0)
4898FIELD^^1^2
4899"^DD",172.201,172.201,0,"DDA")
4900N
4901"^DD",172.201,172.201,0,"DT")
49023111013
4903"^DD",172.201,172.201,0,"NM","C0X STRING")
4904
4905"^DD",172.201,172.201,0,"PT",172.101,.02)
4906
4907"^DD",172.201,172.201,0,"PT",172.101,.03)
4908
4909"^DD",172.201,172.201,0,"PT",172.101,.04)
4910
4911"^DD",172.201,172.201,0,"PT",172.101,.05)
4912
4913"^DD",172.201,172.201,.01,0)
4914STRING^RF^^0;1^K:$L(X)>240!($L(X)<1)!'(X=X) X
4915"^DD",172.201,172.201,.01,.1)
4916TRIPLE STRING
4917"^DD",172.201,172.201,.01,1,0)
4918^.1^^0
4919"^DD",172.201,172.201,.01,3)
4920Answer must be 1-240 characters in length
4921"^DD",172.201,172.201,.01,"DT")
49223111028
4923"^DD",172.201,172.201,1,0)
4924TEXT^172.2011^^1;0
4925"^DD",172.201,172.2011,0)
4926TEXT SUB-FIELD^^.01^1
4927"^DD",172.201,172.2011,0,"DT")
49283111013
4929"^DD",172.201,172.2011,0,"NM","TEXT")
4930
4931"^DD",172.201,172.2011,0,"UP")
4932172.201
4933"^DD",172.201,172.2011,.01,0)
4934TEXT^Wx^^0;1
4935"^DD",172.201,172.2011,.01,.1)
4936LONGER TEXT
4937"^DD",172.201,172.2011,.01,"DT")
49383111013
4939"^DIC",172.101,172.101,0)
4940C0X TRIPLE^172.101
4941"^DIC",172.101,172.101,0,"GL")
4942^C0X(101,
4943"^DIC",172.101,"B","C0X TRIPLE",172.101)
4944
4945"^DIC",172.201,172.201,0)
4946C0X STRING^172.201
4947"^DIC",172.201,172.201,0,"GL")
4948^C0X(201,
4949"^DIC",172.201,"B","C0X STRING",172.201)
4950
4951**END**
4952**END**
Note: See TracBrowser for help on using the repository browser.