source: fmts/trunk/kids/C0X_1_0_0_T5.KID@ 1500

Last change on this file since 1500 was 1278, checked in by George Lilly, 13 years ago

new user entry point FILEINC0XF2N and more timing messages and blocking

File size: 77.1 KB
Line 
1KIDS Distribution saved on Nov 04, 2011@21:27:03
2new user entry point at FILEIN C0XF2N
3**KIDS**:C0X*1.0*0^
4
5**INSTALL NAME**
6C0X*1.0*0
7"BLD",7885,0)
8C0X*1.0*0^^0^3111104^n
9"BLD",7885,4,0)
10^9.64PA^172.201^2
11"BLD",7885,4,172.101,0)
12172.101
13"BLD",7885,4,172.101,222)
14y^y^f^^^^n
15"BLD",7885,4,172.201,0)
16172.201
17"BLD",7885,4,172.201,222)
18y^y^f^^^^n
19"BLD",7885,4,"B",172.101,172.101)
20
21"BLD",7885,4,"B",172.201,172.201)
22
23"BLD",7885,6.3)
245
25"BLD",7885,"KRN",0)
26^9.67PA^779.2^20
27"BLD",7885,"KRN",.4,0)
28.4
29"BLD",7885,"KRN",.4,"NM",0)
30^9.68A^1^1
31"BLD",7885,"KRN",.4,"NM",1,0)
32C0X PRINT GRAPH FILE #172.101^172.101^0
33"BLD",7885,"KRN",.4,"NM","B","C0X PRINT GRAPH FILE #172.101",1)
34
35"BLD",7885,"KRN",.401,0)
36.401
37"BLD",7885,"KRN",.402,0)
38.402
39"BLD",7885,"KRN",.403,0)
40.403
41"BLD",7885,"KRN",.5,0)
42.5
43"BLD",7885,"KRN",.84,0)
44.84
45"BLD",7885,"KRN",3.6,0)
463.6
47"BLD",7885,"KRN",3.8,0)
483.8
49"BLD",7885,"KRN",9.2,0)
509.2
51"BLD",7885,"KRN",9.8,0)
529.8
53"BLD",7885,"KRN",9.8,"NM",0)
54^9.68A^2^2
55"BLD",7885,"KRN",9.8,"NM",1,0)
56C0XMAIN^^0^B261424134
57"BLD",7885,"KRN",9.8,"NM",2,0)
58C0XF2N^^0^B289235092
59"BLD",7885,"KRN",9.8,"NM","B","C0XF2N",2)
60
61"BLD",7885,"KRN",9.8,"NM","B","C0XMAIN",1)
62
63"BLD",7885,"KRN",19,0)
6419
65"BLD",7885,"KRN",19.1,0)
6619.1
67"BLD",7885,"KRN",101,0)
68101
69"BLD",7885,"KRN",409.61,0)
70409.61
71"BLD",7885,"KRN",771,0)
72771
73"BLD",7885,"KRN",779.2,0)
74779.2
75"BLD",7885,"KRN",870,0)
76870
77"BLD",7885,"KRN",8989.51,0)
788989.51
79"BLD",7885,"KRN",8989.52,0)
808989.52
81"BLD",7885,"KRN",8994,0)
828994
83"BLD",7885,"KRN","B",.4,.4)
84
85"BLD",7885,"KRN","B",.401,.401)
86
87"BLD",7885,"KRN","B",.402,.402)
88
89"BLD",7885,"KRN","B",.403,.403)
90
91"BLD",7885,"KRN","B",.5,.5)
92
93"BLD",7885,"KRN","B",.84,.84)
94
95"BLD",7885,"KRN","B",3.6,3.6)
96
97"BLD",7885,"KRN","B",3.8,3.8)
98
99"BLD",7885,"KRN","B",9.2,9.2)
100
101"BLD",7885,"KRN","B",9.8,9.8)
102
103"BLD",7885,"KRN","B",19,19)
104
105"BLD",7885,"KRN","B",19.1,19.1)
106
107"BLD",7885,"KRN","B",101,101)
108
109"BLD",7885,"KRN","B",409.61,409.61)
110
111"BLD",7885,"KRN","B",771,771)
112
113"BLD",7885,"KRN","B",779.2,779.2)
114
115"BLD",7885,"KRN","B",870,870)
116
117"BLD",7885,"KRN","B",8989.51,8989.51)
118
119"BLD",7885,"KRN","B",8989.52,8989.52)
120
121"BLD",7885,"KRN","B",8994,8994)
122
123"FIA",172.101)
124C0X TRIPLE
125"FIA",172.101,0)
126^C0X(101,
127"FIA",172.101,0,0)
128172.101I
129"FIA",172.101,0,1)
130y^y^f^^^^n
131"FIA",172.101,0,10)
132
133"FIA",172.101,0,11)
134
135"FIA",172.101,0,"RLRO")
136
137"FIA",172.101,172.101)
1380
139"FIA",172.201)
140C0X STRING
141"FIA",172.201,0)
142^C0X(201,
143"FIA",172.201,0,0)
144172.201
145"FIA",172.201,0,1)
146y^y^f^^^^n
147"FIA",172.201,0,10)
148
149"FIA",172.201,0,11)
150
151"FIA",172.201,0,"RLRO")
152
153"FIA",172.201,172.201)
1540
155"FIA",172.201,172.2011)
1560
157"IX",172.101,172.101,"G",0)
158172.101^G^REGULAR INDEX OF THE GRAPH FIELD^R^^F^IR^I^172.101^^^^^LS
159"IX",172.101,172.101,"G",1)
160S ^C0X(101,"G",X,DA)=""
161"IX",172.101,172.101,"G",2)
162K ^C0X(101,"G",X,DA)
163"IX",172.101,172.101,"G",2.5)
164K ^C0X(101,"G")
165"IX",172.101,172.101,"G",11.1,0)
166^.114IA^1^1
167"IX",172.101,172.101,"G",11.1,1,0)
1681^F^172.101^.02^^1^F
169"IX",172.101,172.101,"G",11.1,1,3)
170
171"IX",172.101,172.101,"GOPS",0)
172172.101^GOPS^GRAPH ONLY OBJECT PREDICATE SUBJECT^R^^R^IR^I^172.101^^^^^LS
173"IX",172.101,172.101,"GOPS",1)
174S ^C0X(101,"GOPS",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)=""
175"IX",172.101,172.101,"GOPS",2)
176K ^C0X(101,"GOPS",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)
177"IX",172.101,172.101,"GOPS",2.5)
178K ^C0X(101,"GOPS")
179"IX",172.101,172.101,"GOPS",11.1,0)
180^.114IA^4^4
181"IX",172.101,172.101,"GOPS",11.1,1,0)
1821^F^172.101^.02^240^1^F
183"IX",172.101,172.101,"GOPS",11.1,1,3)
184
185"IX",172.101,172.101,"GOPS",11.1,2,0)
1862^F^172.101^.05^240^2^F
187"IX",172.101,172.101,"GOPS",11.1,2,3)
188
189"IX",172.101,172.101,"GOPS",11.1,3,0)
1903^F^172.101^.04^240^3^F
191"IX",172.101,172.101,"GOPS",11.1,3,3)
192
193"IX",172.101,172.101,"GOPS",11.1,4,0)
1944^F^172.101^.03^240^4^F
195"IX",172.101,172.101,"GOPS",11.1,4,3)
196
197"IX",172.101,172.101,"GOSP",0)
198172.101^GOSP^GRAPH ONLY OBJECT SUBJECT PREDICATE^R^^R^IR^I^172.101^^^^^LS
199"IX",172.101,172.101,"GOSP",1)
200S ^C0X(101,"GOSP",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)=""
201"IX",172.101,172.101,"GOSP",2)
202K ^C0X(101,"GOSP",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)
203"IX",172.101,172.101,"GOSP",2.5)
204K ^C0X(101,"GOSP")
205"IX",172.101,172.101,"GOSP",11.1,0)
206^.114IA^4^4
207"IX",172.101,172.101,"GOSP",11.1,1,0)
2081^F^172.101^.02^240^1^F
209"IX",172.101,172.101,"GOSP",11.1,1,3)
210
211"IX",172.101,172.101,"GOSP",11.1,2,0)
2122^F^172.101^.05^240^2^F
213"IX",172.101,172.101,"GOSP",11.1,2,3)
214
215"IX",172.101,172.101,"GOSP",11.1,3,0)
2163^F^172.101^.03^240^3^F
217"IX",172.101,172.101,"GOSP",11.1,3,3)
218
219"IX",172.101,172.101,"GOSP",11.1,4,0)
2204^F^172.101^.04^240^4^F
221"IX",172.101,172.101,"GOSP",11.1,4,3)
222
223"IX",172.101,172.101,"GPSO",0)
224172.101^GPSO^GRAPH ONLY PREDICATE SUBJECT OBJECT^R^^R^IR^I^172.101^^^^^LS
225"IX",172.101,172.101,"GPSO",1)
226S ^C0X(101,"GPSO",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)=""
227"IX",172.101,172.101,"GPSO",2)
228K ^C0X(101,"GPSO",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)
229"IX",172.101,172.101,"GPSO",2.5)
230K ^C0X(101,"GPSO")
231"IX",172.101,172.101,"GPSO",11.1,0)
232^.114IA^4^4
233"IX",172.101,172.101,"GPSO",11.1,1,0)
2341^F^172.101^.02^240^1^F
235"IX",172.101,172.101,"GPSO",11.1,1,3)
236
237"IX",172.101,172.101,"GPSO",11.1,2,0)
2382^F^172.101^.04^240^2^F
239"IX",172.101,172.101,"GPSO",11.1,2,3)
240
241"IX",172.101,172.101,"GPSO",11.1,3,0)
2423^F^172.101^.03^240^3^F
243"IX",172.101,172.101,"GPSO",11.1,3,3)
244
245"IX",172.101,172.101,"GPSO",11.1,4,0)
2464^F^172.101^.05^240^4^F
247"IX",172.101,172.101,"GPSO",11.1,4,3)
248
249"IX",172.101,172.101,"GSPO",0)
250172.101^GSPO^GROUP ONLY SUBJECT PREDICATE OBJECT^R^^R^IR^I^172.101^^^^^LS
251"IX",172.101,172.101,"GSPO",1)
252S ^C0X(101,"GSPO",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)=""
253"IX",172.101,172.101,"GSPO",2)
254K ^C0X(101,"GSPO",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)
255"IX",172.101,172.101,"GSPO",2.5)
256K ^C0X(101,"GSPO")
257"IX",172.101,172.101,"GSPO",11.1,0)
258^.114IA^4^4
259"IX",172.101,172.101,"GSPO",11.1,1,0)
2601^F^172.101^.02^240^1^F
261"IX",172.101,172.101,"GSPO",11.1,1,3)
262
263"IX",172.101,172.101,"GSPO",11.1,2,0)
2642^F^172.101^.03^240^2^F
265"IX",172.101,172.101,"GSPO",11.1,2,3)
266
267"IX",172.101,172.101,"GSPO",11.1,3,0)
2683^F^172.101^.04^240^3^F
269"IX",172.101,172.101,"GSPO",11.1,3,3)
270
271"IX",172.101,172.101,"GSPO",11.1,4,0)
2724^F^172.101^.05^240^4^F
273"IX",172.101,172.101,"GSPO",11.1,4,3)
274
275"IX",172.101,172.101,"OPS",0)
276172.101^OPS^REGULAR INDEX OF OBJECT PREDICATE SUBJECT^R^^R^IR^I^172.101^^^^^LS
277"IX",172.101,172.101,"OPS",1)
278S ^C0X(101,"OPS",X(1),X(2),X(3),DA)=""
279"IX",172.101,172.101,"OPS",2)
280K ^C0X(101,"OPS",X(1),X(2),X(3),DA)
281"IX",172.101,172.101,"OPS",2.5)
282K ^C0X(101,"OPS")
283"IX",172.101,172.101,"OPS",11.1,0)
284^.114IA^3^3
285"IX",172.101,172.101,"OPS",11.1,1,0)
2861^F^172.101^.05^^1^F
287"IX",172.101,172.101,"OPS",11.1,1,3)
288
289"IX",172.101,172.101,"OPS",11.1,2,0)
2902^F^172.101^.04^^2^F
291"IX",172.101,172.101,"OPS",11.1,2,3)
292
293"IX",172.101,172.101,"OPS",11.1,3,0)
2943^F^172.101^.03^^3^F
295"IX",172.101,172.101,"OPS",11.1,3,3)
296
297"IX",172.101,172.101,"OSP",0)
298172.101^OSP^REGULAR INDEX OF OBJECT SUBJECT PREDICATE^R^^R^IR^I^172.101^^^^^LS
299"IX",172.101,172.101,"OSP",1)
300S ^C0X(101,"OSP",X(1),X(2),X(3),DA)=""
301"IX",172.101,172.101,"OSP",2)
302K ^C0X(101,"OSP",X(1),X(2),X(3),DA)
303"IX",172.101,172.101,"OSP",2.5)
304K ^C0X(101,"OSP")
305"IX",172.101,172.101,"OSP",11.1,0)
306^.114IA^3^3
307"IX",172.101,172.101,"OSP",11.1,1,0)
3081^F^172.101^.05^^1^F
309"IX",172.101,172.101,"OSP",11.1,1,3)
310
311"IX",172.101,172.101,"OSP",11.1,2,0)
3122^F^172.101^.03^^2^F
313"IX",172.101,172.101,"OSP",11.1,2,3)
314
315"IX",172.101,172.101,"OSP",11.1,3,0)
3163^F^172.101^.04^^3^F
317"IX",172.101,172.101,"OSP",11.1,3,3)
318
319"IX",172.101,172.101,"PSO",0)
320172.101^PSO^REGULAR INDEX OF PREDICATE SUBJECT OBJECT^R^^R^IR^I^172.101^^^^^LS
321"IX",172.101,172.101,"PSO",1)
322S ^C0X(101,"PSO",X(1),X(2),X(3),DA)=""
323"IX",172.101,172.101,"PSO",2)
324K ^C0X(101,"PSO",X(1),X(2),X(3),DA)
325"IX",172.101,172.101,"PSO",2.5)
326K ^C0X(101,"PSO")
327"IX",172.101,172.101,"PSO",11.1,0)
328^.114IA^3^3
329"IX",172.101,172.101,"PSO",11.1,1,0)
3301^F^172.101^.04^^1^F
331"IX",172.101,172.101,"PSO",11.1,1,3)
332
333"IX",172.101,172.101,"PSO",11.1,2,0)
3342^F^172.101^.03^^2^F
335"IX",172.101,172.101,"PSO",11.1,2,3)
336
337"IX",172.101,172.101,"PSO",11.1,3,0)
3383^F^172.101^.05^^3^F
339"IX",172.101,172.101,"PSO",11.1,3,3)
340
341"IX",172.101,172.101,"SPO",0)
342172.101^SPO^REGULAR INDEX OF SUBJECT PREDICATE OBJECT^R^^R^IR^I^172.101^^^^^LS
343"IX",172.101,172.101,"SPO",1)
344S ^C0X(101,"SPO",X(1),X(2),X(3),DA)=""
345"IX",172.101,172.101,"SPO",2)
346K ^C0X(101,"SPO",X(1),X(2),X(3),DA)
347"IX",172.101,172.101,"SPO",2.5)
348K ^C0X(101,"SPO")
349"IX",172.101,172.101,"SPO",11.1,0)
350^.114IA^3^3
351"IX",172.101,172.101,"SPO",11.1,1,0)
3521^F^172.101^.03^^1^F
353"IX",172.101,172.101,"SPO",11.1,1,3)
354
355"IX",172.101,172.101,"SPO",11.1,2,0)
3562^F^172.101^.04^^2^F
357"IX",172.101,172.101,"SPO",11.1,2,3)
358
359"IX",172.101,172.101,"SPO",11.1,3,0)
3603^F^172.101^.05^^3^F
361"IX",172.101,172.101,"SPO",11.1,3,3)
362
363"IX",172.201,172.201,"B",0)
364172.201^B^regular B index for strings to support long strings^R^^F^IR^I^172.201^^^^^LS
365"IX",172.201,172.201,"B",1)
366S ^C0X(201,"B",$E(X,1,240),DA)=""
367"IX",172.201,172.201,"B",2)
368K ^C0X(201,"B",$E(X,1,240),DA)
369"IX",172.201,172.201,"B",2.5)
370K ^C0X(201,"B")
371"IX",172.201,172.201,"B",11.1,0)
372^.114IA^1^1
373"IX",172.201,172.201,"B",11.1,1,0)
3741^F^172.201^.01^240^1^F
375"KRN",.4,1498,-1)
3760^1
377"KRN",.4,1498,0)
378C0X PRINT GRAPH^3111029.121^@^172.101^^@^3111030
379"KRN",.4,1498,"F",2)
380.03;W25;S~.04;C27;W25~.05;C54;W25~
381"KRN",.4,1498,"H")
382C0X TRIPLE LIST
383"MBREQ")
3840
385"ORD",5,.4)
386.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,"",%)
387"ORD",5,.4,0)
388PRINT TEMPLATE
389"QUES","XPF1",0)
390Y
391"QUES","XPF1","??")
392^D REP^XPDH
393"QUES","XPF1","A")
394Shall I write over your |FLAG| File
395"QUES","XPF1","B")
396YES
397"QUES","XPF1","M")
398D XPF1^XPDIQ
399"QUES","XPF2",0)
400Y
401"QUES","XPF2","??")
402^D DTA^XPDH
403"QUES","XPF2","A")
404Want my data |FLAG| yours
405"QUES","XPF2","B")
406YES
407"QUES","XPF2","M")
408D XPF2^XPDIQ
409"QUES","XPI1",0)
410YO
411"QUES","XPI1","??")
412^D INHIBIT^XPDH
413"QUES","XPI1","A")
414Want KIDS to INHIBIT LOGONs during the install
415"QUES","XPI1","B")
416NO
417"QUES","XPI1","M")
418D XPI1^XPDIQ
419"QUES","XPM1",0)
420PO^VA(200,:EM
421"QUES","XPM1","??")
422^D MG^XPDH
423"QUES","XPM1","A")
424Enter the Coordinator for Mail Group '|FLAG|'
425"QUES","XPM1","B")
426
427"QUES","XPM1","M")
428D XPM1^XPDIQ
429"QUES","XPO1",0)
430Y
431"QUES","XPO1","??")
432^D MENU^XPDH
433"QUES","XPO1","A")
434Want KIDS to Rebuild Menu Trees Upon Completion of Install
435"QUES","XPO1","B")
436NO
437"QUES","XPO1","M")
438D XPO1^XPDIQ
439"QUES","XPZ1",0)
440Y
441"QUES","XPZ1","??")
442^D OPT^XPDH
443"QUES","XPZ1","A")
444Want to DISABLE Scheduled Options, Menu Options, and Protocols
445"QUES","XPZ1","B")
446NO
447"QUES","XPZ1","M")
448D XPZ1^XPDIQ
449"QUES","XPZ2",0)
450Y
451"QUES","XPZ2","??")
452^D RTN^XPDH
453"QUES","XPZ2","A")
454Want to MOVE routines to other CPUs
455"QUES","XPZ2","B")
456NO
457"QUES","XPZ2","M")
458D XPZ2^XPDIQ
459"RTN")
4602
461"RTN","C0XF2N")
4620^2^B289235092
463"RTN","C0XF2N",1,0)
464C0XMAIN ; GPL - Fileman Triples entry point routine ;10/13/11 17:05
465"RTN","C0XF2N",2,0)
466 ;;0.1;C0X;nopatch;noreleasedate;Build 5
467"RTN","C0XF2N",3,0)
468 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU
469"RTN","C0XF2N",4,0)
470 ;General Public License See attached copy of the License.
471"RTN","C0XF2N",5,0)
472 ;
473"RTN","C0XF2N",6,0)
474 ;This program is free software; you can redistribute it and/or modify
475"RTN","C0XF2N",7,0)
476 ;it under the terms of the GNU General Public License as published by
477"RTN","C0XF2N",8,0)
478 ;the Free Software Foundation; either version 2 of the License, or
479"RTN","C0XF2N",9,0)
480 ;(at your option) any later version.
481"RTN","C0XF2N",10,0)
482 ;
483"RTN","C0XF2N",11,0)
484 ;This program is distributed in the hope that it will be useful,
485"RTN","C0XF2N",12,0)
486 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
487"RTN","C0XF2N",13,0)
488 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
489"RTN","C0XF2N",14,0)
490 ;GNU General Public License for more details.
491"RTN","C0XF2N",15,0)
492 ;
493"RTN","C0XF2N",16,0)
494 ;You should have received a copy of the GNU General Public License along
495"RTN","C0XF2N",17,0)
496 ;with this program; if not, write to the Free Software Foundation, Inc.,
497"RTN","C0XF2N",18,0)
498 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
499"RTN","C0XF2N",19,0)
500 ;
501"RTN","C0XF2N",20,0)
502 Q
503"RTN","C0XF2N",21,0)
504 ;
505"RTN","C0XF2N",22,0)
506 ; This is based on C0XMAIN but experiments with a fast load for triples
507"RTN","C0XF2N",23,0)
508 ; that will write directly to the fileman global
509"RTN","C0XF2N",24,0)
510 ; The file 172.101 is a F2N design style for triples, which means
511"RTN","C0XF2N",25,0)
512 ; that it is a Flat file with no subfiles, all fields at the root
513"RTN","C0XF2N",26,0)
514 ; ... it is a "2" file solution which means all strings are stored in
515"RTN","C0XF2N",27,0)
516 ; ... strings file and pointed to by the triples file
517"RTN","C0XF2N",28,0)
518 ; ... it is an N file because it has generated Node IDs instead of
519"RTN","C0XF2N",29,0)
520 ; ... DINUM which would use the IEN for the Node ID.
521"RTN","C0XF2N",30,0)
522 ; gpl 11/04/2011
523"RTN","C0XF2N",31,0)
524 ;
525"RTN","C0XF2N",32,0)
526INITFARY(ZFARY) ; INITIALIZE FILE NUMBERS AND OTHER USEFUL THINGS
527"RTN","C0XF2N",33,0)
528 ; FOR THE DEFAULT TRIPLE STORE. USE OTHER VALUES FOR SUPPORTING ADDITIONAL
529"RTN","C0XF2N",34,0)
530 ; TRIPLE STORES
531"RTN","C0XF2N",35,0)
532 S @ZFARY@("C0XTFN")=172.101 ; TRIPLES FILE NUMBER
533"RTN","C0XF2N",36,0)
534 S @ZFARY@("C0XSFN")=172.201 ; TRIPLES STRINGS FILE NUMBER
535"RTN","C0XF2N",37,0)
536 S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME
537"RTN","C0XF2N",38,0)
538 S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME
539"RTN","C0XF2N",39,0)
540 S @ZFARY@("C0XDIR")="/home/glilly/rdf/"
541"RTN","C0XF2N",40,0)
542 D USEFARY(ZFARY)
543"RTN","C0XF2N",41,0)
544 Q
545"RTN","C0XF2N",42,0)
546 ;
547"RTN","C0XF2N",43,0)
548USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY
549"RTN","C0XF2N",44,0)
550 N ZI S ZI=""
551"RTN","C0XF2N",45,0)
552 F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D
553"RTN","C0XF2N",46,0)
554 . ;N ZX
555"RTN","C0XF2N",47,0)
556 . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_""""
557"RTN","C0XF2N",48,0)
558 . ;W !,ZX
559"RTN","C0XF2N",49,0)
560 . X ZX
561"RTN","C0XF2N",50,0)
562 Q
563"RTN","C0XF2N",51,0)
564 ;
565"RTN","C0XF2N",52,0)
566FILEIN ; INTERACTIVE ENTRY POINT FOR OPTION TO READ IN A FILE
567"RTN","C0XF2N",53,0)
568 I '$D(C0XFARY) D INITFARY("C0XFARY")
569"RTN","C0XF2N",54,0)
570 D USEFARY("C0XFARY")
571"RTN","C0XF2N",55,0)
572 S DIR(0)="F^3:240"
573"RTN","C0XF2N",56,0)
574 S DIR("A")="File Directory"
575"RTN","C0XF2N",57,0)
576 S DIR("B")=C0XDIR
577"RTN","C0XF2N",58,0)
578 D ^DIR
579"RTN","C0XF2N",59,0)
580 I Y="^" Q ;
581"RTN","C0XF2N",60,0)
582 S C0XDIR=Y
583"RTN","C0XF2N",61,0)
584 S C0XFARY("C0XDIR")=Y
585"RTN","C0XF2N",62,0)
586 S DIR(0)="F^3:240"
587"RTN","C0XF2N",63,0)
588 S DIR("A")="File Name"
589"RTN","C0XF2N",64,0)
590 I '$D(C0XFN) S DIR("B")="qds.rdf"
591"RTN","C0XF2N",65,0)
592 E S DIR("B")=C0XFN
593"RTN","C0XF2N",66,0)
594 D ^DIR
595"RTN","C0XF2N",67,0)
596 I Y="" Q ;
597"RTN","C0XF2N",68,0)
598 I Y="^" Q ;
599"RTN","C0XF2N",69,0)
600 S C0XFN=Y
601"RTN","C0XF2N",70,0)
602 D IMPORT(C0XFN,C0XDIR,,"C0XFARY")
603"RTN","C0XF2N",71,0)
604 Q
605"RTN","C0XF2N",72,0)
606 ;
607"RTN","C0XF2N",73,0)
608IMPORT(FNAME,FDIR,FURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD
609"RTN","C0XF2N",74,0)
610 ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE
611"RTN","C0XF2N",75,0)
612 ; NODE NAME OF THE TEXT TRIPLE
613"RTN","C0XF2N",76,0)
614 ; FDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR)
615"RTN","C0XF2N",77,0)
616 ; FURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE
617"RTN","C0XF2N",78,0)
618 ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE
619"RTN","C0XF2N",79,0)
620 I '$D(FARY) D ;
621"RTN","C0XF2N",80,0)
622 . D INITFARY("C0XFARY")
623"RTN","C0XF2N",81,0)
624 . S FARY="C0XFARY"
625"RTN","C0XF2N",82,0)
626 D USEFARY(FARY)
627"RTN","C0XF2N",83,0)
628 N ZD,ZTMP
629"RTN","C0XF2N",84,0)
630 I '$D(FDIR) S FDIR=C0XDIR ; DIRECTORY OF THE RDF FILE
631"RTN","C0XF2N",85,0)
632 I '$D(FURL) D ;
633"RTN","C0XF2N",86,0)
634 . N ZN2 S ZN2=$TR(FNAME,".","_") ; REMOVE THE DOT FROM THE NAME
635"RTN","C0XF2N",87,0)
636 . S FURL=FDIR_ZN2
637"RTN","C0XF2N",88,0)
638 N ZTMP
639"RTN","C0XF2N",89,0)
640 S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE
641"RTN","C0XF2N",90,0)
642 K @ZTMP ; MAKE SURE IT'S CLEAR
643"RTN","C0XF2N",91,0)
644 S C0XSTART=$$NOW^XLFDT
645"RTN","C0XF2N",92,0)
646 W !,"STARTED: ",C0XSTART
647"RTN","C0XF2N",93,0)
648 W !,"READING IN: ",FNAME
649"RTN","C0XF2N",94,0)
650 I '$$FILEREAD(ZTMP,FDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS
651"RTN","C0XF2N",95,0)
652 . W !,"ERROR READING FILE: ",FDIR,FNAME
653"RTN","C0XF2N",96,0)
654 S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT
655"RTN","C0XF2N",97,0)
656 W !,$O(@ZRDF@(""),-1)," LINES READ"
657"RTN","C0XF2N",98,0)
658 D INSRDF(ZRDF,FURL,FARY) ; IMPORT AND PROCESS THE RDF
659"RTN","C0XF2N",99,0)
660 Q
661"RTN","C0XF2N",100,0)
662 ;
663"RTN","C0XF2N",101,0)
664WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT
665"RTN","C0XF2N",102,0)
666 ;
667"RTN","C0XF2N",103,0)
668 I '$D(FARY) D ;
669"RTN","C0XF2N",104,0)
670 . D INITFARY("C0XFARY")
671"RTN","C0XF2N",105,0)
672 . S FARY="C0XFARY"
673"RTN","C0XF2N",106,0)
674 D USEFARY(FARY)
675"RTN","C0XF2N",107,0)
676 ;N ZLOC,ZTMP
677"RTN","C0XF2N",108,0)
678 K ZTMP
679"RTN","C0XF2N",109,0)
680 S ZLOC=$NA(^TMP("C0X","WGET",$J))
681"RTN","C0XF2N",110,0)
682 K @ZLOC
683"RTN","C0XF2N",111,0)
684 S C0XSTART=$$NOW^XLFDT
685"RTN","C0XF2N",112,0)
686 W !,"STARTED: ",C0XSTART
687"RTN","C0XF2N",113,0)
688 W !,"DOWNLOADING: ",ZURL
689"RTN","C0XF2N",114,0)
690 S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP)
691"RTN","C0XF2N",115,0)
692 M @ZLOC=ZTMP
693"RTN","C0XF2N",116,0)
694 S C0XLINES=$O(@ZLOC@(""),-1)
695"RTN","C0XF2N",117,0)
696 W !,C0XLINES," LINES READ"
697"RTN","C0XF2N",118,0)
698 S C0XDLC=$$NOW^XLFDT ; DOWNLOAD COMPLETE
699"RTN","C0XF2N",119,0)
700 W !,"DOWNLOAD COMPLETE AT ",C0XDLC
701"RTN","C0XF2N",120,0)
702 S C0XDIFF=$$FMDIFF^XLFDT(C0XDLC,C0XSTART,2)
703"RTN","C0XF2N",121,0)
704 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
705"RTN","C0XF2N",122,0)
706 I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XLINES/C0XDIFF,".")," LINES PER SEC"
707"RTN","C0XF2N",123,0)
708 D INSRDF(ZLOC,ZURL,FARY)
709"RTN","C0XF2N",124,0)
710 Q
711"RTN","C0XF2N",125,0)
712 ;
713"RTN","C0XF2N",126,0)
714INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS
715"RTN","C0XF2N",127,0)
716 ; ZRDF IS PASSED BY NAME
717"RTN","C0XF2N",128,0)
718 I '$D(FARY) D ;
719"RTN","C0XF2N",129,0)
720 . D INITFARY("C0XFARY")
721"RTN","C0XF2N",130,0)
722 . S FARY="C0XFARY"
723"RTN","C0XF2N",131,0)
724 D USEFARY(FARY)
725"RTN","C0XF2N",132,0)
726 N ZGRAPH,ZSUBJECT
727"RTN","C0XF2N",133,0)
728 S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME
729"RTN","C0XF2N",134,0)
730 S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT
731"RTN","C0XF2N",135,0)
732 D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY)
733"RTN","C0XF2N",136,0)
734 N ZTXTNM
735"RTN","C0XF2N",137,0)
736 S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE
737"RTN","C0XF2N",138,0)
738 D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY)
739"RTN","C0XF2N",139,0)
740 D UPDIE(.C0XFDA) ; TRY IT OUT
741"RTN","C0XF2N",140,0)
742 K C0XCNT ;RESET FOR NEXT TIME
743"RTN","C0XF2N",141,0)
744 D STORETXT(ZRDF,ZTXTNM,FARY)
745"RTN","C0XF2N",142,0)
746 W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM
747"RTN","C0XF2N",143,0)
748 D PROCESS2(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF
749"RTN","C0XF2N",144,0)
750 Q
751"RTN","C0XF2N",145,0)
752 ;
753"RTN","C0XF2N",146,0)
754STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME
755"RTN","C0XF2N",147,0)
756 ;
757"RTN","C0XF2N",148,0)
758 I '$D(FARY) D ;
759"RTN","C0XF2N",149,0)
760 . D INITFARY("C0XFARY")
761"RTN","C0XF2N",150,0)
762 . S FARY="C0XFARY"
763"RTN","C0XF2N",151,0)
764 D USEFARY(FARY)
765"RTN","C0XF2N",152,0)
766 N ZIEN
767"RTN","C0XF2N",153,0)
768 S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN
769"RTN","C0XF2N",154,0)
770 D CLEAN^DILF
771"RTN","C0XF2N",155,0)
772 K ZERR
773"RTN","C0XF2N",156,0)
774 D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR")
775"RTN","C0XF2N",157,0)
776 I $D(ZERR) D ;
777"RTN","C0XF2N",158,0)
778 . ZWR ZERR
779"RTN","C0XF2N",159,0)
780 Q
781"RTN","C0XF2N",160,0)
782 ;
783"RTN","C0XF2N",161,0)
784GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT
785"RTN","C0XF2N",162,0)
786 ; ZRTN IS PASSED BY REFERENCE
787"RTN","C0XF2N",163,0)
788 I '$D(FARY) D ;
789"RTN","C0XF2N",164,0)
790 . D INITFARY("C0XFARY")
791"RTN","C0XF2N",165,0)
792 . S FARY="C0XFARY"
793"RTN","C0XF2N",166,0)
794 D USEFARY(FARY)
795"RTN","C0XF2N",167,0)
796 N ZIEN
797"RTN","C0XF2N",168,0)
798 S ZIEN=$$IENOF(ZNAME)
799"RTN","C0XF2N",169,0)
800 S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN")
801"RTN","C0XF2N",170,0)
802 Q
803"RTN","C0XF2N",171,0)
804 ;
805"RTN","C0XF2N",172,0)
806WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL
807"RTN","C0XF2N",173,0)
808 ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING
809"RTN","C0XF2N",174,0)
810 I '$D(FARY) D ;
811"RTN","C0XF2N",175,0)
812 . D INITFARY("C0XFARY")
813"RTN","C0XF2N",176,0)
814 . S FARY="C0XFARY"
815"RTN","C0XF2N",177,0)
816 D USEFARY(FARY)
817"RTN","C0XF2N",178,0)
818 N ZIEN
819"RTN","C0XF2N",179,0)
820 S ZIEN=$$IENOF(ZNAME)
821"RTN","C0XF2N",180,0)
822 Q $NA(@C0XSN@(ZIEN,1))
823"RTN","C0XF2N",181,0)
824 ;
825"RTN","C0XF2N",182,0)
826FILEREAD(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH
827"RTN","C0XF2N",183,0)
828 ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT
829"RTN","C0XF2N",184,0)
830 ; IE ^TMP("C0X","FILEIN",1)
831"RTN","C0XF2N",185,0)
832 ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1
833"RTN","C0XF2N",186,0)
834 ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH
835"RTN","C0XF2N",187,0)
836 S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL)
837"RTN","C0XF2N",188,0)
838 Q OK
839"RTN","C0XF2N",189,0)
840 ;
841"RTN","C0XF2N",190,0)
842TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE
843"RTN","C0XF2N",191,0)
844 S ZIN=$NA(^TMP("C0X",12226,"FILEIN"))
845"RTN","C0XF2N",192,0)
846 S ZGRAPH="/test/rdfFile"
847"RTN","C0XF2N",193,0)
848 S ZM="/test/rdfFile/meta"
849"RTN","C0XF2N",194,0)
850 D PROCESS(.G,ZIN,ZGRAPH,ZM)
851"RTN","C0XF2N",195,0)
852 Q
853"RTN","C0XF2N",196,0)
854 ;
855"RTN","C0XF2N",197,0)
856PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE
857"RTN","C0XF2N",198,0)
858 ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING
859"RTN","C0XF2N",199,0)
860 ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE
861"RTN","C0XF2N",200,0)
862 ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS
863"RTN","C0XF2N",201,0)
864 ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA
865"RTN","C0XF2N",202,0)
866 ;
867"RTN","C0XF2N",203,0)
868 I '$D(FARY) D ;
869"RTN","C0XF2N",204,0)
870 . D INITFARY("C0XFARY")
871"RTN","C0XF2N",205,0)
872 . S FARY="C0XFARY"
873"RTN","C0XF2N",206,0)
874 D USEFARY(FARY)
875"RTN","C0XF2N",207,0)
876 ; -- first parse the rdf file with the MXML parser
877"RTN","C0XF2N",208,0)
878 ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML
879"RTN","C0XF2N",209,0)
880 S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W")
881"RTN","C0XF2N",210,0)
882 ; -- assign the MXLM dom global name to ZDOM
883"RTN","C0XF2N",211,0)
884 S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID))
885"RTN","C0XF2N",212,0)
886 W !,$O(@ZDOM@(""),-1)," XML NODES PARSED"
887"RTN","C0XF2N",213,0)
888 ; -- populate the metagraph to point to the graph with status unfinished
889"RTN","C0XF2N",214,0)
890 S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT
891"RTN","C0XF2N",215,0)
892 I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH
893"RTN","C0XF2N",216,0)
894 D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH
895"RTN","C0XF2N",217,0)
896 D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished
897"RTN","C0XF2N",218,0)
898 ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT")
899"RTN","C0XF2N",219,0)
900 S C0XDATE=$$NOW^XLFDT
901"RTN","C0XF2N",220,0)
902 D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY)
903"RTN","C0XF2N",221,0)
904 D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store
905"RTN","C0XF2N",222,0)
906 ; --
907"RTN","C0XF2N",223,0)
908 ; -- pull out the vocabularies in the RDF statement. marked with xmlns:
909"RTN","C0XF2N",224,0)
910 ; -- put them in a local variable for quick reference
911"RTN","C0XF2N",225,0)
912 ; -- TODO: create a graph for vocabularies and validate incoming against it
913"RTN","C0XF2N",226,0)
914 ;
915"RTN","C0XF2N",227,0)
916 S C0XVOC=""
917"RTN","C0XF2N",228,0)
918 N ZI,ZJ,ZK S ZI=""
919"RTN","C0XF2N",229,0)
920 F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns
921"RTN","C0XF2N",230,0)
922 . S ZVOC=$P(ZI,"xmlns:",2)
923"RTN","C0XF2N",231,0)
924 . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI))
925"RTN","C0XF2N",232,0)
926 ;W !,"VOCABS:" ZWR C0XVOC
927"RTN","C0XF2N",233,0)
928 ;
929"RTN","C0XF2N",234,0)
930 ; -- look for children called rdf:Description. quit if none. not an rdf file
931"RTN","C0XF2N",235,0)
932 ;
933"RTN","C0XF2N",236,0)
934 S ZI=$O(@ZDOM@(1,"C",""))
935"RTN","C0XF2N",237,0)
936 I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file
937"RTN","C0XF2N",238,0)
938 . W !,"Error. Not an RDF file. Cannot process."
939"RTN","C0XF2N",239,0)
940 ;
941"RTN","C0XF2N",240,0)
942 ; -- now process the rdf description children
943"RTN","C0XF2N",241,0)
944 ;
945"RTN","C0XF2N",242,0)
946 S ZI=""
947"RTN","C0XF2N",243,0)
948 S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate
949"RTN","C0XF2N",244,0)
950 F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ;
951"RTN","C0XF2N",245,0)
952 . ; -- we are skipping any child that is not rdf:Description
953"RTN","C0XF2N",246,0)
954 . ; -- TODO: check to see if this is right in general
955"RTN","C0XF2N",247,0)
956 . ;
957"RTN","C0XF2N",248,0)
958 . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ;
959"RTN","C0XF2N",249,0)
960 . . W !,"SKIPPING NODE: ",ZI
961"RTN","C0XF2N",250,0)
962 . ; -- now looking for the subject for the triples
963"RTN","C0XF2N",251,0)
964 . S ZX=$G(@ZDOM@(ZI,"A","rdf:about"))
965"RTN","C0XF2N",252,0)
966 . I ZX'="" D ; we have the subject
967"RTN","C0XF2N",253,0)
968 . . ;W " about: ",ZX
969"RTN","C0XF2N",254,0)
970 . . S C0XSUB=ZX
971"RTN","C0XF2N",255,0)
972 . E D ;
973"RTN","C0XF2N",256,0)
974 . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject
975"RTN","C0XF2N",257,0)
976 . . I ZX'="" D ;
977"RTN","C0XF2N",258,0)
978 . . . S C0XSUB=ZX
979"RTN","C0XF2N",259,0)
980 . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT
981"RTN","C0XF2N",260,0)
982 . ;
983"RTN","C0XF2N",261,0)
984 . ; -- we now have the subject. the children of this node have the rest
985"RTN","C0XF2N",262,0)
986 . ;
987"RTN","C0XF2N",263,0)
988 . S ZJ="" ; for the children of the rdf:Description nodes
989"RTN","C0XF2N",264,0)
990 . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child
991"RTN","C0XF2N",265,0)
992 . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix
993"RTN","C0XF2N",266,0)
994 . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space
995"RTN","C0XF2N",267,0)
996 . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix
997"RTN","C0XF2N",268,0)
998 . . I C0XPRE[":" D ; expand using vocabulary
999"RTN","C0XF2N",269,0)
1000 . . . N ZB,ZA
1001"RTN","C0XF2N",270,0)
1002 . . . S ZB=$P(C0XPRE,":",1)
1003"RTN","C0XF2N",271,0)
1004 . . . S ZA=$P(C0XPRE,":",2)
1005"RTN","C0XF2N",272,0)
1006 . . . I $G(C0XVOC(ZB))'="" D ;
1007"RTN","C0XF2N",273,0)
1008 . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded
1009"RTN","C0XF2N",274,0)
1010 . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object
1011"RTN","C0XF2N",275,0)
1012 . . I ZY'="" D Q ;
1013"RTN","C0XF2N",276,0)
1014 . . . S C0XOBJ=ZY ; object
1015"RTN","C0XF2N",277,0)
1016 . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple
1017"RTN","C0XF2N",278,0)
1018 . . ; -- this is an else because of the quit above
1019"RTN","C0XF2N",279,0)
1020 . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object
1021"RTN","C0XF2N",280,0)
1022 . . I ZX'="" D Q ; got one
1023"RTN","C0XF2N",281,0)
1024 . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject
1025"RTN","C0XF2N",282,0)
1026 . . . ; without change... this could be foolish .. look at it again later
1027"RTN","C0XF2N",283,0)
1028 . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
1029"RTN","C0XF2N",284,0)
1030 . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here
1031"RTN","C0XF2N",285,0)
1032 . . I C0XOBJ="" D Q ; not a happy situation
1033"RTN","C0XF2N",286,0)
1034 . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ
1035"RTN","C0XF2N",287,0)
1036 . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
1037"RTN","C0XF2N",288,0)
1038 W !,"INSERTING ",C0XCNT," TRIPLES"
1039"RTN","C0XF2N",289,0)
1040 D UPDIE(.C0XFDA) ; commit the updates to the file
1041"RTN","C0XF2N",290,0)
1042 ; next, mark the graph as finished
1043"RTN","C0XF2N",291,0)
1044 S C0XEND=$$NOW^XLFDT
1045"RTN","C0XF2N",292,0)
1046 W !," ENDED AT: ",C0XEND
1047"RTN","C0XF2N",293,0)
1048 S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2)
1049"RTN","C0XF2N",294,0)
1050 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
1051"RTN","C0XF2N",295,0)
1052 I C0XDIFF'=0 D ;
1053"RTN","C0XF2N",296,0)
1054 . W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
1055"RTN","C0XF2N",297,0)
1056 Q
1057"RTN","C0XF2N",298,0)
1058 ;
1059"RTN","C0XF2N",299,0)
1060PROCESS2(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE
1061"RTN","C0XF2N",300,0)
1062 ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING
1063"RTN","C0XF2N",301,0)
1064 ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE
1065"RTN","C0XF2N",302,0)
1066 ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS
1067"RTN","C0XF2N",303,0)
1068 ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA
1069"RTN","C0XF2N",304,0)
1070 ;
1071"RTN","C0XF2N",305,0)
1072 I '$D(FARY) D ;
1073"RTN","C0XF2N",306,0)
1074 . D INITFARY("C0XFARY")
1075"RTN","C0XF2N",307,0)
1076 . S FARY="C0XFARY"
1077"RTN","C0XF2N",308,0)
1078 D USEFARY(FARY)
1079"RTN","C0XF2N",309,0)
1080 ;N BATCNT
1081"RTN","C0XF2N",310,0)
1082 ;N BATMAX
1083"RTN","C0XF2N",311,0)
1084 S BATCNT=0 ; BATCH COUNTER
1085"RTN","C0XF2N",312,0)
1086 S BATMAX=10000 ; TRY BATCHES OF THIS SIZE
1087"RTN","C0XF2N",313,0)
1088 ; -- first parse the rdf file with the MXML parser
1089"RTN","C0XF2N",314,0)
1090 ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML
1091"RTN","C0XF2N",315,0)
1092 S C0XDLC2=$$NOW^XLFDT ; START OF PARSE
1093"RTN","C0XF2N",316,0)
1094 S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W")
1095"RTN","C0XF2N",317,0)
1096 ; -- assign the MXLM dom global name to ZDOM
1097"RTN","C0XF2N",318,0)
1098 S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID))
1099"RTN","C0XF2N",319,0)
1100 S C0XNODE=$O(@ZDOM@(""),-1)
1101"RTN","C0XF2N",320,0)
1102 W !,C0XNODE," XML NODES PARSED"
1103"RTN","C0XF2N",321,0)
1104 S C0XPRS=$$NOW^XLFDT ; PARSE COMPLETE
1105"RTN","C0XF2N",322,0)
1106 W !,"PARSE COMPLETE AT ",C0XPRS
1107"RTN","C0XF2N",323,0)
1108 S C0XDIFF=$$FMDIFF^XLFDT(C0XPRS,C0XDLC2,2)
1109"RTN","C0XF2N",324,0)
1110 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
1111"RTN","C0XF2N",325,0)
1112 I C0XDIFF'=0 D ;
1113"RTN","C0XF2N",326,0)
1114 . W !," APPROXIMATELY ",$P(C0XNODE/C0XDIFF,".")," NODES PER SECOND"
1115"RTN","C0XF2N",327,0)
1116 ; -- populate the metagraph to point to the graph with status unfinished
1117"RTN","C0XF2N",328,0)
1118 S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT
1119"RTN","C0XF2N",329,0)
1120 I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH
1121"RTN","C0XF2N",330,0)
1122 D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH
1123"RTN","C0XF2N",331,0)
1124 D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished
1125"RTN","C0XF2N",332,0)
1126 ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT")
1127"RTN","C0XF2N",333,0)
1128 S C0XDATE=$$NOW^XLFDT
1129"RTN","C0XF2N",334,0)
1130 D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY)
1131"RTN","C0XF2N",335,0)
1132 D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store
1133"RTN","C0XF2N",336,0)
1134 ; --
1135"RTN","C0XF2N",337,0)
1136 ; -- pull out the vocabularies in the RDF statement. marked with xmlns:
1137"RTN","C0XF2N",338,0)
1138 ; -- put them in a local variable for quick reference
1139"RTN","C0XF2N",339,0)
1140 ; -- TODO: create a graph for vocabularies and validate incoming against it
1141"RTN","C0XF2N",340,0)
1142 ;
1143"RTN","C0XF2N",341,0)
1144 S C0XVOC=""
1145"RTN","C0XF2N",342,0)
1146 N ZI,ZJ,ZK S ZI=""
1147"RTN","C0XF2N",343,0)
1148 F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns
1149"RTN","C0XF2N",344,0)
1150 . S ZVOC=$P(ZI,"xmlns:",2)
1151"RTN","C0XF2N",345,0)
1152 . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI))
1153"RTN","C0XF2N",346,0)
1154 ;W !,"VOCABS:" ZWR C0XVOC
1155"RTN","C0XF2N",347,0)
1156 ;
1157"RTN","C0XF2N",348,0)
1158 ; -- look for children called rdf:Description. quit if none. not an rdf file
1159"RTN","C0XF2N",349,0)
1160 ;
1161"RTN","C0XF2N",350,0)
1162 S ZI=$O(@ZDOM@(1,"C",""))
1163"RTN","C0XF2N",351,0)
1164 I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file
1165"RTN","C0XF2N",352,0)
1166 . W !,"Error. Not an RDF file. Cannot process."
1167"RTN","C0XF2N",353,0)
1168 ;
1169"RTN","C0XF2N",354,0)
1170 ; -- now process the rdf description children
1171"RTN","C0XF2N",355,0)
1172 ;
1173"RTN","C0XF2N",356,0)
1174 S ZI=""
1175"RTN","C0XF2N",357,0)
1176 S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate
1177"RTN","C0XF2N",358,0)
1178 F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ;
1179"RTN","C0XF2N",359,0)
1180 . ; -- we are skipping any child that is not rdf:Description
1181"RTN","C0XF2N",360,0)
1182 . ; -- TODO: check to see if this is right in general
1183"RTN","C0XF2N",361,0)
1184 . ;
1185"RTN","C0XF2N",362,0)
1186 . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ;
1187"RTN","C0XF2N",363,0)
1188 . . W !,"SKIPPING NODE: ",ZI
1189"RTN","C0XF2N",364,0)
1190 . ; -- now looking for the subject for the triples
1191"RTN","C0XF2N",365,0)
1192 . S ZX=$G(@ZDOM@(ZI,"A","rdf:about"))
1193"RTN","C0XF2N",366,0)
1194 . I ZX'="" D ; we have the subject
1195"RTN","C0XF2N",367,0)
1196 . . ;W " about: ",ZX
1197"RTN","C0XF2N",368,0)
1198 . . S C0XSUB=ZX
1199"RTN","C0XF2N",369,0)
1200 . E D ;
1201"RTN","C0XF2N",370,0)
1202 . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject
1203"RTN","C0XF2N",371,0)
1204 . . I ZX'="" D ;
1205"RTN","C0XF2N",372,0)
1206 . . . S C0XSUB=ZX
1207"RTN","C0XF2N",373,0)
1208 . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT
1209"RTN","C0XF2N",374,0)
1210 . ;
1211"RTN","C0XF2N",375,0)
1212 . ; -- we now have the subject. the children of this node have the rest
1213"RTN","C0XF2N",376,0)
1214 . ;
1215"RTN","C0XF2N",377,0)
1216 . S ZJ="" ; for the children of the rdf:Description nodes
1217"RTN","C0XF2N",378,0)
1218 . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child
1219"RTN","C0XF2N",379,0)
1220 . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix
1221"RTN","C0XF2N",380,0)
1222 . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space
1223"RTN","C0XF2N",381,0)
1224 . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix
1225"RTN","C0XF2N",382,0)
1226 . . I C0XPRE[":" D ; expand using vocabulary
1227"RTN","C0XF2N",383,0)
1228 . . . N ZB,ZA
1229"RTN","C0XF2N",384,0)
1230 . . . S ZB=$P(C0XPRE,":",1)
1231"RTN","C0XF2N",385,0)
1232 . . . S ZA=$P(C0XPRE,":",2)
1233"RTN","C0XF2N",386,0)
1234 . . . I $G(C0XVOC(ZB))'="" D ;
1235"RTN","C0XF2N",387,0)
1236 . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded
1237"RTN","C0XF2N",388,0)
1238 . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object
1239"RTN","C0XF2N",389,0)
1240 . . I ZY'="" D Q ;
1241"RTN","C0XF2N",390,0)
1242 . . . S C0XOBJ=ZY ; object
1243"RTN","C0XF2N",391,0)
1244 . . . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple
1245"RTN","C0XF2N",392,0)
1246 . . ; -- this is an else because of the quit above
1247"RTN","C0XF2N",393,0)
1248 . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object
1249"RTN","C0XF2N",394,0)
1250 . . I ZX'="" D Q ; got one
1251"RTN","C0XF2N",395,0)
1252 . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject
1253"RTN","C0XF2N",396,0)
1254 . . . ; without change... this could be foolish .. look at it again later
1255"RTN","C0XF2N",397,0)
1256 . . . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
1257"RTN","C0XF2N",398,0)
1258 . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here
1259"RTN","C0XF2N",399,0)
1260 . . I C0XOBJ="" D Q ; not a happy situation
1261"RTN","C0XF2N",400,0)
1262 . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ
1263"RTN","C0XF2N",401,0)
1264 . . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
1265"RTN","C0XF2N",402,0)
1266 S C0XTRP=$$NOW^XLFDT ; PARSE COMPLETE
1267"RTN","C0XF2N",403,0)
1268 W !,"TRIPLES COMPLETE AT ",C0XTRP
1269"RTN","C0XF2N",404,0)
1270 S C0XDIFF=$$FMDIFF^XLFDT(C0XTRP,C0XPRS,2)
1271"RTN","C0XF2N",405,0)
1272 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
1273"RTN","C0XF2N",406,0)
1274 I C0XDIFF'=0 D ;
1275"RTN","C0XF2N",407,0)
1276 . W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
1277"RTN","C0XF2N",408,0)
1278 W !,"INSERTING ",C0XCNT," TRIPLES"
1279"RTN","C0XF2N",409,0)
1280 I $D(C0XFDA) D UPDIE(.C0XFDA) ; commit the updates to the file
1281"RTN","C0XF2N",410,0)
1282 ; next, mark the graph as finished
1283"RTN","C0XF2N",411,0)
1284 S C0XINS=$$NOW^XLFDT ; PARSE COMPLETE
1285"RTN","C0XF2N",412,0)
1286 W !,"INSERTION COMPLETE AT ",C0XPRS
1287"RTN","C0XF2N",413,0)
1288 S C0XDIFF=$$FMDIFF^XLFDT(C0XINS,C0XTRP,2)
1289"RTN","C0XF2N",414,0)
1290 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
1291"RTN","C0XF2N",415,0)
1292 W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," NODES PER SECOND"
1293"RTN","C0XF2N",416,0)
1294 S C0XEND=$$NOW^XLFDT
1295"RTN","C0XF2N",417,0)
1296 W !," ENDED AT: ",C0XEND
1297"RTN","C0XF2N",418,0)
1298 S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2)
1299"RTN","C0XF2N",419,0)
1300 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
1301"RTN","C0XF2N",420,0)
1302 W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
1303"RTN","C0XF2N",421,0)
1304 Q
1305"RTN","C0XF2N",422,0)
1306 ;
1307"RTN","C0XF2N",423,0)
1308SHOW(ZN) ;
1309"RTN","C0XF2N",424,0)
1310 ZWR ^TMP("MXMLDOM",$J,1,ZN,*)
1311"RTN","C0XF2N",425,0)
1312 Q
1313"RTN","C0XF2N",426,0)
1314 ;
1315"RTN","C0XF2N",427,0)
1316ANONS() ; RETURNS AN ANONOMOUS SUBJECT
1317"RTN","C0XF2N",428,0)
1318 Q "_S:"_$$LKY9
1319"RTN","C0XF2N",429,0)
1320 ;
1321"RTN","C0XF2N",430,0)
1322NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED
1323"RTN","C0XF2N",431,0)
1324 ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT
1325"RTN","C0XF2N",432,0)
1326 ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN
1327"RTN","C0XF2N",433,0)
1328 S NGRAPH="G"_$$LKY9
1329"RTN","C0XF2N",434,0)
1330 S NMETA=NGRAPH_"A"
1331"RTN","C0XF2N",435,0)
1332 Q
1333"RTN","C0XF2N",436,0)
1334 ;
1335"RTN","C0XF2N",437,0)
1336ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT
1337"RTN","C0XF2N",438,0)
1338 ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE
1339"RTN","C0XF2N",439,0)
1340 I '$D(FARY) D ;
1341"RTN","C0XF2N",440,0)
1342 . D INITFARY("C0XFARY")
1343"RTN","C0XF2N",441,0)
1344 . S FARY="C0XFARY"
1345"RTN","C0XF2N",442,0)
1346 D USEFARY(FARY)
1347"RTN","C0XF2N",443,0)
1348 I '$D(C0XCNT) S C0XCNT=0
1349"RTN","C0XF2N",444,0)
1350 N ZNODE
1351"RTN","C0XF2N",445,0)
1352 S ZNODE="N"_$$LKY17
1353"RTN","C0XF2N",446,0)
1354 N ZNARY ; GET READY TO CALL IENOFA
1355"RTN","C0XF2N",447,0)
1356 S ZNARY("ZG",ZG)=""
1357"RTN","C0XF2N",448,0)
1358 S ZNARY("ZS",ZS)=""
1359"RTN","C0XF2N",449,0)
1360 S ZNARY("ZP",ZP)=""
1361"RTN","C0XF2N",450,0)
1362 S ZNARY("ZO",ZO)=""
1363"RTN","C0XF2N",451,0)
1364 D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS
1365"RTN","C0XF2N",452,0)
1366 ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN
1367"RTN","C0XF2N",453,0)
1368 ;S ZSIEN=$$IENOF(ZS)
1369"RTN","C0XF2N",454,0)
1370 ;S ZPIEN=$$IENOF(ZP)
1371"RTN","C0XF2N",455,0)
1372 ;S ZOIEN=$$IENOF(ZO)
1373"RTN","C0XF2N",456,0)
1374 ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED
1375"RTN","C0XF2N",457,0)
1376 S C0XCNT=C0XCNT+1
1377"RTN","C0XF2N",458,0)
1378 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE
1379"RTN","C0XF2N",459,0)
1380 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG",""))
1381"RTN","C0XF2N",460,0)
1382 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS",""))
1383"RTN","C0XF2N",461,0)
1384 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP",""))
1385"RTN","C0XF2N",462,0)
1386 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO",""))
1387"RTN","C0XF2N",463,0)
1388 ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE
1389"RTN","C0XF2N",464,0)
1390 Q
1391"RTN","C0XF2N",465,0)
1392 ;
1393"RTN","C0XF2N",466,0)
1394ADD2(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT
1395"RTN","C0XF2N",467,0)
1396 ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE
1397"RTN","C0XF2N",468,0)
1398 I '$D(FARY) D ;
1399"RTN","C0XF2N",469,0)
1400 . D INITFARY("C0XFARY")
1401"RTN","C0XF2N",470,0)
1402 . S FARY="C0XFARY"
1403"RTN","C0XF2N",471,0)
1404 D USEFARY(FARY)
1405"RTN","C0XF2N",472,0)
1406 I '$D(C0XCNT) S C0XCNT=0
1407"RTN","C0XF2N",473,0)
1408 N ZNODE
1409"RTN","C0XF2N",474,0)
1410 S ZNODE="N"_$$LKY17
1411"RTN","C0XF2N",475,0)
1412 N ZNARY ; GET READY TO CALL IENOFA
1413"RTN","C0XF2N",476,0)
1414 S ZNARY("ZG",ZG)=""
1415"RTN","C0XF2N",477,0)
1416 S ZNARY("ZS",ZS)=""
1417"RTN","C0XF2N",478,0)
1418 S ZNARY("ZP",ZP)=""
1419"RTN","C0XF2N",479,0)
1420 S ZNARY("ZO",ZO)=""
1421"RTN","C0XF2N",480,0)
1422 D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS
1423"RTN","C0XF2N",481,0)
1424 ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN
1425"RTN","C0XF2N",482,0)
1426 ;S ZSIEN=$$IENOF(ZS)
1427"RTN","C0XF2N",483,0)
1428 ;S ZPIEN=$$IENOF(ZP)
1429"RTN","C0XF2N",484,0)
1430 ;S ZOIEN=$$IENOF(ZO)
1431"RTN","C0XF2N",485,0)
1432 ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED
1433"RTN","C0XF2N",486,0)
1434 S BATCNT=BATCNT+1
1435"RTN","C0XF2N",487,0)
1436 S C0XCNT=C0XCNT+1
1437"RTN","C0XF2N",488,0)
1438 S C0XFDA(C0XTFN,"?+"_BATCNT_",",.01)=ZNODE
1439"RTN","C0XF2N",489,0)
1440 S C0XFDA(C0XTFN,"?+"_BATCNT_",",.02)=$O(ZIENS("IEN","ZG",""))
1441"RTN","C0XF2N",490,0)
1442 S C0XFDA(C0XTFN,"?+"_BATCNT_",",.03)=$O(ZIENS("IEN","ZS",""))
1443"RTN","C0XF2N",491,0)
1444 S C0XFDA(C0XTFN,"?+"_BATCNT_",",.04)=$O(ZIENS("IEN","ZP",""))
1445"RTN","C0XF2N",492,0)
1446 S C0XFDA(C0XTFN,"?+"_BATCNT_",",.05)=$O(ZIENS("IEN","ZO",""))
1447"RTN","C0XF2N",493,0)
1448 I BATCNT=BATMAX D ; BATCH IS DONE
1449"RTN","C0XF2N",494,0)
1450 . D UPDIE(.C0XFDA)
1451"RTN","C0XF2N",495,0)
1452 . K C0XFDA
1453"RTN","C0XF2N",496,0)
1454 . S BATCNT=0 ; RESET COUNTER
1455"RTN","C0XF2N",497,0)
1456 ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE
1457"RTN","C0XF2N",498,0)
1458 Q
1459"RTN","C0XF2N",499,0)
1460 ;
1461"RTN","C0XF2N",500,0)
1462LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
1463"RTN","C0XF2N",501,0)
1464 ; UNIQUE NODE AND GRAPH NAMES
1465"RTN","C0XF2N",502,0)
1466 N ZN,ZI
1467"RTN","C0XF2N",503,0)
1468 S ZN=""
1469"RTN","C0XF2N",504,0)
1470 F ZI=1:1:9 D ;
1471"RTN","C0XF2N",505,0)
1472 . S ZN=ZN_$R(10)
1473"RTN","C0XF2N",506,0)
1474 Q ZN
1475"RTN","C0XF2N",507,0)
1476 ;
1477"RTN","C0XF2N",508,0)
1478LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
1479"RTN","C0XF2N",509,0)
1480 ; UNIQUE NODE AND GRAPH NAMES
1481"RTN","C0XF2N",510,0)
1482 N ZN,ZI
1483"RTN","C0XF2N",511,0)
1484 S ZN=""
1485"RTN","C0XF2N",512,0)
1486 F ZI=1:1:17 D ;
1487"RTN","C0XF2N",513,0)
1488 . S ZN=ZN_$R(10)
1489"RTN","C0XF2N",514,0)
1490 Q ZN
1491"RTN","C0XF2N",515,0)
1492 ;
1493"RTN","C0XF2N",516,0)
1494IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE
1495"RTN","C0XF2N",517,0)
1496 I '$D(FARY) D ;
1497"RTN","C0XF2N",518,0)
1498 . D INITFARY("C0XFARY")
1499"RTN","C0XF2N",519,0)
1500 . S FARY="C0XFARY"
1501"RTN","C0XF2N",520,0)
1502 N ZIEN
1503"RTN","C0XF2N",521,0)
1504 S ZIEN=$O(@C0XSN@("B",ZSTRING,""))
1505"RTN","C0XF2N",522,0)
1506 I ZIEN="" D ;
1507"RTN","C0XF2N",523,0)
1508 . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING
1509"RTN","C0XF2N",524,0)
1510 . D UPDIE(.C0XFDA2)
1511"RTN","C0XF2N",525,0)
1512 . S ZIEN=$O(@C0XSN@("B",ZSTRING,""))
1513"RTN","C0XF2N",526,0)
1514 . K C0XFDA2
1515"RTN","C0XF2N",527,0)
1516 Q ZIEN
1517"RTN","C0XF2N",528,0)
1518 ;
1519"RTN","C0XF2N",529,0)
1520IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE
1521"RTN","C0XF2N",530,0)
1522 ; OR ADD THEM IF
1523"RTN","C0XF2N",531,0)
1524 ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE
1525"RTN","C0XF2N",532,0)
1526 ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")=""
1527"RTN","C0XF2N",533,0)
1528 ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)=""
1529"RTN","C0XF2N",534,0)
1530 I '$D(FARY) D ;
1531"RTN","C0XF2N",535,0)
1532 . D INITFARY("C0XFARY")
1533"RTN","C0XF2N",536,0)
1534 . S FARY="C0XFARY"
1535"RTN","C0XF2N",537,0)
1536 K ZOUTARY ; START WITH CLEAN RESULTS
1537"RTN","C0XF2N",538,0)
1538 K C0XFDA2 ; USE A SEPARATE FDA FOR THIS
1539"RTN","C0XF2N",539,0)
1540 N ZI S ZI=""
1541"RTN","C0XF2N",540,0)
1542 N ZV,ZIEN
1543"RTN","C0XF2N",541,0)
1544 N ZCNT S ZCNT=0
1545"RTN","C0XF2N",542,0)
1546 F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS
1547"RTN","C0XF2N",543,0)
1548 . S ZV=$O(ZINARY(ZI,""))
1549"RTN","C0XF2N",544,0)
1550 . I $O(@C0XSN@("B",ZV,""))="" D ;
1551"RTN","C0XF2N",545,0)
1552 . . S ZCNT=ZCNT+1
1553"RTN","C0XF2N",546,0)
1554 . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV
1555"RTN","C0XF2N",547,0)
1556 I $D(C0XFDA2) D ;
1557"RTN","C0XF2N",548,0)
1558 . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS
1559"RTN","C0XF2N",549,0)
1560 . K C0XFDA2 ; CLEAN UP
1561"RTN","C0XF2N",550,0)
1562 F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS
1563"RTN","C0XF2N",551,0)
1564 . S ZV=$O(ZINARY(ZI,""))
1565"RTN","C0XF2N",552,0)
1566 . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW
1567"RTN","C0XF2N",553,0)
1568 . I ZIEN="" D ;
1569"RTN","C0XF2N",554,0)
1570 . . W !,"ERROR ADDING STRING: ",ZV
1571"RTN","C0XF2N",555,0)
1572 . . B
1573"RTN","C0XF2N",556,0)
1574 . S ZOUTARY("IEN",ZI,ZIEN)=""
1575"RTN","C0XF2N",557,0)
1576 Q
1577"RTN","C0XF2N",558,0)
1578 ;
1579"RTN","C0XF2N",559,0)
1580UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
1581"RTN","C0XF2N",560,0)
1582 ; ZFDA IS PASSED BY REFERENCE
1583"RTN","C0XF2N",561,0)
1584 ;ZWR ZFDA
1585"RTN","C0XF2N",562,0)
1586 ;B
1587"RTN","C0XF2N",563,0)
1588 K ZERR
1589"RTN","C0XF2N",564,0)
1590 D CLEAN^DILF
1591"RTN","C0XF2N",565,0)
1592 D UPDATE^DIE("","ZFDA","","ZERR")
1593"RTN","C0XF2N",566,0)
1594 I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST,
1595"RTN","C0XF2N",567,0)
1596 ; INVOKE THE ERROR TRAP IF TASKED
1597"RTN","C0XF2N",568,0)
1598 ;. W "ERROR",!
1599"RTN","C0XF2N",569,0)
1600 ;. ZWR ZERR
1601"RTN","C0XF2N",570,0)
1602 ;. B
1603"RTN","C0XF2N",571,0)
1604 K ZFDA
1605"RTN","C0XF2N",572,0)
1606 Q
1607"RTN","C0XF2N",573,0)
1608 ;
1609"RTN","C0XMAIN")
16100^1^B261424134
1611"RTN","C0XMAIN",1,0)
1612C0XMAIN ; GPL - Fileman Triples entry point routine ;10/13/11 17:05
1613"RTN","C0XMAIN",2,0)
1614 ;;0.1;C0X;nopatch;noreleasedate;Build 5
1615"RTN","C0XMAIN",3,0)
1616 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU
1617"RTN","C0XMAIN",4,0)
1618 ;General Public License See attached copy of the License.
1619"RTN","C0XMAIN",5,0)
1620 ;
1621"RTN","C0XMAIN",6,0)
1622 ;This program is free software; you can redistribute it and/or modify
1623"RTN","C0XMAIN",7,0)
1624 ;it under the terms of the GNU General Public License as published by
1625"RTN","C0XMAIN",8,0)
1626 ;the Free Software Foundation; either version 2 of the License, or
1627"RTN","C0XMAIN",9,0)
1628 ;(at your option) any later version.
1629"RTN","C0XMAIN",10,0)
1630 ;
1631"RTN","C0XMAIN",11,0)
1632 ;This program is distributed in the hope that it will be useful,
1633"RTN","C0XMAIN",12,0)
1634 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
1635"RTN","C0XMAIN",13,0)
1636 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1637"RTN","C0XMAIN",14,0)
1638 ;GNU General Public License for more details.
1639"RTN","C0XMAIN",15,0)
1640 ;
1641"RTN","C0XMAIN",16,0)
1642 ;You should have received a copy of the GNU General Public License along
1643"RTN","C0XMAIN",17,0)
1644 ;with this program; if not, write to the Free Software Foundation, Inc.,
1645"RTN","C0XMAIN",18,0)
1646 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1647"RTN","C0XMAIN",19,0)
1648 ;
1649"RTN","C0XMAIN",20,0)
1650 Q
1651"RTN","C0XMAIN",21,0)
1652 ;
1653"RTN","C0XMAIN",22,0)
1654INITFARY(ZFARY) ; INITIALIZE FILE NUMBERS AND OTHER USEFUL THINGS
1655"RTN","C0XMAIN",23,0)
1656 ; FOR THE DEFAULT TRIPLE STORE. USE OTHER VALUES FOR SUPPORTING ADDITIONAL
1657"RTN","C0XMAIN",24,0)
1658 ; TRIPLE STORES
1659"RTN","C0XMAIN",25,0)
1660 S @ZFARY@("C0XTFN")=172.101 ; TRIPLES FILE NUMBER
1661"RTN","C0XMAIN",26,0)
1662 S @ZFARY@("C0XSFN")=172.201 ; TRIPLES STRINGS FILE NUMBER
1663"RTN","C0XMAIN",27,0)
1664 S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME
1665"RTN","C0XMAIN",28,0)
1666 S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME
1667"RTN","C0XMAIN",29,0)
1668 S @ZFARY@("C0XDIR")="/home/glilly/all_smart_patient_data/smart-rdf/"
1669"RTN","C0XMAIN",30,0)
1670 D USEFARY(ZFARY)
1671"RTN","C0XMAIN",31,0)
1672 Q
1673"RTN","C0XMAIN",32,0)
1674 ;
1675"RTN","C0XMAIN",33,0)
1676USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY
1677"RTN","C0XMAIN",34,0)
1678 N ZI S ZI=""
1679"RTN","C0XMAIN",35,0)
1680 F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D
1681"RTN","C0XMAIN",36,0)
1682 . ;N ZX
1683"RTN","C0XMAIN",37,0)
1684 . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_""""
1685"RTN","C0XMAIN",38,0)
1686 . ;W !,ZX
1687"RTN","C0XMAIN",39,0)
1688 . X ZX
1689"RTN","C0XMAIN",40,0)
1690 Q
1691"RTN","C0XMAIN",41,0)
1692 ;
1693"RTN","C0XMAIN",42,0)
1694IMPORT(FNAME,FDIR,FURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD
1695"RTN","C0XMAIN",43,0)
1696 ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE
1697"RTN","C0XMAIN",44,0)
1698 ; NODE NAME OF THE TEXT TRIPLE
1699"RTN","C0XMAIN",45,0)
1700 ; FDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR)
1701"RTN","C0XMAIN",46,0)
1702 ; FURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE
1703"RTN","C0XMAIN",47,0)
1704 ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE
1705"RTN","C0XMAIN",48,0)
1706 I '$D(FARY) D ;
1707"RTN","C0XMAIN",49,0)
1708 . D INITFARY("C0XFARY")
1709"RTN","C0XMAIN",50,0)
1710 . S FARY="C0XFARY"
1711"RTN","C0XMAIN",51,0)
1712 D USEFARY(FARY)
1713"RTN","C0XMAIN",52,0)
1714 N ZD,ZTMP
1715"RTN","C0XMAIN",53,0)
1716 I '$D(FDIR) S FDIR=C0XDIR ; DIRECTORY OF THE RDF FILE
1717"RTN","C0XMAIN",54,0)
1718 I '$D(FURL) D ;
1719"RTN","C0XMAIN",55,0)
1720 . N ZN2 S ZN2=$TR(FNAME,".","_") ; REMOVE THE DOT FROM THE NAME
1721"RTN","C0XMAIN",56,0)
1722 . S FURL=FDIR_ZN2
1723"RTN","C0XMAIN",57,0)
1724 N ZTMP
1725"RTN","C0XMAIN",58,0)
1726 S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE
1727"RTN","C0XMAIN",59,0)
1728 K @ZTMP ; MAKE SURE IT'S CLEAR
1729"RTN","C0XMAIN",60,0)
1730 S C0XSTART=$$NOW^XLFDT
1731"RTN","C0XMAIN",61,0)
1732 W !,"STARTED: ",C0XSTART
1733"RTN","C0XMAIN",62,0)
1734 W !,"READING IN: ",FNAME
1735"RTN","C0XMAIN",63,0)
1736 I '$$FILEIN(ZTMP,FDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS
1737"RTN","C0XMAIN",64,0)
1738 . W !,"ERROR READING FILE: ",FDIR,FNAME
1739"RTN","C0XMAIN",65,0)
1740 S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT
1741"RTN","C0XMAIN",66,0)
1742 W !,$O(@ZRDF@(""),-1)," LINES READ"
1743"RTN","C0XMAIN",67,0)
1744 D INSRDF(ZRDF,FURL,FARY) ; IMPORT AND PROCESS THE RDF
1745"RTN","C0XMAIN",68,0)
1746 Q
1747"RTN","C0XMAIN",69,0)
1748 ;
1749"RTN","C0XMAIN",70,0)
1750WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT
1751"RTN","C0XMAIN",71,0)
1752 ;
1753"RTN","C0XMAIN",72,0)
1754 I '$D(FARY) D ;
1755"RTN","C0XMAIN",73,0)
1756 . D INITFARY("C0XFARY")
1757"RTN","C0XMAIN",74,0)
1758 . S FARY="C0XFARY"
1759"RTN","C0XMAIN",75,0)
1760 D USEFARY(FARY)
1761"RTN","C0XMAIN",76,0)
1762 ;N ZLOC,ZTMP
1763"RTN","C0XMAIN",77,0)
1764 K ZTMP
1765"RTN","C0XMAIN",78,0)
1766 S ZLOC=$NA(^TMP("C0X","WGET",$J))
1767"RTN","C0XMAIN",79,0)
1768 K @ZLOC
1769"RTN","C0XMAIN",80,0)
1770 S C0XSTART=$$NOW^XLFDT
1771"RTN","C0XMAIN",81,0)
1772 W !,"STARTED: ",C0XSTART
1773"RTN","C0XMAIN",82,0)
1774 W !,"DOWNLOADING: ",ZURL
1775"RTN","C0XMAIN",83,0)
1776 S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP)
1777"RTN","C0XMAIN",84,0)
1778 M @ZLOC=ZTMP
1779"RTN","C0XMAIN",85,0)
1780 S C0XLINES=$O(@ZLOC@(""),-1)
1781"RTN","C0XMAIN",86,0)
1782 W !,C0XLINES," LINES READ"
1783"RTN","C0XMAIN",87,0)
1784 S C0XDLC=$$NOW^XLFDT ; DOWNLOAD COMPLETE
1785"RTN","C0XMAIN",88,0)
1786 W !,"DOWNLOAD COMPLETE AT ",C0XDLC
1787"RTN","C0XMAIN",89,0)
1788 S C0XDIFF=$$FMDIFF^XLFDT(C0XDLC,C0XSTART,2)
1789"RTN","C0XMAIN",90,0)
1790 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
1791"RTN","C0XMAIN",91,0)
1792 I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XLINES/C0XDIFF,".")," LINES PER SEC"
1793"RTN","C0XMAIN",92,0)
1794 D INSRDF(ZLOC,ZURL,FARY)
1795"RTN","C0XMAIN",93,0)
1796 Q
1797"RTN","C0XMAIN",94,0)
1798 ;
1799"RTN","C0XMAIN",95,0)
1800INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS
1801"RTN","C0XMAIN",96,0)
1802 ; ZRDF IS PASSED BY NAME
1803"RTN","C0XMAIN",97,0)
1804 I '$D(FARY) D ;
1805"RTN","C0XMAIN",98,0)
1806 . D INITFARY("C0XFARY")
1807"RTN","C0XMAIN",99,0)
1808 . S FARY="C0XFARY"
1809"RTN","C0XMAIN",100,0)
1810 D USEFARY(FARY)
1811"RTN","C0XMAIN",101,0)
1812 N ZGRAPH,ZSUBJECT
1813"RTN","C0XMAIN",102,0)
1814 S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME
1815"RTN","C0XMAIN",103,0)
1816 S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT
1817"RTN","C0XMAIN",104,0)
1818 D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY)
1819"RTN","C0XMAIN",105,0)
1820 N ZTXTNM
1821"RTN","C0XMAIN",106,0)
1822 S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE
1823"RTN","C0XMAIN",107,0)
1824 D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY)
1825"RTN","C0XMAIN",108,0)
1826 D UPDIE(.C0XFDA) ; TRY IT OUT
1827"RTN","C0XMAIN",109,0)
1828 K C0XCNT ;RESET FOR NEXT TIME
1829"RTN","C0XMAIN",110,0)
1830 D STORETXT(ZRDF,ZTXTNM,FARY)
1831"RTN","C0XMAIN",111,0)
1832 W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM
1833"RTN","C0XMAIN",112,0)
1834 D PROCESS2(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF
1835"RTN","C0XMAIN",113,0)
1836 Q
1837"RTN","C0XMAIN",114,0)
1838 ;
1839"RTN","C0XMAIN",115,0)
1840STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME
1841"RTN","C0XMAIN",116,0)
1842 ;
1843"RTN","C0XMAIN",117,0)
1844 I '$D(FARY) D ;
1845"RTN","C0XMAIN",118,0)
1846 . D INITFARY("C0XFARY")
1847"RTN","C0XMAIN",119,0)
1848 . S FARY="C0XFARY"
1849"RTN","C0XMAIN",120,0)
1850 D USEFARY(FARY)
1851"RTN","C0XMAIN",121,0)
1852 N ZIEN
1853"RTN","C0XMAIN",122,0)
1854 S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN
1855"RTN","C0XMAIN",123,0)
1856 D CLEAN^DILF
1857"RTN","C0XMAIN",124,0)
1858 K ZERR
1859"RTN","C0XMAIN",125,0)
1860 D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR")
1861"RTN","C0XMAIN",126,0)
1862 I $D(ZERR) D ;
1863"RTN","C0XMAIN",127,0)
1864 . ZWR ZERR
1865"RTN","C0XMAIN",128,0)
1866 Q
1867"RTN","C0XMAIN",129,0)
1868 ;
1869"RTN","C0XMAIN",130,0)
1870GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT
1871"RTN","C0XMAIN",131,0)
1872 ; ZRTN IS PASSED BY REFERENCE
1873"RTN","C0XMAIN",132,0)
1874 I '$D(FARY) D ;
1875"RTN","C0XMAIN",133,0)
1876 . D INITFARY("C0XFARY")
1877"RTN","C0XMAIN",134,0)
1878 . S FARY="C0XFARY"
1879"RTN","C0XMAIN",135,0)
1880 D USEFARY(FARY)
1881"RTN","C0XMAIN",136,0)
1882 N ZIEN
1883"RTN","C0XMAIN",137,0)
1884 S ZIEN=$$IENOF(ZNAME)
1885"RTN","C0XMAIN",138,0)
1886 S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN")
1887"RTN","C0XMAIN",139,0)
1888 Q
1889"RTN","C0XMAIN",140,0)
1890 ;
1891"RTN","C0XMAIN",141,0)
1892WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL
1893"RTN","C0XMAIN",142,0)
1894 ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING
1895"RTN","C0XMAIN",143,0)
1896 I '$D(FARY) D ;
1897"RTN","C0XMAIN",144,0)
1898 . D INITFARY("C0XFARY")
1899"RTN","C0XMAIN",145,0)
1900 . S FARY="C0XFARY"
1901"RTN","C0XMAIN",146,0)
1902 D USEFARY(FARY)
1903"RTN","C0XMAIN",147,0)
1904 N ZIEN
1905"RTN","C0XMAIN",148,0)
1906 S ZIEN=$$IENOF(ZNAME)
1907"RTN","C0XMAIN",149,0)
1908 Q $NA(@C0XSN@(ZIEN,1))
1909"RTN","C0XMAIN",150,0)
1910 ;
1911"RTN","C0XMAIN",151,0)
1912FILEIN(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH
1913"RTN","C0XMAIN",152,0)
1914 ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT
1915"RTN","C0XMAIN",153,0)
1916 ; IE ^TMP("C0X","FILEIN",1)
1917"RTN","C0XMAIN",154,0)
1918 ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1
1919"RTN","C0XMAIN",155,0)
1920 ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH
1921"RTN","C0XMAIN",156,0)
1922 S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL)
1923"RTN","C0XMAIN",157,0)
1924 Q OK
1925"RTN","C0XMAIN",158,0)
1926 ;
1927"RTN","C0XMAIN",159,0)
1928TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE
1929"RTN","C0XMAIN",160,0)
1930 S ZIN=$NA(^TMP("C0X",12226,"FILEIN"))
1931"RTN","C0XMAIN",161,0)
1932 S ZGRAPH="/test/rdfFile"
1933"RTN","C0XMAIN",162,0)
1934 S ZM="/test/rdfFile/meta"
1935"RTN","C0XMAIN",163,0)
1936 D PROCESS(.G,ZIN,ZGRAPH,ZM)
1937"RTN","C0XMAIN",164,0)
1938 Q
1939"RTN","C0XMAIN",165,0)
1940 ;
1941"RTN","C0XMAIN",166,0)
1942PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE
1943"RTN","C0XMAIN",167,0)
1944 ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING
1945"RTN","C0XMAIN",168,0)
1946 ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE
1947"RTN","C0XMAIN",169,0)
1948 ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS
1949"RTN","C0XMAIN",170,0)
1950 ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA
1951"RTN","C0XMAIN",171,0)
1952 ;
1953"RTN","C0XMAIN",172,0)
1954 I '$D(FARY) D ;
1955"RTN","C0XMAIN",173,0)
1956 . D INITFARY("C0XFARY")
1957"RTN","C0XMAIN",174,0)
1958 . S FARY="C0XFARY"
1959"RTN","C0XMAIN",175,0)
1960 D USEFARY(FARY)
1961"RTN","C0XMAIN",176,0)
1962 ; -- first parse the rdf file with the MXML parser
1963"RTN","C0XMAIN",177,0)
1964 ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML
1965"RTN","C0XMAIN",178,0)
1966 S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W")
1967"RTN","C0XMAIN",179,0)
1968 ; -- assign the MXLM dom global name to ZDOM
1969"RTN","C0XMAIN",180,0)
1970 S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID))
1971"RTN","C0XMAIN",181,0)
1972 W !,$O(@ZDOM@(""),-1)," XML NODES PARSED"
1973"RTN","C0XMAIN",182,0)
1974 ; -- populate the metagraph to point to the graph with status unfinished
1975"RTN","C0XMAIN",183,0)
1976 S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT
1977"RTN","C0XMAIN",184,0)
1978 I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH
1979"RTN","C0XMAIN",185,0)
1980 D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH
1981"RTN","C0XMAIN",186,0)
1982 D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished
1983"RTN","C0XMAIN",187,0)
1984 ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT")
1985"RTN","C0XMAIN",188,0)
1986 S C0XDATE=$$NOW^XLFDT
1987"RTN","C0XMAIN",189,0)
1988 D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY)
1989"RTN","C0XMAIN",190,0)
1990 D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store
1991"RTN","C0XMAIN",191,0)
1992 ; --
1993"RTN","C0XMAIN",192,0)
1994 ; -- pull out the vocabularies in the RDF statement. marked with xmlns:
1995"RTN","C0XMAIN",193,0)
1996 ; -- put them in a local variable for quick reference
1997"RTN","C0XMAIN",194,0)
1998 ; -- TODO: create a graph for vocabularies and validate incoming against it
1999"RTN","C0XMAIN",195,0)
2000 ;
2001"RTN","C0XMAIN",196,0)
2002 S C0XVOC=""
2003"RTN","C0XMAIN",197,0)
2004 N ZI,ZJ,ZK S ZI=""
2005"RTN","C0XMAIN",198,0)
2006 F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns
2007"RTN","C0XMAIN",199,0)
2008 . S ZVOC=$P(ZI,"xmlns:",2)
2009"RTN","C0XMAIN",200,0)
2010 . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI))
2011"RTN","C0XMAIN",201,0)
2012 ;W !,"VOCABS:" ZWR C0XVOC
2013"RTN","C0XMAIN",202,0)
2014 ;
2015"RTN","C0XMAIN",203,0)
2016 ; -- look for children called rdf:Description. quit if none. not an rdf file
2017"RTN","C0XMAIN",204,0)
2018 ;
2019"RTN","C0XMAIN",205,0)
2020 S ZI=$O(@ZDOM@(1,"C",""))
2021"RTN","C0XMAIN",206,0)
2022 I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file
2023"RTN","C0XMAIN",207,0)
2024 . W !,"Error. Not an RDF file. Cannot process."
2025"RTN","C0XMAIN",208,0)
2026 ;
2027"RTN","C0XMAIN",209,0)
2028 ; -- now process the rdf description children
2029"RTN","C0XMAIN",210,0)
2030 ;
2031"RTN","C0XMAIN",211,0)
2032 S ZI=""
2033"RTN","C0XMAIN",212,0)
2034 S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate
2035"RTN","C0XMAIN",213,0)
2036 F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ;
2037"RTN","C0XMAIN",214,0)
2038 . ; -- we are skipping any child that is not rdf:Description
2039"RTN","C0XMAIN",215,0)
2040 . ; -- TODO: check to see if this is right in general
2041"RTN","C0XMAIN",216,0)
2042 . ;
2043"RTN","C0XMAIN",217,0)
2044 . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ;
2045"RTN","C0XMAIN",218,0)
2046 . . W !,"SKIPPING NODE: ",ZI
2047"RTN","C0XMAIN",219,0)
2048 . ; -- now looking for the subject for the triples
2049"RTN","C0XMAIN",220,0)
2050 . S ZX=$G(@ZDOM@(ZI,"A","rdf:about"))
2051"RTN","C0XMAIN",221,0)
2052 . I ZX'="" D ; we have the subject
2053"RTN","C0XMAIN",222,0)
2054 . . ;W " about: ",ZX
2055"RTN","C0XMAIN",223,0)
2056 . . S C0XSUB=ZX
2057"RTN","C0XMAIN",224,0)
2058 . E D ;
2059"RTN","C0XMAIN",225,0)
2060 . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject
2061"RTN","C0XMAIN",226,0)
2062 . . I ZX'="" D ;
2063"RTN","C0XMAIN",227,0)
2064 . . . S C0XSUB=ZX
2065"RTN","C0XMAIN",228,0)
2066 . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT
2067"RTN","C0XMAIN",229,0)
2068 . ;
2069"RTN","C0XMAIN",230,0)
2070 . ; -- we now have the subject. the children of this node have the rest
2071"RTN","C0XMAIN",231,0)
2072 . ;
2073"RTN","C0XMAIN",232,0)
2074 . S ZJ="" ; for the children of the rdf:Description nodes
2075"RTN","C0XMAIN",233,0)
2076 . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child
2077"RTN","C0XMAIN",234,0)
2078 . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix
2079"RTN","C0XMAIN",235,0)
2080 . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space
2081"RTN","C0XMAIN",236,0)
2082 . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix
2083"RTN","C0XMAIN",237,0)
2084 . . I C0XPRE[":" D ; expand using vocabulary
2085"RTN","C0XMAIN",238,0)
2086 . . . N ZB,ZA
2087"RTN","C0XMAIN",239,0)
2088 . . . S ZB=$P(C0XPRE,":",1)
2089"RTN","C0XMAIN",240,0)
2090 . . . S ZA=$P(C0XPRE,":",2)
2091"RTN","C0XMAIN",241,0)
2092 . . . I $G(C0XVOC(ZB))'="" D ;
2093"RTN","C0XMAIN",242,0)
2094 . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded
2095"RTN","C0XMAIN",243,0)
2096 . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object
2097"RTN","C0XMAIN",244,0)
2098 . . I ZY'="" D Q ;
2099"RTN","C0XMAIN",245,0)
2100 . . . S C0XOBJ=ZY ; object
2101"RTN","C0XMAIN",246,0)
2102 . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple
2103"RTN","C0XMAIN",247,0)
2104 . . ; -- this is an else because of the quit above
2105"RTN","C0XMAIN",248,0)
2106 . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object
2107"RTN","C0XMAIN",249,0)
2108 . . I ZX'="" D Q ; got one
2109"RTN","C0XMAIN",250,0)
2110 . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject
2111"RTN","C0XMAIN",251,0)
2112 . . . ; without change... this could be foolish .. look at it again later
2113"RTN","C0XMAIN",252,0)
2114 . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
2115"RTN","C0XMAIN",253,0)
2116 . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here
2117"RTN","C0XMAIN",254,0)
2118 . . I C0XOBJ="" D Q ; not a happy situation
2119"RTN","C0XMAIN",255,0)
2120 . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ
2121"RTN","C0XMAIN",256,0)
2122 . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
2123"RTN","C0XMAIN",257,0)
2124 W !,"INSERTING ",C0XCNT," TRIPLES"
2125"RTN","C0XMAIN",258,0)
2126 D UPDIE(.C0XFDA) ; commit the updates to the file
2127"RTN","C0XMAIN",259,0)
2128 ; next, mark the graph as finished
2129"RTN","C0XMAIN",260,0)
2130 S C0XEND=$$NOW^XLFDT
2131"RTN","C0XMAIN",261,0)
2132 W !," ENDED AT: ",C0XEND
2133"RTN","C0XMAIN",262,0)
2134 S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2)
2135"RTN","C0XMAIN",263,0)
2136 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
2137"RTN","C0XMAIN",264,0)
2138 I C0XDIFF'=0 D ;
2139"RTN","C0XMAIN",265,0)
2140 . W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
2141"RTN","C0XMAIN",266,0)
2142 Q
2143"RTN","C0XMAIN",267,0)
2144 ;
2145"RTN","C0XMAIN",268,0)
2146PROCESS2(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE
2147"RTN","C0XMAIN",269,0)
2148 ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING
2149"RTN","C0XMAIN",270,0)
2150 ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE
2151"RTN","C0XMAIN",271,0)
2152 ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS
2153"RTN","C0XMAIN",272,0)
2154 ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA
2155"RTN","C0XMAIN",273,0)
2156 ;
2157"RTN","C0XMAIN",274,0)
2158 I '$D(FARY) D ;
2159"RTN","C0XMAIN",275,0)
2160 . D INITFARY("C0XFARY")
2161"RTN","C0XMAIN",276,0)
2162 . S FARY="C0XFARY"
2163"RTN","C0XMAIN",277,0)
2164 D USEFARY(FARY)
2165"RTN","C0XMAIN",278,0)
2166 ;N BATCNT
2167"RTN","C0XMAIN",279,0)
2168 ;N BATMAX
2169"RTN","C0XMAIN",280,0)
2170 S BATCNT=0 ; BATCH COUNTER
2171"RTN","C0XMAIN",281,0)
2172 S BATMAX=10000 ; TRY BATCHES OF THIS SIZE
2173"RTN","C0XMAIN",282,0)
2174 ; -- first parse the rdf file with the MXML parser
2175"RTN","C0XMAIN",283,0)
2176 ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML
2177"RTN","C0XMAIN",284,0)
2178 S C0XDLC2=$$NOW^XLFDT ; START OF PARSE
2179"RTN","C0XMAIN",285,0)
2180 S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W")
2181"RTN","C0XMAIN",286,0)
2182 ; -- assign the MXLM dom global name to ZDOM
2183"RTN","C0XMAIN",287,0)
2184 S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID))
2185"RTN","C0XMAIN",288,0)
2186 S C0XNODE=$O(@ZDOM@(""),-1)
2187"RTN","C0XMAIN",289,0)
2188 W !,C0XNODE," XML NODES PARSED"
2189"RTN","C0XMAIN",290,0)
2190 S C0XPRS=$$NOW^XLFDT ; PARSE COMPLETE
2191"RTN","C0XMAIN",291,0)
2192 W !,"PARSE COMPLETE AT ",C0XPRS
2193"RTN","C0XMAIN",292,0)
2194 S C0XDIFF=$$FMDIFF^XLFDT(C0XPRS,C0XDLC2,2)
2195"RTN","C0XMAIN",293,0)
2196 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
2197"RTN","C0XMAIN",294,0)
2198 I C0XDIFF'=0 D ;
2199"RTN","C0XMAIN",295,0)
2200 . W !," APPROXIMATELY ",$P(C0XNODE/C0XDIFF,".")," NODES PER SECOND"
2201"RTN","C0XMAIN",296,0)
2202 ; -- populate the metagraph to point to the graph with status unfinished
2203"RTN","C0XMAIN",297,0)
2204 S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT
2205"RTN","C0XMAIN",298,0)
2206 I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH
2207"RTN","C0XMAIN",299,0)
2208 D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH
2209"RTN","C0XMAIN",300,0)
2210 D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished
2211"RTN","C0XMAIN",301,0)
2212 ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT")
2213"RTN","C0XMAIN",302,0)
2214 S C0XDATE=$$NOW^XLFDT
2215"RTN","C0XMAIN",303,0)
2216 D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY)
2217"RTN","C0XMAIN",304,0)
2218 D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store
2219"RTN","C0XMAIN",305,0)
2220 ; --
2221"RTN","C0XMAIN",306,0)
2222 ; -- pull out the vocabularies in the RDF statement. marked with xmlns:
2223"RTN","C0XMAIN",307,0)
2224 ; -- put them in a local variable for quick reference
2225"RTN","C0XMAIN",308,0)
2226 ; -- TODO: create a graph for vocabularies and validate incoming against it
2227"RTN","C0XMAIN",309,0)
2228 ;
2229"RTN","C0XMAIN",310,0)
2230 S C0XVOC=""
2231"RTN","C0XMAIN",311,0)
2232 N ZI,ZJ,ZK S ZI=""
2233"RTN","C0XMAIN",312,0)
2234 F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns
2235"RTN","C0XMAIN",313,0)
2236 . S ZVOC=$P(ZI,"xmlns:",2)
2237"RTN","C0XMAIN",314,0)
2238 . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI))
2239"RTN","C0XMAIN",315,0)
2240 ;W !,"VOCABS:" ZWR C0XVOC
2241"RTN","C0XMAIN",316,0)
2242 ;
2243"RTN","C0XMAIN",317,0)
2244 ; -- look for children called rdf:Description. quit if none. not an rdf file
2245"RTN","C0XMAIN",318,0)
2246 ;
2247"RTN","C0XMAIN",319,0)
2248 S ZI=$O(@ZDOM@(1,"C",""))
2249"RTN","C0XMAIN",320,0)
2250 I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file
2251"RTN","C0XMAIN",321,0)
2252 . W !,"Error. Not an RDF file. Cannot process."
2253"RTN","C0XMAIN",322,0)
2254 ;
2255"RTN","C0XMAIN",323,0)
2256 ; -- now process the rdf description children
2257"RTN","C0XMAIN",324,0)
2258 ;
2259"RTN","C0XMAIN",325,0)
2260 S ZI=""
2261"RTN","C0XMAIN",326,0)
2262 S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate
2263"RTN","C0XMAIN",327,0)
2264 F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ;
2265"RTN","C0XMAIN",328,0)
2266 . ; -- we are skipping any child that is not rdf:Description
2267"RTN","C0XMAIN",329,0)
2268 . ; -- TODO: check to see if this is right in general
2269"RTN","C0XMAIN",330,0)
2270 . ;
2271"RTN","C0XMAIN",331,0)
2272 . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ;
2273"RTN","C0XMAIN",332,0)
2274 . . W !,"SKIPPING NODE: ",ZI
2275"RTN","C0XMAIN",333,0)
2276 . ; -- now looking for the subject for the triples
2277"RTN","C0XMAIN",334,0)
2278 . S ZX=$G(@ZDOM@(ZI,"A","rdf:about"))
2279"RTN","C0XMAIN",335,0)
2280 . I ZX'="" D ; we have the subject
2281"RTN","C0XMAIN",336,0)
2282 . . ;W " about: ",ZX
2283"RTN","C0XMAIN",337,0)
2284 . . S C0XSUB=ZX
2285"RTN","C0XMAIN",338,0)
2286 . E D ;
2287"RTN","C0XMAIN",339,0)
2288 . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject
2289"RTN","C0XMAIN",340,0)
2290 . . I ZX'="" D ;
2291"RTN","C0XMAIN",341,0)
2292 . . . S C0XSUB=ZX
2293"RTN","C0XMAIN",342,0)
2294 . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT
2295"RTN","C0XMAIN",343,0)
2296 . ;
2297"RTN","C0XMAIN",344,0)
2298 . ; -- we now have the subject. the children of this node have the rest
2299"RTN","C0XMAIN",345,0)
2300 . ;
2301"RTN","C0XMAIN",346,0)
2302 . S ZJ="" ; for the children of the rdf:Description nodes
2303"RTN","C0XMAIN",347,0)
2304 . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child
2305"RTN","C0XMAIN",348,0)
2306 . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix
2307"RTN","C0XMAIN",349,0)
2308 . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space
2309"RTN","C0XMAIN",350,0)
2310 . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix
2311"RTN","C0XMAIN",351,0)
2312 . . I C0XPRE[":" D ; expand using vocabulary
2313"RTN","C0XMAIN",352,0)
2314 . . . N ZB,ZA
2315"RTN","C0XMAIN",353,0)
2316 . . . S ZB=$P(C0XPRE,":",1)
2317"RTN","C0XMAIN",354,0)
2318 . . . S ZA=$P(C0XPRE,":",2)
2319"RTN","C0XMAIN",355,0)
2320 . . . I $G(C0XVOC(ZB))'="" D ;
2321"RTN","C0XMAIN",356,0)
2322 . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded
2323"RTN","C0XMAIN",357,0)
2324 . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object
2325"RTN","C0XMAIN",358,0)
2326 . . I ZY'="" D Q ;
2327"RTN","C0XMAIN",359,0)
2328 . . . S C0XOBJ=ZY ; object
2329"RTN","C0XMAIN",360,0)
2330 . . . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple
2331"RTN","C0XMAIN",361,0)
2332 . . ; -- this is an else because of the quit above
2333"RTN","C0XMAIN",362,0)
2334 . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object
2335"RTN","C0XMAIN",363,0)
2336 . . I ZX'="" D Q ; got one
2337"RTN","C0XMAIN",364,0)
2338 . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject
2339"RTN","C0XMAIN",365,0)
2340 . . . ; without change... this could be foolish .. look at it again later
2341"RTN","C0XMAIN",366,0)
2342 . . . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
2343"RTN","C0XMAIN",367,0)
2344 . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here
2345"RTN","C0XMAIN",368,0)
2346 . . I C0XOBJ="" D Q ; not a happy situation
2347"RTN","C0XMAIN",369,0)
2348 . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ
2349"RTN","C0XMAIN",370,0)
2350 . . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
2351"RTN","C0XMAIN",371,0)
2352 S C0XTRP=$$NOW^XLFDT ; PARSE COMPLETE
2353"RTN","C0XMAIN",372,0)
2354 W !,"TRIPLES COMPLETE AT ",C0XTRP
2355"RTN","C0XMAIN",373,0)
2356 S C0XDIFF=$$FMDIFF^XLFDT(C0XTRP,C0XPRS,2)
2357"RTN","C0XMAIN",374,0)
2358 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
2359"RTN","C0XMAIN",375,0)
2360 I C0XDIFF'=0 D ;
2361"RTN","C0XMAIN",376,0)
2362 . W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
2363"RTN","C0XMAIN",377,0)
2364 W !,"INSERTING ",C0XCNT," TRIPLES"
2365"RTN","C0XMAIN",378,0)
2366 I $D(C0XFDA) D UPDIE(.C0XFDA) ; commit the updates to the file
2367"RTN","C0XMAIN",379,0)
2368 ; next, mark the graph as finished
2369"RTN","C0XMAIN",380,0)
2370 S C0XINS=$$NOW^XLFDT ; PARSE COMPLETE
2371"RTN","C0XMAIN",381,0)
2372 W !,"INSERTION COMPLETE AT ",C0XPRS
2373"RTN","C0XMAIN",382,0)
2374 S C0XDIFF=$$FMDIFF^XLFDT(C0XINS,C0XTRP,2)
2375"RTN","C0XMAIN",383,0)
2376 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
2377"RTN","C0XMAIN",384,0)
2378 W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," NODES PER SECOND"
2379"RTN","C0XMAIN",385,0)
2380 S C0XEND=$$NOW^XLFDT
2381"RTN","C0XMAIN",386,0)
2382 W !," ENDED AT: ",C0XEND
2383"RTN","C0XMAIN",387,0)
2384 S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2)
2385"RTN","C0XMAIN",388,0)
2386 W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
2387"RTN","C0XMAIN",389,0)
2388 W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
2389"RTN","C0XMAIN",390,0)
2390 Q
2391"RTN","C0XMAIN",391,0)
2392 ;
2393"RTN","C0XMAIN",392,0)
2394SHOW(ZN) ;
2395"RTN","C0XMAIN",393,0)
2396 ZWR ^TMP("MXMLDOM",$J,1,ZN,*)
2397"RTN","C0XMAIN",394,0)
2398 Q
2399"RTN","C0XMAIN",395,0)
2400 ;
2401"RTN","C0XMAIN",396,0)
2402ANONS() ; RETURNS AN ANONOMOUS SUBJECT
2403"RTN","C0XMAIN",397,0)
2404 Q "_S:"_$$LKY9
2405"RTN","C0XMAIN",398,0)
2406 ;
2407"RTN","C0XMAIN",399,0)
2408NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED
2409"RTN","C0XMAIN",400,0)
2410 ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT
2411"RTN","C0XMAIN",401,0)
2412 ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN
2413"RTN","C0XMAIN",402,0)
2414 S NGRAPH="G"_$$LKY9
2415"RTN","C0XMAIN",403,0)
2416 S NMETA=NGRAPH_"A"
2417"RTN","C0XMAIN",404,0)
2418 Q
2419"RTN","C0XMAIN",405,0)
2420 ;
2421"RTN","C0XMAIN",406,0)
2422ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT
2423"RTN","C0XMAIN",407,0)
2424 ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE
2425"RTN","C0XMAIN",408,0)
2426 I '$D(FARY) D ;
2427"RTN","C0XMAIN",409,0)
2428 . D INITFARY("C0XFARY")
2429"RTN","C0XMAIN",410,0)
2430 . S FARY="C0XFARY"
2431"RTN","C0XMAIN",411,0)
2432 D USEFARY(FARY)
2433"RTN","C0XMAIN",412,0)
2434 I '$D(C0XCNT) S C0XCNT=0
2435"RTN","C0XMAIN",413,0)
2436 N ZNODE
2437"RTN","C0XMAIN",414,0)
2438 S ZNODE="N"_$$LKY17
2439"RTN","C0XMAIN",415,0)
2440 N ZNARY ; GET READY TO CALL IENOFA
2441"RTN","C0XMAIN",416,0)
2442 S ZNARY("ZG",ZG)=""
2443"RTN","C0XMAIN",417,0)
2444 S ZNARY("ZS",ZS)=""
2445"RTN","C0XMAIN",418,0)
2446 S ZNARY("ZP",ZP)=""
2447"RTN","C0XMAIN",419,0)
2448 S ZNARY("ZO",ZO)=""
2449"RTN","C0XMAIN",420,0)
2450 D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS
2451"RTN","C0XMAIN",421,0)
2452 ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN
2453"RTN","C0XMAIN",422,0)
2454 ;S ZSIEN=$$IENOF(ZS)
2455"RTN","C0XMAIN",423,0)
2456 ;S ZPIEN=$$IENOF(ZP)
2457"RTN","C0XMAIN",424,0)
2458 ;S ZOIEN=$$IENOF(ZO)
2459"RTN","C0XMAIN",425,0)
2460 ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED
2461"RTN","C0XMAIN",426,0)
2462 S C0XCNT=C0XCNT+1
2463"RTN","C0XMAIN",427,0)
2464 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE
2465"RTN","C0XMAIN",428,0)
2466 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG",""))
2467"RTN","C0XMAIN",429,0)
2468 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS",""))
2469"RTN","C0XMAIN",430,0)
2470 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP",""))
2471"RTN","C0XMAIN",431,0)
2472 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO",""))
2473"RTN","C0XMAIN",432,0)
2474 ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE
2475"RTN","C0XMAIN",433,0)
2476 Q
2477"RTN","C0XMAIN",434,0)
2478 ;
2479"RTN","C0XMAIN",435,0)
2480ADD2(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT
2481"RTN","C0XMAIN",436,0)
2482 ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE
2483"RTN","C0XMAIN",437,0)
2484 I '$D(FARY) D ;
2485"RTN","C0XMAIN",438,0)
2486 . D INITFARY("C0XFARY")
2487"RTN","C0XMAIN",439,0)
2488 . S FARY="C0XFARY"
2489"RTN","C0XMAIN",440,0)
2490 D USEFARY(FARY)
2491"RTN","C0XMAIN",441,0)
2492 I '$D(C0XCNT) S C0XCNT=0
2493"RTN","C0XMAIN",442,0)
2494 N ZNODE
2495"RTN","C0XMAIN",443,0)
2496 S ZNODE="N"_$$LKY17
2497"RTN","C0XMAIN",444,0)
2498 N ZNARY ; GET READY TO CALL IENOFA
2499"RTN","C0XMAIN",445,0)
2500 S ZNARY("ZG",ZG)=""
2501"RTN","C0XMAIN",446,0)
2502 S ZNARY("ZS",ZS)=""
2503"RTN","C0XMAIN",447,0)
2504 S ZNARY("ZP",ZP)=""
2505"RTN","C0XMAIN",448,0)
2506 S ZNARY("ZO",ZO)=""
2507"RTN","C0XMAIN",449,0)
2508 D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS
2509"RTN","C0XMAIN",450,0)
2510 ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN
2511"RTN","C0XMAIN",451,0)
2512 ;S ZSIEN=$$IENOF(ZS)
2513"RTN","C0XMAIN",452,0)
2514 ;S ZPIEN=$$IENOF(ZP)
2515"RTN","C0XMAIN",453,0)
2516 ;S ZOIEN=$$IENOF(ZO)
2517"RTN","C0XMAIN",454,0)
2518 ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED
2519"RTN","C0XMAIN",455,0)
2520 S C0XCNT=C0XCNT+1
2521"RTN","C0XMAIN",456,0)
2522 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE
2523"RTN","C0XMAIN",457,0)
2524 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG",""))
2525"RTN","C0XMAIN",458,0)
2526 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS",""))
2527"RTN","C0XMAIN",459,0)
2528 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP",""))
2529"RTN","C0XMAIN",460,0)
2530 S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO",""))
2531"RTN","C0XMAIN",461,0)
2532 S BATCNT=BATCNT+1
2533"RTN","C0XMAIN",462,0)
2534 I BATCNT=BATMAX D ; BATCH IS DONE
2535"RTN","C0XMAIN",463,0)
2536 . D UPDIE(.C0XFDA)
2537"RTN","C0XMAIN",464,0)
2538 . K C0XFDA
2539"RTN","C0XMAIN",465,0)
2540 . S BATCNT=0 ; RESET COUNTER
2541"RTN","C0XMAIN",466,0)
2542 ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE
2543"RTN","C0XMAIN",467,0)
2544 Q
2545"RTN","C0XMAIN",468,0)
2546 ;
2547"RTN","C0XMAIN",469,0)
2548LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
2549"RTN","C0XMAIN",470,0)
2550 ; UNIQUE NODE AND GRAPH NAMES
2551"RTN","C0XMAIN",471,0)
2552 N ZN,ZI
2553"RTN","C0XMAIN",472,0)
2554 S ZN=""
2555"RTN","C0XMAIN",473,0)
2556 F ZI=1:1:9 D ;
2557"RTN","C0XMAIN",474,0)
2558 . S ZN=ZN_$R(10)
2559"RTN","C0XMAIN",475,0)
2560 Q ZN
2561"RTN","C0XMAIN",476,0)
2562 ;
2563"RTN","C0XMAIN",477,0)
2564LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
2565"RTN","C0XMAIN",478,0)
2566 ; UNIQUE NODE AND GRAPH NAMES
2567"RTN","C0XMAIN",479,0)
2568 N ZN,ZI
2569"RTN","C0XMAIN",480,0)
2570 S ZN=""
2571"RTN","C0XMAIN",481,0)
2572 F ZI=1:1:17 D ;
2573"RTN","C0XMAIN",482,0)
2574 . S ZN=ZN_$R(10)
2575"RTN","C0XMAIN",483,0)
2576 Q ZN
2577"RTN","C0XMAIN",484,0)
2578 ;
2579"RTN","C0XMAIN",485,0)
2580IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE
2581"RTN","C0XMAIN",486,0)
2582 I '$D(FARY) D ;
2583"RTN","C0XMAIN",487,0)
2584 . D INITFARY("C0XFARY")
2585"RTN","C0XMAIN",488,0)
2586 . S FARY="C0XFARY"
2587"RTN","C0XMAIN",489,0)
2588 N ZIEN
2589"RTN","C0XMAIN",490,0)
2590 S ZIEN=$O(@C0XSN@("B",ZSTRING,""))
2591"RTN","C0XMAIN",491,0)
2592 I ZIEN="" D ;
2593"RTN","C0XMAIN",492,0)
2594 . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING
2595"RTN","C0XMAIN",493,0)
2596 . D UPDIE(.C0XFDA2)
2597"RTN","C0XMAIN",494,0)
2598 . S ZIEN=$O(@C0XSN@("B",ZSTRING,""))
2599"RTN","C0XMAIN",495,0)
2600 . K C0XFDA2
2601"RTN","C0XMAIN",496,0)
2602 Q ZIEN
2603"RTN","C0XMAIN",497,0)
2604 ;
2605"RTN","C0XMAIN",498,0)
2606IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE
2607"RTN","C0XMAIN",499,0)
2608 ; OR ADD THEM IF
2609"RTN","C0XMAIN",500,0)
2610 ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE
2611"RTN","C0XMAIN",501,0)
2612 ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")=""
2613"RTN","C0XMAIN",502,0)
2614 ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)=""
2615"RTN","C0XMAIN",503,0)
2616 I '$D(FARY) D ;
2617"RTN","C0XMAIN",504,0)
2618 . D INITFARY("C0XFARY")
2619"RTN","C0XMAIN",505,0)
2620 . S FARY="C0XFARY"
2621"RTN","C0XMAIN",506,0)
2622 K ZOUTARY ; START WITH CLEAN RESULTS
2623"RTN","C0XMAIN",507,0)
2624 K C0XFDA2 ; USE A SEPARATE FDA FOR THIS
2625"RTN","C0XMAIN",508,0)
2626 N ZI S ZI=""
2627"RTN","C0XMAIN",509,0)
2628 N ZV,ZIEN
2629"RTN","C0XMAIN",510,0)
2630 N ZCNT S ZCNT=0
2631"RTN","C0XMAIN",511,0)
2632 F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS
2633"RTN","C0XMAIN",512,0)
2634 . S ZV=$O(ZINARY(ZI,""))
2635"RTN","C0XMAIN",513,0)
2636 . I $O(@C0XSN@("B",ZV,""))="" D ;
2637"RTN","C0XMAIN",514,0)
2638 . . S ZCNT=ZCNT+1
2639"RTN","C0XMAIN",515,0)
2640 . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV
2641"RTN","C0XMAIN",516,0)
2642 I $D(C0XFDA2) D ;
2643"RTN","C0XMAIN",517,0)
2644 . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS
2645"RTN","C0XMAIN",518,0)
2646 . K C0XFDA2 ; CLEAN UP
2647"RTN","C0XMAIN",519,0)
2648 F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS
2649"RTN","C0XMAIN",520,0)
2650 . S ZV=$O(ZINARY(ZI,""))
2651"RTN","C0XMAIN",521,0)
2652 . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW
2653"RTN","C0XMAIN",522,0)
2654 . I ZIEN="" D ;
2655"RTN","C0XMAIN",523,0)
2656 . . W !,"ERROR ADDING STRING: ",ZV
2657"RTN","C0XMAIN",524,0)
2658 . . B
2659"RTN","C0XMAIN",525,0)
2660 . S ZOUTARY("IEN",ZI,ZIEN)=""
2661"RTN","C0XMAIN",526,0)
2662 Q
2663"RTN","C0XMAIN",527,0)
2664 ;
2665"RTN","C0XMAIN",528,0)
2666UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
2667"RTN","C0XMAIN",529,0)
2668 ; ZFDA IS PASSED BY REFERENCE
2669"RTN","C0XMAIN",530,0)
2670 ;ZWR ZFDA
2671"RTN","C0XMAIN",531,0)
2672 ;B
2673"RTN","C0XMAIN",532,0)
2674 K ZERR
2675"RTN","C0XMAIN",533,0)
2676 D CLEAN^DILF
2677"RTN","C0XMAIN",534,0)
2678 D UPDATE^DIE("","ZFDA","","ZERR")
2679"RTN","C0XMAIN",535,0)
2680 I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST,
2681"RTN","C0XMAIN",536,0)
2682 ; INVOKE THE ERROR TRAP IF TASKED
2683"RTN","C0XMAIN",537,0)
2684 ;. W "ERROR",!
2685"RTN","C0XMAIN",538,0)
2686 ;. ZWR ZERR
2687"RTN","C0XMAIN",539,0)
2688 ;. B
2689"RTN","C0XMAIN",540,0)
2690 K ZFDA
2691"RTN","C0XMAIN",541,0)
2692 Q
2693"RTN","C0XMAIN",542,0)
2694 ;
2695"SEC","^DIC",172.101,172.101,0,"AUDIT")
2696@
2697"SEC","^DIC",172.101,172.101,0,"DD")
2698@
2699"SEC","^DIC",172.101,172.101,0,"DEL")
2700@
2701"SEC","^DIC",172.101,172.101,0,"LAYGO")
2702@
2703"SEC","^DIC",172.101,172.101,0,"RD")
2704@
2705"SEC","^DIC",172.101,172.101,0,"WR")
2706@
2707"SEC","^DIC",172.201,172.201,0,"AUDIT")
2708@
2709"SEC","^DIC",172.201,172.201,0,"DD")
2710@
2711"SEC","^DIC",172.201,172.201,0,"DEL")
2712@
2713"SEC","^DIC",172.201,172.201,0,"LAYGO")
2714@
2715"SEC","^DIC",172.201,172.201,0,"RD")
2716@
2717"SEC","^DIC",172.201,172.201,0,"WR")
2718@
2719"VER")
27208.0^22.0
2721"^DD",172.101,172.101,0)
2722FIELD^^.05^5
2723"^DD",172.101,172.101,0,"DDA")
2724N
2725"^DD",172.101,172.101,0,"DT")
27263111013
2727"^DD",172.101,172.101,0,"ID",.02)
2728S %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
2729"^DD",172.101,172.101,0,"ID",.03)
2730S %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
2731"^DD",172.101,172.101,0,"ID",.04)
2732S %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
2733"^DD",172.101,172.101,0,"ID",.05)
2734S %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
2735"^DD",172.101,172.101,0,"IX","B",172.101,.01)
2736
2737"^DD",172.101,172.101,0,"NM","C0X TRIPLE")
2738
2739"^DD",172.101,172.101,.01,0)
2740NODEID^RF^^0;1^K:$L(X)>30!($L(X)<3)!'(X'?1P.E) X
2741"^DD",172.101,172.101,.01,.1)
2742TRIPLE NODE ID
2743"^DD",172.101,172.101,.01,1,0)
2744^.1
2745"^DD",172.101,172.101,.01,1,1,0)
2746172.101^B
2747"^DD",172.101,172.101,.01,1,1,1)
2748S ^C0X(101,"B",$E(X,1,30),DA)=""
2749"^DD",172.101,172.101,.01,1,1,2)
2750K ^C0X(101,"B",$E(X,1,30),DA)
2751"^DD",172.101,172.101,.01,3)
2752Answer must be 3-30 characters in length
2753"^DD",172.101,172.101,.01,"DT")
27543111013
2755"^DD",172.101,172.101,.02,0)
2756GRAPH^P172.201^C0X(201,^0;2^Q
2757"^DD",172.101,172.101,.02,.1)
2758TRIPLE GRAPH
2759"^DD",172.101,172.101,.02,3)
2760Answer must be 3-240 characters in length
2761"^DD",172.101,172.101,.02,"DT")
27623111030
2763"^DD",172.101,172.101,.03,0)
2764SUBJECT^P172.201^C0X(201,^0;3^Q
2765"^DD",172.101,172.101,.03,.1)
2766TRIPLE SUBJECT
2767"^DD",172.101,172.101,.03,"DT")
27683111030
2769"^DD",172.101,172.101,.04,0)
2770PREDICATE^P172.201^C0X(201,^0;4^Q
2771"^DD",172.101,172.101,.04,.1)
2772TRIPLE PREDICATE
2773"^DD",172.101,172.101,.04,"DT")
27743111030
2775"^DD",172.101,172.101,.05,0)
2776OBJECT^P172.201^C0X(201,^0;5^Q
2777"^DD",172.101,172.101,.05,.1)
2778TRIPLE OBJECT
2779"^DD",172.101,172.101,.05,"DT")
27803111030
2781"^DD",172.201,172.201,0)
2782FIELD^^1^2
2783"^DD",172.201,172.201,0,"DDA")
2784N
2785"^DD",172.201,172.201,0,"DT")
27863111013
2787"^DD",172.201,172.201,0,"NM","C0X STRING")
2788
2789"^DD",172.201,172.201,0,"PT",172.101,.02)
2790
2791"^DD",172.201,172.201,0,"PT",172.101,.03)
2792
2793"^DD",172.201,172.201,0,"PT",172.101,.04)
2794
2795"^DD",172.201,172.201,0,"PT",172.101,.05)
2796
2797"^DD",172.201,172.201,.01,0)
2798STRING^RF^^0;1^K:$L(X)>240!($L(X)<1)!'(X=X) X
2799"^DD",172.201,172.201,.01,.1)
2800TRIPLE STRING
2801"^DD",172.201,172.201,.01,1,0)
2802^.1^^0
2803"^DD",172.201,172.201,.01,3)
2804Answer must be 1-240 characters in length
2805"^DD",172.201,172.201,.01,"DT")
28063111028
2807"^DD",172.201,172.201,1,0)
2808TEXT^172.2011^^1;0
2809"^DD",172.201,172.2011,0)
2810TEXT SUB-FIELD^^.01^1
2811"^DD",172.201,172.2011,0,"DT")
28123111013
2813"^DD",172.201,172.2011,0,"NM","TEXT")
2814
2815"^DD",172.201,172.2011,0,"UP")
2816172.201
2817"^DD",172.201,172.2011,.01,0)
2818TEXT^Wx^^0;1
2819"^DD",172.201,172.2011,.01,.1)
2820LONGER TEXT
2821"^DD",172.201,172.2011,.01,"DT")
28223111013
2823"^DIC",172.101,172.101,0)
2824C0X TRIPLE^172.101
2825"^DIC",172.101,172.101,0,"GL")
2826^C0X(101,
2827"^DIC",172.101,"B","C0X TRIPLE",172.101)
2828
2829"^DIC",172.201,172.201,0)
2830C0X STRING^172.201
2831"^DIC",172.201,172.201,0,"GL")
2832^C0X(201,
2833"^DIC",172.201,"B","C0X STRING",172.201)
2834
2835**END**
2836**END**
Note: See TracBrowser for help on using the repository browser.