2837 lines
77 KiB
Genshi
2837 lines
77 KiB
Genshi
KIDS Distribution saved on Nov 04, 2011@21:27:03
|
|
new user entry point at FILEIN C0XF2N
|
|
**KIDS**:C0X*1.0*0^
|
|
|
|
**INSTALL NAME**
|
|
C0X*1.0*0
|
|
"BLD",7885,0)
|
|
C0X*1.0*0^^0^3111104^n
|
|
"BLD",7885,4,0)
|
|
^9.64PA^172.201^2
|
|
"BLD",7885,4,172.101,0)
|
|
172.101
|
|
"BLD",7885,4,172.101,222)
|
|
y^y^f^^^^n
|
|
"BLD",7885,4,172.201,0)
|
|
172.201
|
|
"BLD",7885,4,172.201,222)
|
|
y^y^f^^^^n
|
|
"BLD",7885,4,"B",172.101,172.101)
|
|
|
|
"BLD",7885,4,"B",172.201,172.201)
|
|
|
|
"BLD",7885,6.3)
|
|
5
|
|
"BLD",7885,"KRN",0)
|
|
^9.67PA^779.2^20
|
|
"BLD",7885,"KRN",.4,0)
|
|
.4
|
|
"BLD",7885,"KRN",.4,"NM",0)
|
|
^9.68A^1^1
|
|
"BLD",7885,"KRN",.4,"NM",1,0)
|
|
C0X PRINT GRAPH FILE #172.101^172.101^0
|
|
"BLD",7885,"KRN",.4,"NM","B","C0X PRINT GRAPH FILE #172.101",1)
|
|
|
|
"BLD",7885,"KRN",.401,0)
|
|
.401
|
|
"BLD",7885,"KRN",.402,0)
|
|
.402
|
|
"BLD",7885,"KRN",.403,0)
|
|
.403
|
|
"BLD",7885,"KRN",.5,0)
|
|
.5
|
|
"BLD",7885,"KRN",.84,0)
|
|
.84
|
|
"BLD",7885,"KRN",3.6,0)
|
|
3.6
|
|
"BLD",7885,"KRN",3.8,0)
|
|
3.8
|
|
"BLD",7885,"KRN",9.2,0)
|
|
9.2
|
|
"BLD",7885,"KRN",9.8,0)
|
|
9.8
|
|
"BLD",7885,"KRN",9.8,"NM",0)
|
|
^9.68A^2^2
|
|
"BLD",7885,"KRN",9.8,"NM",1,0)
|
|
C0XMAIN^^0^B261424134
|
|
"BLD",7885,"KRN",9.8,"NM",2,0)
|
|
C0XF2N^^0^B289235092
|
|
"BLD",7885,"KRN",9.8,"NM","B","C0XF2N",2)
|
|
|
|
"BLD",7885,"KRN",9.8,"NM","B","C0XMAIN",1)
|
|
|
|
"BLD",7885,"KRN",19,0)
|
|
19
|
|
"BLD",7885,"KRN",19.1,0)
|
|
19.1
|
|
"BLD",7885,"KRN",101,0)
|
|
101
|
|
"BLD",7885,"KRN",409.61,0)
|
|
409.61
|
|
"BLD",7885,"KRN",771,0)
|
|
771
|
|
"BLD",7885,"KRN",779.2,0)
|
|
779.2
|
|
"BLD",7885,"KRN",870,0)
|
|
870
|
|
"BLD",7885,"KRN",8989.51,0)
|
|
8989.51
|
|
"BLD",7885,"KRN",8989.52,0)
|
|
8989.52
|
|
"BLD",7885,"KRN",8994,0)
|
|
8994
|
|
"BLD",7885,"KRN","B",.4,.4)
|
|
|
|
"BLD",7885,"KRN","B",.401,.401)
|
|
|
|
"BLD",7885,"KRN","B",.402,.402)
|
|
|
|
"BLD",7885,"KRN","B",.403,.403)
|
|
|
|
"BLD",7885,"KRN","B",.5,.5)
|
|
|
|
"BLD",7885,"KRN","B",.84,.84)
|
|
|
|
"BLD",7885,"KRN","B",3.6,3.6)
|
|
|
|
"BLD",7885,"KRN","B",3.8,3.8)
|
|
|
|
"BLD",7885,"KRN","B",9.2,9.2)
|
|
|
|
"BLD",7885,"KRN","B",9.8,9.8)
|
|
|
|
"BLD",7885,"KRN","B",19,19)
|
|
|
|
"BLD",7885,"KRN","B",19.1,19.1)
|
|
|
|
"BLD",7885,"KRN","B",101,101)
|
|
|
|
"BLD",7885,"KRN","B",409.61,409.61)
|
|
|
|
"BLD",7885,"KRN","B",771,771)
|
|
|
|
"BLD",7885,"KRN","B",779.2,779.2)
|
|
|
|
"BLD",7885,"KRN","B",870,870)
|
|
|
|
"BLD",7885,"KRN","B",8989.51,8989.51)
|
|
|
|
"BLD",7885,"KRN","B",8989.52,8989.52)
|
|
|
|
"BLD",7885,"KRN","B",8994,8994)
|
|
|
|
"FIA",172.101)
|
|
C0X TRIPLE
|
|
"FIA",172.101,0)
|
|
^C0X(101,
|
|
"FIA",172.101,0,0)
|
|
172.101I
|
|
"FIA",172.101,0,1)
|
|
y^y^f^^^^n
|
|
"FIA",172.101,0,10)
|
|
|
|
"FIA",172.101,0,11)
|
|
|
|
"FIA",172.101,0,"RLRO")
|
|
|
|
"FIA",172.101,172.101)
|
|
0
|
|
"FIA",172.201)
|
|
C0X STRING
|
|
"FIA",172.201,0)
|
|
^C0X(201,
|
|
"FIA",172.201,0,0)
|
|
172.201
|
|
"FIA",172.201,0,1)
|
|
y^y^f^^^^n
|
|
"FIA",172.201,0,10)
|
|
|
|
"FIA",172.201,0,11)
|
|
|
|
"FIA",172.201,0,"RLRO")
|
|
|
|
"FIA",172.201,172.201)
|
|
0
|
|
"FIA",172.201,172.2011)
|
|
0
|
|
"IX",172.101,172.101,"G",0)
|
|
172.101^G^REGULAR INDEX OF THE GRAPH FIELD^R^^F^IR^I^172.101^^^^^LS
|
|
"IX",172.101,172.101,"G",1)
|
|
S ^C0X(101,"G",X,DA)=""
|
|
"IX",172.101,172.101,"G",2)
|
|
K ^C0X(101,"G",X,DA)
|
|
"IX",172.101,172.101,"G",2.5)
|
|
K ^C0X(101,"G")
|
|
"IX",172.101,172.101,"G",11.1,0)
|
|
^.114IA^1^1
|
|
"IX",172.101,172.101,"G",11.1,1,0)
|
|
1^F^172.101^.02^^1^F
|
|
"IX",172.101,172.101,"G",11.1,1,3)
|
|
|
|
"IX",172.101,172.101,"GOPS",0)
|
|
172.101^GOPS^GRAPH ONLY OBJECT PREDICATE SUBJECT^R^^R^IR^I^172.101^^^^^LS
|
|
"IX",172.101,172.101,"GOPS",1)
|
|
S ^C0X(101,"GOPS",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)=""
|
|
"IX",172.101,172.101,"GOPS",2)
|
|
K ^C0X(101,"GOPS",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)
|
|
"IX",172.101,172.101,"GOPS",2.5)
|
|
K ^C0X(101,"GOPS")
|
|
"IX",172.101,172.101,"GOPS",11.1,0)
|
|
^.114IA^4^4
|
|
"IX",172.101,172.101,"GOPS",11.1,1,0)
|
|
1^F^172.101^.02^240^1^F
|
|
"IX",172.101,172.101,"GOPS",11.1,1,3)
|
|
|
|
"IX",172.101,172.101,"GOPS",11.1,2,0)
|
|
2^F^172.101^.05^240^2^F
|
|
"IX",172.101,172.101,"GOPS",11.1,2,3)
|
|
|
|
"IX",172.101,172.101,"GOPS",11.1,3,0)
|
|
3^F^172.101^.04^240^3^F
|
|
"IX",172.101,172.101,"GOPS",11.1,3,3)
|
|
|
|
"IX",172.101,172.101,"GOPS",11.1,4,0)
|
|
4^F^172.101^.03^240^4^F
|
|
"IX",172.101,172.101,"GOPS",11.1,4,3)
|
|
|
|
"IX",172.101,172.101,"GOSP",0)
|
|
172.101^GOSP^GRAPH ONLY OBJECT SUBJECT PREDICATE^R^^R^IR^I^172.101^^^^^LS
|
|
"IX",172.101,172.101,"GOSP",1)
|
|
S ^C0X(101,"GOSP",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)=""
|
|
"IX",172.101,172.101,"GOSP",2)
|
|
K ^C0X(101,"GOSP",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)
|
|
"IX",172.101,172.101,"GOSP",2.5)
|
|
K ^C0X(101,"GOSP")
|
|
"IX",172.101,172.101,"GOSP",11.1,0)
|
|
^.114IA^4^4
|
|
"IX",172.101,172.101,"GOSP",11.1,1,0)
|
|
1^F^172.101^.02^240^1^F
|
|
"IX",172.101,172.101,"GOSP",11.1,1,3)
|
|
|
|
"IX",172.101,172.101,"GOSP",11.1,2,0)
|
|
2^F^172.101^.05^240^2^F
|
|
"IX",172.101,172.101,"GOSP",11.1,2,3)
|
|
|
|
"IX",172.101,172.101,"GOSP",11.1,3,0)
|
|
3^F^172.101^.03^240^3^F
|
|
"IX",172.101,172.101,"GOSP",11.1,3,3)
|
|
|
|
"IX",172.101,172.101,"GOSP",11.1,4,0)
|
|
4^F^172.101^.04^240^4^F
|
|
"IX",172.101,172.101,"GOSP",11.1,4,3)
|
|
|
|
"IX",172.101,172.101,"GPSO",0)
|
|
172.101^GPSO^GRAPH ONLY PREDICATE SUBJECT OBJECT^R^^R^IR^I^172.101^^^^^LS
|
|
"IX",172.101,172.101,"GPSO",1)
|
|
S ^C0X(101,"GPSO",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)=""
|
|
"IX",172.101,172.101,"GPSO",2)
|
|
K ^C0X(101,"GPSO",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)
|
|
"IX",172.101,172.101,"GPSO",2.5)
|
|
K ^C0X(101,"GPSO")
|
|
"IX",172.101,172.101,"GPSO",11.1,0)
|
|
^.114IA^4^4
|
|
"IX",172.101,172.101,"GPSO",11.1,1,0)
|
|
1^F^172.101^.02^240^1^F
|
|
"IX",172.101,172.101,"GPSO",11.1,1,3)
|
|
|
|
"IX",172.101,172.101,"GPSO",11.1,2,0)
|
|
2^F^172.101^.04^240^2^F
|
|
"IX",172.101,172.101,"GPSO",11.1,2,3)
|
|
|
|
"IX",172.101,172.101,"GPSO",11.1,3,0)
|
|
3^F^172.101^.03^240^3^F
|
|
"IX",172.101,172.101,"GPSO",11.1,3,3)
|
|
|
|
"IX",172.101,172.101,"GPSO",11.1,4,0)
|
|
4^F^172.101^.05^240^4^F
|
|
"IX",172.101,172.101,"GPSO",11.1,4,3)
|
|
|
|
"IX",172.101,172.101,"GSPO",0)
|
|
172.101^GSPO^GROUP ONLY SUBJECT PREDICATE OBJECT^R^^R^IR^I^172.101^^^^^LS
|
|
"IX",172.101,172.101,"GSPO",1)
|
|
S ^C0X(101,"GSPO",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)=""
|
|
"IX",172.101,172.101,"GSPO",2)
|
|
K ^C0X(101,"GSPO",$E(X(1),1,240),$E(X(2),1,240),$E(X(3),1,240),$E(X(4),1,240),DA)
|
|
"IX",172.101,172.101,"GSPO",2.5)
|
|
K ^C0X(101,"GSPO")
|
|
"IX",172.101,172.101,"GSPO",11.1,0)
|
|
^.114IA^4^4
|
|
"IX",172.101,172.101,"GSPO",11.1,1,0)
|
|
1^F^172.101^.02^240^1^F
|
|
"IX",172.101,172.101,"GSPO",11.1,1,3)
|
|
|
|
"IX",172.101,172.101,"GSPO",11.1,2,0)
|
|
2^F^172.101^.03^240^2^F
|
|
"IX",172.101,172.101,"GSPO",11.1,2,3)
|
|
|
|
"IX",172.101,172.101,"GSPO",11.1,3,0)
|
|
3^F^172.101^.04^240^3^F
|
|
"IX",172.101,172.101,"GSPO",11.1,3,3)
|
|
|
|
"IX",172.101,172.101,"GSPO",11.1,4,0)
|
|
4^F^172.101^.05^240^4^F
|
|
"IX",172.101,172.101,"GSPO",11.1,4,3)
|
|
|
|
"IX",172.101,172.101,"OPS",0)
|
|
172.101^OPS^REGULAR INDEX OF OBJECT PREDICATE SUBJECT^R^^R^IR^I^172.101^^^^^LS
|
|
"IX",172.101,172.101,"OPS",1)
|
|
S ^C0X(101,"OPS",X(1),X(2),X(3),DA)=""
|
|
"IX",172.101,172.101,"OPS",2)
|
|
K ^C0X(101,"OPS",X(1),X(2),X(3),DA)
|
|
"IX",172.101,172.101,"OPS",2.5)
|
|
K ^C0X(101,"OPS")
|
|
"IX",172.101,172.101,"OPS",11.1,0)
|
|
^.114IA^3^3
|
|
"IX",172.101,172.101,"OPS",11.1,1,0)
|
|
1^F^172.101^.05^^1^F
|
|
"IX",172.101,172.101,"OPS",11.1,1,3)
|
|
|
|
"IX",172.101,172.101,"OPS",11.1,2,0)
|
|
2^F^172.101^.04^^2^F
|
|
"IX",172.101,172.101,"OPS",11.1,2,3)
|
|
|
|
"IX",172.101,172.101,"OPS",11.1,3,0)
|
|
3^F^172.101^.03^^3^F
|
|
"IX",172.101,172.101,"OPS",11.1,3,3)
|
|
|
|
"IX",172.101,172.101,"OSP",0)
|
|
172.101^OSP^REGULAR INDEX OF OBJECT SUBJECT PREDICATE^R^^R^IR^I^172.101^^^^^LS
|
|
"IX",172.101,172.101,"OSP",1)
|
|
S ^C0X(101,"OSP",X(1),X(2),X(3),DA)=""
|
|
"IX",172.101,172.101,"OSP",2)
|
|
K ^C0X(101,"OSP",X(1),X(2),X(3),DA)
|
|
"IX",172.101,172.101,"OSP",2.5)
|
|
K ^C0X(101,"OSP")
|
|
"IX",172.101,172.101,"OSP",11.1,0)
|
|
^.114IA^3^3
|
|
"IX",172.101,172.101,"OSP",11.1,1,0)
|
|
1^F^172.101^.05^^1^F
|
|
"IX",172.101,172.101,"OSP",11.1,1,3)
|
|
|
|
"IX",172.101,172.101,"OSP",11.1,2,0)
|
|
2^F^172.101^.03^^2^F
|
|
"IX",172.101,172.101,"OSP",11.1,2,3)
|
|
|
|
"IX",172.101,172.101,"OSP",11.1,3,0)
|
|
3^F^172.101^.04^^3^F
|
|
"IX",172.101,172.101,"OSP",11.1,3,3)
|
|
|
|
"IX",172.101,172.101,"PSO",0)
|
|
172.101^PSO^REGULAR INDEX OF PREDICATE SUBJECT OBJECT^R^^R^IR^I^172.101^^^^^LS
|
|
"IX",172.101,172.101,"PSO",1)
|
|
S ^C0X(101,"PSO",X(1),X(2),X(3),DA)=""
|
|
"IX",172.101,172.101,"PSO",2)
|
|
K ^C0X(101,"PSO",X(1),X(2),X(3),DA)
|
|
"IX",172.101,172.101,"PSO",2.5)
|
|
K ^C0X(101,"PSO")
|
|
"IX",172.101,172.101,"PSO",11.1,0)
|
|
^.114IA^3^3
|
|
"IX",172.101,172.101,"PSO",11.1,1,0)
|
|
1^F^172.101^.04^^1^F
|
|
"IX",172.101,172.101,"PSO",11.1,1,3)
|
|
|
|
"IX",172.101,172.101,"PSO",11.1,2,0)
|
|
2^F^172.101^.03^^2^F
|
|
"IX",172.101,172.101,"PSO",11.1,2,3)
|
|
|
|
"IX",172.101,172.101,"PSO",11.1,3,0)
|
|
3^F^172.101^.05^^3^F
|
|
"IX",172.101,172.101,"PSO",11.1,3,3)
|
|
|
|
"IX",172.101,172.101,"SPO",0)
|
|
172.101^SPO^REGULAR INDEX OF SUBJECT PREDICATE OBJECT^R^^R^IR^I^172.101^^^^^LS
|
|
"IX",172.101,172.101,"SPO",1)
|
|
S ^C0X(101,"SPO",X(1),X(2),X(3),DA)=""
|
|
"IX",172.101,172.101,"SPO",2)
|
|
K ^C0X(101,"SPO",X(1),X(2),X(3),DA)
|
|
"IX",172.101,172.101,"SPO",2.5)
|
|
K ^C0X(101,"SPO")
|
|
"IX",172.101,172.101,"SPO",11.1,0)
|
|
^.114IA^3^3
|
|
"IX",172.101,172.101,"SPO",11.1,1,0)
|
|
1^F^172.101^.03^^1^F
|
|
"IX",172.101,172.101,"SPO",11.1,1,3)
|
|
|
|
"IX",172.101,172.101,"SPO",11.1,2,0)
|
|
2^F^172.101^.04^^2^F
|
|
"IX",172.101,172.101,"SPO",11.1,2,3)
|
|
|
|
"IX",172.101,172.101,"SPO",11.1,3,0)
|
|
3^F^172.101^.05^^3^F
|
|
"IX",172.101,172.101,"SPO",11.1,3,3)
|
|
|
|
"IX",172.201,172.201,"B",0)
|
|
172.201^B^regular B index for strings to support long strings^R^^F^IR^I^172.201^^^^^LS
|
|
"IX",172.201,172.201,"B",1)
|
|
S ^C0X(201,"B",$E(X,1,240),DA)=""
|
|
"IX",172.201,172.201,"B",2)
|
|
K ^C0X(201,"B",$E(X,1,240),DA)
|
|
"IX",172.201,172.201,"B",2.5)
|
|
K ^C0X(201,"B")
|
|
"IX",172.201,172.201,"B",11.1,0)
|
|
^.114IA^1^1
|
|
"IX",172.201,172.201,"B",11.1,1,0)
|
|
1^F^172.201^.01^240^1^F
|
|
"KRN",.4,1498,-1)
|
|
0^1
|
|
"KRN",.4,1498,0)
|
|
C0X PRINT GRAPH^3111029.121^@^172.101^^@^3111030
|
|
"KRN",.4,1498,"F",2)
|
|
.03;W25;S~.04;C27;W25~.05;C54;W25~
|
|
"KRN",.4,1498,"H")
|
|
C0X TRIPLE LIST
|
|
"MBREQ")
|
|
0
|
|
"ORD",5,.4)
|
|
.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,"",%)
|
|
"ORD",5,.4,0)
|
|
PRINT TEMPLATE
|
|
"QUES","XPF1",0)
|
|
Y
|
|
"QUES","XPF1","??")
|
|
^D REP^XPDH
|
|
"QUES","XPF1","A")
|
|
Shall I write over your |FLAG| File
|
|
"QUES","XPF1","B")
|
|
YES
|
|
"QUES","XPF1","M")
|
|
D XPF1^XPDIQ
|
|
"QUES","XPF2",0)
|
|
Y
|
|
"QUES","XPF2","??")
|
|
^D DTA^XPDH
|
|
"QUES","XPF2","A")
|
|
Want my data |FLAG| yours
|
|
"QUES","XPF2","B")
|
|
YES
|
|
"QUES","XPF2","M")
|
|
D XPF2^XPDIQ
|
|
"QUES","XPI1",0)
|
|
YO
|
|
"QUES","XPI1","??")
|
|
^D INHIBIT^XPDH
|
|
"QUES","XPI1","A")
|
|
Want KIDS to INHIBIT LOGONs during the install
|
|
"QUES","XPI1","B")
|
|
NO
|
|
"QUES","XPI1","M")
|
|
D XPI1^XPDIQ
|
|
"QUES","XPM1",0)
|
|
PO^VA(200,:EM
|
|
"QUES","XPM1","??")
|
|
^D MG^XPDH
|
|
"QUES","XPM1","A")
|
|
Enter the Coordinator for Mail Group '|FLAG|'
|
|
"QUES","XPM1","B")
|
|
|
|
"QUES","XPM1","M")
|
|
D XPM1^XPDIQ
|
|
"QUES","XPO1",0)
|
|
Y
|
|
"QUES","XPO1","??")
|
|
^D MENU^XPDH
|
|
"QUES","XPO1","A")
|
|
Want KIDS to Rebuild Menu Trees Upon Completion of Install
|
|
"QUES","XPO1","B")
|
|
NO
|
|
"QUES","XPO1","M")
|
|
D XPO1^XPDIQ
|
|
"QUES","XPZ1",0)
|
|
Y
|
|
"QUES","XPZ1","??")
|
|
^D OPT^XPDH
|
|
"QUES","XPZ1","A")
|
|
Want to DISABLE Scheduled Options, Menu Options, and Protocols
|
|
"QUES","XPZ1","B")
|
|
NO
|
|
"QUES","XPZ1","M")
|
|
D XPZ1^XPDIQ
|
|
"QUES","XPZ2",0)
|
|
Y
|
|
"QUES","XPZ2","??")
|
|
^D RTN^XPDH
|
|
"QUES","XPZ2","A")
|
|
Want to MOVE routines to other CPUs
|
|
"QUES","XPZ2","B")
|
|
NO
|
|
"QUES","XPZ2","M")
|
|
D XPZ2^XPDIQ
|
|
"RTN")
|
|
2
|
|
"RTN","C0XF2N")
|
|
0^2^B289235092
|
|
"RTN","C0XF2N",1,0)
|
|
C0XMAIN ; GPL - Fileman Triples entry point routine ;10/13/11 17:05
|
|
"RTN","C0XF2N",2,0)
|
|
;;0.1;C0X;nopatch;noreleasedate;Build 5
|
|
"RTN","C0XF2N",3,0)
|
|
;Copyright 2011 George Lilly. Licensed under the terms of the GNU
|
|
"RTN","C0XF2N",4,0)
|
|
;General Public License See attached copy of the License.
|
|
"RTN","C0XF2N",5,0)
|
|
;
|
|
"RTN","C0XF2N",6,0)
|
|
;This program is free software; you can redistribute it and/or modify
|
|
"RTN","C0XF2N",7,0)
|
|
;it under the terms of the GNU General Public License as published by
|
|
"RTN","C0XF2N",8,0)
|
|
;the Free Software Foundation; either version 2 of the License, or
|
|
"RTN","C0XF2N",9,0)
|
|
;(at your option) any later version.
|
|
"RTN","C0XF2N",10,0)
|
|
;
|
|
"RTN","C0XF2N",11,0)
|
|
;This program is distributed in the hope that it will be useful,
|
|
"RTN","C0XF2N",12,0)
|
|
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
"RTN","C0XF2N",13,0)
|
|
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
"RTN","C0XF2N",14,0)
|
|
;GNU General Public License for more details.
|
|
"RTN","C0XF2N",15,0)
|
|
;
|
|
"RTN","C0XF2N",16,0)
|
|
;You should have received a copy of the GNU General Public License along
|
|
"RTN","C0XF2N",17,0)
|
|
;with this program; if not, write to the Free Software Foundation, Inc.,
|
|
"RTN","C0XF2N",18,0)
|
|
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
"RTN","C0XF2N",19,0)
|
|
;
|
|
"RTN","C0XF2N",20,0)
|
|
Q
|
|
"RTN","C0XF2N",21,0)
|
|
;
|
|
"RTN","C0XF2N",22,0)
|
|
; This is based on C0XMAIN but experiments with a fast load for triples
|
|
"RTN","C0XF2N",23,0)
|
|
; that will write directly to the fileman global
|
|
"RTN","C0XF2N",24,0)
|
|
; The file 172.101 is a F2N design style for triples, which means
|
|
"RTN","C0XF2N",25,0)
|
|
; that it is a Flat file with no subfiles, all fields at the root
|
|
"RTN","C0XF2N",26,0)
|
|
; ... it is a "2" file solution which means all strings are stored in
|
|
"RTN","C0XF2N",27,0)
|
|
; ... strings file and pointed to by the triples file
|
|
"RTN","C0XF2N",28,0)
|
|
; ... it is an N file because it has generated Node IDs instead of
|
|
"RTN","C0XF2N",29,0)
|
|
; ... DINUM which would use the IEN for the Node ID.
|
|
"RTN","C0XF2N",30,0)
|
|
; gpl 11/04/2011
|
|
"RTN","C0XF2N",31,0)
|
|
;
|
|
"RTN","C0XF2N",32,0)
|
|
INITFARY(ZFARY) ; INITIALIZE FILE NUMBERS AND OTHER USEFUL THINGS
|
|
"RTN","C0XF2N",33,0)
|
|
; FOR THE DEFAULT TRIPLE STORE. USE OTHER VALUES FOR SUPPORTING ADDITIONAL
|
|
"RTN","C0XF2N",34,0)
|
|
; TRIPLE STORES
|
|
"RTN","C0XF2N",35,0)
|
|
S @ZFARY@("C0XTFN")=172.101 ; TRIPLES FILE NUMBER
|
|
"RTN","C0XF2N",36,0)
|
|
S @ZFARY@("C0XSFN")=172.201 ; TRIPLES STRINGS FILE NUMBER
|
|
"RTN","C0XF2N",37,0)
|
|
S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME
|
|
"RTN","C0XF2N",38,0)
|
|
S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME
|
|
"RTN","C0XF2N",39,0)
|
|
S @ZFARY@("C0XDIR")="/home/glilly/rdf/"
|
|
"RTN","C0XF2N",40,0)
|
|
D USEFARY(ZFARY)
|
|
"RTN","C0XF2N",41,0)
|
|
Q
|
|
"RTN","C0XF2N",42,0)
|
|
;
|
|
"RTN","C0XF2N",43,0)
|
|
USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY
|
|
"RTN","C0XF2N",44,0)
|
|
N ZI S ZI=""
|
|
"RTN","C0XF2N",45,0)
|
|
F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D
|
|
"RTN","C0XF2N",46,0)
|
|
. ;N ZX
|
|
"RTN","C0XF2N",47,0)
|
|
. S ZX="S "_ZI_"="""_@ZFARY@(ZI)_""""
|
|
"RTN","C0XF2N",48,0)
|
|
. ;W !,ZX
|
|
"RTN","C0XF2N",49,0)
|
|
. X ZX
|
|
"RTN","C0XF2N",50,0)
|
|
Q
|
|
"RTN","C0XF2N",51,0)
|
|
;
|
|
"RTN","C0XF2N",52,0)
|
|
FILEIN ; INTERACTIVE ENTRY POINT FOR OPTION TO READ IN A FILE
|
|
"RTN","C0XF2N",53,0)
|
|
I '$D(C0XFARY) D INITFARY("C0XFARY")
|
|
"RTN","C0XF2N",54,0)
|
|
D USEFARY("C0XFARY")
|
|
"RTN","C0XF2N",55,0)
|
|
S DIR(0)="F^3:240"
|
|
"RTN","C0XF2N",56,0)
|
|
S DIR("A")="File Directory"
|
|
"RTN","C0XF2N",57,0)
|
|
S DIR("B")=C0XDIR
|
|
"RTN","C0XF2N",58,0)
|
|
D ^DIR
|
|
"RTN","C0XF2N",59,0)
|
|
I Y="^" Q ;
|
|
"RTN","C0XF2N",60,0)
|
|
S C0XDIR=Y
|
|
"RTN","C0XF2N",61,0)
|
|
S C0XFARY("C0XDIR")=Y
|
|
"RTN","C0XF2N",62,0)
|
|
S DIR(0)="F^3:240"
|
|
"RTN","C0XF2N",63,0)
|
|
S DIR("A")="File Name"
|
|
"RTN","C0XF2N",64,0)
|
|
I '$D(C0XFN) S DIR("B")="qds.rdf"
|
|
"RTN","C0XF2N",65,0)
|
|
E S DIR("B")=C0XFN
|
|
"RTN","C0XF2N",66,0)
|
|
D ^DIR
|
|
"RTN","C0XF2N",67,0)
|
|
I Y="" Q ;
|
|
"RTN","C0XF2N",68,0)
|
|
I Y="^" Q ;
|
|
"RTN","C0XF2N",69,0)
|
|
S C0XFN=Y
|
|
"RTN","C0XF2N",70,0)
|
|
D IMPORT(C0XFN,C0XDIR,,"C0XFARY")
|
|
"RTN","C0XF2N",71,0)
|
|
Q
|
|
"RTN","C0XF2N",72,0)
|
|
;
|
|
"RTN","C0XF2N",73,0)
|
|
IMPORT(FNAME,FDIR,FURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD
|
|
"RTN","C0XF2N",74,0)
|
|
; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE
|
|
"RTN","C0XF2N",75,0)
|
|
; NODE NAME OF THE TEXT TRIPLE
|
|
"RTN","C0XF2N",76,0)
|
|
; FDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR)
|
|
"RTN","C0XF2N",77,0)
|
|
; FURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE
|
|
"RTN","C0XF2N",78,0)
|
|
; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE
|
|
"RTN","C0XF2N",79,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XF2N",80,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XF2N",81,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XF2N",82,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XF2N",83,0)
|
|
N ZD,ZTMP
|
|
"RTN","C0XF2N",84,0)
|
|
I '$D(FDIR) S FDIR=C0XDIR ; DIRECTORY OF THE RDF FILE
|
|
"RTN","C0XF2N",85,0)
|
|
I '$D(FURL) D ;
|
|
"RTN","C0XF2N",86,0)
|
|
. N ZN2 S ZN2=$TR(FNAME,".","_") ; REMOVE THE DOT FROM THE NAME
|
|
"RTN","C0XF2N",87,0)
|
|
. S FURL=FDIR_ZN2
|
|
"RTN","C0XF2N",88,0)
|
|
N ZTMP
|
|
"RTN","C0XF2N",89,0)
|
|
S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE
|
|
"RTN","C0XF2N",90,0)
|
|
K @ZTMP ; MAKE SURE IT'S CLEAR
|
|
"RTN","C0XF2N",91,0)
|
|
S C0XSTART=$$NOW^XLFDT
|
|
"RTN","C0XF2N",92,0)
|
|
W !,"STARTED: ",C0XSTART
|
|
"RTN","C0XF2N",93,0)
|
|
W !,"READING IN: ",FNAME
|
|
"RTN","C0XF2N",94,0)
|
|
I '$$FILEREAD(ZTMP,FDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS
|
|
"RTN","C0XF2N",95,0)
|
|
. W !,"ERROR READING FILE: ",FDIR,FNAME
|
|
"RTN","C0XF2N",96,0)
|
|
S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT
|
|
"RTN","C0XF2N",97,0)
|
|
W !,$O(@ZRDF@(""),-1)," LINES READ"
|
|
"RTN","C0XF2N",98,0)
|
|
D INSRDF(ZRDF,FURL,FARY) ; IMPORT AND PROCESS THE RDF
|
|
"RTN","C0XF2N",99,0)
|
|
Q
|
|
"RTN","C0XF2N",100,0)
|
|
;
|
|
"RTN","C0XF2N",101,0)
|
|
WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT
|
|
"RTN","C0XF2N",102,0)
|
|
;
|
|
"RTN","C0XF2N",103,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XF2N",104,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XF2N",105,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XF2N",106,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XF2N",107,0)
|
|
;N ZLOC,ZTMP
|
|
"RTN","C0XF2N",108,0)
|
|
K ZTMP
|
|
"RTN","C0XF2N",109,0)
|
|
S ZLOC=$NA(^TMP("C0X","WGET",$J))
|
|
"RTN","C0XF2N",110,0)
|
|
K @ZLOC
|
|
"RTN","C0XF2N",111,0)
|
|
S C0XSTART=$$NOW^XLFDT
|
|
"RTN","C0XF2N",112,0)
|
|
W !,"STARTED: ",C0XSTART
|
|
"RTN","C0XF2N",113,0)
|
|
W !,"DOWNLOADING: ",ZURL
|
|
"RTN","C0XF2N",114,0)
|
|
S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP)
|
|
"RTN","C0XF2N",115,0)
|
|
M @ZLOC=ZTMP
|
|
"RTN","C0XF2N",116,0)
|
|
S C0XLINES=$O(@ZLOC@(""),-1)
|
|
"RTN","C0XF2N",117,0)
|
|
W !,C0XLINES," LINES READ"
|
|
"RTN","C0XF2N",118,0)
|
|
S C0XDLC=$$NOW^XLFDT ; DOWNLOAD COMPLETE
|
|
"RTN","C0XF2N",119,0)
|
|
W !,"DOWNLOAD COMPLETE AT ",C0XDLC
|
|
"RTN","C0XF2N",120,0)
|
|
S C0XDIFF=$$FMDIFF^XLFDT(C0XDLC,C0XSTART,2)
|
|
"RTN","C0XF2N",121,0)
|
|
W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
|
|
"RTN","C0XF2N",122,0)
|
|
I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XLINES/C0XDIFF,".")," LINES PER SEC"
|
|
"RTN","C0XF2N",123,0)
|
|
D INSRDF(ZLOC,ZURL,FARY)
|
|
"RTN","C0XF2N",124,0)
|
|
Q
|
|
"RTN","C0XF2N",125,0)
|
|
;
|
|
"RTN","C0XF2N",126,0)
|
|
INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS
|
|
"RTN","C0XF2N",127,0)
|
|
; ZRDF IS PASSED BY NAME
|
|
"RTN","C0XF2N",128,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XF2N",129,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XF2N",130,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XF2N",131,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XF2N",132,0)
|
|
N ZGRAPH,ZSUBJECT
|
|
"RTN","C0XF2N",133,0)
|
|
S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME
|
|
"RTN","C0XF2N",134,0)
|
|
S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT
|
|
"RTN","C0XF2N",135,0)
|
|
D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY)
|
|
"RTN","C0XF2N",136,0)
|
|
N ZTXTNM
|
|
"RTN","C0XF2N",137,0)
|
|
S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE
|
|
"RTN","C0XF2N",138,0)
|
|
D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY)
|
|
"RTN","C0XF2N",139,0)
|
|
D UPDIE(.C0XFDA) ; TRY IT OUT
|
|
"RTN","C0XF2N",140,0)
|
|
K C0XCNT ;RESET FOR NEXT TIME
|
|
"RTN","C0XF2N",141,0)
|
|
D STORETXT(ZRDF,ZTXTNM,FARY)
|
|
"RTN","C0XF2N",142,0)
|
|
W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM
|
|
"RTN","C0XF2N",143,0)
|
|
D PROCESS2(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF
|
|
"RTN","C0XF2N",144,0)
|
|
Q
|
|
"RTN","C0XF2N",145,0)
|
|
;
|
|
"RTN","C0XF2N",146,0)
|
|
STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME
|
|
"RTN","C0XF2N",147,0)
|
|
;
|
|
"RTN","C0XF2N",148,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XF2N",149,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XF2N",150,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XF2N",151,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XF2N",152,0)
|
|
N ZIEN
|
|
"RTN","C0XF2N",153,0)
|
|
S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN
|
|
"RTN","C0XF2N",154,0)
|
|
D CLEAN^DILF
|
|
"RTN","C0XF2N",155,0)
|
|
K ZERR
|
|
"RTN","C0XF2N",156,0)
|
|
D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR")
|
|
"RTN","C0XF2N",157,0)
|
|
I $D(ZERR) D ;
|
|
"RTN","C0XF2N",158,0)
|
|
. ZWR ZERR
|
|
"RTN","C0XF2N",159,0)
|
|
Q
|
|
"RTN","C0XF2N",160,0)
|
|
;
|
|
"RTN","C0XF2N",161,0)
|
|
GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT
|
|
"RTN","C0XF2N",162,0)
|
|
; ZRTN IS PASSED BY REFERENCE
|
|
"RTN","C0XF2N",163,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XF2N",164,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XF2N",165,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XF2N",166,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XF2N",167,0)
|
|
N ZIEN
|
|
"RTN","C0XF2N",168,0)
|
|
S ZIEN=$$IENOF(ZNAME)
|
|
"RTN","C0XF2N",169,0)
|
|
S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN")
|
|
"RTN","C0XF2N",170,0)
|
|
Q
|
|
"RTN","C0XF2N",171,0)
|
|
;
|
|
"RTN","C0XF2N",172,0)
|
|
WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL
|
|
"RTN","C0XF2N",173,0)
|
|
; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING
|
|
"RTN","C0XF2N",174,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XF2N",175,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XF2N",176,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XF2N",177,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XF2N",178,0)
|
|
N ZIEN
|
|
"RTN","C0XF2N",179,0)
|
|
S ZIEN=$$IENOF(ZNAME)
|
|
"RTN","C0XF2N",180,0)
|
|
Q $NA(@C0XSN@(ZIEN,1))
|
|
"RTN","C0XF2N",181,0)
|
|
;
|
|
"RTN","C0XF2N",182,0)
|
|
FILEREAD(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH
|
|
"RTN","C0XF2N",183,0)
|
|
; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT
|
|
"RTN","C0XF2N",184,0)
|
|
; IE ^TMP("C0X","FILEIN",1)
|
|
"RTN","C0XF2N",185,0)
|
|
; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1
|
|
"RTN","C0XF2N",186,0)
|
|
; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH
|
|
"RTN","C0XF2N",187,0)
|
|
S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL)
|
|
"RTN","C0XF2N",188,0)
|
|
Q OK
|
|
"RTN","C0XF2N",189,0)
|
|
;
|
|
"RTN","C0XF2N",190,0)
|
|
TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE
|
|
"RTN","C0XF2N",191,0)
|
|
S ZIN=$NA(^TMP("C0X",12226,"FILEIN"))
|
|
"RTN","C0XF2N",192,0)
|
|
S ZGRAPH="/test/rdfFile"
|
|
"RTN","C0XF2N",193,0)
|
|
S ZM="/test/rdfFile/meta"
|
|
"RTN","C0XF2N",194,0)
|
|
D PROCESS(.G,ZIN,ZGRAPH,ZM)
|
|
"RTN","C0XF2N",195,0)
|
|
Q
|
|
"RTN","C0XF2N",196,0)
|
|
;
|
|
"RTN","C0XF2N",197,0)
|
|
PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE
|
|
"RTN","C0XF2N",198,0)
|
|
; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING
|
|
"RTN","C0XF2N",199,0)
|
|
; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE
|
|
"RTN","C0XF2N",200,0)
|
|
; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS
|
|
"RTN","C0XF2N",201,0)
|
|
; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA
|
|
"RTN","C0XF2N",202,0)
|
|
;
|
|
"RTN","C0XF2N",203,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XF2N",204,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XF2N",205,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XF2N",206,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XF2N",207,0)
|
|
; -- first parse the rdf file with the MXML parser
|
|
"RTN","C0XF2N",208,0)
|
|
;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML
|
|
"RTN","C0XF2N",209,0)
|
|
S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W")
|
|
"RTN","C0XF2N",210,0)
|
|
; -- assign the MXLM dom global name to ZDOM
|
|
"RTN","C0XF2N",211,0)
|
|
S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID))
|
|
"RTN","C0XF2N",212,0)
|
|
W !,$O(@ZDOM@(""),-1)," XML NODES PARSED"
|
|
"RTN","C0XF2N",213,0)
|
|
; -- populate the metagraph to point to the graph with status unfinished
|
|
"RTN","C0XF2N",214,0)
|
|
S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT
|
|
"RTN","C0XF2N",215,0)
|
|
I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH
|
|
"RTN","C0XF2N",216,0)
|
|
D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH
|
|
"RTN","C0XF2N",217,0)
|
|
D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished
|
|
"RTN","C0XF2N",218,0)
|
|
;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT")
|
|
"RTN","C0XF2N",219,0)
|
|
S C0XDATE=$$NOW^XLFDT
|
|
"RTN","C0XF2N",220,0)
|
|
D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY)
|
|
"RTN","C0XF2N",221,0)
|
|
D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store
|
|
"RTN","C0XF2N",222,0)
|
|
; --
|
|
"RTN","C0XF2N",223,0)
|
|
; -- pull out the vocabularies in the RDF statement. marked with xmlns:
|
|
"RTN","C0XF2N",224,0)
|
|
; -- put them in a local variable for quick reference
|
|
"RTN","C0XF2N",225,0)
|
|
; -- TODO: create a graph for vocabularies and validate incoming against it
|
|
"RTN","C0XF2N",226,0)
|
|
;
|
|
"RTN","C0XF2N",227,0)
|
|
S C0XVOC=""
|
|
"RTN","C0XF2N",228,0)
|
|
N ZI,ZJ,ZK S ZI=""
|
|
"RTN","C0XF2N",229,0)
|
|
F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns
|
|
"RTN","C0XF2N",230,0)
|
|
. S ZVOC=$P(ZI,"xmlns:",2)
|
|
"RTN","C0XF2N",231,0)
|
|
. I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI))
|
|
"RTN","C0XF2N",232,0)
|
|
;W !,"VOCABS:" ZWR C0XVOC
|
|
"RTN","C0XF2N",233,0)
|
|
;
|
|
"RTN","C0XF2N",234,0)
|
|
; -- look for children called rdf:Description. quit if none. not an rdf file
|
|
"RTN","C0XF2N",235,0)
|
|
;
|
|
"RTN","C0XF2N",236,0)
|
|
S ZI=$O(@ZDOM@(1,"C",""))
|
|
"RTN","C0XF2N",237,0)
|
|
I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file
|
|
"RTN","C0XF2N",238,0)
|
|
. W !,"Error. Not an RDF file. Cannot process."
|
|
"RTN","C0XF2N",239,0)
|
|
;
|
|
"RTN","C0XF2N",240,0)
|
|
; -- now process the rdf description children
|
|
"RTN","C0XF2N",241,0)
|
|
;
|
|
"RTN","C0XF2N",242,0)
|
|
S ZI=""
|
|
"RTN","C0XF2N",243,0)
|
|
S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate
|
|
"RTN","C0XF2N",244,0)
|
|
F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ;
|
|
"RTN","C0XF2N",245,0)
|
|
. ; -- we are skipping any child that is not rdf:Description
|
|
"RTN","C0XF2N",246,0)
|
|
. ; -- TODO: check to see if this is right in general
|
|
"RTN","C0XF2N",247,0)
|
|
. ;
|
|
"RTN","C0XF2N",248,0)
|
|
. IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ;
|
|
"RTN","C0XF2N",249,0)
|
|
. . W !,"SKIPPING NODE: ",ZI
|
|
"RTN","C0XF2N",250,0)
|
|
. ; -- now looking for the subject for the triples
|
|
"RTN","C0XF2N",251,0)
|
|
. S ZX=$G(@ZDOM@(ZI,"A","rdf:about"))
|
|
"RTN","C0XF2N",252,0)
|
|
. I ZX'="" D ; we have the subject
|
|
"RTN","C0XF2N",253,0)
|
|
. . ;W " about: ",ZX
|
|
"RTN","C0XF2N",254,0)
|
|
. . S C0XSUB=ZX
|
|
"RTN","C0XF2N",255,0)
|
|
. E D ;
|
|
"RTN","C0XF2N",256,0)
|
|
. . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject
|
|
"RTN","C0XF2N",257,0)
|
|
. . I ZX'="" D ;
|
|
"RTN","C0XF2N",258,0)
|
|
. . . S C0XSUB=ZX
|
|
"RTN","C0XF2N",259,0)
|
|
. I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT
|
|
"RTN","C0XF2N",260,0)
|
|
. ;
|
|
"RTN","C0XF2N",261,0)
|
|
. ; -- we now have the subject. the children of this node have the rest
|
|
"RTN","C0XF2N",262,0)
|
|
. ;
|
|
"RTN","C0XF2N",263,0)
|
|
. S ZJ="" ; for the children of the rdf:Description nodes
|
|
"RTN","C0XF2N",264,0)
|
|
. F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child
|
|
"RTN","C0XF2N",265,0)
|
|
. . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix
|
|
"RTN","C0XF2N",266,0)
|
|
. . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space
|
|
"RTN","C0XF2N",267,0)
|
|
. . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix
|
|
"RTN","C0XF2N",268,0)
|
|
. . I C0XPRE[":" D ; expand using vocabulary
|
|
"RTN","C0XF2N",269,0)
|
|
. . . N ZB,ZA
|
|
"RTN","C0XF2N",270,0)
|
|
. . . S ZB=$P(C0XPRE,":",1)
|
|
"RTN","C0XF2N",271,0)
|
|
. . . S ZA=$P(C0XPRE,":",2)
|
|
"RTN","C0XF2N",272,0)
|
|
. . . I $G(C0XVOC(ZB))'="" D ;
|
|
"RTN","C0XF2N",273,0)
|
|
. . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded
|
|
"RTN","C0XF2N",274,0)
|
|
. . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object
|
|
"RTN","C0XF2N",275,0)
|
|
. . I ZY'="" D Q ;
|
|
"RTN","C0XF2N",276,0)
|
|
. . . S C0XOBJ=ZY ; object
|
|
"RTN","C0XF2N",277,0)
|
|
. . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple
|
|
"RTN","C0XF2N",278,0)
|
|
. . ; -- this is an else because of the quit above
|
|
"RTN","C0XF2N",279,0)
|
|
. . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object
|
|
"RTN","C0XF2N",280,0)
|
|
. . I ZX'="" D Q ; got one
|
|
"RTN","C0XF2N",281,0)
|
|
. . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject
|
|
"RTN","C0XF2N",282,0)
|
|
. . . ; without change... this could be foolish .. look at it again later
|
|
"RTN","C0XF2N",283,0)
|
|
. . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
|
|
"RTN","C0XF2N",284,0)
|
|
. . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here
|
|
"RTN","C0XF2N",285,0)
|
|
. . I C0XOBJ="" D Q ; not a happy situation
|
|
"RTN","C0XF2N",286,0)
|
|
. . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ
|
|
"RTN","C0XF2N",287,0)
|
|
. . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
|
|
"RTN","C0XF2N",288,0)
|
|
W !,"INSERTING ",C0XCNT," TRIPLES"
|
|
"RTN","C0XF2N",289,0)
|
|
D UPDIE(.C0XFDA) ; commit the updates to the file
|
|
"RTN","C0XF2N",290,0)
|
|
; next, mark the graph as finished
|
|
"RTN","C0XF2N",291,0)
|
|
S C0XEND=$$NOW^XLFDT
|
|
"RTN","C0XF2N",292,0)
|
|
W !," ENDED AT: ",C0XEND
|
|
"RTN","C0XF2N",293,0)
|
|
S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2)
|
|
"RTN","C0XF2N",294,0)
|
|
W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
|
|
"RTN","C0XF2N",295,0)
|
|
I C0XDIFF'=0 D ;
|
|
"RTN","C0XF2N",296,0)
|
|
. W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
|
|
"RTN","C0XF2N",297,0)
|
|
Q
|
|
"RTN","C0XF2N",298,0)
|
|
;
|
|
"RTN","C0XF2N",299,0)
|
|
PROCESS2(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE
|
|
"RTN","C0XF2N",300,0)
|
|
; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING
|
|
"RTN","C0XF2N",301,0)
|
|
; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE
|
|
"RTN","C0XF2N",302,0)
|
|
; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS
|
|
"RTN","C0XF2N",303,0)
|
|
; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA
|
|
"RTN","C0XF2N",304,0)
|
|
;
|
|
"RTN","C0XF2N",305,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XF2N",306,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XF2N",307,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XF2N",308,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XF2N",309,0)
|
|
;N BATCNT
|
|
"RTN","C0XF2N",310,0)
|
|
;N BATMAX
|
|
"RTN","C0XF2N",311,0)
|
|
S BATCNT=0 ; BATCH COUNTER
|
|
"RTN","C0XF2N",312,0)
|
|
S BATMAX=10000 ; TRY BATCHES OF THIS SIZE
|
|
"RTN","C0XF2N",313,0)
|
|
; -- first parse the rdf file with the MXML parser
|
|
"RTN","C0XF2N",314,0)
|
|
;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML
|
|
"RTN","C0XF2N",315,0)
|
|
S C0XDLC2=$$NOW^XLFDT ; START OF PARSE
|
|
"RTN","C0XF2N",316,0)
|
|
S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W")
|
|
"RTN","C0XF2N",317,0)
|
|
; -- assign the MXLM dom global name to ZDOM
|
|
"RTN","C0XF2N",318,0)
|
|
S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID))
|
|
"RTN","C0XF2N",319,0)
|
|
S C0XNODE=$O(@ZDOM@(""),-1)
|
|
"RTN","C0XF2N",320,0)
|
|
W !,C0XNODE," XML NODES PARSED"
|
|
"RTN","C0XF2N",321,0)
|
|
S C0XPRS=$$NOW^XLFDT ; PARSE COMPLETE
|
|
"RTN","C0XF2N",322,0)
|
|
W !,"PARSE COMPLETE AT ",C0XPRS
|
|
"RTN","C0XF2N",323,0)
|
|
S C0XDIFF=$$FMDIFF^XLFDT(C0XPRS,C0XDLC2,2)
|
|
"RTN","C0XF2N",324,0)
|
|
W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
|
|
"RTN","C0XF2N",325,0)
|
|
I C0XDIFF'=0 D ;
|
|
"RTN","C0XF2N",326,0)
|
|
. W !," APPROXIMATELY ",$P(C0XNODE/C0XDIFF,".")," NODES PER SECOND"
|
|
"RTN","C0XF2N",327,0)
|
|
; -- populate the metagraph to point to the graph with status unfinished
|
|
"RTN","C0XF2N",328,0)
|
|
S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT
|
|
"RTN","C0XF2N",329,0)
|
|
I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH
|
|
"RTN","C0XF2N",330,0)
|
|
D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH
|
|
"RTN","C0XF2N",331,0)
|
|
D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished
|
|
"RTN","C0XF2N",332,0)
|
|
;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT")
|
|
"RTN","C0XF2N",333,0)
|
|
S C0XDATE=$$NOW^XLFDT
|
|
"RTN","C0XF2N",334,0)
|
|
D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY)
|
|
"RTN","C0XF2N",335,0)
|
|
D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store
|
|
"RTN","C0XF2N",336,0)
|
|
; --
|
|
"RTN","C0XF2N",337,0)
|
|
; -- pull out the vocabularies in the RDF statement. marked with xmlns:
|
|
"RTN","C0XF2N",338,0)
|
|
; -- put them in a local variable for quick reference
|
|
"RTN","C0XF2N",339,0)
|
|
; -- TODO: create a graph for vocabularies and validate incoming against it
|
|
"RTN","C0XF2N",340,0)
|
|
;
|
|
"RTN","C0XF2N",341,0)
|
|
S C0XVOC=""
|
|
"RTN","C0XF2N",342,0)
|
|
N ZI,ZJ,ZK S ZI=""
|
|
"RTN","C0XF2N",343,0)
|
|
F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns
|
|
"RTN","C0XF2N",344,0)
|
|
. S ZVOC=$P(ZI,"xmlns:",2)
|
|
"RTN","C0XF2N",345,0)
|
|
. I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI))
|
|
"RTN","C0XF2N",346,0)
|
|
;W !,"VOCABS:" ZWR C0XVOC
|
|
"RTN","C0XF2N",347,0)
|
|
;
|
|
"RTN","C0XF2N",348,0)
|
|
; -- look for children called rdf:Description. quit if none. not an rdf file
|
|
"RTN","C0XF2N",349,0)
|
|
;
|
|
"RTN","C0XF2N",350,0)
|
|
S ZI=$O(@ZDOM@(1,"C",""))
|
|
"RTN","C0XF2N",351,0)
|
|
I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file
|
|
"RTN","C0XF2N",352,0)
|
|
. W !,"Error. Not an RDF file. Cannot process."
|
|
"RTN","C0XF2N",353,0)
|
|
;
|
|
"RTN","C0XF2N",354,0)
|
|
; -- now process the rdf description children
|
|
"RTN","C0XF2N",355,0)
|
|
;
|
|
"RTN","C0XF2N",356,0)
|
|
S ZI=""
|
|
"RTN","C0XF2N",357,0)
|
|
S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate
|
|
"RTN","C0XF2N",358,0)
|
|
F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ;
|
|
"RTN","C0XF2N",359,0)
|
|
. ; -- we are skipping any child that is not rdf:Description
|
|
"RTN","C0XF2N",360,0)
|
|
. ; -- TODO: check to see if this is right in general
|
|
"RTN","C0XF2N",361,0)
|
|
. ;
|
|
"RTN","C0XF2N",362,0)
|
|
. IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ;
|
|
"RTN","C0XF2N",363,0)
|
|
. . W !,"SKIPPING NODE: ",ZI
|
|
"RTN","C0XF2N",364,0)
|
|
. ; -- now looking for the subject for the triples
|
|
"RTN","C0XF2N",365,0)
|
|
. S ZX=$G(@ZDOM@(ZI,"A","rdf:about"))
|
|
"RTN","C0XF2N",366,0)
|
|
. I ZX'="" D ; we have the subject
|
|
"RTN","C0XF2N",367,0)
|
|
. . ;W " about: ",ZX
|
|
"RTN","C0XF2N",368,0)
|
|
. . S C0XSUB=ZX
|
|
"RTN","C0XF2N",369,0)
|
|
. E D ;
|
|
"RTN","C0XF2N",370,0)
|
|
. . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject
|
|
"RTN","C0XF2N",371,0)
|
|
. . I ZX'="" D ;
|
|
"RTN","C0XF2N",372,0)
|
|
. . . S C0XSUB=ZX
|
|
"RTN","C0XF2N",373,0)
|
|
. I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT
|
|
"RTN","C0XF2N",374,0)
|
|
. ;
|
|
"RTN","C0XF2N",375,0)
|
|
. ; -- we now have the subject. the children of this node have the rest
|
|
"RTN","C0XF2N",376,0)
|
|
. ;
|
|
"RTN","C0XF2N",377,0)
|
|
. S ZJ="" ; for the children of the rdf:Description nodes
|
|
"RTN","C0XF2N",378,0)
|
|
. F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child
|
|
"RTN","C0XF2N",379,0)
|
|
. . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix
|
|
"RTN","C0XF2N",380,0)
|
|
. . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space
|
|
"RTN","C0XF2N",381,0)
|
|
. . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix
|
|
"RTN","C0XF2N",382,0)
|
|
. . I C0XPRE[":" D ; expand using vocabulary
|
|
"RTN","C0XF2N",383,0)
|
|
. . . N ZB,ZA
|
|
"RTN","C0XF2N",384,0)
|
|
. . . S ZB=$P(C0XPRE,":",1)
|
|
"RTN","C0XF2N",385,0)
|
|
. . . S ZA=$P(C0XPRE,":",2)
|
|
"RTN","C0XF2N",386,0)
|
|
. . . I $G(C0XVOC(ZB))'="" D ;
|
|
"RTN","C0XF2N",387,0)
|
|
. . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded
|
|
"RTN","C0XF2N",388,0)
|
|
. . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object
|
|
"RTN","C0XF2N",389,0)
|
|
. . I ZY'="" D Q ;
|
|
"RTN","C0XF2N",390,0)
|
|
. . . S C0XOBJ=ZY ; object
|
|
"RTN","C0XF2N",391,0)
|
|
. . . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple
|
|
"RTN","C0XF2N",392,0)
|
|
. . ; -- this is an else because of the quit above
|
|
"RTN","C0XF2N",393,0)
|
|
. . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object
|
|
"RTN","C0XF2N",394,0)
|
|
. . I ZX'="" D Q ; got one
|
|
"RTN","C0XF2N",395,0)
|
|
. . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject
|
|
"RTN","C0XF2N",396,0)
|
|
. . . ; without change... this could be foolish .. look at it again later
|
|
"RTN","C0XF2N",397,0)
|
|
. . . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
|
|
"RTN","C0XF2N",398,0)
|
|
. . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here
|
|
"RTN","C0XF2N",399,0)
|
|
. . I C0XOBJ="" D Q ; not a happy situation
|
|
"RTN","C0XF2N",400,0)
|
|
. . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ
|
|
"RTN","C0XF2N",401,0)
|
|
. . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
|
|
"RTN","C0XF2N",402,0)
|
|
S C0XTRP=$$NOW^XLFDT ; PARSE COMPLETE
|
|
"RTN","C0XF2N",403,0)
|
|
W !,"TRIPLES COMPLETE AT ",C0XTRP
|
|
"RTN","C0XF2N",404,0)
|
|
S C0XDIFF=$$FMDIFF^XLFDT(C0XTRP,C0XPRS,2)
|
|
"RTN","C0XF2N",405,0)
|
|
W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
|
|
"RTN","C0XF2N",406,0)
|
|
I C0XDIFF'=0 D ;
|
|
"RTN","C0XF2N",407,0)
|
|
. W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
|
|
"RTN","C0XF2N",408,0)
|
|
W !,"INSERTING ",C0XCNT," TRIPLES"
|
|
"RTN","C0XF2N",409,0)
|
|
I $D(C0XFDA) D UPDIE(.C0XFDA) ; commit the updates to the file
|
|
"RTN","C0XF2N",410,0)
|
|
; next, mark the graph as finished
|
|
"RTN","C0XF2N",411,0)
|
|
S C0XINS=$$NOW^XLFDT ; PARSE COMPLETE
|
|
"RTN","C0XF2N",412,0)
|
|
W !,"INSERTION COMPLETE AT ",C0XPRS
|
|
"RTN","C0XF2N",413,0)
|
|
S C0XDIFF=$$FMDIFF^XLFDT(C0XINS,C0XTRP,2)
|
|
"RTN","C0XF2N",414,0)
|
|
W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
|
|
"RTN","C0XF2N",415,0)
|
|
W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," NODES PER SECOND"
|
|
"RTN","C0XF2N",416,0)
|
|
S C0XEND=$$NOW^XLFDT
|
|
"RTN","C0XF2N",417,0)
|
|
W !," ENDED AT: ",C0XEND
|
|
"RTN","C0XF2N",418,0)
|
|
S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2)
|
|
"RTN","C0XF2N",419,0)
|
|
W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
|
|
"RTN","C0XF2N",420,0)
|
|
W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
|
|
"RTN","C0XF2N",421,0)
|
|
Q
|
|
"RTN","C0XF2N",422,0)
|
|
;
|
|
"RTN","C0XF2N",423,0)
|
|
SHOW(ZN) ;
|
|
"RTN","C0XF2N",424,0)
|
|
ZWR ^TMP("MXMLDOM",$J,1,ZN,*)
|
|
"RTN","C0XF2N",425,0)
|
|
Q
|
|
"RTN","C0XF2N",426,0)
|
|
;
|
|
"RTN","C0XF2N",427,0)
|
|
ANONS() ; RETURNS AN ANONOMOUS SUBJECT
|
|
"RTN","C0XF2N",428,0)
|
|
Q "_S:"_$$LKY9
|
|
"RTN","C0XF2N",429,0)
|
|
;
|
|
"RTN","C0XF2N",430,0)
|
|
NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED
|
|
"RTN","C0XF2N",431,0)
|
|
; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT
|
|
"RTN","C0XF2N",432,0)
|
|
; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN
|
|
"RTN","C0XF2N",433,0)
|
|
S NGRAPH="G"_$$LKY9
|
|
"RTN","C0XF2N",434,0)
|
|
S NMETA=NGRAPH_"A"
|
|
"RTN","C0XF2N",435,0)
|
|
Q
|
|
"RTN","C0XF2N",436,0)
|
|
;
|
|
"RTN","C0XF2N",437,0)
|
|
ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT
|
|
"RTN","C0XF2N",438,0)
|
|
; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE
|
|
"RTN","C0XF2N",439,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XF2N",440,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XF2N",441,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XF2N",442,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XF2N",443,0)
|
|
I '$D(C0XCNT) S C0XCNT=0
|
|
"RTN","C0XF2N",444,0)
|
|
N ZNODE
|
|
"RTN","C0XF2N",445,0)
|
|
S ZNODE="N"_$$LKY17
|
|
"RTN","C0XF2N",446,0)
|
|
N ZNARY ; GET READY TO CALL IENOFA
|
|
"RTN","C0XF2N",447,0)
|
|
S ZNARY("ZG",ZG)=""
|
|
"RTN","C0XF2N",448,0)
|
|
S ZNARY("ZS",ZS)=""
|
|
"RTN","C0XF2N",449,0)
|
|
S ZNARY("ZP",ZP)=""
|
|
"RTN","C0XF2N",450,0)
|
|
S ZNARY("ZO",ZO)=""
|
|
"RTN","C0XF2N",451,0)
|
|
D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS
|
|
"RTN","C0XF2N",452,0)
|
|
;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN
|
|
"RTN","C0XF2N",453,0)
|
|
;S ZSIEN=$$IENOF(ZS)
|
|
"RTN","C0XF2N",454,0)
|
|
;S ZPIEN=$$IENOF(ZP)
|
|
"RTN","C0XF2N",455,0)
|
|
;S ZOIEN=$$IENOF(ZO)
|
|
"RTN","C0XF2N",456,0)
|
|
;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED
|
|
"RTN","C0XF2N",457,0)
|
|
S C0XCNT=C0XCNT+1
|
|
"RTN","C0XF2N",458,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE
|
|
"RTN","C0XF2N",459,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG",""))
|
|
"RTN","C0XF2N",460,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS",""))
|
|
"RTN","C0XF2N",461,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP",""))
|
|
"RTN","C0XF2N",462,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO",""))
|
|
"RTN","C0XF2N",463,0)
|
|
; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE
|
|
"RTN","C0XF2N",464,0)
|
|
Q
|
|
"RTN","C0XF2N",465,0)
|
|
;
|
|
"RTN","C0XF2N",466,0)
|
|
ADD2(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT
|
|
"RTN","C0XF2N",467,0)
|
|
; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE
|
|
"RTN","C0XF2N",468,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XF2N",469,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XF2N",470,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XF2N",471,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XF2N",472,0)
|
|
I '$D(C0XCNT) S C0XCNT=0
|
|
"RTN","C0XF2N",473,0)
|
|
N ZNODE
|
|
"RTN","C0XF2N",474,0)
|
|
S ZNODE="N"_$$LKY17
|
|
"RTN","C0XF2N",475,0)
|
|
N ZNARY ; GET READY TO CALL IENOFA
|
|
"RTN","C0XF2N",476,0)
|
|
S ZNARY("ZG",ZG)=""
|
|
"RTN","C0XF2N",477,0)
|
|
S ZNARY("ZS",ZS)=""
|
|
"RTN","C0XF2N",478,0)
|
|
S ZNARY("ZP",ZP)=""
|
|
"RTN","C0XF2N",479,0)
|
|
S ZNARY("ZO",ZO)=""
|
|
"RTN","C0XF2N",480,0)
|
|
D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS
|
|
"RTN","C0XF2N",481,0)
|
|
;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN
|
|
"RTN","C0XF2N",482,0)
|
|
;S ZSIEN=$$IENOF(ZS)
|
|
"RTN","C0XF2N",483,0)
|
|
;S ZPIEN=$$IENOF(ZP)
|
|
"RTN","C0XF2N",484,0)
|
|
;S ZOIEN=$$IENOF(ZO)
|
|
"RTN","C0XF2N",485,0)
|
|
;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED
|
|
"RTN","C0XF2N",486,0)
|
|
S BATCNT=BATCNT+1
|
|
"RTN","C0XF2N",487,0)
|
|
S C0XCNT=C0XCNT+1
|
|
"RTN","C0XF2N",488,0)
|
|
S C0XFDA(C0XTFN,"?+"_BATCNT_",",.01)=ZNODE
|
|
"RTN","C0XF2N",489,0)
|
|
S C0XFDA(C0XTFN,"?+"_BATCNT_",",.02)=$O(ZIENS("IEN","ZG",""))
|
|
"RTN","C0XF2N",490,0)
|
|
S C0XFDA(C0XTFN,"?+"_BATCNT_",",.03)=$O(ZIENS("IEN","ZS",""))
|
|
"RTN","C0XF2N",491,0)
|
|
S C0XFDA(C0XTFN,"?+"_BATCNT_",",.04)=$O(ZIENS("IEN","ZP",""))
|
|
"RTN","C0XF2N",492,0)
|
|
S C0XFDA(C0XTFN,"?+"_BATCNT_",",.05)=$O(ZIENS("IEN","ZO",""))
|
|
"RTN","C0XF2N",493,0)
|
|
I BATCNT=BATMAX D ; BATCH IS DONE
|
|
"RTN","C0XF2N",494,0)
|
|
. D UPDIE(.C0XFDA)
|
|
"RTN","C0XF2N",495,0)
|
|
. K C0XFDA
|
|
"RTN","C0XF2N",496,0)
|
|
. S BATCNT=0 ; RESET COUNTER
|
|
"RTN","C0XF2N",497,0)
|
|
; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE
|
|
"RTN","C0XF2N",498,0)
|
|
Q
|
|
"RTN","C0XF2N",499,0)
|
|
;
|
|
"RTN","C0XF2N",500,0)
|
|
LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
|
|
"RTN","C0XF2N",501,0)
|
|
; UNIQUE NODE AND GRAPH NAMES
|
|
"RTN","C0XF2N",502,0)
|
|
N ZN,ZI
|
|
"RTN","C0XF2N",503,0)
|
|
S ZN=""
|
|
"RTN","C0XF2N",504,0)
|
|
F ZI=1:1:9 D ;
|
|
"RTN","C0XF2N",505,0)
|
|
. S ZN=ZN_$R(10)
|
|
"RTN","C0XF2N",506,0)
|
|
Q ZN
|
|
"RTN","C0XF2N",507,0)
|
|
;
|
|
"RTN","C0XF2N",508,0)
|
|
LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
|
|
"RTN","C0XF2N",509,0)
|
|
; UNIQUE NODE AND GRAPH NAMES
|
|
"RTN","C0XF2N",510,0)
|
|
N ZN,ZI
|
|
"RTN","C0XF2N",511,0)
|
|
S ZN=""
|
|
"RTN","C0XF2N",512,0)
|
|
F ZI=1:1:17 D ;
|
|
"RTN","C0XF2N",513,0)
|
|
. S ZN=ZN_$R(10)
|
|
"RTN","C0XF2N",514,0)
|
|
Q ZN
|
|
"RTN","C0XF2N",515,0)
|
|
;
|
|
"RTN","C0XF2N",516,0)
|
|
IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE
|
|
"RTN","C0XF2N",517,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XF2N",518,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XF2N",519,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XF2N",520,0)
|
|
N ZIEN
|
|
"RTN","C0XF2N",521,0)
|
|
S ZIEN=$O(@C0XSN@("B",ZSTRING,""))
|
|
"RTN","C0XF2N",522,0)
|
|
I ZIEN="" D ;
|
|
"RTN","C0XF2N",523,0)
|
|
. S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING
|
|
"RTN","C0XF2N",524,0)
|
|
. D UPDIE(.C0XFDA2)
|
|
"RTN","C0XF2N",525,0)
|
|
. S ZIEN=$O(@C0XSN@("B",ZSTRING,""))
|
|
"RTN","C0XF2N",526,0)
|
|
. K C0XFDA2
|
|
"RTN","C0XF2N",527,0)
|
|
Q ZIEN
|
|
"RTN","C0XF2N",528,0)
|
|
;
|
|
"RTN","C0XF2N",529,0)
|
|
IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE
|
|
"RTN","C0XF2N",530,0)
|
|
; OR ADD THEM IF
|
|
"RTN","C0XF2N",531,0)
|
|
; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE
|
|
"RTN","C0XF2N",532,0)
|
|
; ZINARY LOOKS LIKE ZINARY("VAR","VAL")=""
|
|
"RTN","C0XF2N",533,0)
|
|
; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)=""
|
|
"RTN","C0XF2N",534,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XF2N",535,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XF2N",536,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XF2N",537,0)
|
|
K ZOUTARY ; START WITH CLEAN RESULTS
|
|
"RTN","C0XF2N",538,0)
|
|
K C0XFDA2 ; USE A SEPARATE FDA FOR THIS
|
|
"RTN","C0XF2N",539,0)
|
|
N ZI S ZI=""
|
|
"RTN","C0XF2N",540,0)
|
|
N ZV,ZIEN
|
|
"RTN","C0XF2N",541,0)
|
|
N ZCNT S ZCNT=0
|
|
"RTN","C0XF2N",542,0)
|
|
F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS
|
|
"RTN","C0XF2N",543,0)
|
|
. S ZV=$O(ZINARY(ZI,""))
|
|
"RTN","C0XF2N",544,0)
|
|
. I $O(@C0XSN@("B",ZV,""))="" D ;
|
|
"RTN","C0XF2N",545,0)
|
|
. . S ZCNT=ZCNT+1
|
|
"RTN","C0XF2N",546,0)
|
|
. . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV
|
|
"RTN","C0XF2N",547,0)
|
|
I $D(C0XFDA2) D ;
|
|
"RTN","C0XF2N",548,0)
|
|
. D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS
|
|
"RTN","C0XF2N",549,0)
|
|
. K C0XFDA2 ; CLEAN UP
|
|
"RTN","C0XF2N",550,0)
|
|
F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS
|
|
"RTN","C0XF2N",551,0)
|
|
. S ZV=$O(ZINARY(ZI,""))
|
|
"RTN","C0XF2N",552,0)
|
|
. S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW
|
|
"RTN","C0XF2N",553,0)
|
|
. I ZIEN="" D ;
|
|
"RTN","C0XF2N",554,0)
|
|
. . W !,"ERROR ADDING STRING: ",ZV
|
|
"RTN","C0XF2N",555,0)
|
|
. . B
|
|
"RTN","C0XF2N",556,0)
|
|
. S ZOUTARY("IEN",ZI,ZIEN)=""
|
|
"RTN","C0XF2N",557,0)
|
|
Q
|
|
"RTN","C0XF2N",558,0)
|
|
;
|
|
"RTN","C0XF2N",559,0)
|
|
UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
|
|
"RTN","C0XF2N",560,0)
|
|
; ZFDA IS PASSED BY REFERENCE
|
|
"RTN","C0XF2N",561,0)
|
|
;ZWR ZFDA
|
|
"RTN","C0XF2N",562,0)
|
|
;B
|
|
"RTN","C0XF2N",563,0)
|
|
K ZERR
|
|
"RTN","C0XF2N",564,0)
|
|
D CLEAN^DILF
|
|
"RTN","C0XF2N",565,0)
|
|
D UPDATE^DIE("","ZFDA","","ZERR")
|
|
"RTN","C0XF2N",566,0)
|
|
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST,
|
|
"RTN","C0XF2N",567,0)
|
|
; INVOKE THE ERROR TRAP IF TASKED
|
|
"RTN","C0XF2N",568,0)
|
|
;. W "ERROR",!
|
|
"RTN","C0XF2N",569,0)
|
|
;. ZWR ZERR
|
|
"RTN","C0XF2N",570,0)
|
|
;. B
|
|
"RTN","C0XF2N",571,0)
|
|
K ZFDA
|
|
"RTN","C0XF2N",572,0)
|
|
Q
|
|
"RTN","C0XF2N",573,0)
|
|
;
|
|
"RTN","C0XMAIN")
|
|
0^1^B261424134
|
|
"RTN","C0XMAIN",1,0)
|
|
C0XMAIN ; GPL - Fileman Triples entry point routine ;10/13/11 17:05
|
|
"RTN","C0XMAIN",2,0)
|
|
;;0.1;C0X;nopatch;noreleasedate;Build 5
|
|
"RTN","C0XMAIN",3,0)
|
|
;Copyright 2011 George Lilly. Licensed under the terms of the GNU
|
|
"RTN","C0XMAIN",4,0)
|
|
;General Public License See attached copy of the License.
|
|
"RTN","C0XMAIN",5,0)
|
|
;
|
|
"RTN","C0XMAIN",6,0)
|
|
;This program is free software; you can redistribute it and/or modify
|
|
"RTN","C0XMAIN",7,0)
|
|
;it under the terms of the GNU General Public License as published by
|
|
"RTN","C0XMAIN",8,0)
|
|
;the Free Software Foundation; either version 2 of the License, or
|
|
"RTN","C0XMAIN",9,0)
|
|
;(at your option) any later version.
|
|
"RTN","C0XMAIN",10,0)
|
|
;
|
|
"RTN","C0XMAIN",11,0)
|
|
;This program is distributed in the hope that it will be useful,
|
|
"RTN","C0XMAIN",12,0)
|
|
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
"RTN","C0XMAIN",13,0)
|
|
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
"RTN","C0XMAIN",14,0)
|
|
;GNU General Public License for more details.
|
|
"RTN","C0XMAIN",15,0)
|
|
;
|
|
"RTN","C0XMAIN",16,0)
|
|
;You should have received a copy of the GNU General Public License along
|
|
"RTN","C0XMAIN",17,0)
|
|
;with this program; if not, write to the Free Software Foundation, Inc.,
|
|
"RTN","C0XMAIN",18,0)
|
|
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
"RTN","C0XMAIN",19,0)
|
|
;
|
|
"RTN","C0XMAIN",20,0)
|
|
Q
|
|
"RTN","C0XMAIN",21,0)
|
|
;
|
|
"RTN","C0XMAIN",22,0)
|
|
INITFARY(ZFARY) ; INITIALIZE FILE NUMBERS AND OTHER USEFUL THINGS
|
|
"RTN","C0XMAIN",23,0)
|
|
; FOR THE DEFAULT TRIPLE STORE. USE OTHER VALUES FOR SUPPORTING ADDITIONAL
|
|
"RTN","C0XMAIN",24,0)
|
|
; TRIPLE STORES
|
|
"RTN","C0XMAIN",25,0)
|
|
S @ZFARY@("C0XTFN")=172.101 ; TRIPLES FILE NUMBER
|
|
"RTN","C0XMAIN",26,0)
|
|
S @ZFARY@("C0XSFN")=172.201 ; TRIPLES STRINGS FILE NUMBER
|
|
"RTN","C0XMAIN",27,0)
|
|
S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME
|
|
"RTN","C0XMAIN",28,0)
|
|
S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME
|
|
"RTN","C0XMAIN",29,0)
|
|
S @ZFARY@("C0XDIR")="/home/glilly/all_smart_patient_data/smart-rdf/"
|
|
"RTN","C0XMAIN",30,0)
|
|
D USEFARY(ZFARY)
|
|
"RTN","C0XMAIN",31,0)
|
|
Q
|
|
"RTN","C0XMAIN",32,0)
|
|
;
|
|
"RTN","C0XMAIN",33,0)
|
|
USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY
|
|
"RTN","C0XMAIN",34,0)
|
|
N ZI S ZI=""
|
|
"RTN","C0XMAIN",35,0)
|
|
F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D
|
|
"RTN","C0XMAIN",36,0)
|
|
. ;N ZX
|
|
"RTN","C0XMAIN",37,0)
|
|
. S ZX="S "_ZI_"="""_@ZFARY@(ZI)_""""
|
|
"RTN","C0XMAIN",38,0)
|
|
. ;W !,ZX
|
|
"RTN","C0XMAIN",39,0)
|
|
. X ZX
|
|
"RTN","C0XMAIN",40,0)
|
|
Q
|
|
"RTN","C0XMAIN",41,0)
|
|
;
|
|
"RTN","C0XMAIN",42,0)
|
|
IMPORT(FNAME,FDIR,FURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD
|
|
"RTN","C0XMAIN",43,0)
|
|
; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE
|
|
"RTN","C0XMAIN",44,0)
|
|
; NODE NAME OF THE TEXT TRIPLE
|
|
"RTN","C0XMAIN",45,0)
|
|
; FDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR)
|
|
"RTN","C0XMAIN",46,0)
|
|
; FURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE
|
|
"RTN","C0XMAIN",47,0)
|
|
; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE
|
|
"RTN","C0XMAIN",48,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XMAIN",49,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XMAIN",50,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XMAIN",51,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XMAIN",52,0)
|
|
N ZD,ZTMP
|
|
"RTN","C0XMAIN",53,0)
|
|
I '$D(FDIR) S FDIR=C0XDIR ; DIRECTORY OF THE RDF FILE
|
|
"RTN","C0XMAIN",54,0)
|
|
I '$D(FURL) D ;
|
|
"RTN","C0XMAIN",55,0)
|
|
. N ZN2 S ZN2=$TR(FNAME,".","_") ; REMOVE THE DOT FROM THE NAME
|
|
"RTN","C0XMAIN",56,0)
|
|
. S FURL=FDIR_ZN2
|
|
"RTN","C0XMAIN",57,0)
|
|
N ZTMP
|
|
"RTN","C0XMAIN",58,0)
|
|
S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE
|
|
"RTN","C0XMAIN",59,0)
|
|
K @ZTMP ; MAKE SURE IT'S CLEAR
|
|
"RTN","C0XMAIN",60,0)
|
|
S C0XSTART=$$NOW^XLFDT
|
|
"RTN","C0XMAIN",61,0)
|
|
W !,"STARTED: ",C0XSTART
|
|
"RTN","C0XMAIN",62,0)
|
|
W !,"READING IN: ",FNAME
|
|
"RTN","C0XMAIN",63,0)
|
|
I '$$FILEIN(ZTMP,FDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS
|
|
"RTN","C0XMAIN",64,0)
|
|
. W !,"ERROR READING FILE: ",FDIR,FNAME
|
|
"RTN","C0XMAIN",65,0)
|
|
S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT
|
|
"RTN","C0XMAIN",66,0)
|
|
W !,$O(@ZRDF@(""),-1)," LINES READ"
|
|
"RTN","C0XMAIN",67,0)
|
|
D INSRDF(ZRDF,FURL,FARY) ; IMPORT AND PROCESS THE RDF
|
|
"RTN","C0XMAIN",68,0)
|
|
Q
|
|
"RTN","C0XMAIN",69,0)
|
|
;
|
|
"RTN","C0XMAIN",70,0)
|
|
WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT
|
|
"RTN","C0XMAIN",71,0)
|
|
;
|
|
"RTN","C0XMAIN",72,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XMAIN",73,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XMAIN",74,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XMAIN",75,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XMAIN",76,0)
|
|
;N ZLOC,ZTMP
|
|
"RTN","C0XMAIN",77,0)
|
|
K ZTMP
|
|
"RTN","C0XMAIN",78,0)
|
|
S ZLOC=$NA(^TMP("C0X","WGET",$J))
|
|
"RTN","C0XMAIN",79,0)
|
|
K @ZLOC
|
|
"RTN","C0XMAIN",80,0)
|
|
S C0XSTART=$$NOW^XLFDT
|
|
"RTN","C0XMAIN",81,0)
|
|
W !,"STARTED: ",C0XSTART
|
|
"RTN","C0XMAIN",82,0)
|
|
W !,"DOWNLOADING: ",ZURL
|
|
"RTN","C0XMAIN",83,0)
|
|
S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP)
|
|
"RTN","C0XMAIN",84,0)
|
|
M @ZLOC=ZTMP
|
|
"RTN","C0XMAIN",85,0)
|
|
S C0XLINES=$O(@ZLOC@(""),-1)
|
|
"RTN","C0XMAIN",86,0)
|
|
W !,C0XLINES," LINES READ"
|
|
"RTN","C0XMAIN",87,0)
|
|
S C0XDLC=$$NOW^XLFDT ; DOWNLOAD COMPLETE
|
|
"RTN","C0XMAIN",88,0)
|
|
W !,"DOWNLOAD COMPLETE AT ",C0XDLC
|
|
"RTN","C0XMAIN",89,0)
|
|
S C0XDIFF=$$FMDIFF^XLFDT(C0XDLC,C0XSTART,2)
|
|
"RTN","C0XMAIN",90,0)
|
|
W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
|
|
"RTN","C0XMAIN",91,0)
|
|
I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XLINES/C0XDIFF,".")," LINES PER SEC"
|
|
"RTN","C0XMAIN",92,0)
|
|
D INSRDF(ZLOC,ZURL,FARY)
|
|
"RTN","C0XMAIN",93,0)
|
|
Q
|
|
"RTN","C0XMAIN",94,0)
|
|
;
|
|
"RTN","C0XMAIN",95,0)
|
|
INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS
|
|
"RTN","C0XMAIN",96,0)
|
|
; ZRDF IS PASSED BY NAME
|
|
"RTN","C0XMAIN",97,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XMAIN",98,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XMAIN",99,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XMAIN",100,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XMAIN",101,0)
|
|
N ZGRAPH,ZSUBJECT
|
|
"RTN","C0XMAIN",102,0)
|
|
S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME
|
|
"RTN","C0XMAIN",103,0)
|
|
S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT
|
|
"RTN","C0XMAIN",104,0)
|
|
D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY)
|
|
"RTN","C0XMAIN",105,0)
|
|
N ZTXTNM
|
|
"RTN","C0XMAIN",106,0)
|
|
S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE
|
|
"RTN","C0XMAIN",107,0)
|
|
D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY)
|
|
"RTN","C0XMAIN",108,0)
|
|
D UPDIE(.C0XFDA) ; TRY IT OUT
|
|
"RTN","C0XMAIN",109,0)
|
|
K C0XCNT ;RESET FOR NEXT TIME
|
|
"RTN","C0XMAIN",110,0)
|
|
D STORETXT(ZRDF,ZTXTNM,FARY)
|
|
"RTN","C0XMAIN",111,0)
|
|
W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM
|
|
"RTN","C0XMAIN",112,0)
|
|
D PROCESS2(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF
|
|
"RTN","C0XMAIN",113,0)
|
|
Q
|
|
"RTN","C0XMAIN",114,0)
|
|
;
|
|
"RTN","C0XMAIN",115,0)
|
|
STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME
|
|
"RTN","C0XMAIN",116,0)
|
|
;
|
|
"RTN","C0XMAIN",117,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XMAIN",118,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XMAIN",119,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XMAIN",120,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XMAIN",121,0)
|
|
N ZIEN
|
|
"RTN","C0XMAIN",122,0)
|
|
S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN
|
|
"RTN","C0XMAIN",123,0)
|
|
D CLEAN^DILF
|
|
"RTN","C0XMAIN",124,0)
|
|
K ZERR
|
|
"RTN","C0XMAIN",125,0)
|
|
D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR")
|
|
"RTN","C0XMAIN",126,0)
|
|
I $D(ZERR) D ;
|
|
"RTN","C0XMAIN",127,0)
|
|
. ZWR ZERR
|
|
"RTN","C0XMAIN",128,0)
|
|
Q
|
|
"RTN","C0XMAIN",129,0)
|
|
;
|
|
"RTN","C0XMAIN",130,0)
|
|
GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT
|
|
"RTN","C0XMAIN",131,0)
|
|
; ZRTN IS PASSED BY REFERENCE
|
|
"RTN","C0XMAIN",132,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XMAIN",133,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XMAIN",134,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XMAIN",135,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XMAIN",136,0)
|
|
N ZIEN
|
|
"RTN","C0XMAIN",137,0)
|
|
S ZIEN=$$IENOF(ZNAME)
|
|
"RTN","C0XMAIN",138,0)
|
|
S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN")
|
|
"RTN","C0XMAIN",139,0)
|
|
Q
|
|
"RTN","C0XMAIN",140,0)
|
|
;
|
|
"RTN","C0XMAIN",141,0)
|
|
WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL
|
|
"RTN","C0XMAIN",142,0)
|
|
; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING
|
|
"RTN","C0XMAIN",143,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XMAIN",144,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XMAIN",145,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XMAIN",146,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XMAIN",147,0)
|
|
N ZIEN
|
|
"RTN","C0XMAIN",148,0)
|
|
S ZIEN=$$IENOF(ZNAME)
|
|
"RTN","C0XMAIN",149,0)
|
|
Q $NA(@C0XSN@(ZIEN,1))
|
|
"RTN","C0XMAIN",150,0)
|
|
;
|
|
"RTN","C0XMAIN",151,0)
|
|
FILEIN(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH
|
|
"RTN","C0XMAIN",152,0)
|
|
; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT
|
|
"RTN","C0XMAIN",153,0)
|
|
; IE ^TMP("C0X","FILEIN",1)
|
|
"RTN","C0XMAIN",154,0)
|
|
; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1
|
|
"RTN","C0XMAIN",155,0)
|
|
; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH
|
|
"RTN","C0XMAIN",156,0)
|
|
S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL)
|
|
"RTN","C0XMAIN",157,0)
|
|
Q OK
|
|
"RTN","C0XMAIN",158,0)
|
|
;
|
|
"RTN","C0XMAIN",159,0)
|
|
TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE
|
|
"RTN","C0XMAIN",160,0)
|
|
S ZIN=$NA(^TMP("C0X",12226,"FILEIN"))
|
|
"RTN","C0XMAIN",161,0)
|
|
S ZGRAPH="/test/rdfFile"
|
|
"RTN","C0XMAIN",162,0)
|
|
S ZM="/test/rdfFile/meta"
|
|
"RTN","C0XMAIN",163,0)
|
|
D PROCESS(.G,ZIN,ZGRAPH,ZM)
|
|
"RTN","C0XMAIN",164,0)
|
|
Q
|
|
"RTN","C0XMAIN",165,0)
|
|
;
|
|
"RTN","C0XMAIN",166,0)
|
|
PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE
|
|
"RTN","C0XMAIN",167,0)
|
|
; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING
|
|
"RTN","C0XMAIN",168,0)
|
|
; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE
|
|
"RTN","C0XMAIN",169,0)
|
|
; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS
|
|
"RTN","C0XMAIN",170,0)
|
|
; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA
|
|
"RTN","C0XMAIN",171,0)
|
|
;
|
|
"RTN","C0XMAIN",172,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XMAIN",173,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XMAIN",174,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XMAIN",175,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XMAIN",176,0)
|
|
; -- first parse the rdf file with the MXML parser
|
|
"RTN","C0XMAIN",177,0)
|
|
;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML
|
|
"RTN","C0XMAIN",178,0)
|
|
S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W")
|
|
"RTN","C0XMAIN",179,0)
|
|
; -- assign the MXLM dom global name to ZDOM
|
|
"RTN","C0XMAIN",180,0)
|
|
S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID))
|
|
"RTN","C0XMAIN",181,0)
|
|
W !,$O(@ZDOM@(""),-1)," XML NODES PARSED"
|
|
"RTN","C0XMAIN",182,0)
|
|
; -- populate the metagraph to point to the graph with status unfinished
|
|
"RTN","C0XMAIN",183,0)
|
|
S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT
|
|
"RTN","C0XMAIN",184,0)
|
|
I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH
|
|
"RTN","C0XMAIN",185,0)
|
|
D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH
|
|
"RTN","C0XMAIN",186,0)
|
|
D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished
|
|
"RTN","C0XMAIN",187,0)
|
|
;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT")
|
|
"RTN","C0XMAIN",188,0)
|
|
S C0XDATE=$$NOW^XLFDT
|
|
"RTN","C0XMAIN",189,0)
|
|
D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY)
|
|
"RTN","C0XMAIN",190,0)
|
|
D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store
|
|
"RTN","C0XMAIN",191,0)
|
|
; --
|
|
"RTN","C0XMAIN",192,0)
|
|
; -- pull out the vocabularies in the RDF statement. marked with xmlns:
|
|
"RTN","C0XMAIN",193,0)
|
|
; -- put them in a local variable for quick reference
|
|
"RTN","C0XMAIN",194,0)
|
|
; -- TODO: create a graph for vocabularies and validate incoming against it
|
|
"RTN","C0XMAIN",195,0)
|
|
;
|
|
"RTN","C0XMAIN",196,0)
|
|
S C0XVOC=""
|
|
"RTN","C0XMAIN",197,0)
|
|
N ZI,ZJ,ZK S ZI=""
|
|
"RTN","C0XMAIN",198,0)
|
|
F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns
|
|
"RTN","C0XMAIN",199,0)
|
|
. S ZVOC=$P(ZI,"xmlns:",2)
|
|
"RTN","C0XMAIN",200,0)
|
|
. I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI))
|
|
"RTN","C0XMAIN",201,0)
|
|
;W !,"VOCABS:" ZWR C0XVOC
|
|
"RTN","C0XMAIN",202,0)
|
|
;
|
|
"RTN","C0XMAIN",203,0)
|
|
; -- look for children called rdf:Description. quit if none. not an rdf file
|
|
"RTN","C0XMAIN",204,0)
|
|
;
|
|
"RTN","C0XMAIN",205,0)
|
|
S ZI=$O(@ZDOM@(1,"C",""))
|
|
"RTN","C0XMAIN",206,0)
|
|
I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file
|
|
"RTN","C0XMAIN",207,0)
|
|
. W !,"Error. Not an RDF file. Cannot process."
|
|
"RTN","C0XMAIN",208,0)
|
|
;
|
|
"RTN","C0XMAIN",209,0)
|
|
; -- now process the rdf description children
|
|
"RTN","C0XMAIN",210,0)
|
|
;
|
|
"RTN","C0XMAIN",211,0)
|
|
S ZI=""
|
|
"RTN","C0XMAIN",212,0)
|
|
S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate
|
|
"RTN","C0XMAIN",213,0)
|
|
F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ;
|
|
"RTN","C0XMAIN",214,0)
|
|
. ; -- we are skipping any child that is not rdf:Description
|
|
"RTN","C0XMAIN",215,0)
|
|
. ; -- TODO: check to see if this is right in general
|
|
"RTN","C0XMAIN",216,0)
|
|
. ;
|
|
"RTN","C0XMAIN",217,0)
|
|
. IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ;
|
|
"RTN","C0XMAIN",218,0)
|
|
. . W !,"SKIPPING NODE: ",ZI
|
|
"RTN","C0XMAIN",219,0)
|
|
. ; -- now looking for the subject for the triples
|
|
"RTN","C0XMAIN",220,0)
|
|
. S ZX=$G(@ZDOM@(ZI,"A","rdf:about"))
|
|
"RTN","C0XMAIN",221,0)
|
|
. I ZX'="" D ; we have the subject
|
|
"RTN","C0XMAIN",222,0)
|
|
. . ;W " about: ",ZX
|
|
"RTN","C0XMAIN",223,0)
|
|
. . S C0XSUB=ZX
|
|
"RTN","C0XMAIN",224,0)
|
|
. E D ;
|
|
"RTN","C0XMAIN",225,0)
|
|
. . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject
|
|
"RTN","C0XMAIN",226,0)
|
|
. . I ZX'="" D ;
|
|
"RTN","C0XMAIN",227,0)
|
|
. . . S C0XSUB=ZX
|
|
"RTN","C0XMAIN",228,0)
|
|
. I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT
|
|
"RTN","C0XMAIN",229,0)
|
|
. ;
|
|
"RTN","C0XMAIN",230,0)
|
|
. ; -- we now have the subject. the children of this node have the rest
|
|
"RTN","C0XMAIN",231,0)
|
|
. ;
|
|
"RTN","C0XMAIN",232,0)
|
|
. S ZJ="" ; for the children of the rdf:Description nodes
|
|
"RTN","C0XMAIN",233,0)
|
|
. F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child
|
|
"RTN","C0XMAIN",234,0)
|
|
. . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix
|
|
"RTN","C0XMAIN",235,0)
|
|
. . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space
|
|
"RTN","C0XMAIN",236,0)
|
|
. . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix
|
|
"RTN","C0XMAIN",237,0)
|
|
. . I C0XPRE[":" D ; expand using vocabulary
|
|
"RTN","C0XMAIN",238,0)
|
|
. . . N ZB,ZA
|
|
"RTN","C0XMAIN",239,0)
|
|
. . . S ZB=$P(C0XPRE,":",1)
|
|
"RTN","C0XMAIN",240,0)
|
|
. . . S ZA=$P(C0XPRE,":",2)
|
|
"RTN","C0XMAIN",241,0)
|
|
. . . I $G(C0XVOC(ZB))'="" D ;
|
|
"RTN","C0XMAIN",242,0)
|
|
. . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded
|
|
"RTN","C0XMAIN",243,0)
|
|
. . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object
|
|
"RTN","C0XMAIN",244,0)
|
|
. . I ZY'="" D Q ;
|
|
"RTN","C0XMAIN",245,0)
|
|
. . . S C0XOBJ=ZY ; object
|
|
"RTN","C0XMAIN",246,0)
|
|
. . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple
|
|
"RTN","C0XMAIN",247,0)
|
|
. . ; -- this is an else because of the quit above
|
|
"RTN","C0XMAIN",248,0)
|
|
. . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object
|
|
"RTN","C0XMAIN",249,0)
|
|
. . I ZX'="" D Q ; got one
|
|
"RTN","C0XMAIN",250,0)
|
|
. . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject
|
|
"RTN","C0XMAIN",251,0)
|
|
. . . ; without change... this could be foolish .. look at it again later
|
|
"RTN","C0XMAIN",252,0)
|
|
. . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
|
|
"RTN","C0XMAIN",253,0)
|
|
. . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here
|
|
"RTN","C0XMAIN",254,0)
|
|
. . I C0XOBJ="" D Q ; not a happy situation
|
|
"RTN","C0XMAIN",255,0)
|
|
. . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ
|
|
"RTN","C0XMAIN",256,0)
|
|
. . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
|
|
"RTN","C0XMAIN",257,0)
|
|
W !,"INSERTING ",C0XCNT," TRIPLES"
|
|
"RTN","C0XMAIN",258,0)
|
|
D UPDIE(.C0XFDA) ; commit the updates to the file
|
|
"RTN","C0XMAIN",259,0)
|
|
; next, mark the graph as finished
|
|
"RTN","C0XMAIN",260,0)
|
|
S C0XEND=$$NOW^XLFDT
|
|
"RTN","C0XMAIN",261,0)
|
|
W !," ENDED AT: ",C0XEND
|
|
"RTN","C0XMAIN",262,0)
|
|
S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2)
|
|
"RTN","C0XMAIN",263,0)
|
|
W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
|
|
"RTN","C0XMAIN",264,0)
|
|
I C0XDIFF'=0 D ;
|
|
"RTN","C0XMAIN",265,0)
|
|
. W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
|
|
"RTN","C0XMAIN",266,0)
|
|
Q
|
|
"RTN","C0XMAIN",267,0)
|
|
;
|
|
"RTN","C0XMAIN",268,0)
|
|
PROCESS2(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE
|
|
"RTN","C0XMAIN",269,0)
|
|
; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING
|
|
"RTN","C0XMAIN",270,0)
|
|
; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE
|
|
"RTN","C0XMAIN",271,0)
|
|
; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS
|
|
"RTN","C0XMAIN",272,0)
|
|
; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA
|
|
"RTN","C0XMAIN",273,0)
|
|
;
|
|
"RTN","C0XMAIN",274,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XMAIN",275,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XMAIN",276,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XMAIN",277,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XMAIN",278,0)
|
|
;N BATCNT
|
|
"RTN","C0XMAIN",279,0)
|
|
;N BATMAX
|
|
"RTN","C0XMAIN",280,0)
|
|
S BATCNT=0 ; BATCH COUNTER
|
|
"RTN","C0XMAIN",281,0)
|
|
S BATMAX=10000 ; TRY BATCHES OF THIS SIZE
|
|
"RTN","C0XMAIN",282,0)
|
|
; -- first parse the rdf file with the MXML parser
|
|
"RTN","C0XMAIN",283,0)
|
|
;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML
|
|
"RTN","C0XMAIN",284,0)
|
|
S C0XDLC2=$$NOW^XLFDT ; START OF PARSE
|
|
"RTN","C0XMAIN",285,0)
|
|
S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W")
|
|
"RTN","C0XMAIN",286,0)
|
|
; -- assign the MXLM dom global name to ZDOM
|
|
"RTN","C0XMAIN",287,0)
|
|
S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID))
|
|
"RTN","C0XMAIN",288,0)
|
|
S C0XNODE=$O(@ZDOM@(""),-1)
|
|
"RTN","C0XMAIN",289,0)
|
|
W !,C0XNODE," XML NODES PARSED"
|
|
"RTN","C0XMAIN",290,0)
|
|
S C0XPRS=$$NOW^XLFDT ; PARSE COMPLETE
|
|
"RTN","C0XMAIN",291,0)
|
|
W !,"PARSE COMPLETE AT ",C0XPRS
|
|
"RTN","C0XMAIN",292,0)
|
|
S C0XDIFF=$$FMDIFF^XLFDT(C0XPRS,C0XDLC2,2)
|
|
"RTN","C0XMAIN",293,0)
|
|
W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
|
|
"RTN","C0XMAIN",294,0)
|
|
I C0XDIFF'=0 D ;
|
|
"RTN","C0XMAIN",295,0)
|
|
. W !," APPROXIMATELY ",$P(C0XNODE/C0XDIFF,".")," NODES PER SECOND"
|
|
"RTN","C0XMAIN",296,0)
|
|
; -- populate the metagraph to point to the graph with status unfinished
|
|
"RTN","C0XMAIN",297,0)
|
|
S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT
|
|
"RTN","C0XMAIN",298,0)
|
|
I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH
|
|
"RTN","C0XMAIN",299,0)
|
|
D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH
|
|
"RTN","C0XMAIN",300,0)
|
|
D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished
|
|
"RTN","C0XMAIN",301,0)
|
|
;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT")
|
|
"RTN","C0XMAIN",302,0)
|
|
S C0XDATE=$$NOW^XLFDT
|
|
"RTN","C0XMAIN",303,0)
|
|
D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY)
|
|
"RTN","C0XMAIN",304,0)
|
|
D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store
|
|
"RTN","C0XMAIN",305,0)
|
|
; --
|
|
"RTN","C0XMAIN",306,0)
|
|
; -- pull out the vocabularies in the RDF statement. marked with xmlns:
|
|
"RTN","C0XMAIN",307,0)
|
|
; -- put them in a local variable for quick reference
|
|
"RTN","C0XMAIN",308,0)
|
|
; -- TODO: create a graph for vocabularies and validate incoming against it
|
|
"RTN","C0XMAIN",309,0)
|
|
;
|
|
"RTN","C0XMAIN",310,0)
|
|
S C0XVOC=""
|
|
"RTN","C0XMAIN",311,0)
|
|
N ZI,ZJ,ZK S ZI=""
|
|
"RTN","C0XMAIN",312,0)
|
|
F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns
|
|
"RTN","C0XMAIN",313,0)
|
|
. S ZVOC=$P(ZI,"xmlns:",2)
|
|
"RTN","C0XMAIN",314,0)
|
|
. I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI))
|
|
"RTN","C0XMAIN",315,0)
|
|
;W !,"VOCABS:" ZWR C0XVOC
|
|
"RTN","C0XMAIN",316,0)
|
|
;
|
|
"RTN","C0XMAIN",317,0)
|
|
; -- look for children called rdf:Description. quit if none. not an rdf file
|
|
"RTN","C0XMAIN",318,0)
|
|
;
|
|
"RTN","C0XMAIN",319,0)
|
|
S ZI=$O(@ZDOM@(1,"C",""))
|
|
"RTN","C0XMAIN",320,0)
|
|
I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file
|
|
"RTN","C0XMAIN",321,0)
|
|
. W !,"Error. Not an RDF file. Cannot process."
|
|
"RTN","C0XMAIN",322,0)
|
|
;
|
|
"RTN","C0XMAIN",323,0)
|
|
; -- now process the rdf description children
|
|
"RTN","C0XMAIN",324,0)
|
|
;
|
|
"RTN","C0XMAIN",325,0)
|
|
S ZI=""
|
|
"RTN","C0XMAIN",326,0)
|
|
S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate
|
|
"RTN","C0XMAIN",327,0)
|
|
F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ;
|
|
"RTN","C0XMAIN",328,0)
|
|
. ; -- we are skipping any child that is not rdf:Description
|
|
"RTN","C0XMAIN",329,0)
|
|
. ; -- TODO: check to see if this is right in general
|
|
"RTN","C0XMAIN",330,0)
|
|
. ;
|
|
"RTN","C0XMAIN",331,0)
|
|
. IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ;
|
|
"RTN","C0XMAIN",332,0)
|
|
. . W !,"SKIPPING NODE: ",ZI
|
|
"RTN","C0XMAIN",333,0)
|
|
. ; -- now looking for the subject for the triples
|
|
"RTN","C0XMAIN",334,0)
|
|
. S ZX=$G(@ZDOM@(ZI,"A","rdf:about"))
|
|
"RTN","C0XMAIN",335,0)
|
|
. I ZX'="" D ; we have the subject
|
|
"RTN","C0XMAIN",336,0)
|
|
. . ;W " about: ",ZX
|
|
"RTN","C0XMAIN",337,0)
|
|
. . S C0XSUB=ZX
|
|
"RTN","C0XMAIN",338,0)
|
|
. E D ;
|
|
"RTN","C0XMAIN",339,0)
|
|
. . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject
|
|
"RTN","C0XMAIN",340,0)
|
|
. . I ZX'="" D ;
|
|
"RTN","C0XMAIN",341,0)
|
|
. . . S C0XSUB=ZX
|
|
"RTN","C0XMAIN",342,0)
|
|
. I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT
|
|
"RTN","C0XMAIN",343,0)
|
|
. ;
|
|
"RTN","C0XMAIN",344,0)
|
|
. ; -- we now have the subject. the children of this node have the rest
|
|
"RTN","C0XMAIN",345,0)
|
|
. ;
|
|
"RTN","C0XMAIN",346,0)
|
|
. S ZJ="" ; for the children of the rdf:Description nodes
|
|
"RTN","C0XMAIN",347,0)
|
|
. F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child
|
|
"RTN","C0XMAIN",348,0)
|
|
. . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix
|
|
"RTN","C0XMAIN",349,0)
|
|
. . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space
|
|
"RTN","C0XMAIN",350,0)
|
|
. . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix
|
|
"RTN","C0XMAIN",351,0)
|
|
. . I C0XPRE[":" D ; expand using vocabulary
|
|
"RTN","C0XMAIN",352,0)
|
|
. . . N ZB,ZA
|
|
"RTN","C0XMAIN",353,0)
|
|
. . . S ZB=$P(C0XPRE,":",1)
|
|
"RTN","C0XMAIN",354,0)
|
|
. . . S ZA=$P(C0XPRE,":",2)
|
|
"RTN","C0XMAIN",355,0)
|
|
. . . I $G(C0XVOC(ZB))'="" D ;
|
|
"RTN","C0XMAIN",356,0)
|
|
. . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded
|
|
"RTN","C0XMAIN",357,0)
|
|
. . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object
|
|
"RTN","C0XMAIN",358,0)
|
|
. . I ZY'="" D Q ;
|
|
"RTN","C0XMAIN",359,0)
|
|
. . . S C0XOBJ=ZY ; object
|
|
"RTN","C0XMAIN",360,0)
|
|
. . . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple
|
|
"RTN","C0XMAIN",361,0)
|
|
. . ; -- this is an else because of the quit above
|
|
"RTN","C0XMAIN",362,0)
|
|
. . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object
|
|
"RTN","C0XMAIN",363,0)
|
|
. . I ZX'="" D Q ; got one
|
|
"RTN","C0XMAIN",364,0)
|
|
. . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject
|
|
"RTN","C0XMAIN",365,0)
|
|
. . . ; without change... this could be foolish .. look at it again later
|
|
"RTN","C0XMAIN",366,0)
|
|
. . . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
|
|
"RTN","C0XMAIN",367,0)
|
|
. . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here
|
|
"RTN","C0XMAIN",368,0)
|
|
. . I C0XOBJ="" D Q ; not a happy situation
|
|
"RTN","C0XMAIN",369,0)
|
|
. . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ
|
|
"RTN","C0XMAIN",370,0)
|
|
. . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node
|
|
"RTN","C0XMAIN",371,0)
|
|
S C0XTRP=$$NOW^XLFDT ; PARSE COMPLETE
|
|
"RTN","C0XMAIN",372,0)
|
|
W !,"TRIPLES COMPLETE AT ",C0XTRP
|
|
"RTN","C0XMAIN",373,0)
|
|
S C0XDIFF=$$FMDIFF^XLFDT(C0XTRP,C0XPRS,2)
|
|
"RTN","C0XMAIN",374,0)
|
|
W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
|
|
"RTN","C0XMAIN",375,0)
|
|
I C0XDIFF'=0 D ;
|
|
"RTN","C0XMAIN",376,0)
|
|
. W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
|
|
"RTN","C0XMAIN",377,0)
|
|
W !,"INSERTING ",C0XCNT," TRIPLES"
|
|
"RTN","C0XMAIN",378,0)
|
|
I $D(C0XFDA) D UPDIE(.C0XFDA) ; commit the updates to the file
|
|
"RTN","C0XMAIN",379,0)
|
|
; next, mark the graph as finished
|
|
"RTN","C0XMAIN",380,0)
|
|
S C0XINS=$$NOW^XLFDT ; PARSE COMPLETE
|
|
"RTN","C0XMAIN",381,0)
|
|
W !,"INSERTION COMPLETE AT ",C0XPRS
|
|
"RTN","C0XMAIN",382,0)
|
|
S C0XDIFF=$$FMDIFF^XLFDT(C0XINS,C0XTRP,2)
|
|
"RTN","C0XMAIN",383,0)
|
|
W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
|
|
"RTN","C0XMAIN",384,0)
|
|
W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," NODES PER SECOND"
|
|
"RTN","C0XMAIN",385,0)
|
|
S C0XEND=$$NOW^XLFDT
|
|
"RTN","C0XMAIN",386,0)
|
|
W !," ENDED AT: ",C0XEND
|
|
"RTN","C0XMAIN",387,0)
|
|
S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2)
|
|
"RTN","C0XMAIN",388,0)
|
|
W !," ELAPSED TIME: ",C0XDIFF," SECONDS"
|
|
"RTN","C0XMAIN",389,0)
|
|
W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND"
|
|
"RTN","C0XMAIN",390,0)
|
|
Q
|
|
"RTN","C0XMAIN",391,0)
|
|
;
|
|
"RTN","C0XMAIN",392,0)
|
|
SHOW(ZN) ;
|
|
"RTN","C0XMAIN",393,0)
|
|
ZWR ^TMP("MXMLDOM",$J,1,ZN,*)
|
|
"RTN","C0XMAIN",394,0)
|
|
Q
|
|
"RTN","C0XMAIN",395,0)
|
|
;
|
|
"RTN","C0XMAIN",396,0)
|
|
ANONS() ; RETURNS AN ANONOMOUS SUBJECT
|
|
"RTN","C0XMAIN",397,0)
|
|
Q "_S:"_$$LKY9
|
|
"RTN","C0XMAIN",398,0)
|
|
;
|
|
"RTN","C0XMAIN",399,0)
|
|
NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED
|
|
"RTN","C0XMAIN",400,0)
|
|
; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT
|
|
"RTN","C0XMAIN",401,0)
|
|
; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN
|
|
"RTN","C0XMAIN",402,0)
|
|
S NGRAPH="G"_$$LKY9
|
|
"RTN","C0XMAIN",403,0)
|
|
S NMETA=NGRAPH_"A"
|
|
"RTN","C0XMAIN",404,0)
|
|
Q
|
|
"RTN","C0XMAIN",405,0)
|
|
;
|
|
"RTN","C0XMAIN",406,0)
|
|
ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT
|
|
"RTN","C0XMAIN",407,0)
|
|
; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE
|
|
"RTN","C0XMAIN",408,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XMAIN",409,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XMAIN",410,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XMAIN",411,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XMAIN",412,0)
|
|
I '$D(C0XCNT) S C0XCNT=0
|
|
"RTN","C0XMAIN",413,0)
|
|
N ZNODE
|
|
"RTN","C0XMAIN",414,0)
|
|
S ZNODE="N"_$$LKY17
|
|
"RTN","C0XMAIN",415,0)
|
|
N ZNARY ; GET READY TO CALL IENOFA
|
|
"RTN","C0XMAIN",416,0)
|
|
S ZNARY("ZG",ZG)=""
|
|
"RTN","C0XMAIN",417,0)
|
|
S ZNARY("ZS",ZS)=""
|
|
"RTN","C0XMAIN",418,0)
|
|
S ZNARY("ZP",ZP)=""
|
|
"RTN","C0XMAIN",419,0)
|
|
S ZNARY("ZO",ZO)=""
|
|
"RTN","C0XMAIN",420,0)
|
|
D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS
|
|
"RTN","C0XMAIN",421,0)
|
|
;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN
|
|
"RTN","C0XMAIN",422,0)
|
|
;S ZSIEN=$$IENOF(ZS)
|
|
"RTN","C0XMAIN",423,0)
|
|
;S ZPIEN=$$IENOF(ZP)
|
|
"RTN","C0XMAIN",424,0)
|
|
;S ZOIEN=$$IENOF(ZO)
|
|
"RTN","C0XMAIN",425,0)
|
|
;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED
|
|
"RTN","C0XMAIN",426,0)
|
|
S C0XCNT=C0XCNT+1
|
|
"RTN","C0XMAIN",427,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE
|
|
"RTN","C0XMAIN",428,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG",""))
|
|
"RTN","C0XMAIN",429,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS",""))
|
|
"RTN","C0XMAIN",430,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP",""))
|
|
"RTN","C0XMAIN",431,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO",""))
|
|
"RTN","C0XMAIN",432,0)
|
|
; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE
|
|
"RTN","C0XMAIN",433,0)
|
|
Q
|
|
"RTN","C0XMAIN",434,0)
|
|
;
|
|
"RTN","C0XMAIN",435,0)
|
|
ADD2(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT
|
|
"RTN","C0XMAIN",436,0)
|
|
; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE
|
|
"RTN","C0XMAIN",437,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XMAIN",438,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XMAIN",439,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XMAIN",440,0)
|
|
D USEFARY(FARY)
|
|
"RTN","C0XMAIN",441,0)
|
|
I '$D(C0XCNT) S C0XCNT=0
|
|
"RTN","C0XMAIN",442,0)
|
|
N ZNODE
|
|
"RTN","C0XMAIN",443,0)
|
|
S ZNODE="N"_$$LKY17
|
|
"RTN","C0XMAIN",444,0)
|
|
N ZNARY ; GET READY TO CALL IENOFA
|
|
"RTN","C0XMAIN",445,0)
|
|
S ZNARY("ZG",ZG)=""
|
|
"RTN","C0XMAIN",446,0)
|
|
S ZNARY("ZS",ZS)=""
|
|
"RTN","C0XMAIN",447,0)
|
|
S ZNARY("ZP",ZP)=""
|
|
"RTN","C0XMAIN",448,0)
|
|
S ZNARY("ZO",ZO)=""
|
|
"RTN","C0XMAIN",449,0)
|
|
D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS
|
|
"RTN","C0XMAIN",450,0)
|
|
;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN
|
|
"RTN","C0XMAIN",451,0)
|
|
;S ZSIEN=$$IENOF(ZS)
|
|
"RTN","C0XMAIN",452,0)
|
|
;S ZPIEN=$$IENOF(ZP)
|
|
"RTN","C0XMAIN",453,0)
|
|
;S ZOIEN=$$IENOF(ZO)
|
|
"RTN","C0XMAIN",454,0)
|
|
;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED
|
|
"RTN","C0XMAIN",455,0)
|
|
S C0XCNT=C0XCNT+1
|
|
"RTN","C0XMAIN",456,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE
|
|
"RTN","C0XMAIN",457,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG",""))
|
|
"RTN","C0XMAIN",458,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS",""))
|
|
"RTN","C0XMAIN",459,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP",""))
|
|
"RTN","C0XMAIN",460,0)
|
|
S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO",""))
|
|
"RTN","C0XMAIN",461,0)
|
|
S BATCNT=BATCNT+1
|
|
"RTN","C0XMAIN",462,0)
|
|
I BATCNT=BATMAX D ; BATCH IS DONE
|
|
"RTN","C0XMAIN",463,0)
|
|
. D UPDIE(.C0XFDA)
|
|
"RTN","C0XMAIN",464,0)
|
|
. K C0XFDA
|
|
"RTN","C0XMAIN",465,0)
|
|
. S BATCNT=0 ; RESET COUNTER
|
|
"RTN","C0XMAIN",466,0)
|
|
; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE
|
|
"RTN","C0XMAIN",467,0)
|
|
Q
|
|
"RTN","C0XMAIN",468,0)
|
|
;
|
|
"RTN","C0XMAIN",469,0)
|
|
LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
|
|
"RTN","C0XMAIN",470,0)
|
|
; UNIQUE NODE AND GRAPH NAMES
|
|
"RTN","C0XMAIN",471,0)
|
|
N ZN,ZI
|
|
"RTN","C0XMAIN",472,0)
|
|
S ZN=""
|
|
"RTN","C0XMAIN",473,0)
|
|
F ZI=1:1:9 D ;
|
|
"RTN","C0XMAIN",474,0)
|
|
. S ZN=ZN_$R(10)
|
|
"RTN","C0XMAIN",475,0)
|
|
Q ZN
|
|
"RTN","C0XMAIN",476,0)
|
|
;
|
|
"RTN","C0XMAIN",477,0)
|
|
LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
|
|
"RTN","C0XMAIN",478,0)
|
|
; UNIQUE NODE AND GRAPH NAMES
|
|
"RTN","C0XMAIN",479,0)
|
|
N ZN,ZI
|
|
"RTN","C0XMAIN",480,0)
|
|
S ZN=""
|
|
"RTN","C0XMAIN",481,0)
|
|
F ZI=1:1:17 D ;
|
|
"RTN","C0XMAIN",482,0)
|
|
. S ZN=ZN_$R(10)
|
|
"RTN","C0XMAIN",483,0)
|
|
Q ZN
|
|
"RTN","C0XMAIN",484,0)
|
|
;
|
|
"RTN","C0XMAIN",485,0)
|
|
IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE
|
|
"RTN","C0XMAIN",486,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XMAIN",487,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XMAIN",488,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XMAIN",489,0)
|
|
N ZIEN
|
|
"RTN","C0XMAIN",490,0)
|
|
S ZIEN=$O(@C0XSN@("B",ZSTRING,""))
|
|
"RTN","C0XMAIN",491,0)
|
|
I ZIEN="" D ;
|
|
"RTN","C0XMAIN",492,0)
|
|
. S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING
|
|
"RTN","C0XMAIN",493,0)
|
|
. D UPDIE(.C0XFDA2)
|
|
"RTN","C0XMAIN",494,0)
|
|
. S ZIEN=$O(@C0XSN@("B",ZSTRING,""))
|
|
"RTN","C0XMAIN",495,0)
|
|
. K C0XFDA2
|
|
"RTN","C0XMAIN",496,0)
|
|
Q ZIEN
|
|
"RTN","C0XMAIN",497,0)
|
|
;
|
|
"RTN","C0XMAIN",498,0)
|
|
IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE
|
|
"RTN","C0XMAIN",499,0)
|
|
; OR ADD THEM IF
|
|
"RTN","C0XMAIN",500,0)
|
|
; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE
|
|
"RTN","C0XMAIN",501,0)
|
|
; ZINARY LOOKS LIKE ZINARY("VAR","VAL")=""
|
|
"RTN","C0XMAIN",502,0)
|
|
; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)=""
|
|
"RTN","C0XMAIN",503,0)
|
|
I '$D(FARY) D ;
|
|
"RTN","C0XMAIN",504,0)
|
|
. D INITFARY("C0XFARY")
|
|
"RTN","C0XMAIN",505,0)
|
|
. S FARY="C0XFARY"
|
|
"RTN","C0XMAIN",506,0)
|
|
K ZOUTARY ; START WITH CLEAN RESULTS
|
|
"RTN","C0XMAIN",507,0)
|
|
K C0XFDA2 ; USE A SEPARATE FDA FOR THIS
|
|
"RTN","C0XMAIN",508,0)
|
|
N ZI S ZI=""
|
|
"RTN","C0XMAIN",509,0)
|
|
N ZV,ZIEN
|
|
"RTN","C0XMAIN",510,0)
|
|
N ZCNT S ZCNT=0
|
|
"RTN","C0XMAIN",511,0)
|
|
F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS
|
|
"RTN","C0XMAIN",512,0)
|
|
. S ZV=$O(ZINARY(ZI,""))
|
|
"RTN","C0XMAIN",513,0)
|
|
. I $O(@C0XSN@("B",ZV,""))="" D ;
|
|
"RTN","C0XMAIN",514,0)
|
|
. . S ZCNT=ZCNT+1
|
|
"RTN","C0XMAIN",515,0)
|
|
. . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV
|
|
"RTN","C0XMAIN",516,0)
|
|
I $D(C0XFDA2) D ;
|
|
"RTN","C0XMAIN",517,0)
|
|
. D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS
|
|
"RTN","C0XMAIN",518,0)
|
|
. K C0XFDA2 ; CLEAN UP
|
|
"RTN","C0XMAIN",519,0)
|
|
F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS
|
|
"RTN","C0XMAIN",520,0)
|
|
. S ZV=$O(ZINARY(ZI,""))
|
|
"RTN","C0XMAIN",521,0)
|
|
. S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW
|
|
"RTN","C0XMAIN",522,0)
|
|
. I ZIEN="" D ;
|
|
"RTN","C0XMAIN",523,0)
|
|
. . W !,"ERROR ADDING STRING: ",ZV
|
|
"RTN","C0XMAIN",524,0)
|
|
. . B
|
|
"RTN","C0XMAIN",525,0)
|
|
. S ZOUTARY("IEN",ZI,ZIEN)=""
|
|
"RTN","C0XMAIN",526,0)
|
|
Q
|
|
"RTN","C0XMAIN",527,0)
|
|
;
|
|
"RTN","C0XMAIN",528,0)
|
|
UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
|
|
"RTN","C0XMAIN",529,0)
|
|
; ZFDA IS PASSED BY REFERENCE
|
|
"RTN","C0XMAIN",530,0)
|
|
;ZWR ZFDA
|
|
"RTN","C0XMAIN",531,0)
|
|
;B
|
|
"RTN","C0XMAIN",532,0)
|
|
K ZERR
|
|
"RTN","C0XMAIN",533,0)
|
|
D CLEAN^DILF
|
|
"RTN","C0XMAIN",534,0)
|
|
D UPDATE^DIE("","ZFDA","","ZERR")
|
|
"RTN","C0XMAIN",535,0)
|
|
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST,
|
|
"RTN","C0XMAIN",536,0)
|
|
; INVOKE THE ERROR TRAP IF TASKED
|
|
"RTN","C0XMAIN",537,0)
|
|
;. W "ERROR",!
|
|
"RTN","C0XMAIN",538,0)
|
|
;. ZWR ZERR
|
|
"RTN","C0XMAIN",539,0)
|
|
;. B
|
|
"RTN","C0XMAIN",540,0)
|
|
K ZFDA
|
|
"RTN","C0XMAIN",541,0)
|
|
Q
|
|
"RTN","C0XMAIN",542,0)
|
|
;
|
|
"SEC","^DIC",172.101,172.101,0,"AUDIT")
|
|
@
|
|
"SEC","^DIC",172.101,172.101,0,"DD")
|
|
@
|
|
"SEC","^DIC",172.101,172.101,0,"DEL")
|
|
@
|
|
"SEC","^DIC",172.101,172.101,0,"LAYGO")
|
|
@
|
|
"SEC","^DIC",172.101,172.101,0,"RD")
|
|
@
|
|
"SEC","^DIC",172.101,172.101,0,"WR")
|
|
@
|
|
"SEC","^DIC",172.201,172.201,0,"AUDIT")
|
|
@
|
|
"SEC","^DIC",172.201,172.201,0,"DD")
|
|
@
|
|
"SEC","^DIC",172.201,172.201,0,"DEL")
|
|
@
|
|
"SEC","^DIC",172.201,172.201,0,"LAYGO")
|
|
@
|
|
"SEC","^DIC",172.201,172.201,0,"RD")
|
|
@
|
|
"SEC","^DIC",172.201,172.201,0,"WR")
|
|
@
|
|
"VER")
|
|
8.0^22.0
|
|
"^DD",172.101,172.101,0)
|
|
FIELD^^.05^5
|
|
"^DD",172.101,172.101,0,"DDA")
|
|
N
|
|
"^DD",172.101,172.101,0,"DT")
|
|
3111013
|
|
"^DD",172.101,172.101,0,"ID",.02)
|
|
S %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
|
|
"^DD",172.101,172.101,0,"ID",.03)
|
|
S %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
|
|
"^DD",172.101,172.101,0,"ID",.04)
|
|
S %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
|
|
"^DD",172.101,172.101,0,"ID",.05)
|
|
S %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
|
|
"^DD",172.101,172.101,0,"IX","B",172.101,.01)
|
|
|
|
"^DD",172.101,172.101,0,"NM","C0X TRIPLE")
|
|
|
|
"^DD",172.101,172.101,.01,0)
|
|
NODEID^RF^^0;1^K:$L(X)>30!($L(X)<3)!'(X'?1P.E) X
|
|
"^DD",172.101,172.101,.01,.1)
|
|
TRIPLE NODE ID
|
|
"^DD",172.101,172.101,.01,1,0)
|
|
^.1
|
|
"^DD",172.101,172.101,.01,1,1,0)
|
|
172.101^B
|
|
"^DD",172.101,172.101,.01,1,1,1)
|
|
S ^C0X(101,"B",$E(X,1,30),DA)=""
|
|
"^DD",172.101,172.101,.01,1,1,2)
|
|
K ^C0X(101,"B",$E(X,1,30),DA)
|
|
"^DD",172.101,172.101,.01,3)
|
|
Answer must be 3-30 characters in length
|
|
"^DD",172.101,172.101,.01,"DT")
|
|
3111013
|
|
"^DD",172.101,172.101,.02,0)
|
|
GRAPH^P172.201^C0X(201,^0;2^Q
|
|
"^DD",172.101,172.101,.02,.1)
|
|
TRIPLE GRAPH
|
|
"^DD",172.101,172.101,.02,3)
|
|
Answer must be 3-240 characters in length
|
|
"^DD",172.101,172.101,.02,"DT")
|
|
3111030
|
|
"^DD",172.101,172.101,.03,0)
|
|
SUBJECT^P172.201^C0X(201,^0;3^Q
|
|
"^DD",172.101,172.101,.03,.1)
|
|
TRIPLE SUBJECT
|
|
"^DD",172.101,172.101,.03,"DT")
|
|
3111030
|
|
"^DD",172.101,172.101,.04,0)
|
|
PREDICATE^P172.201^C0X(201,^0;4^Q
|
|
"^DD",172.101,172.101,.04,.1)
|
|
TRIPLE PREDICATE
|
|
"^DD",172.101,172.101,.04,"DT")
|
|
3111030
|
|
"^DD",172.101,172.101,.05,0)
|
|
OBJECT^P172.201^C0X(201,^0;5^Q
|
|
"^DD",172.101,172.101,.05,.1)
|
|
TRIPLE OBJECT
|
|
"^DD",172.101,172.101,.05,"DT")
|
|
3111030
|
|
"^DD",172.201,172.201,0)
|
|
FIELD^^1^2
|
|
"^DD",172.201,172.201,0,"DDA")
|
|
N
|
|
"^DD",172.201,172.201,0,"DT")
|
|
3111013
|
|
"^DD",172.201,172.201,0,"NM","C0X STRING")
|
|
|
|
"^DD",172.201,172.201,0,"PT",172.101,.02)
|
|
|
|
"^DD",172.201,172.201,0,"PT",172.101,.03)
|
|
|
|
"^DD",172.201,172.201,0,"PT",172.101,.04)
|
|
|
|
"^DD",172.201,172.201,0,"PT",172.101,.05)
|
|
|
|
"^DD",172.201,172.201,.01,0)
|
|
STRING^RF^^0;1^K:$L(X)>240!($L(X)<1)!'(X=X) X
|
|
"^DD",172.201,172.201,.01,.1)
|
|
TRIPLE STRING
|
|
"^DD",172.201,172.201,.01,1,0)
|
|
^.1^^0
|
|
"^DD",172.201,172.201,.01,3)
|
|
Answer must be 1-240 characters in length
|
|
"^DD",172.201,172.201,.01,"DT")
|
|
3111028
|
|
"^DD",172.201,172.201,1,0)
|
|
TEXT^172.2011^^1;0
|
|
"^DD",172.201,172.2011,0)
|
|
TEXT SUB-FIELD^^.01^1
|
|
"^DD",172.201,172.2011,0,"DT")
|
|
3111013
|
|
"^DD",172.201,172.2011,0,"NM","TEXT")
|
|
|
|
"^DD",172.201,172.2011,0,"UP")
|
|
172.201
|
|
"^DD",172.201,172.2011,.01,0)
|
|
TEXT^Wx^^0;1
|
|
"^DD",172.201,172.2011,.01,.1)
|
|
LONGER TEXT
|
|
"^DD",172.201,172.2011,.01,"DT")
|
|
3111013
|
|
"^DIC",172.101,172.101,0)
|
|
C0X TRIPLE^172.101
|
|
"^DIC",172.101,172.101,0,"GL")
|
|
^C0X(101,
|
|
"^DIC",172.101,"B","C0X TRIPLE",172.101)
|
|
|
|
"^DIC",172.201,172.201,0)
|
|
C0X STRING^172.201
|
|
"^DIC",172.201,172.201,0,"GL")
|
|
^C0X(201,
|
|
"^DIC",172.201,"B","C0X STRING",172.201)
|
|
|
|
**END**
|
|
**END**
|