From 5da329af8b5ce094c7a089331b717fea85d49f88 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 26 Sep 2012 16:58:34 +0000 Subject: [PATCH] Proper KIDS build + Routines --- kids/C0X_1_0_0_T1.KID | 720 --- kids/C0X_1_0_0_T10.KID | 4914 ----------------- kids/C0X_1_0_0_T2.KID | 1078 ---- kids/C0X_1_0_0_T3.KID | 1334 ----- kids/C0X_1_0_0_T4.KID | 1352 ----- kids/C0X_1_0_0_T5.KID | 2836 ---------- kids/C0X_1_0_0_T6.KID | 2922 ---------- kids/C0X_1_0_0_T7.KID | 2930 ---------- kids/C0X_1_0_0_T8.KID | 3338 ----------- kids/C0X_1_0_0_T9.KID | 3936 ------------- ..._T11.KID => FILEMAN_TRIPLE_STORE_1T12.KID} | 518 +- p/C0XF2N.m | 1398 ++--- p/C0XGET1.m | 974 ++-- p/C0XINIT.m | 234 +- p/C0XMAIN.m | 754 +-- p/C0XRDF.m | 178 +- p/C0XTEST.m | 250 +- p/C0XTKSB.m | 263 +- p/C0XUTIL.m | 164 +- 19 files changed, 2384 insertions(+), 27709 deletions(-) delete mode 100644 kids/C0X_1_0_0_T1.KID delete mode 100644 kids/C0X_1_0_0_T10.KID delete mode 100644 kids/C0X_1_0_0_T2.KID delete mode 100644 kids/C0X_1_0_0_T3.KID delete mode 100644 kids/C0X_1_0_0_T4.KID delete mode 100644 kids/C0X_1_0_0_T5.KID delete mode 100644 kids/C0X_1_0_0_T6.KID delete mode 100644 kids/C0X_1_0_0_T7.KID delete mode 100644 kids/C0X_1_0_0_T8.KID delete mode 100644 kids/C0X_1_0_0_T9.KID rename kids/{C0X_1_0_0_T11.KID => FILEMAN_TRIPLE_STORE_1T12.KID} (97%) diff --git a/kids/C0X_1_0_0_T1.KID b/kids/C0X_1_0_0_T1.KID deleted file mode 100644 index 54a376f..0000000 --- a/kids/C0X_1_0_0_T1.KID +++ /dev/null @@ -1,720 +0,0 @@ -KIDS Distribution saved on Oct 27, 2011@22:14:58 -Initial build of fileman triplestore -**KIDS**:C0X*1.0*0^ - -**INSTALL NAME** -C0X*1.0*0 -"BLD",7885,0) -C0X*1.0*0^^0^3111027^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) -1 -"BLD",7885,"KRN",0) -^9.67PA^779.2^20 -"BLD",7885,"KRN",.4,0) -.4 -"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^1^1 -"BLD",7885,"KRN",9.8,"NM",1,0) -C0XMAIN^^0^B11207527 -"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,"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) - -"MBREQ") -0 -"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") -1 -"RTN","C0XMAIN") -0^1^B11207527 -"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 1 -"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="/local/files/"_ZN2 -"RTN","C0XMAIN",57,0) - N ZGRAPH,ZSUBJECT -"RTN","C0XMAIN",58,0) - S ZGRAPH="G"_$$LKY9 ; RANDOM GRAPH NAME -"RTN","C0XMAIN",59,0) - S ZSUBJECT="_S"_$$LKY9 ; RANDOM ANOYMOUS SUBJECT -"RTN","C0XMAIN",60,0) - D ADD(ZGRAPH,ZSUBJECT,"v:url",FURL) -"RTN","C0XMAIN",61,0) - N ZTXTNM -"RTN","C0XMAIN",62,0) - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_$$LKY9 ; NAME FOR TEXT NODE -"RTN","C0XMAIN",63,0) - D ADD(ZGRAPH,ZSUBJECT,"v:rdfSource",ZTXTNM) -"RTN","C0XMAIN",64,0) - D UPDIE(.C0XFDA) ; TRY IT OUT -"RTN","C0XMAIN",65,0) - K C0XCNT ;RESET FOR NEXT TIME -"RTN","C0XMAIN",66,0) - Q -"RTN","C0XMAIN",67,0) - ; -"RTN","C0XMAIN",68,0) -ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT -"RTN","C0XMAIN",69,0) - ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE -"RTN","C0XMAIN",70,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",71,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",72,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",73,0) - D USEFARY(FARY) -"RTN","C0XMAIN",74,0) - I '$D(C0XCNT) S C0XCNT=0 -"RTN","C0XMAIN",75,0) - N ZNODE -"RTN","C0XMAIN",76,0) - S ZNODE="N"_$$LKY9 -"RTN","C0XMAIN",77,0) - S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN -"RTN","C0XMAIN",78,0) - S ZSIEN=$$IENOF(ZS) -"RTN","C0XMAIN",79,0) - S ZPIEN=$$IENOF(ZP) -"RTN","C0XMAIN",80,0) - S ZOIEN=$$IENOF(ZO) -"RTN","C0XMAIN",81,0) - ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED -"RTN","C0XMAIN",82,0) - S C0XCNT=C0XCNT+1 -"RTN","C0XMAIN",83,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE -"RTN","C0XMAIN",84,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=ZGIEN -"RTN","C0XMAIN",85,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=ZSIEN -"RTN","C0XMAIN",86,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=ZPIEN -"RTN","C0XMAIN",87,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=ZOIEN -"RTN","C0XMAIN",88,0) - ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE -"RTN","C0XMAIN",89,0) - Q -"RTN","C0XMAIN",90,0) - ; -"RTN","C0XMAIN",91,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",92,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",93,0) - N ZN,ZI -"RTN","C0XMAIN",94,0) - S ZN="" -"RTN","C0XMAIN",95,0) - F ZI=1:1:9 D ; -"RTN","C0XMAIN",96,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",97,0) - Q ZN -"RTN","C0XMAIN",98,0) - ; -"RTN","C0XMAIN",99,0) -IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE -"RTN","C0XMAIN",100,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",101,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",102,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",103,0) - N ZIEN -"RTN","C0XMAIN",104,0) - S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",105,0) - I ZIEN="" D ; -"RTN","C0XMAIN",106,0) - . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING -"RTN","C0XMAIN",107,0) - . D UPDIE(.C0XFDA2) -"RTN","C0XMAIN",108,0) - . S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",109,0) - . K C0XFDA2 -"RTN","C0XMAIN",110,0) - Q ZIEN -"RTN","C0XMAIN",111,0) - ; -"RTN","C0XMAIN",112,0) -UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS -"RTN","C0XMAIN",113,0) - ; ZFDA IS PASSED BY REFERENCE -"RTN","C0XMAIN",114,0) - K ZERR -"RTN","C0XMAIN",115,0) - D CLEAN^DILF -"RTN","C0XMAIN",116,0) - D UPDATE^DIE("","ZFDA","","ZERR") -"RTN","C0XMAIN",117,0) - I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED -"RTN","C0XMAIN",118,0) - ;. W "ERROR",! -"RTN","C0XMAIN",119,0) - ;. ZWR ZERR -"RTN","C0XMAIN",120,0) - ;. B -"RTN","C0XMAIN",121,0) - K ZFDA -"RTN","C0XMAIN",122,0) - Q -"RTN","C0XMAIN",123,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") -3111013 -"^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") -3111013 -"^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") -3111013 -"^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") -3111013 -"^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,"IX","B",172.201,.01) - -"^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 -"^DD",172.201,172.201,.01,1,1,0) -172.201^B -"^DD",172.201,172.201,.01,1,1,1) -S ^C0X(201,"B",$E(X,1,30),DA)="" -"^DD",172.201,172.201,.01,1,1,2) -K ^C0X(201,"B",$E(X,1,30),DA) -"^DD",172.201,172.201,.01,3) -Answer must be 1-240 characters in length -"^DD",172.201,172.201,.01,"DT") -3111013 -"^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** diff --git a/kids/C0X_1_0_0_T10.KID b/kids/C0X_1_0_0_T10.KID deleted file mode 100644 index 5474591..0000000 --- a/kids/C0X_1_0_0_T10.KID +++ /dev/null @@ -1,4914 +0,0 @@ -KIDS Distribution saved on Sep 07, 2012@20:20:44 -compatible with smart container -**KIDS**:C0X*1.0*0^ - -**INSTALL NAME** -C0X*1.0*0 -"BLD",7921,0) -C0X*1.0*0^^0^3120907^n -"BLD",7921,4,0) -^9.64PA^172.201^2 -"BLD",7921,4,172.101,0) -172.101 -"BLD",7921,4,172.101,222) -y^y^f^^^^n -"BLD",7921,4,172.201,0) -172.201 -"BLD",7921,4,172.201,222) -y^y^f^^^^n -"BLD",7921,4,"B",172.101,172.101) - -"BLD",7921,4,"B",172.201,172.201) - -"BLD",7921,6.3) -9 -"BLD",7921,"KRN",0) -^9.67PA^779.2^20 -"BLD",7921,"KRN",.4,0) -.4 -"BLD",7921,"KRN",.4,"NM",0) -^9.68A^1^1 -"BLD",7921,"KRN",.4,"NM",1,0) -C0X PRINT GRAPH FILE #172.101^172.101^0 -"BLD",7921,"KRN",.4,"NM","B","C0X PRINT GRAPH FILE #172.101",1) - -"BLD",7921,"KRN",.401,0) -.401 -"BLD",7921,"KRN",.402,0) -.402 -"BLD",7921,"KRN",.403,0) -.403 -"BLD",7921,"KRN",.5,0) -.5 -"BLD",7921,"KRN",.84,0) -.84 -"BLD",7921,"KRN",3.6,0) -3.6 -"BLD",7921,"KRN",3.8,0) -3.8 -"BLD",7921,"KRN",9.2,0) -9.2 -"BLD",7921,"KRN",9.8,0) -9.8 -"BLD",7921,"KRN",9.8,"NM",0) -^9.68A^8^8 -"BLD",7921,"KRN",9.8,"NM",1,0) -C0XMAIN^^0^B115393527 -"BLD",7921,"KRN",9.8,"NM",2,0) -C0XF2N^^0^B367797666 -"BLD",7921,"KRN",9.8,"NM",3,0) -C0XTEST^^0^B14490662 -"BLD",7921,"KRN",9.8,"NM",4,0) -C0XINIT^^0^B21176787 -"BLD",7921,"KRN",9.8,"NM",5,0) -C0XUTIL^^0^B11155926 -"BLD",7921,"KRN",9.8,"NM",6,0) -C0XTKSB^^0^B17580555 -"BLD",7921,"KRN",9.8,"NM",7,0) -C0XRDF^^0^B4392 -"BLD",7921,"KRN",9.8,"NM",8,0) -C0XGET1^^0^B4808799 -"BLD",7921,"KRN",9.8,"NM","B","C0XF2N",2) - -"BLD",7921,"KRN",9.8,"NM","B","C0XGET1",8) - -"BLD",7921,"KRN",9.8,"NM","B","C0XINIT",4) - -"BLD",7921,"KRN",9.8,"NM","B","C0XMAIN",1) - -"BLD",7921,"KRN",9.8,"NM","B","C0XRDF",7) - -"BLD",7921,"KRN",9.8,"NM","B","C0XTEST",3) - -"BLD",7921,"KRN",9.8,"NM","B","C0XTKSB",6) - -"BLD",7921,"KRN",9.8,"NM","B","C0XUTIL",5) - -"BLD",7921,"KRN",19,0) -19 -"BLD",7921,"KRN",19.1,0) -19.1 -"BLD",7921,"KRN",101,0) -101 -"BLD",7921,"KRN",409.61,0) -409.61 -"BLD",7921,"KRN",771,0) -771 -"BLD",7921,"KRN",779.2,0) -779.2 -"BLD",7921,"KRN",870,0) -870 -"BLD",7921,"KRN",8989.51,0) -8989.51 -"BLD",7921,"KRN",8989.52,0) -8989.52 -"BLD",7921,"KRN",8994,0) -8994 -"BLD",7921,"KRN","B",.4,.4) - -"BLD",7921,"KRN","B",.401,.401) - -"BLD",7921,"KRN","B",.402,.402) - -"BLD",7921,"KRN","B",.403,.403) - -"BLD",7921,"KRN","B",.5,.5) - -"BLD",7921,"KRN","B",.84,.84) - -"BLD",7921,"KRN","B",3.6,3.6) - -"BLD",7921,"KRN","B",3.8,3.8) - -"BLD",7921,"KRN","B",9.2,9.2) - -"BLD",7921,"KRN","B",9.8,9.8) - -"BLD",7921,"KRN","B",19,19) - -"BLD",7921,"KRN","B",19.1,19.1) - -"BLD",7921,"KRN","B",101,101) - -"BLD",7921,"KRN","B",409.61,409.61) - -"BLD",7921,"KRN","B",771,771) - -"BLD",7921,"KRN","B",779.2,779.2) - -"BLD",7921,"KRN","B",870,870) - -"BLD",7921,"KRN","B",8989.51,8989.51) - -"BLD",7921,"KRN","B",8989.52,8989.52) - -"BLD",7921,"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.101,172.1011) -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,1511,-1) -0^1 -"KRN",.4,1511,0) -C0X PRINT GRAPH^3111207.1727^@^172.101^^@^3120605 -"KRN",.4,1511,"F",1) -.03;W25;S~.04;C28;W25~.05;C54;W24~ -"KRN",.4,1511,"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") -8 -"RTN","C0XF2N") -0^2^B367797666 -"RTN","C0XF2N",1,0) -C0XF2N ; GPL - Fileman Triples entry point routine ;10/13/11 17:05 -"RTN","C0XF2N",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 9 -"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) - I $D(@ZFARY) Q ; ALREADY INITIALIZED -"RTN","C0XF2N",36,0) - S @ZFARY@("C0XTFN")=172.101 ; TRIPLES FILE NUMBER -"RTN","C0XF2N",37,0) - S @ZFARY@("C0XSFN")=172.201 ; TRIPLES STRINGS FILE NUMBER -"RTN","C0XF2N",38,0) - S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME -"RTN","C0XF2N",39,0) - S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME -"RTN","C0XF2N",40,0) - S @ZFARY@("C0XDIR")="/home/glilly/fmts/trunk/samples/smart-new/" -"RTN","C0XF2N",41,0) - S @ZFARY@("BLKLOAD")=1 ; this file supports block load -"RTN","C0XF2N",42,0) - S @ZFARY@("FMTSSTYLE")="F2N" ; fileman style -"RTN","C0XF2N",43,0) - S @ZFARY@("REPLYFMT")="JSON" -"RTN","C0XF2N",44,0) - D USEFARY(ZFARY) -"RTN","C0XF2N",45,0) - Q -"RTN","C0XF2N",46,0) - ; -"RTN","C0XF2N",47,0) -USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY -"RTN","C0XF2N",48,0) - N ZI S ZI="" -"RTN","C0XF2N",49,0) - F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D -"RTN","C0XF2N",50,0) - . ;N ZX -"RTN","C0XF2N",51,0) - . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_"""" -"RTN","C0XF2N",52,0) - . ;W !,ZX -"RTN","C0XF2N",53,0) - . X ZX -"RTN","C0XF2N",54,0) - Q -"RTN","C0XF2N",55,0) - ; -"RTN","C0XF2N",56,0) -FILEIN ; INTERACTIVE ENTRY POINT FOR OPTION TO READ IN A FILE -"RTN","C0XF2N",57,0) - I '$D(C0XFARY) D INITFARY("C0XFARY") -"RTN","C0XF2N",58,0) - D USEFARY("C0XFARY") -"RTN","C0XF2N",59,0) - S DIR(0)="F^3:240" -"RTN","C0XF2N",60,0) - S DIR("A")="File Directory" -"RTN","C0XF2N",61,0) - S DIR("B")=C0XDIR -"RTN","C0XF2N",62,0) - D ^DIR -"RTN","C0XF2N",63,0) - I Y="^" Q ; -"RTN","C0XF2N",64,0) - S C0XDIR=Y -"RTN","C0XF2N",65,0) - S C0XFARY("C0XDIR")=Y -"RTN","C0XF2N",66,0) - S DIR(0)="F^3:240" -"RTN","C0XF2N",67,0) - S DIR("A")="File Name" -"RTN","C0XF2N",68,0) - I '$D(C0XFN) S DIR("B")="qds.rdf" -"RTN","C0XF2N",69,0) - E S DIR("B")=C0XFN -"RTN","C0XF2N",70,0) - D ^DIR -"RTN","C0XF2N",71,0) - I Y="" Q ; -"RTN","C0XF2N",72,0) - I Y="^" Q ; -"RTN","C0XF2N",73,0) - S C0XFN=Y -"RTN","C0XF2N",74,0) - D IMPORT(C0XFN,C0XDIR,,"C0XFARY") -"RTN","C0XF2N",75,0) - K C0XFDA -"RTN","C0XF2N",76,0) - Q -"RTN","C0XF2N",77,0) - ; -"RTN","C0XF2N",78,0) -IMPORT(FNAME,INDIR,INURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD -"RTN","C0XF2N",79,0) - ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE -"RTN","C0XF2N",80,0) - ; NODE NAME OF THE TEXT TRIPLE -"RTN","C0XF2N",81,0) - ; INDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR) -"RTN","C0XF2N",82,0) - ; INURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE -"RTN","C0XF2N",83,0) - ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE -"RTN","C0XF2N",84,0) - I '$D(FARY) D ; -"RTN","C0XF2N",85,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",86,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",87,0) - D USEFARY(FARY) -"RTN","C0XF2N",88,0) - N ZD,ZTMP -"RTN","C0XF2N",89,0) - I '$D(INDIR) S INDIR=C0XDIR ; DIRECTORY OF THE RDF FILE -"RTN","C0XF2N",90,0) - I $G(INURL)="" D ; -"RTN","C0XF2N",91,0) - . ;N ZN2 S ZN2=$P(FNAME,".",1)_"_"_$P(FNAME,".",2) ; REMOVE THE DOT -"RTN","C0XF2N",92,0) - . ;S INURL=FDIR_ZN2 -"RTN","C0XF2N",93,0) - . S INURL=INDIR_FNAME -"RTN","C0XF2N",94,0) - N ZTMP -"RTN","C0XF2N",95,0) - S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE -"RTN","C0XF2N",96,0) - K @ZTMP ; MAKE SURE IT'S CLEAR -"RTN","C0XF2N",97,0) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XF2N",98,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XF2N",99,0) - W !,"READING IN: ",FNAME -"RTN","C0XF2N",100,0) - I '$$FILEREAD(ZTMP,INDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS -"RTN","C0XF2N",101,0) - . W !,"ERROR READING FILE: ",INDIR,FNAME -"RTN","C0XF2N",102,0) - S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT -"RTN","C0XF2N",103,0) - W !,$O(@ZRDF@(""),-1)," LINES READ" -"RTN","C0XF2N",104,0) - D INSRDF(ZRDF,INURL,FARY) ; IMPORT AND PROCESS THE RDF -"RTN","C0XF2N",105,0) - K INURL -"RTN","C0XF2N",106,0) - K C0XFDA -"RTN","C0XF2N",107,0) - ;K ^TMP("MXMLDOM",$J) -"RTN","C0XF2N",108,0) - Q -"RTN","C0XF2N",109,0) - ; -"RTN","C0XF2N",110,0) -WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT -"RTN","C0XF2N",111,0) - ; -"RTN","C0XF2N",112,0) - I '$D(FARY) D ; -"RTN","C0XF2N",113,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",114,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",115,0) - D USEFARY(FARY) -"RTN","C0XF2N",116,0) - ;N ZLOC,ZTMP -"RTN","C0XF2N",117,0) - K ZTMP -"RTN","C0XF2N",118,0) - S ZLOC=$NA(^TMP("C0X","WGET",$J)) -"RTN","C0XF2N",119,0) - K @ZLOC -"RTN","C0XF2N",120,0) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XF2N",121,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XF2N",122,0) - W !,"DOWNLOADING: ",ZURL -"RTN","C0XF2N",123,0) - S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP) -"RTN","C0XF2N",124,0) - M @ZLOC=ZTMP -"RTN","C0XF2N",125,0) - S C0XLINES=$O(@ZLOC@(""),-1) -"RTN","C0XF2N",126,0) - W !,C0XLINES," LINES READ" -"RTN","C0XF2N",127,0) - S C0XDLC=$$NOW^XLFDT ; DOWNLOAD COMPLETE -"RTN","C0XF2N",128,0) - W !,"DOWNLOAD COMPLETE AT ",C0XDLC -"RTN","C0XF2N",129,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XDLC,C0XSTART,2) -"RTN","C0XF2N",130,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",131,0) - I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XLINES/C0XDIFF,".")," LINES PER SEC" -"RTN","C0XF2N",132,0) - D INSRDF(ZLOC,ZURL,FARY) -"RTN","C0XF2N",133,0) - Q -"RTN","C0XF2N",134,0) - ; -"RTN","C0XF2N",135,0) -INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS -"RTN","C0XF2N",136,0) - ; ZRDF IS PASSED BY NAME -"RTN","C0XF2N",137,0) - I '$D(FARY) D ; -"RTN","C0XF2N",138,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",139,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",140,0) - D USEFARY(FARY) -"RTN","C0XF2N",141,0) - S BATCNT=0 ; BATCH COUNTER -"RTN","C0XF2N",142,0) - S BATMAX=10000 ; TRY BATCHES OF THIS SIZE -"RTN","C0XF2N",143,0) - N ZGRAPH,ZSUBJECT -"RTN","C0XF2N",144,0) - S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME -"RTN","C0XF2N",145,0) - S ZSUBJECT=$$ANONS() ; RANDOM ANOYMOUS SUBJECT -"RTN","C0XF2N",146,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY) -"RTN","C0XF2N",147,0) - N ZTXTNM -"RTN","C0XF2N",148,0) - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE -"RTN","C0XF2N",149,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:fileSource",ZTXTNM,FARY) -"RTN","C0XF2N",150,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:fileTag",$$name2tag(ZNAME),FARY) -"RTN","C0XF2N",151,0) - D SWUPDIE(.C0XFDA) ; TRY IT OUT -"RTN","C0XF2N",152,0) - K C0XCNT ;RESET FOR NEXT TIME -"RTN","C0XF2N",153,0) - D STORETXT(ZRDF,ZTXTNM,FARY) -"RTN","C0XF2N",154,0) - W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:fileSource ",ZTXTNM -"RTN","C0XF2N",155,0) - D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF -"RTN","C0XF2N",156,0) - Q -"RTN","C0XF2N",157,0) - ; -"RTN","C0XF2N",158,0) -name2tag(zname) ; extrinsic which returns a tag derived from a name -"RTN","C0XF2N",159,0) - ; /home/vista/project.xml ==> project -"RTN","C0XF2N",160,0) - q $p($re($p($re(zname),"/")),".") -"RTN","C0XF2N",161,0) - ; -"RTN","C0XF2N",162,0) -STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME -"RTN","C0XF2N",163,0) - ; -"RTN","C0XF2N",164,0) - I '$D(FARY) D ; -"RTN","C0XF2N",165,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",166,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",167,0) - D USEFARY(FARY) -"RTN","C0XF2N",168,0) - N ZIEN -"RTN","C0XF2N",169,0) - S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN -"RTN","C0XF2N",170,0) - D CLEAN^DILF -"RTN","C0XF2N",171,0) - K ZERR -"RTN","C0XF2N",172,0) - D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") -"RTN","C0XF2N",173,0) - I $D(ZERR) D Q ; -"RTN","C0XF2N",174,0) - . W !,"ERROR CREATING WORD PROCESSING FIELD" -"RTN","C0XF2N",175,0) - . S C0XERR="ERROR CREATING WORD PROCESSING FIELD" -"RTN","C0XF2N",176,0) - . D ^%ZTER ; error trap -"RTN","C0XF2N",177,0) - Q -"RTN","C0XF2N",178,0) - ; -"RTN","C0XF2N",179,0) -GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT -"RTN","C0XF2N",180,0) - ; ZRTN IS PASSED BY REFERENCE -"RTN","C0XF2N",181,0) - I '$D(FARY) D ; -"RTN","C0XF2N",182,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",183,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",184,0) - D USEFARY(FARY) -"RTN","C0XF2N",185,0) - N ZIEN -"RTN","C0XF2N",186,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XF2N",187,0) - S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") -"RTN","C0XF2N",188,0) - Q -"RTN","C0XF2N",189,0) - ; -"RTN","C0XF2N",190,0) -WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL -"RTN","C0XF2N",191,0) - ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING -"RTN","C0XF2N",192,0) - I '$D(FARY) D ; -"RTN","C0XF2N",193,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",194,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",195,0) - D USEFARY(FARY) -"RTN","C0XF2N",196,0) - N ZIEN -"RTN","C0XF2N",197,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XF2N",198,0) - Q $NA(@C0XSN@(ZIEN,1)) -"RTN","C0XF2N",199,0) - ; -"RTN","C0XF2N",200,0) -FILEREAD(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH -"RTN","C0XF2N",201,0) - ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT -"RTN","C0XF2N",202,0) - ; IE ^TMP("C0X","FILEIN",1) -"RTN","C0XF2N",203,0) - ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 -"RTN","C0XF2N",204,0) - ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH -"RTN","C0XF2N",205,0) - S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) -"RTN","C0XF2N",206,0) - Q OK -"RTN","C0XF2N",207,0) - ; -"RTN","C0XF2N",208,0) -TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE -"RTN","C0XF2N",209,0) - S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) -"RTN","C0XF2N",210,0) - S ZGRAPH="/test/rdfFile" -"RTN","C0XF2N",211,0) - S ZM="/test/rdfFile/meta" -"RTN","C0XF2N",212,0) - D PROCESS(.G,ZIN,ZGRAPH,ZM) -"RTN","C0XF2N",213,0) - Q -"RTN","C0XF2N",214,0) - ; -"RTN","C0XF2N",215,0) -VISTAOWL ; -"RTN","C0XF2N",216,0) - S ZRDF=$NA(^TMP("C0X",542,"FILEIN")) -"RTN","C0XF2N",217,0) - S ZNAME="/home/glilly/vistaowl/VistAOWL.owl" -"RTN","C0XF2N",218,0) - S ZGRAPH="_:G431590209" -"RTN","C0XF2N",219,0) - S FARY="C0XFARY" -"RTN","C0XF2N",220,0) - D INITFARY(FARY) -"RTN","C0XF2N",221,0) - S C0XDOCID=1 -"RTN","C0XF2N",222,0) - S BATCNT=0 -"RTN","C0XF2N",223,0) - S BATMAX=10000 -"RTN","C0XF2N",224,0) - D PROCESS(.G,ZRDF,ZGRAPH,ZNAME,FARY) -"RTN","C0XF2N",225,0) - Q -"RTN","C0XF2N",226,0) - ; -"RTN","C0XF2N",227,0) -PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE -"RTN","C0XF2N",228,0) - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING -"RTN","C0XF2N",229,0) - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE -"RTN","C0XF2N",230,0) - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS -"RTN","C0XF2N",231,0) - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA -"RTN","C0XF2N",232,0) - ; -"RTN","C0XF2N",233,0) - I '$D(FARY) D ; -"RTN","C0XF2N",234,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",235,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",236,0) - D USEFARY(FARY) -"RTN","C0XF2N",237,0) - ;N BATCNT -"RTN","C0XF2N",238,0) - ;N BATMAX -"RTN","C0XF2N",239,0) - ; -- first parse the rdf file with the MXML parser -"RTN","C0XF2N",240,0) - ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML -"RTN","C0XF2N",241,0) - S C0XDLC2=$$NOW^XLFDT ; START OF PARSE -"RTN","C0XF2N",242,0) - I @ZRDF@(1)'[" "nodeID:1234" -"RTN","C0XGET1",173,0) - n zin,zrtn -"RTN","C0XGET1",174,0) - d subjects(.zin,$g(pred),$g(obj),$g(form),$g(fary)) -"RTN","C0XGET1",175,0) - s zrtn=$o(zin("")) -"RTN","C0XGET1",176,0) - i $o(zin(zrtn))'="" s zrtn="" -"RTN","C0XGET1",177,0) - q zrtn -"RTN","C0XGET1",178,0) - ; -"RTN","C0XGET1",179,0) -preds(listrtn,sub,obj,graph,form,fary) ; return list of subjects -"RTN","C0XGET1",180,0) - d onelist("P",$g(sub),,$g(obj),$g(fary)) ;subjects -"RTN","C0XGET1",181,0) - q -"RTN","C0XGET1",182,0) - ; -"RTN","C0XGET1",183,0) -objects(listrtn,sub,pred,graph,form,fary) ; return list of subjects -"RTN","C0XGET1",184,0) - d onelist("O",$g(sub),$g(pred),"",$g(fary)) ;subjects -"RTN","C0XGET1",185,0) - q -"RTN","C0XGET1",186,0) - ; -"RTN","C0XGET1",187,0) -object(sub,pred,graph,form,fary) ; extrinsic which returns the first -"RTN","C0XGET1",188,0) - ; multiple of return from objects - returns null if more than one -"RTN","C0XGET1",189,0) - ; objects(.G,sub,pred) -"RTN","C0XGET1",190,0) - ; G("location") ==> "location" -"RTN","C0XGET1",191,0) - n zin,zrtn -"RTN","C0XGET1",192,0) - d objects(.zin,$g(sub),$g(pred),$g(form),$g(fary)) -"RTN","C0XGET1",193,0) - s zrtn=$o(zin("")) -"RTN","C0XGET1",194,0) - i $o(zin(zrtn))'="" s zrtn="" -"RTN","C0XGET1",195,0) - q zrtn -"RTN","C0XGET1",196,0) - ; -"RTN","C0XGET1",197,0) -onelist(zw,sub,pred,obj,fary) ; returns list -"RTN","C0XGET1",198,0) - ; zw is S P or O depending on what should be returned -"RTN","C0XGET1",199,0) - I $g(fary)="" D ; -"RTN","C0XGET1",200,0) - . D INITFARY^C0XF2N("C0XFARY") -"RTN","C0XGET1",201,0) - . S fary="C0XFARY" -"RTN","C0XGET1",202,0) - D USEFARY^C0XF2N(fary) -"RTN","C0XGET1",203,0) - I '$D(form) S form="json" -"RTN","C0XGET1",204,0) - k listrtn ; start with a clean return -"RTN","C0XGET1",205,0) - n zsub,zpred,zobj,zgraph,tmprtn -"RTN","C0XGET1",206,0) - s zsub=$$IENOF($$EXT^C0XUTIL($g(sub)),fary) ; ien of sub -"RTN","C0XGET1",207,0) - s zpred=$$IENOF($$EXT^C0XUTIL($g(pred)),fary) ; ien of pred -"RTN","C0XGET1",208,0) - s zobj=$$IENOF($$EXT^C0XUTIL($g(obj)),fary) ; ien of obj -"RTN","C0XGET1",209,0) - s zgraph=$$IENOF($g(graph),fary) ; ien of graph -"RTN","C0XGET1",210,0) - I $G(DEBUG) W !,"s:",zsub," p:",zpred," o:",zobj -"RTN","C0XGET1",211,0) - n c0xflag,zi,zx,zt -"RTN","C0XGET1",212,0) - s zt=$na(^C0X(101)) ; -"RTN","C0XGET1",213,0) - s c0xflag=$$mask(zsub,zpred,zobj) ; get mask flags -"RTN","C0XGET1",214,0) - k tmprtn -"RTN","C0XGET1",215,0) - n itbl,ii,ix -"RTN","C0XGET1",216,0) - s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"OSP") ; no constraint -"RTN","C0XGET1",217,0) - s itbl("I000",ii)="d zip(.tmprtn,zt,zi)" -"RTN","C0XGET1",218,0) - s ii=$s(zw="S":"OSP",zw="P":"OPS",zw="O":"OSP") ; obj constraint -"RTN","C0XGET1",219,0) - s ix=$s(zw="O":"d just(zobj)",1:"d zip1(.tmprtn,zt,zi,zobj)") -"RTN","C0XGET1",220,0) - s itbl("I001",ii)=ix -"RTN","C0XGET1",221,0) - s ii=$s(zw="S":"PSO",zw="P":"POS",zw="O":"POS") ; pred constraint -"RTN","C0XGET1",222,0) - s ix=$s(zw="P":"d just(zpred)",1:"d zip1(.tmprtn,zt,zi,zpred)") -"RTN","C0XGET1",223,0) - s itbl("I010",ii)=ix -"RTN","C0XGET1",224,0) - s ii=$s(zw="S":"POS",zw="P":"OPS",zw="O":"OSP") ; pred + obj constraint -"RTN","C0XGET1",225,0) - s ix=$s(zw="S":"d zip2(.tmprtn,zt,zi,zpred,zobj)",zw="P":"d just(zpred)",zw="O":"d just(zobj)",1:"d just(zobj)") -"RTN","C0XGET1",226,0) - s itbl("I011",ii)=ix -"RTN","C0XGET1",227,0) - s ii=$s(zw="S":"SPO",zw="P":"SPO",zw="O":"SOP") ; sub constraint -"RTN","C0XGET1",228,0) - s ix=$s(zw="S":"d just(zsub)",1:"d zip1(.tmprtn,zt,zi,zsub)") -"RTN","C0XGET1",229,0) - s itbl("I100",ii)=ix -"RTN","C0XGET1",230,0) - s ii=$s(zw="S":"SPO",zw="P":"SOP",zw="O":"OSP") ; sub + obj constraint -"RTN","C0XGET1",231,0) - s ix=$s(zw="P":"d zip2(.tmprtn,zt,zi,zsub,zobj)",zw="S":"d just(zsub)",zw="O":"d just(zobj)",1:"d just(zobj)") -"RTN","C0XGET1",232,0) - s itbl("I101",ii)=ix -"RTN","C0XGET1",233,0) - s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"SPO") ; sub + pred constraint -"RTN","C0XGET1",234,0) - s ix=$s(zw="O":"d zip2(.tmprtn,zt,zi,zsub,zpred)",zw="S":"d just(zsub)",zw="P":"d just(zpred)",1:"d just(zsub)") -"RTN","C0XGET1",235,0) - s itbl("I110",ii)=ix -"RTN","C0XGET1",236,0) - s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"OSP") ; sub + pred + obj constraint -"RTN","C0XGET1",237,0) - s ix=$s(zw="O":"d just(zobj)",zw="S":"d just(zsub)",zw="P":"d just(zpred)",1:"d just(zsub)") -"RTN","C0XGET1",238,0) - s itbl("I111",ii)=ix -"RTN","C0XGET1",239,0) - ; end itbl definition -"RTN","C0XGET1",240,0) - ; -"RTN","C0XGET1",241,0) - s zi=$o(itbl(c0xflag,"")) ; find index to use -"RTN","C0XGET1",242,0) - s zx=itbl(c0xflag,zi) ; executable instruction to run -"RTN","C0XGET1",243,0) - ;i $g(ngraph)'="" s zi="G"_zi ; this is wrong.. don't do graphs yet -"RTN","C0XGET1",244,0) - i $g(DEBUG) w !,c0xflag," ",zw," ",zt," ",zi," ",zx,! -"RTN","C0XGET1",245,0) - ;zwr itbl -"RTN","C0XGET1",246,0) - x zx -"RTN","C0XGET1",247,0) - k listrtn -"RTN","C0XGET1",248,0) - d strings(.listrtn,"tmprtn") ; convert pointer to strings -"RTN","C0XGET1",249,0) - q -"RTN","C0XGET1",250,0) - ; -"RTN","C0XGET1",251,0) -just(zin) ; add one element to tmprtn -"RTN","C0XGET1",252,0) - s tmprtn(zin)="" -"RTN","C0XGET1",253,0) - q -"RTN","C0XGET1",254,0) - ; -"RTN","C0XGET1",255,0) -zip(zrtn,zt,zi) ; pull out just the first element of the index -"RTN","C0XGET1",256,0) - ; -"RTN","C0XGET1",257,0) - n zii s zii="" -"RTN","C0XGET1",258,0) - f s zii=$o(@zt@(zi,zii)) q:zii="" d ; -"RTN","C0XGET1",259,0) - . s zrtn(zii)="" -"RTN","C0XGET1",260,0) - q -"RTN","C0XGET1",261,0) - ; -"RTN","C0XGET1",262,0) -zip1(zrtn,zt,zi,zn) ; pull out just the first element of the index -"RTN","C0XGET1",263,0) - ; -"RTN","C0XGET1",264,0) - n zii s zii="" -"RTN","C0XGET1",265,0) - f s zii=$o(@zt@(zi,zn,zii)) q:zii="" d ; -"RTN","C0XGET1",266,0) - . s zrtn(zii)="" -"RTN","C0XGET1",267,0) - q -"RTN","C0XGET1",268,0) - ; -"RTN","C0XGET1",269,0) -zip2(zrtn,zt,zi,zn,zn1) ; pull out just the first element of the index -"RTN","C0XGET1",270,0) - ; -"RTN","C0XGET1",271,0) - n zii s zii="" -"RTN","C0XGET1",272,0) - f s zii=$o(@zt@(zi,zn,zn1,zii)) q:zii="" d ; -"RTN","C0XGET1",273,0) - . s zrtn(zii)="" -"RTN","C0XGET1",274,0) - q -"RTN","C0XGET1",275,0) - ; -"RTN","C0XGET1",276,0) -arrayout(rtn,zary) ; output an array of triples -"RTN","C0XGET1",277,0) - ; -"RTN","C0XGET1",278,0) - s zrsub="" -"RTN","C0XGET1",279,0) - s zcnt=1 -"RTN","C0XGET1",280,0) - f s zrsub=$o(zary(zrsub)) q:zrsub="" d ; organized by subject -"RTN","C0XGET1",281,0) - . s zzz="" -"RTN","C0XGET1",282,0) - . f s zzz=$o(zary(zrsub,zzz)) q:zzz="" d ; pred and obj -"RTN","C0XGET1",283,0) - . . s rtn(zcnt)=zrsub_"^"_zzz -"RTN","C0XGET1",284,0) - . . s zcnt=zcnt+1 -"RTN","C0XGET1",285,0) - q -"RTN","C0XGET1",286,0) - ; -"RTN","C0XGET1",287,0) -rawout(rtn,zary) ; output a mumps array of triples -"RTN","C0XGET1",288,0) - ; -"RTN","C0XGET1",289,0) - s zrsub="" -"RTN","C0XGET1",290,0) - ;s zcnt=1 -"RTN","C0XGET1",291,0) - f s zrsub=$o(zary(zrsub)) q:zrsub="" d ; organized by subject -"RTN","C0XGET1",292,0) - . s zzz="" -"RTN","C0XGET1",293,0) - . f s zzz=$o(zary(zrsub,zzz)) q:zzz="" d ; pred and obj -"RTN","C0XGET1",294,0) - . . s rtn(zrsub,$p(zzz,"^",1))=$p(zzz,"^",2) -"RTN","C0XGET1",295,0) - . . ;s zcnt=zcnt+1 -"RTN","C0XGET1",296,0) - q -"RTN","C0XGET1",297,0) - ; -"RTN","C0XGET1",298,0) -strings(zrary,zinary) ; convert pointers to strings -"RTN","C0XGET1",299,0) - ; -"RTN","C0XGET1",300,0) - k zrary -"RTN","C0XGET1",301,0) - n zzz s zzz="" -"RTN","C0XGET1",302,0) - f s zzz=$o(@zinary@(zzz)) q:zzz="" d ; -"RTN","C0XGET1",303,0) - . n zs -"RTN","C0XGET1",304,0) - . ;s zs=$$GET1^DIQ(C0XSFN,zzz_",",.01) -"RTN","C0XGET1",305,0) - . s zs=$$NSP^C0XUTIL(zzz) ; get namespaced string -"RTN","C0XGET1",306,0) - . q:zs="" -"RTN","C0XGET1",307,0) - . s zrary(zs)="" ; -"RTN","C0XGET1",308,0) - q -"RTN","C0XGET1",309,0) - ; -"RTN","C0XGET1",310,0) -ien2tary(zrary,zinary) ; zinary is an array of iens passed by name -"RTN","C0XGET1",311,0) - ; zrary is passed by reference and is return array of triples -"RTN","C0XGET1",312,0) - ; format zrary(zsub,"zpred^zobj")="" -"RTN","C0XGET1",313,0) - ; -"RTN","C0XGET1",314,0) - k zrary ; start out clean -"RTN","C0XGET1",315,0) - n zzz,zrsub,zrpred,zrobj,zgraph,zcnt -"RTN","C0XGET1",316,0) - s zzz="" -"RTN","C0XGET1",317,0) - f s zzz=$o(@zinary@(zzz)) q:zzz="" d ; -"RTN","C0XGET1",318,0) - . s zrsub=$$GET1^DIQ(C0XTFN,zzz_",",.03,"E") -"RTN","C0XGET1",319,0) - . s zrpred=$$GET1^DIQ(C0XTFN,zzz_",",.04,"E") -"RTN","C0XGET1",320,0) - . s zrobj=$$GET1^DIQ(C0XTFN,zzz_",",.05,"E") -"RTN","C0XGET1",321,0) - . s zrgraph=$$GET1^DIQ(C0XTFN,zzz_",",.02,"E") -"RTN","C0XGET1",322,0) - . s zrary(zrsub,zrpred_"^"_zrobj)="" -"RTN","C0XGET1",323,0) - q -"RTN","C0XGET1",324,0) - ; -"RTN","C0XGET1",325,0) -jsonout(jout,zary) ; -"RTN","C0XGET1",326,0) - d REPLYSTART^FMQLJSON("jout") -"RTN","C0XGET1",327,0) - d LISTSTART^FMQLJSON("jout","results") -"RTN","C0XGET1",328,0) - n zi s zi="" -"RTN","C0XGET1",329,0) - f s zi=$o(zary(zi)) q:zi="" d ; for each subject -"RTN","C0XGET1",330,0) - . n zii s zii="" -"RTN","C0XGET1",331,0) - . D DICTSTART^FMQLJSON("jout",zi) -"RTN","C0XGET1",332,0) - . f s zii=$o(zary(zi,zii)) q:zii="" d ; for each pred^obj pair -"RTN","C0XGET1",333,0) - . . d DASSERT^FMQLJSON("jout",$p(zii,"^",1),$p(zii,"^",2)) -"RTN","C0XGET1",334,0) - . D DICTEND^FMQLJSON("jout") -"RTN","C0XGET1",335,0) - d LISTEND^FMQLJSON("jout") -"RTN","C0XGET1",336,0) - d REPLYEND^FMQLJSON("jout") -"RTN","C0XGET1",337,0) - q -"RTN","C0XGET1",338,0) - ; -"RTN","C0XGET1",339,0) -mask(zsub,zpred,zobj) ; function to return mask information -"RTN","C0XGET1",340,0) - ; about the inputs ie I100 for just a subject and no pred or obj -"RTN","C0XGET1",341,0) - n zf1,zf2,zf3,zflag -"RTN","C0XGET1",342,0) - s zf1=$s($g(zsub)="":0,1:1) -"RTN","C0XGET1",343,0) - s zf2=$s($g(zpred)="":0,1:1) -"RTN","C0XGET1",344,0) - s zf3=$s($g(zobj)="":0,1:1) -"RTN","C0XGET1",345,0) - s zflag="I"_zf1_zf2_zf3 -"RTN","C0XGET1",346,0) - q zflag -"RTN","C0XGET1",347,0) - ; -"RTN","C0XGET1",348,0) -trip(triprtn,nsub,npred,nobj,ngraph,fary) ; returns triples iens -"RTN","C0XGET1",349,0) - ; nsub,npred,nobj are all optional -"RTN","C0XGET1",350,0) - ; graf is also optional, and will limit the search to a particular ngraph -"RTN","C0XGET1",351,0) - ; fary is which triple store (not implemented yet) -"RTN","C0XGET1",352,0) - n c0xflag,zi,zx,zt -"RTN","C0XGET1",353,0) - s zt=$na(^C0X(101)) ; -"RTN","C0XGET1",354,0) - s c0xflag=$$mask(nsub,npred,nobj) ; get mask flags -"RTN","C0XGET1",355,0) - n itbl -"RTN","C0XGET1",356,0) - s itbl("I000","SPO")="d do3(.triprtn,zt,zi)" -"RTN","C0XGET1",357,0) - s itbl("I001","OSP")="d do2(.triprtn,zt,zi,nobj)" -"RTN","C0XGET1",358,0) - s itbl("I010","PSO")="d do2(.triprtn,zt,zi,npred)" -"RTN","C0XGET1",359,0) - s itbl("I011","POS")="d do1(.triprtn,zt,zi,npred,nobj)" -"RTN","C0XGET1",360,0) - s itbl("I100","SPO")="d do2(.triprtn,zt,zi,nsub)" -"RTN","C0XGET1",361,0) - s itbl("I101","SOP")="d do1(.triprtn,zt,zi,nsub,nobj)" -"RTN","C0XGET1",362,0) - s itbl("I110","SPO")="d do1(.triprtn,zt,zi,nsub,npred)" -"RTN","C0XGET1",363,0) - s itbl("I111","SPO")="d do0(.triprtn,zt,zi,nsub,npred,nobj)" -"RTN","C0XGET1",364,0) - s zi=$o(itbl(c0xflag,"")) -"RTN","C0XGET1",365,0) - s zx=itbl(c0xflag,zi) ; executable instruction to run -"RTN","C0XGET1",366,0) - i $g(ngraph)'="" s zi="G"_zi -"RTN","C0XGET1",367,0) - i $g(DEBUG) w !,zx -"RTN","C0XGET1",368,0) - x zx -"RTN","C0XGET1",369,0) - q -"RTN","C0XGET1",370,0) - ; -"RTN","C0XGET1",371,0) -do0(dortn,zt,zi,z1,z2,z3) -"RTN","C0XGET1",372,0) - ; looking for only one triple -"RTN","C0XGET1",373,0) - n zz -"RTN","C0XGET1",374,0) - s zz=$o(@zt@(zi,z1,z2,z3,"")) -"RTN","C0XGET1",375,0) - i zz'="" s dortn(zz)="" -"RTN","C0XGET1",376,0) - q -"RTN","C0XGET1",377,0) - ; -"RTN","C0XGET1",378,0) -do1(dortn,zt,zi,z1,z2) ; have 2, looking for one -"RTN","C0XGET1",379,0) - n zr,zx1 -"RTN","C0XGET1",380,0) - s zx1="" -"RTN","C0XGET1",381,0) - f s zx1=$o(@zt@(zi,z1,z2,zx1)) q:zx1="" d ; -"RTN","C0XGET1",382,0) - . s zr=$o(@zt@(zi,z1,z2,zx1,"")) -"RTN","C0XGET1",383,0) - . s dortn(zr)="" -"RTN","C0XGET1",384,0) - q -"RTN","C0XGET1",385,0) - ; -"RTN","C0XGET1",386,0) -do2(dortn,zt,zi,z1) ; have one, looking for 2 -"RTN","C0XGET1",387,0) - n zr,zx1,zx2 -"RTN","C0XGET1",388,0) - s (zx1,zx2)="" -"RTN","C0XGET1",389,0) - f s zx1=$o(@zt@(zi,z1,zx1)) q:zx1="" d ; -"RTN","C0XGET1",390,0) - . f s zx2=$o(@zt@(zi,z1,zx1,zx2)) q:zx2="" d ; -"RTN","C0XGET1",391,0) - . . s zr=$o(@zt@(zi,z1,zx1,zx2,"")) -"RTN","C0XGET1",392,0) - . . s dortn(zr)="" -"RTN","C0XGET1",393,0) - q -"RTN","C0XGET1",394,0) - ; -"RTN","C0XGET1",395,0) -do3(dortn,zt,zi) ; have none, looking for three -"RTN","C0XGET1",396,0) - n zr,zx1,zx2,zx3 -"RTN","C0XGET1",397,0) - s (zx1,zx2,zx3)="" -"RTN","C0XGET1",398,0) - f s zx1=$o(@zt@(zi,zx1)) q:zx1="" d ; -"RTN","C0XGET1",399,0) - . f s zx2=$o(@zt@(zi,zx1,zx2)) q:zx2="" d ; -"RTN","C0XGET1",400,0) - . . f s zx3=$o(@zt@(zi,zx1,zx2,zx3)) q:zx3="" d ; -"RTN","C0XGET1",401,0) - . . . s zr=$o(@zt@(zi,zx1,zx2,zx3,"")) -"RTN","C0XGET1",402,0) - . . . s dortn(zr)="" -"RTN","C0XGET1",403,0) - q -"RTN","C0XGET1",404,0) - ; -"RTN","C0XGET1",405,0) -IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE -"RTN","C0XGET1",406,0) - I '$D(FARY) D ; -"RTN","C0XGET1",407,0) - . D INITFARY^C0XF2N("C0XFARY") -"RTN","C0XGET1",408,0) - . S FARY="C0XFARY" -"RTN","C0XGET1",409,0) - N ZIEN -"RTN","C0XGET1",410,0) - I $G(ZSTRING)="" Q "" ; NO STRING -"RTN","C0XGET1",411,0) - S ZIEN=$O(@C0XSN@("B",$$EXT^C0XUTIL(ZSTRING),"")) -"RTN","C0XGET1",412,0) - Q ZIEN -"RTN","C0XGET1",413,0) - ; -"RTN","C0XGET1",414,0) -IENOFA(ZOUTARY,INARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE -"RTN","C0XGET1",415,0) - ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" -"RTN","C0XGET1",416,0) - I '$D(FARY) D ; -"RTN","C0XGET1",417,0) - . D INITFARY^C0XF2N("C0XFARY") -"RTN","C0XGET1",418,0) - . S FARY="C0XFARY" -"RTN","C0XGET1",419,0) - K ZOUTARY ; START WITH CLEAN RESULTS -"RTN","C0XGET1",420,0) - K C0XFDA2 ; USE A SEPARATE FDA FOR THIS -"RTN","C0XGET1",421,0) - I '$D(C0XVOC) D VOCINIT^C0XUTIL -"RTN","C0XGET1",422,0) - N ZINARY -"RTN","C0XGET1",423,0) - N ZI S ZI="" -"RTN","C0XGET1",424,0) - F S ZI=$O(INARY(ZI)) Q:ZI="" D ; -"RTN","C0XGET1",425,0) - . N ZK -"RTN","C0XGET1",426,0) - . S ZK=$O(INARY(ZI,"")) -"RTN","C0XGET1",427,0) - . S ZINARY($$EXT^C0XUTIL(ZI),$$EXT^C0XUTIL(ZK))="" -"RTN","C0XGET1",428,0) - N ZV,ZIEN -"RTN","C0XGET1",429,0) - N ZCNT S ZCNT=0 -"RTN","C0XGET1",430,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS -"RTN","C0XGET1",431,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XGET1",432,0) - . I ZV["^" S ZV=$TR(ZV,"^","|") -"RTN","C0XGET1",433,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOW GET ALL IENS -"RTN","C0XGET1",434,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XGET1",435,0) - . I ZV["^" S ZV=$TR(ZV,"^","|") -"RTN","C0XGET1",436,0) - . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW -"RTN","C0XGET1",437,0) - . I ZIEN="" S ZOUTARY("IEN",ZI)="" -"RTN","C0XGET1",438,0) - . E S ZOUTARY("IEN",ZI,ZIEN)="" -"RTN","C0XGET1",439,0) - Q -"RTN","C0XGET1",440,0) - ; -"RTN","C0XGET1",441,0) -output(zwhat,zfname,zdir) ; function to write an array to a host file -"RTN","C0XGET1",442,0) - ; if zdir is ommitted, will output to the CCR directory -"RTN","C0XGET1",443,0) - ; ^TMP("C0CCCR","ODIR") -"RTN","C0XGET1",444,0) - ; if fname is ommitted, will output yyyy-mm-dd-hh-mm-ss-C0XOUT.out -"RTN","C0XGET1",445,0) - ; zwhat is passed by name -"RTN","C0XGET1",446,0) - ; -"RTN","C0XGET1",447,0) - i '$d(zdir) s zdir=$G(^TMP("C0CCCR","ODIR")) -"RTN","C0XGET1",448,0) - i '$d(zfname) d ; -"RTN","C0XGET1",449,0) - . s zfname=$$FMTE^XLFDT($$NOW^XLFDT,7) -"RTN","C0XGET1",450,0) - . s zfname=$tr(zfname,"/","-") -"RTN","C0XGET1",451,0) - . s zfname=$tr(zfname,"@","-") -"RTN","C0XGET1",452,0) - . s zfname=$tr(zfname,":","-") -"RTN","C0XGET1",453,0) - . s zfname=zfname_".out" -"RTN","C0XGET1",454,0) - i $e(zwhat,1,1)'="^" d ; not a global -"RTN","C0XGET1",455,0) - . k ^TMP("C0XOUT",$J) -"RTN","C0XGET1",456,0) - . m ^TMP("C0XOUT",$J)=@zwhat -"RTN","C0XGET1",457,0) - . s zwhat=$na(^TMP("C0XOUT",$J,1)) -"RTN","C0XGET1",458,0) - n zout s zout="" -"RTN","C0XGET1",459,0) - s zout=$$OUTPUT^C0CXPATH(zwhat,zfname,zdir) -"RTN","C0XGET1",460,0) - K ^TMP("C0XOUT",$J) -"RTN","C0XGET1",461,0) - Q zout -"RTN","C0XGET1",462,0) - ; -"RTN","C0XGET1",463,0) -tagText(ztag) ; extrinsic which returns the location of the text -"RTN","C0XGET1",464,0) - ; associated with ztag -"RTN","C0XGET1",465,0) - n zs,zo -"RTN","C0XGET1",466,0) - s zs=$$subject("fmts:fileTag",ztag) -"RTN","C0XGET1",467,0) - i zs="" d q "" ; -"RTN","C0XGET1",468,0) - . w !,"error, tag is either missing or there are more than one ",ztag -"RTN","C0XGET1",469,0) - s zo=$$object(zs,"fmts:fileSource") -"RTN","C0XGET1",470,0) - i zo="" d q "" ; -"RTN","C0XGET1",471,0) - . w !,"error, tag source not found ",zs -"RTN","C0XGET1",472,0) - w !,zo -"RTN","C0XGET1",473,0) - q $$WHERETXT^C0XF2N(zo) -"RTN","C0XGET1",474,0) - ; -"RTN","C0XGET1",475,0) -tagRoot(ztag) ; extrinsic which returns the root for graphs and subjects -"RTN","C0XGET1",476,0) - ; associated with ztag -"RTN","C0XGET1",477,0) - n zs,zo -"RTN","C0XGET1",478,0) - s zs=$$subject("fmts:fileTag",ztag) -"RTN","C0XGET1",479,0) - i zs="" d q "" ; -"RTN","C0XGET1",480,0) - . w !,"error, tag is either missing or there are more than one ",ztag -"RTN","C0XGET1",481,0) - s zo=$$object(zs,"fmts:root") -"RTN","C0XGET1",482,0) - i zo="" d q "" ; -"RTN","C0XGET1",483,0) - . w !,"error, root not found ",zs -"RTN","C0XGET1",484,0) - ;w !,zo -"RTN","C0XGET1",485,0) - q zo -"RTN","C0XGET1",486,0) - ; -"RTN","C0XINIT") -0^4^B21176787 -"RTN","C0XINIT",1,0) -C0XINIT ; GPL - Fileman Triples initialization routine ;10/13/11 17:05 -"RTN","C0XINIT",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 9 -"RTN","C0XINIT",3,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU -"RTN","C0XINIT",4,0) - ;General Public License See attached copy of the License. -"RTN","C0XINIT",5,0) - ; -"RTN","C0XINIT",6,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XINIT",7,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XINIT",8,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XINIT",9,0) - ;(at your option) any later version. -"RTN","C0XINIT",10,0) - ; -"RTN","C0XINIT",11,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XINIT",12,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XINIT",13,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XINIT",14,0) - ;GNU General Public License for more details. -"RTN","C0XINIT",15,0) - ; -"RTN","C0XINIT",16,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XINIT",17,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XINIT",18,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XINIT",19,0) - ; -"RTN","C0XINIT",20,0) - Q -"RTN","C0XINIT",21,0) - ; -"RTN","C0XINIT",22,0) -CLEAR ; DELETE THE FILESTORE -"RTN","C0XINIT",23,0) - K ^C0X(101) -"RTN","C0XINIT",24,0) - K ^C0X(201) -"RTN","C0XINIT",25,0) - S ^C0X(101,0)="C0X TRIPLE^172.101I^^" -"RTN","C0XINIT",26,0) - S ^C0X(201,0)="C0X STRING^172.201I^^" -"RTN","C0XINIT",27,0) - Q -"RTN","C0XINIT",28,0) - ; -"RTN","C0XINIT",29,0) -INIT ; INITIALIZE THE TRIPLE STORE - THIS DELETES THE GLOBALS AND -"RTN","C0XINIT",30,0) - ; START ALL OVER... USE WITH CAUTION -"RTN","C0XINIT",31,0) - ; -"RTN","C0XINIT",32,0) - ; -- we should be more sophisticated here.. at least warn the user -"RTN","C0XINIT",33,0) - ; -- and give them a chance to cancel -"RTN","C0XINIT",34,0) - ; -"RTN","C0XINIT",35,0) - D CLEAR ; DELETE THE TRIPLESTORE -"RTN","C0XINIT",36,0) - ; -"RTN","C0XINIT",37,0) - ; -- we are assuming that FARY is set up properly in C0XF2N -"RTN","C0XINIT",38,0) - ; -- with repect to the default directory and the defaut fileman files -"RTN","C0XINIT",39,0) - ; -- here's what it is now: "/home/vista/gpl/fmts/trunk/samples/" -"RTN","C0XINIT",40,0) - ; -- that means that all the sample files will look like: -"RTN","C0XINIT",41,0) - ; --- qds/QDS_0001.rdf -"RTN","C0XINIT",42,0) - ; --- smart-rdf-in/small.rdf -"RTN","C0XINIT",43,0) - ; -"RTN","C0XINIT",44,0) - S FARY="C0XFARY" -"RTN","C0XINIT",45,0) - D INITFARY^C0XF2N(FARY) -"RTN","C0XINIT",46,0) - D USEFARY^C0XF2N(FARY) -"RTN","C0XINIT",47,0) - S C0XFARY("C0XDIR")="/home/vista/gpl/fmts/trunk/samples/smart-rdf-in/" ; -"RTN","C0XINIT",48,0) - D USEFARY^C0XF2N(FARY) -"RTN","C0XINIT",49,0) - S SMART(1)="cole-susan.rdf" -"RTN","C0XINIT",50,0) - S SMART(2)="jones-cynthia.rdf" -"RTN","C0XINIT",51,0) - S SMART(3)="small.rdf" -"RTN","C0XINIT",52,0) - S SMART(4)="collins-frank.rdf" -"RTN","C0XINIT",53,0) - S SMART(5)="kelly-david.rdf" -"RTN","C0XINIT",54,0) - S SMART(6)="smith-maria.rdf" -"RTN","C0XINIT",55,0) - S SMART(7)="ford-shirley.rdf" -"RTN","C0XINIT",56,0) - S SMART(8)="morgan-jason.rdf" -"RTN","C0XINIT",57,0) - S SMART(9)="west-lisa.rdf" -"RTN","C0XINIT",58,0) - S SMART(10)="gracia-paul.rdf" -"RTN","C0XINIT",59,0) - S SMART(11)="reed-richard.rdf" -"RTN","C0XINIT",60,0) - S SMART(12)="west-sandra.rdf" -"RTN","C0XINIT",61,0) - S SMART(13)="jackson-jessica.rdf" -"RTN","C0XINIT",62,0) - S SMART(14)="small-allergies.rdf" -"RTN","C0XINIT",63,0) - S SMART(15)="white-patricia.rdf" -"RTN","C0XINIT",64,0) - N ZI S ZI="" -"RTN","C0XINIT",65,0) - F S ZI=$O(SMART(ZI)) Q:ZI="" D ; for each smart file -"RTN","C0XINIT",66,0) - . D IMPORT^C0XF2N(SMART(ZI),C0XDIR,,FARY) ; import to the triplestore -"RTN","C0XINIT",67,0) - S FARY="C0XFARY" -"RTN","C0XINIT",68,0) - S C0XFARY("C0XDIR")="/home/vista/gpl/fmts/trunk/samples/qds/" -"RTN","C0XINIT",69,0) - D USEFARY^C0XF2N(FARY) -"RTN","C0XINIT",70,0) - D IMPORT^C0XF2N("QDS_0001.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",71,0) - D IMPORT^C0XF2N("QDS_0028b.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",72,0) - D IMPORT^C0XF2N("QDS_0052.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",73,0) - D IMPORT^C0XF2N("QDS_0073.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",74,0) - D IMPORT^C0XF2N("QDS_0385.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",75,0) - D IMPORT^C0XF2N("QDS_0002.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",76,0) - D IMPORT^C0XF2N("QDS_0031.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",77,0) - D IMPORT^C0XF2N("QDS_0055.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",78,0) - D IMPORT^C0XF2N("QDS_0074.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",79,0) - D IMPORT^C0XF2N("QDS_0387.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",80,0) - D IMPORT^C0XF2N("QDS_0004.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",81,0) - D IMPORT^C0XF2N("QDS_0032.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",82,0) - D IMPORT^C0XF2N("QDS_0056.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",83,0) - D IMPORT^C0XF2N("QDS_0075.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",84,0) - D IMPORT^C0XF2N("QDS_0389.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",85,0) - D IMPORT^C0XF2N("QDS_0012.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",86,0) - D IMPORT^C0XF2N("QDS_0033.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",87,0) - D IMPORT^C0XF2N("QDS_0059.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",88,0) - D IMPORT^C0XF2N("QDS_0081.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",89,0) - D IMPORT^C0XF2N("QDS_0421.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",90,0) - D IMPORT^C0XF2N("QDS_0013.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",91,0) - D IMPORT^C0XF2N("QDS_0034.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",92,0) - D IMPORT^C0XF2N("QDS_0061.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",93,0) - D IMPORT^C0XF2N("QDS_0083.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",94,0) - D IMPORT^C0XF2N("QDS_0575.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",95,0) - D IMPORT^C0XF2N("QDS_0014.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",96,0) - D IMPORT^C0XF2N("QDS_0036.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",97,0) - D IMPORT^C0XF2N("QDS_0062.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",98,0) - D IMPORT^C0XF2N("QDS_0084.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",99,0) - D IMPORT^C0XF2N("QDS_0018.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",100,0) - D IMPORT^C0XF2N("QDS_0038.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",101,0) - D IMPORT^C0XF2N("QDS_0064.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",102,0) - D IMPORT^C0XF2N("QDS_0086.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",103,0) - D IMPORT^C0XF2N("QDS_0024.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",104,0) - D IMPORT^C0XF2N("QDS_0041.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",105,0) - D IMPORT^C0XF2N("QDS_0067.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",106,0) - D IMPORT^C0XF2N("QDS_0088.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",107,0) - D IMPORT^C0XF2N("QDS_0027.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",108,0) - D IMPORT^C0XF2N("QDS_0043.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",109,0) - D IMPORT^C0XF2N("QDS_0068.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",110,0) - D IMPORT^C0XF2N("QDS_0089.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",111,0) - D IMPORT^C0XF2N("QDS_0028a.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",112,0) - D IMPORT^C0XF2N("QDS_0047.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",113,0) - D IMPORT^C0XF2N("QDS_0070.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",114,0) - D IMPORT^C0XF2N("QDS_0105.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",115,0) - ;D IMPORT^C0XF2N("qds.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",116,0) - Q -"RTN","C0XINIT",117,0) - ; -"RTN","C0XMAIN") -0^1^B115393527 -"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 9 -"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) - S @ZFARY@("C0XDIR")="/home/george/fmts/trunk/samples/" -"RTN","C0XMAIN",31,0) - D USEFARY(ZFARY) -"RTN","C0XMAIN",32,0) - Q -"RTN","C0XMAIN",33,0) - ; -"RTN","C0XMAIN",34,0) -USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY -"RTN","C0XMAIN",35,0) - N ZI S ZI="" -"RTN","C0XMAIN",36,0) - F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D -"RTN","C0XMAIN",37,0) - . ;N ZX -"RTN","C0XMAIN",38,0) - . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_"""" -"RTN","C0XMAIN",39,0) - . ;W !,ZX -"RTN","C0XMAIN",40,0) - . X ZX -"RTN","C0XMAIN",41,0) - Q -"RTN","C0XMAIN",42,0) - ; -"RTN","C0XMAIN",43,0) -IMPORT(FNAME,FDIR,FURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD -"RTN","C0XMAIN",44,0) - ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE -"RTN","C0XMAIN",45,0) - ; NODE NAME OF THE TEXT TRIPLE -"RTN","C0XMAIN",46,0) - ; FDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR) -"RTN","C0XMAIN",47,0) - ; FURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE -"RTN","C0XMAIN",48,0) - ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE -"RTN","C0XMAIN",49,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",50,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",51,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",52,0) - D USEFARY(FARY) -"RTN","C0XMAIN",53,0) - N ZD,ZTMP -"RTN","C0XMAIN",54,0) - I '$D(FDIR) S FDIR=C0XDIR ; DIRECTORY OF THE RDF FILE -"RTN","C0XMAIN",55,0) - I '$D(FURL) D ; -"RTN","C0XMAIN",56,0) - . N ZN2 S ZN2=$TR(FNAME,".","_") ; REMOVE THE DOT FROM THE NAME -"RTN","C0XMAIN",57,0) - . S FURL=FDIR_ZN2 -"RTN","C0XMAIN",58,0) - N ZTMP -"RTN","C0XMAIN",59,0) - S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE -"RTN","C0XMAIN",60,0) - K @ZTMP ; MAKE SURE IT'S CLEAR -"RTN","C0XMAIN",61,0) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XMAIN",62,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XMAIN",63,0) - W !,"READING IN: ",FNAME -"RTN","C0XMAIN",64,0) - I '$$FILEIN(ZTMP,FDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS -"RTN","C0XMAIN",65,0) - . W !,"ERROR READING FILE: ",FDIR,FNAME -"RTN","C0XMAIN",66,0) - S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT -"RTN","C0XMAIN",67,0) - W !,$O(@ZRDF@(""),-1)," LINES READ" -"RTN","C0XMAIN",68,0) - D INSRDF(ZRDF,FURL,FARY) ; IMPORT AND PROCESS THE RDF -"RTN","C0XMAIN",69,0) - Q -"RTN","C0XMAIN",70,0) - ; -"RTN","C0XMAIN",71,0) -WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT -"RTN","C0XMAIN",72,0) - ; -"RTN","C0XMAIN",73,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",74,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",75,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",76,0) - D USEFARY(FARY) -"RTN","C0XMAIN",77,0) - ;N ZLOC,ZTMP -"RTN","C0XMAIN",78,0) - K ZTMP -"RTN","C0XMAIN",79,0) - S ZLOC=$NA(^TMP("C0X","WGET",$J)) -"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) - W !,$O(@ZLOC@(""),-1)," LINES READ" -"RTN","C0XMAIN",86,0) - D INSRDF(ZLOC,ZURL,FARY) -"RTN","C0XMAIN",87,0) - Q -"RTN","C0XMAIN",88,0) - ; -"RTN","C0XMAIN",89,0) -INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS -"RTN","C0XMAIN",90,0) - ; ZRDF IS PASSED BY NAME -"RTN","C0XMAIN",91,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",92,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",93,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",94,0) - D USEFARY(FARY) -"RTN","C0XMAIN",95,0) - N ZGRAPH,ZSUBJECT -"RTN","C0XMAIN",96,0) - S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME -"RTN","C0XMAIN",97,0) - S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT -"RTN","C0XMAIN",98,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY) -"RTN","C0XMAIN",99,0) - N ZTXTNM -"RTN","C0XMAIN",100,0) - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE -"RTN","C0XMAIN",101,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY) -"RTN","C0XMAIN",102,0) - D UPDIE(.C0XFDA) ; TRY IT OUT -"RTN","C0XMAIN",103,0) - K C0XCNT ;RESET FOR NEXT TIME -"RTN","C0XMAIN",104,0) - D STORETXT(ZRDF,ZTXTNM,FARY) -"RTN","C0XMAIN",105,0) - W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM -"RTN","C0XMAIN",106,0) - D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF -"RTN","C0XMAIN",107,0) - Q -"RTN","C0XMAIN",108,0) - ; -"RTN","C0XMAIN",109,0) -STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME -"RTN","C0XMAIN",110,0) - ; -"RTN","C0XMAIN",111,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",112,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",113,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",114,0) - D USEFARY(FARY) -"RTN","C0XMAIN",115,0) - N ZIEN -"RTN","C0XMAIN",116,0) - S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN -"RTN","C0XMAIN",117,0) - D CLEAN^DILF -"RTN","C0XMAIN",118,0) - K ZERR -"RTN","C0XMAIN",119,0) - D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") -"RTN","C0XMAIN",120,0) - I $D(ZERR) D ; -"RTN","C0XMAIN",121,0) - . ZWR ZERR -"RTN","C0XMAIN",122,0) - Q -"RTN","C0XMAIN",123,0) - ; -"RTN","C0XMAIN",124,0) -GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT -"RTN","C0XMAIN",125,0) - ; ZRTN IS PASSED BY REFERENCE -"RTN","C0XMAIN",126,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",127,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",128,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",129,0) - D USEFARY(FARY) -"RTN","C0XMAIN",130,0) - N ZIEN -"RTN","C0XMAIN",131,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XMAIN",132,0) - S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") -"RTN","C0XMAIN",133,0) - Q -"RTN","C0XMAIN",134,0) - ; -"RTN","C0XMAIN",135,0) -WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL -"RTN","C0XMAIN",136,0) - ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING -"RTN","C0XMAIN",137,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",138,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",139,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",140,0) - D USEFARY(FARY) -"RTN","C0XMAIN",141,0) - N ZIEN -"RTN","C0XMAIN",142,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XMAIN",143,0) - Q $NA(@C0XSN@(ZIEN,1)) -"RTN","C0XMAIN",144,0) - ; -"RTN","C0XMAIN",145,0) -FILEIN(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH -"RTN","C0XMAIN",146,0) - ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT -"RTN","C0XMAIN",147,0) - ; IE ^TMP("C0X","FILEIN",1) -"RTN","C0XMAIN",148,0) - ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 -"RTN","C0XMAIN",149,0) - ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH -"RTN","C0XMAIN",150,0) - S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) -"RTN","C0XMAIN",151,0) - Q OK -"RTN","C0XMAIN",152,0) - ; -"RTN","C0XMAIN",153,0) -TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE -"RTN","C0XMAIN",154,0) - S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) -"RTN","C0XMAIN",155,0) - S ZGRAPH="/test/rdfFile" -"RTN","C0XMAIN",156,0) - S ZM="/test/rdfFile/meta" -"RTN","C0XMAIN",157,0) - D PROCESS(.G,ZIN,ZGRAPH,ZM) -"RTN","C0XMAIN",158,0) - Q -"RTN","C0XMAIN",159,0) - ; -"RTN","C0XMAIN",160,0) -PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE -"RTN","C0XMAIN",161,0) - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING -"RTN","C0XMAIN",162,0) - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE -"RTN","C0XMAIN",163,0) - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS -"RTN","C0XMAIN",164,0) - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA -"RTN","C0XMAIN",165,0) - ; -"RTN","C0XMAIN",166,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",167,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",168,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",169,0) - D USEFARY(FARY) -"RTN","C0XMAIN",170,0) - ; -- first parse the rdf file with the MXML parser -"RTN","C0XMAIN",171,0) - ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML -"RTN","C0XMAIN",172,0) - S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W") -"RTN","C0XMAIN",173,0) - ; -- assign the MXLM dom global name to ZDOM -"RTN","C0XMAIN",174,0) - S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID)) -"RTN","C0XMAIN",175,0) - W !,$O(@ZDOM@(""),-1)," XML NODES PARSED" -"RTN","C0XMAIN",176,0) - ; -- populate the metagraph to point to the graph with status unfinished -"RTN","C0XMAIN",177,0) - S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT -"RTN","C0XMAIN",178,0) - I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH -"RTN","C0XMAIN",179,0) - D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH -"RTN","C0XMAIN",180,0) - D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished -"RTN","C0XMAIN",181,0) - ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT") -"RTN","C0XMAIN",182,0) - S C0XDATE=$$NOW^XLFDT -"RTN","C0XMAIN",183,0) - D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY) -"RTN","C0XMAIN",184,0) - D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store -"RTN","C0XMAIN",185,0) - ; -- -"RTN","C0XMAIN",186,0) - ; -- pull out the vocabularies in the RDF statement. marked with xmlns: -"RTN","C0XMAIN",187,0) - ; -- put them in a local variable for quick reference -"RTN","C0XMAIN",188,0) - ; -- TODO: create a graph for vocabularies and validate incoming against it -"RTN","C0XMAIN",189,0) - ; -"RTN","C0XMAIN",190,0) - S C0XVOC="" -"RTN","C0XMAIN",191,0) - N ZI,ZJ,ZK S ZI="" -"RTN","C0XMAIN",192,0) - F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns -"RTN","C0XMAIN",193,0) - . S ZVOC=$P(ZI,"xmlns:",2) -"RTN","C0XMAIN",194,0) - . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI)) -"RTN","C0XMAIN",195,0) - ;W !,"VOCABS:" ZWR C0XVOC -"RTN","C0XMAIN",196,0) - ; -"RTN","C0XMAIN",197,0) - ; -- look for children called rdf:Description. quit if none. not an rdf file -"RTN","C0XMAIN",198,0) - ; -"RTN","C0XMAIN",199,0) - S ZI=$O(@ZDOM@(1,"C","")) -"RTN","C0XMAIN",200,0) - I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file -"RTN","C0XMAIN",201,0) - . W !,"Error. Not an RDF file. Cannot process." -"RTN","C0XMAIN",202,0) - ; -"RTN","C0XMAIN",203,0) - ; -- now process the rdf description children -"RTN","C0XMAIN",204,0) - ; -"RTN","C0XMAIN",205,0) - S ZI="" -"RTN","C0XMAIN",206,0) - S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate -"RTN","C0XMAIN",207,0) - F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ; -"RTN","C0XMAIN",208,0) - . ; -- we are skipping any child that is not rdf:Description -"RTN","C0XMAIN",209,0) - . ; -- TODO: check to see if this is right in general -"RTN","C0XMAIN",210,0) - . ; -"RTN","C0XMAIN",211,0) - . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; -"RTN","C0XMAIN",212,0) - . . W !,"SKIPPING NODE: ",ZI -"RTN","C0XMAIN",213,0) - . ; -- now looking for the subject for the triples -"RTN","C0XMAIN",214,0) - . S ZX=$G(@ZDOM@(ZI,"A","rdf:about")) -"RTN","C0XMAIN",215,0) - . I ZX'="" D ; we have the subject -"RTN","C0XMAIN",216,0) - . . ;W " about: ",ZX -"RTN","C0XMAIN",217,0) - . . S C0XSUB=ZX -"RTN","C0XMAIN",218,0) - . E D ; -"RTN","C0XMAIN",219,0) - . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject -"RTN","C0XMAIN",220,0) - . . I ZX'="" D ; -"RTN","C0XMAIN",221,0) - . . . S C0XSUB=ZX -"RTN","C0XMAIN",222,0) - . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT -"RTN","C0XMAIN",223,0) - . ; -"RTN","C0XMAIN",224,0) - . ; -- we now have the subject. the children of this node have the rest -"RTN","C0XMAIN",225,0) - . ; -"RTN","C0XMAIN",226,0) - . S ZJ="" ; for the children of the rdf:Description nodes -"RTN","C0XMAIN",227,0) - . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child -"RTN","C0XMAIN",228,0) - . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix -"RTN","C0XMAIN",229,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space -"RTN","C0XMAIN",230,0) - . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix -"RTN","C0XMAIN",231,0) - . . I C0XPRE[":" D ; expand using vocabulary -"RTN","C0XMAIN",232,0) - . . . N ZB,ZA -"RTN","C0XMAIN",233,0) - . . . S ZB=$P(C0XPRE,":",1) -"RTN","C0XMAIN",234,0) - . . . S ZA=$P(C0XPRE,":",2) -"RTN","C0XMAIN",235,0) - . . . I $G(C0XVOC(ZB))'="" D ; -"RTN","C0XMAIN",236,0) - . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded -"RTN","C0XMAIN",237,0) - . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object -"RTN","C0XMAIN",238,0) - . . I ZY'="" D Q ; -"RTN","C0XMAIN",239,0) - . . . S C0XOBJ=ZY ; object -"RTN","C0XMAIN",240,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple -"RTN","C0XMAIN",241,0) - . . ; -- this is an else because of the quit above -"RTN","C0XMAIN",242,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object -"RTN","C0XMAIN",243,0) - . . I ZX'="" D Q ; got one -"RTN","C0XMAIN",244,0) - . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject -"RTN","C0XMAIN",245,0) - . . . ; without change... this could be foolish .. look at it again later -"RTN","C0XMAIN",246,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XMAIN",247,0) - . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here -"RTN","C0XMAIN",248,0) - . . I C0XOBJ="" D Q ; not a happy situation -"RTN","C0XMAIN",249,0) - . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ -"RTN","C0XMAIN",250,0) - . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XMAIN",251,0) - W !,"INSERTING ",C0XCNT," TRIPLES" -"RTN","C0XMAIN",252,0) - D UPDIE(.C0XFDA) ; commit the updates to the file -"RTN","C0XMAIN",253,0) - ; next, mark the graph as finished -"RTN","C0XMAIN",254,0) - S C0XEND=$$NOW^XLFDT -"RTN","C0XMAIN",255,0) - W !," ENDED AT: ",C0XEND -"RTN","C0XMAIN",256,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2) -"RTN","C0XMAIN",257,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XMAIN",258,0) - W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" -"RTN","C0XMAIN",259,0) - Q -"RTN","C0XMAIN",260,0) - ; -"RTN","C0XMAIN",261,0) -SHOW(ZN) ; -"RTN","C0XMAIN",262,0) - ZWR ^TMP("MXMLDOM",$J,1,ZN,*) -"RTN","C0XMAIN",263,0) - Q -"RTN","C0XMAIN",264,0) - ; -"RTN","C0XMAIN",265,0) -ANONS() ; RETURNS AN ANONOMOUS SUBJECT -"RTN","C0XMAIN",266,0) - Q "_S:"_$$LKY9 -"RTN","C0XMAIN",267,0) - ; -"RTN","C0XMAIN",268,0) -NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED -"RTN","C0XMAIN",269,0) - ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT -"RTN","C0XMAIN",270,0) - ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN -"RTN","C0XMAIN",271,0) - S NGRAPH="G"_$$LKY9 -"RTN","C0XMAIN",272,0) - S NMETA=NGRAPH_"A" -"RTN","C0XMAIN",273,0) - Q -"RTN","C0XMAIN",274,0) - ; -"RTN","C0XMAIN",275,0) -ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT -"RTN","C0XMAIN",276,0) - ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE -"RTN","C0XMAIN",277,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",278,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",279,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",280,0) - D USEFARY(FARY) -"RTN","C0XMAIN",281,0) - I '$D(C0XCNT) S C0XCNT=0 -"RTN","C0XMAIN",282,0) - N ZNODE -"RTN","C0XMAIN",283,0) - S ZNODE="N"_$$LKY17 -"RTN","C0XMAIN",284,0) - N ZNARY ; GET READY TO CALL IENOFA -"RTN","C0XMAIN",285,0) - S ZNARY("ZG",ZG)="" -"RTN","C0XMAIN",286,0) - S ZNARY("ZS",ZS)="" -"RTN","C0XMAIN",287,0) - S ZNARY("ZP",ZP)="" -"RTN","C0XMAIN",288,0) - S ZNARY("ZO",ZO)="" -"RTN","C0XMAIN",289,0) - D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS -"RTN","C0XMAIN",290,0) - ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN -"RTN","C0XMAIN",291,0) - ;S ZSIEN=$$IENOF(ZS) -"RTN","C0XMAIN",292,0) - ;S ZPIEN=$$IENOF(ZP) -"RTN","C0XMAIN",293,0) - ;S ZOIEN=$$IENOF(ZO) -"RTN","C0XMAIN",294,0) - ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED -"RTN","C0XMAIN",295,0) - S C0XCNT=C0XCNT+1 -"RTN","C0XMAIN",296,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE -"RTN","C0XMAIN",297,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG","")) -"RTN","C0XMAIN",298,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS","")) -"RTN","C0XMAIN",299,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP","")) -"RTN","C0XMAIN",300,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO","")) -"RTN","C0XMAIN",301,0) - ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE -"RTN","C0XMAIN",302,0) - Q -"RTN","C0XMAIN",303,0) - ; -"RTN","C0XMAIN",304,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",305,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",306,0) - N ZN,ZI -"RTN","C0XMAIN",307,0) - S ZN="" -"RTN","C0XMAIN",308,0) - F ZI=1:1:9 D ; -"RTN","C0XMAIN",309,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",310,0) - Q ZN -"RTN","C0XMAIN",311,0) - ; -"RTN","C0XMAIN",312,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",313,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",314,0) - N ZN,ZI -"RTN","C0XMAIN",315,0) - S ZN="" -"RTN","C0XMAIN",316,0) - F ZI=1:1:17 D ; -"RTN","C0XMAIN",317,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",318,0) - Q ZN -"RTN","C0XMAIN",319,0) - ; -"RTN","C0XMAIN",320,0) -IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE -"RTN","C0XMAIN",321,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",322,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",323,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",324,0) - N ZIEN -"RTN","C0XMAIN",325,0) - S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",326,0) - I ZIEN="" D ; -"RTN","C0XMAIN",327,0) - . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING -"RTN","C0XMAIN",328,0) - . D UPDIE(.C0XFDA2) -"RTN","C0XMAIN",329,0) - . S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",330,0) - . K C0XFDA2 -"RTN","C0XMAIN",331,0) - Q ZIEN -"RTN","C0XMAIN",332,0) - ; -"RTN","C0XMAIN",333,0) -IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE -"RTN","C0XMAIN",334,0) - ; OR ADD THEM IF -"RTN","C0XMAIN",335,0) - ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE -"RTN","C0XMAIN",336,0) - ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")="" -"RTN","C0XMAIN",337,0) - ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" -"RTN","C0XMAIN",338,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",339,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",340,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",341,0) - K ZOUTARY ; START WITH CLEAN RESULTS -"RTN","C0XMAIN",342,0) - K C0XFDA2 ; USE A SEPARATE FDA FOR THIS -"RTN","C0XMAIN",343,0) - N ZI S ZI="" -"RTN","C0XMAIN",344,0) - N ZV,ZIEN -"RTN","C0XMAIN",345,0) - N ZCNT S ZCNT=0 -"RTN","C0XMAIN",346,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS -"RTN","C0XMAIN",347,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XMAIN",348,0) - . I $O(@C0XSN@("B",ZV,""))="" D ; -"RTN","C0XMAIN",349,0) - . . S ZCNT=ZCNT+1 -"RTN","C0XMAIN",350,0) - . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV -"RTN","C0XMAIN",351,0) - I $D(C0XFDA2) D ; -"RTN","C0XMAIN",352,0) - . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS -"RTN","C0XMAIN",353,0) - . K C0XFDA2 ; CLEAN UP -"RTN","C0XMAIN",354,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS -"RTN","C0XMAIN",355,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XMAIN",356,0) - . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW -"RTN","C0XMAIN",357,0) - . I ZIEN="" D ; -"RTN","C0XMAIN",358,0) - . . W !,"ERROR ADDING STRING: ",ZV -"RTN","C0XMAIN",359,0) - . . B -"RTN","C0XMAIN",360,0) - . S ZOUTARY("IEN",ZI,ZIEN)="" -"RTN","C0XMAIN",361,0) - Q -"RTN","C0XMAIN",362,0) - ; -"RTN","C0XMAIN",363,0) -UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS -"RTN","C0XMAIN",364,0) - ; ZFDA IS PASSED BY REFERENCE -"RTN","C0XMAIN",365,0) - ;ZWR ZFDA -"RTN","C0XMAIN",366,0) - ;B -"RTN","C0XMAIN",367,0) - K ZERR -"RTN","C0XMAIN",368,0) - D CLEAN^DILF -"RTN","C0XMAIN",369,0) - D UPDATE^DIE("","ZFDA","","ZERR") -"RTN","C0XMAIN",370,0) - I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, -"RTN","C0XMAIN",371,0) - ; INVOKE THE ERROR TRAP IF TASKED -"RTN","C0XMAIN",372,0) - ;. W "ERROR",! -"RTN","C0XMAIN",373,0) - ;. ZWR ZERR -"RTN","C0XMAIN",374,0) - ;. B -"RTN","C0XMAIN",375,0) - K ZFDA -"RTN","C0XMAIN",376,0) - Q -"RTN","C0XMAIN",377,0) - ; -"RTN","C0XRDF") -0^7^B4392 -"RTN","C0XRDF",1,0) -C0XRDF ; GPL - Fileman Triples RDF out ;11/07/11 17:05 -"RTN","C0XRDF",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 9 -"RTN","C0XRDF",3,0) - ;Copyright 2012 George Lilly. Licensed under the terms of the GNU -"RTN","C0XRDF",4,0) - ;General Public License See attached copy of the License. -"RTN","C0XRDF",5,0) - ; -"RTN","C0XRDF",6,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XRDF",7,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XRDF",8,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XRDF",9,0) - ;(at your option) any later version. -"RTN","C0XRDF",10,0) - ; -"RTN","C0XRDF",11,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XRDF",12,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XRDF",13,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XRDF",14,0) - ;GNU General Public License for more details. -"RTN","C0XRDF",15,0) - ; -"RTN","C0XRDF",16,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XRDF",17,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XRDF",18,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XRDF",19,0) - ; -"RTN","C0XRDF",20,0) - Q -"RTN","C0XRDF",21,0) - ; -"RTN","C0XRDF",22,0) -REPLYSTART(ZARY); -"RTN","C0XRDF",23,0) - D ADD(ZARY,"") -"RTN","C0XRDF",24,0) - D ADD(ZARY,"") -"RTN","C0XRDF",25,0) - Q -"RTN","C0XRDF",26,0) - ; -"RTN","C0XRDF",27,0) -LISTSTART(ZARY,ZNAM) -"RTN","C0XRDF",28,0) - Q -"RTN","C0XRDF",29,0) - ; -"RTN","C0XRDF",30,0) -DICTSTART(ZARY,ZSUB) -"RTN","C0XRDF",31,0) - I ZSUB["http" D Q ; -"RTN","C0XRDF",32,0) - . D ADD(ZARY,"") -"RTN","C0XRDF",33,0) - I $E(ZSUB,1,1)="/" D Q ; -"RTN","C0XRDF",34,0) - . D ADD(ZARY,"") -"RTN","C0XRDF",35,0) - D ADD(ZARY,"") -"RTN","C0XRDF",36,0) - Q -"RTN","C0XRDF",37,0) - ; -"RTN","C0XRDF",38,0) -DASSERT(ZARY,ZPRED,ZOBJ) -"RTN","C0XRDF",39,0) - I ZPRED[":" D Q ; -"RTN","C0XRDF",40,0) - . I ZPRED="rdf:type" D Q ; -"RTN","C0XRDF",41,0) - . . D ADD(ZARY,"") -"RTN","C0XRDF",42,0) - . N ZA,ZB,ZC -"RTN","C0XRDF",43,0) - . S ZA=$P(ZPRED,":",1) -"RTN","C0XRDF",44,0) - . S ZB=$P(ZPRED,":",2) -"RTN","C0XRDF",45,0) - . I $E(ZB,1,1)="/" D ; -"RTN","C0XRDF",46,0) - . . S ZB=$P(ZB,"/",2) ; handling gpltest:/note situations -"RTN","C0XRDF",47,0) - . S ZC=C0XVOC(ZA) -"RTN","C0XRDF",48,0) - . I ZOBJ["nodeID:" D Q ; -"RTN","C0XRDF",49,0) - . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:nodeID="""_$$EXT^C0XUTIL(ZOBJ)_"""/>") -"RTN","C0XRDF",50,0) - . S ZOBJ=$$EXT^C0XUTIL(ZOBJ) -"RTN","C0XRDF",51,0) - . I ZOBJ["http" D Q ; -"RTN","C0XRDF",52,0) - . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:resource="""_ZOBJ_"""/>") -"RTN","C0XRDF",53,0) - . I $E(ZOBJ,1,1)="/" D Q ; -"RTN","C0XRDF",54,0) - . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:resource="""_ZOBJ_"""/>") -"RTN","C0XRDF",55,0) - . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""">"_$$EXT^C0XUTIL(ZOBJ)_"") -"RTN","C0XRDF",56,0) - Q -"RTN","C0XRDF",57,0) - ; -"RTN","C0XRDF",58,0) -DICTEND(ZARY) -"RTN","C0XRDF",59,0) - D ADD(ZARY,"") -"RTN","C0XRDF",60,0) - Q -"RTN","C0XRDF",61,0) - ; -"RTN","C0XRDF",62,0) -LISTEND(ZARY) -"RTN","C0XRDF",63,0) - Q -"RTN","C0XRDF",64,0) - ; -"RTN","C0XRDF",65,0) -REPLYEND(ZARY) -"RTN","C0XRDF",66,0) - D ADD(ZARY,"") -"RTN","C0XRDF",67,0) - Q -"RTN","C0XRDF",68,0) - ; -"RTN","C0XRDF",69,0) -ADD(ZARY,ZELE) -"RTN","C0XRDF",70,0) - N ZI -"RTN","C0XRDF",71,0) - I '$D(ZARY) S @ZARY@(1)=ZELE Q ; -"RTN","C0XRDF",72,0) - S ZI=$O(@ZARY@(""),-1) -"RTN","C0XRDF",73,0) - S @ZARY@(ZI+1)=ZELE -"RTN","C0XRDF",74,0) - Q -"RTN","C0XRDF",75,0) - ; -"RTN","C0XRDF",76,0) -rdfout(rdfout,zary) ; -"RTN","C0XRDF",77,0) - d REPLYSTART("rdfout") -"RTN","C0XRDF",78,0) - d LISTSTART("rdfout","results") -"RTN","C0XRDF",79,0) - n zi s zi="" -"RTN","C0XRDF",80,0) - f s zi=$o(zary(zi)) q:zi="" d ; for each subject -"RTN","C0XRDF",81,0) - . n zii s zii="" -"RTN","C0XRDF",82,0) - . D DICTSTART("rdfout",$$EXT^C0XUTIL(zi)) -"RTN","C0XRDF",83,0) - . f s zii=$o(zary(zi,zii)) q:zii="" d ; for each pred^obj pair -"RTN","C0XRDF",84,0) - . . d DASSERT("rdfout",$p(zii,"^",1),$p(zii,"^",2)) -"RTN","C0XRDF",85,0) - . D DICTEND("rdfout") -"RTN","C0XRDF",86,0) - d LISTEND("rdfout") -"RTN","C0XRDF",87,0) - d REPLYEND("rdfout") -"RTN","C0XRDF",88,0) - q -"RTN","C0XRDF",89,0) - ; -"RTN","C0XTEST") -0^3^B14490662 -"RTN","C0XTEST",1,0) -C0XTEST ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05 -"RTN","C0XTEST",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 9 -"RTN","C0XTEST",3,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU -"RTN","C0XTEST",4,0) - ;General Public License See attached copy of the License. -"RTN","C0XTEST",5,0) - ; -"RTN","C0XTEST",6,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XTEST",7,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XTEST",8,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XTEST",9,0) - ;(at your option) any later version. -"RTN","C0XTEST",10,0) - ; -"RTN","C0XTEST",11,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XTEST",12,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XTEST",13,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XTEST",14,0) - ;GNU General Public License for more details. -"RTN","C0XTEST",15,0) - ; -"RTN","C0XTEST",16,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XTEST",17,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XTEST",18,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XTEST",19,0) - ; -"RTN","C0XTEST",20,0) - Q -"RTN","C0XTEST",21,0) - ; -"RTN","C0XTEST",22,0) -EN ; run the test -"RTN","C0XTEST",23,0) - ; -"RTN","C0XTEST",24,0) - k C0XFDA ; clear the node variable -"RTN","C0XTEST",25,0) - i '$d(^C0X(101,0)) d ; global doesn't exist -"RTN","C0XTEST",26,0) - . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1" -"RTN","C0XTEST",27,0) - n zg -"RTN","C0XTEST",28,0) - S zg="_:G"_$$LKY9 ; all nodes are in the same graph -"RTN","C0XTEST",29,0) - n zi -"RTN","C0XTEST",30,0) - f zi=1:1:100000 d ; try a test of 10000 nodes -"RTN","C0XTEST",31,0) - . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name -"RTN","C0XTEST",32,0) - . s C0XFDA(172.101,zi,.02)=zg -"RTN","C0XTEST",33,0) - . s C0XFDA(172.101,zi,.03)=$R(100000) -"RTN","C0XTEST",34,0) - . s C0XFDA(172.101,zi,.04)=$R(100000) -"RTN","C0XTEST",35,0) - . s C0XFDA(172.101,zi,.05)=$R(100000) -"RTN","C0XTEST",36,0) - S C0XST=$$NOW^XLFDT ; start of the insertion test -"RTN","C0XTEST",37,0) - W !,"INSERTION STARTS AT ",C0XST,! -"RTN","C0XTEST",38,0) - d BULKLOAD(.C0XFDA) -"RTN","C0XTEST",39,0) - s C0XEND=$$NOW^XLFDT ; end of the insertion test -"RTN","C0XTEST",40,0) - W !,"INSERTION ENDS AT ",C0XEND -"RTN","C0XTEST",41,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XST,2) -"RTN","C0XTEST",42,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XTEST",43,0) - I C0XDIFF>0 W !," APPROXIMATELY ",$P(100000/C0XDIFF,".")," NODES PER SECOND" -"RTN","C0XTEST",44,0) - q -"RTN","C0XTEST",45,0) - ; -"RTN","C0XTEST",46,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTEST",47,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTEST",48,0) - N ZN,ZI -"RTN","C0XTEST",49,0) - S ZN="" -"RTN","C0XTEST",50,0) - F ZI=1:1:9 D ; -"RTN","C0XTEST",51,0) - . S ZN=ZN_$R(10) -"RTN","C0XTEST",52,0) - Q ZN -"RTN","C0XTEST",53,0) - ; -"RTN","C0XTEST",54,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTEST",55,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTEST",56,0) - N ZN,ZI -"RTN","C0XTEST",57,0) - S ZN="" -"RTN","C0XTEST",58,0) - F ZI=1:1:17 D ; -"RTN","C0XTEST",59,0) - . S ZN=ZN_$R(10) -"RTN","C0XTEST",60,0) - Q ZN -"RTN","C0XTEST",61,0) - ; -"RTN","C0XTEST",62,0) -BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 -"RTN","C0XTEST",63,0) - ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE -"RTN","C0XTEST",64,0) - ; QUITS IF FILE IS NOT 172.101 -"RTN","C0XTEST",65,0) - ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 -"RTN","C0XTEST",66,0) - ; QUITS IF FIRST ENTRY IS NOT IENS 1 -"RTN","C0XTEST",67,0) - ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES -"RTN","C0XTEST",68,0) - ; ZBFDA IS PASSED BY REFERENCE -"RTN","C0XTEST",69,0) - ; -"RTN","C0XTEST",70,0) - ; -- reserves a block of iens from file 172.101 by locking the zero node -"RTN","C0XTEST",71,0) - ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 -"RTN","C0XTEST",72,0) - ; -- then unlocking to minimize the duration of the lock -"RTN","C0XTEST",73,0) - ; -"RTN","C0XTEST",74,0) - W !,"USING BULKLOAD" -"RTN","C0XTEST",75,0) - I '$D(ZBFDA) Q ; EMPTY FDA -"RTN","C0XTEST",76,0) - I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE -"RTN","C0XTEST",77,0) - N ZCNT,ZP3,ZP4 -"RTN","C0XTEST",78,0) - ; -- find the number of nodes to insert -"RTN","C0XTEST",79,0) - S ZCNT=$O(ZBFDA(172.101,""),-1) -"RTN","C0XTEST",80,0) - I ZCNT="" D Q ; -"RTN","C0XTEST",81,0) - . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" -"RTN","C0XTEST",82,0) - . B -"RTN","C0XTEST",83,0) - ; -- lock the zero node and reserve a block of iens to insert -"RTN","C0XTEST",84,0) - W !,"LOCKING ZERO NODE" -"RTN","C0XTEST",85,0) - LOCK +^C0X(101,0) -"RTN","C0XTEST",86,0) - S ZP3=$P(^C0X(101,0),U,3) -"RTN","C0XTEST",87,0) - S ZP4=$P(^C0X(101,0),U,4) -"RTN","C0XTEST",88,0) - S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 -"RTN","C0XTEST",89,0) - S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 -"RTN","C0XTEST",90,0) - LOCK -^C0X(101,0) -"RTN","C0XTEST",91,0) - N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE -"RTN","C0XTEST",92,0) - S ZBASE=ZP3 ; the last ien in the file -"RTN","C0XTEST",93,0) - W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT -"RTN","C0XTEST",94,0) - W !,$$NOW^XLFDT -"RTN","C0XTEST",95,0) - S ZI="" -"RTN","C0XTEST",96,0) - F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; -"RTN","C0XTEST",97,0) - . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name -"RTN","C0XTEST",98,0) - . I ZN="" D BLKERR Q ; -"RTN","C0XTEST",99,0) - . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer -"RTN","C0XTEST",100,0) - . I ZG="" D BLKERR Q ; -"RTN","C0XTEST",101,0) - . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer -"RTN","C0XTEST",102,0) - . I ZS="" D BLKERR Q ; -"RTN","C0XTEST",103,0) - . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer -"RTN","C0XTEST",104,0) - . I ZP="" D BLKERR Q ; -"RTN","C0XTEST",105,0) - . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer -"RTN","C0XTEST",106,0) - . I ZO="" D BLKERR Q ; -"RTN","C0XTEST",107,0) - . S ZIEN=ZI+ZBASE ; the new ien -"RTN","C0XTEST",108,0) - . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node -"RTN","C0XTEST",109,0) - . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index -"RTN","C0XTEST",110,0) - . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index -"RTN","C0XTEST",111,0) - . S ^C0X(101,"SPO",ZS,ZP,ZO)="" -"RTN","C0XTEST",112,0) - . S ^C0X(101,"SOP",ZS,ZO,ZP)="" -"RTN","C0XTEST",113,0) - . S ^C0X(101,"OPS",ZO,ZP,ZS)="" -"RTN","C0XTEST",114,0) - . S ^C0X(101,"OSP",ZO,ZS,ZP)="" -"RTN","C0XTEST",115,0) - . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" -"RTN","C0XTEST",116,0) - . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" -"RTN","C0XTEST",117,0) - . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" -"RTN","C0XTEST",118,0) - . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" -"RTN","C0XTEST",119,0) - Q -"RTN","C0XTEST",120,0) - ; -"RTN","C0XTEST",121,0) -BLKERR ; -"RTN","C0XTEST",122,0) - W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) -"RTN","C0XTEST",123,0) - B -"RTN","C0XTEST",124,0) - Q -"RTN","C0XTEST",125,0) - ; -"RTN","C0XTKSB") -0^6^B17580555 -"RTN","C0XTKSB",1,0) -C0XTESTKSB ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05 -"RTN","C0XTKSB",2,0) - ; KSB - modified to fix a minor bug and to use;;;;;Build 9 -"RTN","C0XTKSB",3,0) - ; high resolution time if routines available ; 11/19/11 1410 EST -"RTN","C0XTKSB",4,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 1 -"RTN","C0XTKSB",5,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU -"RTN","C0XTKSB",6,0) - ;General Public License See attached copy of the License. -"RTN","C0XTKSB",7,0) - ; -"RTN","C0XTKSB",8,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XTKSB",9,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XTKSB",10,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XTKSB",11,0) - ;(at your option) any later version. -"RTN","C0XTKSB",12,0) - ; -"RTN","C0XTKSB",13,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XTKSB",14,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XTKSB",15,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XTKSB",16,0) - ;GNU General Public License for more details. -"RTN","C0XTKSB",17,0) - ; -"RTN","C0XTKSB",18,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XTKSB",19,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XTKSB",20,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XTKSB",21,0) - ; -"RTN","C0XTKSB",22,0) - Q -"RTN","C0XTKSB",23,0) - ; -"RTN","C0XTKSB",24,0) -EN ; run the test -"RTN","C0XTKSB",25,0) - ; -"RTN","C0XTKSB",26,0) - k C0XFDA ; clear the node variable -"RTN","C0XTKSB",27,0) - s U="^" ; initialization - Bhaskar 20111119 -"RTN","C0XTKSB",28,0) - i '$d(^C0X(101,0)) d ; global doesn't exist -"RTN","C0XTKSB",29,0) - . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1" -"RTN","C0XTKSB",30,0) - n zg -"RTN","C0XTKSB",31,0) - S zg="_:G"_$$LKY9 ; all nodes are in the same graph -"RTN","C0XTKSB",32,0) - n zi -"RTN","C0XTKSB",33,0) - f zi=1:1:10000 d ; try a test of 10000 nodes -"RTN","C0XTKSB",34,0) - . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name -"RTN","C0XTKSB",35,0) - . s C0XFDA(172.101,zi,.02)=zg -"RTN","C0XTKSB",36,0) - . s C0XFDA(172.101,zi,.03)=$R(100000) -"RTN","C0XTKSB",37,0) - . s C0XFDA(172.101,zi,.04)=$R(100000) -"RTN","C0XTKSB",38,0) - . s C0XFDA(172.101,zi,.05)=$R(100000) -"RTN","C0XTKSB",39,0) - S C0XST=$$H ; start of the insertion test -"RTN","C0XTKSB",40,0) - W !,"INSERTION STARTS AT ",$ZDATE(C0XST,"YEAR-MM-DD:24:60:SS"),! -"RTN","C0XTKSB",41,0) - d BULKLOAD(.C0XFDA) -"RTN","C0XTKSB",42,0) - s C0XEND=$$H ; end of the insertion test -"RTN","C0XTKSB",43,0) - W !,"INSERTION ENDS AT ",$ZDATE(C0XEND,"YEAR-MM-DD:24:60:SS") -"RTN","C0XTKSB",44,0) - S C0XDIFF=(86400*($P(C0XEND,",",1)-$P(C0XST,",",1)))+$P(C0XEND,",",2)-$P(C0XST,",",2) -"RTN","C0XTKSB",45,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XTKSB",46,0) - W ! -"RTN","C0XTKSB",47,0) - W:C0XDIFF>0 " APPROXIMATELY ",$FN(10000/C0XDIFF,",",0)," NODES PER SECOND",! -"RTN","C0XTKSB",48,0) - q -"RTN","C0XTKSB",49,0) - ; -"RTN","C0XTKSB",50,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTKSB",51,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTKSB",52,0) - N ZN,ZI -"RTN","C0XTKSB",53,0) - S ZN="" -"RTN","C0XTKSB",54,0) - F ZI=1:1:9 D ; -"RTN","C0XTKSB",55,0) - . S ZN=ZN_$R(10) -"RTN","C0XTKSB",56,0) - Q ZN -"RTN","C0XTKSB",57,0) - ; -"RTN","C0XTKSB",58,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTKSB",59,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTKSB",60,0) - N ZN,ZI -"RTN","C0XTKSB",61,0) - S ZN="" -"RTN","C0XTKSB",62,0) - F ZI=1:1:17 D ; -"RTN","C0XTKSB",63,0) - . S ZN=ZN_$R(10) -"RTN","C0XTKSB",64,0) - Q ZN -"RTN","C0XTKSB",65,0) - ; -"RTN","C0XTKSB",66,0) -BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 -"RTN","C0XTKSB",67,0) - ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE -"RTN","C0XTKSB",68,0) - ; QUITS IF FILE IS NOT 172.101 -"RTN","C0XTKSB",69,0) - ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 -"RTN","C0XTKSB",70,0) - ; QUITS IF FIRST ENTRY IS NOT IENS 1 -"RTN","C0XTKSB",71,0) - ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES -"RTN","C0XTKSB",72,0) - ; ZBFDA IS PASSED BY REFERENCE -"RTN","C0XTKSB",73,0) - ; -"RTN","C0XTKSB",74,0) - ; -- reserves a block of iens from file 172.101 by locking the zero node -"RTN","C0XTKSB",75,0) - ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 -"RTN","C0XTKSB",76,0) - ; -- then unlocking to minimize the duration of the lock -"RTN","C0XTKSB",77,0) - ; -"RTN","C0XTKSB",78,0) - W !,"USING BULKLOAD" -"RTN","C0XTKSB",79,0) - I '$D(ZBFDA) Q ; EMPTY FDA -"RTN","C0XTKSB",80,0) - I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE -"RTN","C0XTKSB",81,0) - N ZCNT,ZP3,ZP4 -"RTN","C0XTKSB",82,0) - ; -- find the number of nodes to insert -"RTN","C0XTKSB",83,0) - S ZCNT=$O(ZBFDA(172.101,""),-1) -"RTN","C0XTKSB",84,0) - I ZCNT="" D Q ; -"RTN","C0XTKSB",85,0) - . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" -"RTN","C0XTKSB",86,0) - . B -"RTN","C0XTKSB",87,0) - ; -- lock the zero node and reserve a block of iens to insert -"RTN","C0XTKSB",88,0) - W !,"LOCKING ZERO NODE" -"RTN","C0XTKSB",89,0) - LOCK +^C0X(101,0) -"RTN","C0XTKSB",90,0) - S ZP3=$P(^C0X(101,0),U,3) -"RTN","C0XTKSB",91,0) - S ZP4=$P(^C0X(101,0),U,4) -"RTN","C0XTKSB",92,0) - S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 -"RTN","C0XTKSB",93,0) - S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 -"RTN","C0XTKSB",94,0) - LOCK -^C0X(101,0) -"RTN","C0XTKSB",95,0) - N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE -"RTN","C0XTKSB",96,0) - S ZBASE=ZP3 ; the last ien in the file -"RTN","C0XTKSB",97,0) - W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT -"RTN","C0XTKSB",98,0) - W !,$ZDATE($$H,"YEAR-MM-DD:24:60:SS") -"RTN","C0XTKSB",99,0) - S ZI="" -"RTN","C0XTKSB",100,0) - F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; -"RTN","C0XTKSB",101,0) - . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name -"RTN","C0XTKSB",102,0) - . I ZN="" D BLKERR Q ; -"RTN","C0XTKSB",103,0) - . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer -"RTN","C0XTKSB",104,0) - . I ZG="" D BLKERR Q ; -"RTN","C0XTKSB",105,0) - . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer -"RTN","C0XTKSB",106,0) - . I ZS="" D BLKERR Q ; -"RTN","C0XTKSB",107,0) - . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer -"RTN","C0XTKSB",108,0) - . I ZP="" D BLKERR Q ; -"RTN","C0XTKSB",109,0) - . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer -"RTN","C0XTKSB",110,0) - . I ZO="" D BLKERR Q ; -"RTN","C0XTKSB",111,0) - . S ZIEN=ZI+ZBASE ; the new ien -"RTN","C0XTKSB",112,0) - . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node -"RTN","C0XTKSB",113,0) - . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index -"RTN","C0XTKSB",114,0) - . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index -"RTN","C0XTKSB",115,0) - . S ^C0X(101,"SPO",ZS,ZP,ZO)="" -"RTN","C0XTKSB",116,0) - . S ^C0X(101,"SOP",ZS,ZO,ZP)="" -"RTN","C0XTKSB",117,0) - . S ^C0X(101,"OPS",ZO,ZP,ZS)="" -"RTN","C0XTKSB",118,0) - . S ^C0X(101,"OSP",ZO,ZS,ZP)="" -"RTN","C0XTKSB",119,0) - . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" -"RTN","C0XTKSB",120,0) - . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" -"RTN","C0XTKSB",121,0) - . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" -"RTN","C0XTKSB",122,0) - . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" -"RTN","C0XTKSB",123,0) - Q -"RTN","C0XTKSB",124,0) - ; -"RTN","C0XTKSB",125,0) -BLKERR ; -"RTN","C0XTKSB",126,0) - W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) -"RTN","C0XTKSB",127,0) - B -"RTN","C0XTKSB",128,0) - Q -"RTN","C0XTKSB",129,0) - ; -"RTN","C0XTKSB",130,0) -H() -"RTN","C0XTKSB",131,0) - quit:$length($ztrnlnm("GTMXC_posix"))&$length($text(zhorolog^%POSIX)) $$zhorolog^%POSIX quit $horolog -"RTN","C0XUTIL") -0^5^B11155926 -"RTN","C0XUTIL",1,0) -C0XUTIL ; GPL - Fileman Triples utilities ;11/07/11 17:05 -"RTN","C0XUTIL",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 9 -"RTN","C0XUTIL",3,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU -"RTN","C0XUTIL",4,0) - ;General Public License See attached copy of the License. -"RTN","C0XUTIL",5,0) - ; -"RTN","C0XUTIL",6,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XUTIL",7,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XUTIL",8,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XUTIL",9,0) - ;(at your option) any later version. -"RTN","C0XUTIL",10,0) - ; -"RTN","C0XUTIL",11,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XUTIL",12,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XUTIL",13,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XUTIL",14,0) - ;GNU General Public License for more details. -"RTN","C0XUTIL",15,0) - ; -"RTN","C0XUTIL",16,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XUTIL",17,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XUTIL",18,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XUTIL",19,0) - ; -"RTN","C0XUTIL",20,0) - Q -"RTN","C0XUTIL",21,0) - ; -"RTN","C0XUTIL",22,0) -NSP(ZX) ; OUTPUT TRANSFORM EXTRINSIC -"RTN","C0XUTIL",23,0) - ; -"RTN","C0XUTIL",24,0) - N ZR -"RTN","C0XUTIL",25,0) - ; I WOULD REALLY LIKE TO NOT HAVE THE FILE NUMBER HARD CODED HERE -"RTN","C0XUTIL",26,0) - ; ANYONE KNOW HOW I COULD DO THAT? :) GPL -"RTN","C0XUTIL",27,0) - S ZR=$$GET1^DIQ(172.201,ZX_",",.01) -"RTN","C0XUTIL",28,0) - I '$D(C0XNSP) S C0XNSP=1 ; DEFAULT ON -"RTN","C0XUTIL",29,0) - I C0XNSP=0 Q ZR ; SWITCHED OFF -"RTN","C0XUTIL",30,0) - I '$D(C0XVOC) D VOCINIT ; INITIALIZE THE VOCABULARIES -"RTN","C0XUTIL",31,0) - N ZI,ZJ,ZK S ZI="" -"RTN","C0XUTIL",32,0) - N DONE S DONE=0 -"RTN","C0XUTIL",33,0) - F S ZI=$O(C0XVOC(ZI)) Q:(DONE=1)!(ZI="") D ; -"RTN","C0XUTIL",34,0) - . ;W !,ZI -"RTN","C0XUTIL",35,0) - . S ZJ=C0XVOC(ZI) -"RTN","C0XUTIL",36,0) - . S ZK=$P(ZR,ZJ,2) -"RTN","C0XUTIL",37,0) - . ;W !,"ZK=",ZK -"RTN","C0XUTIL",38,0) - . I ZK'="" D ; BINGO -"RTN","C0XUTIL",39,0) - . . S ZR=ZI_":"_ZK -"RTN","C0XUTIL",40,0) - . . S DONE=1 -"RTN","C0XUTIL",41,0) - Q ZR -"RTN","C0XUTIL",42,0) - ; -"RTN","C0XUTIL",43,0) -VOCINIT ; INITIALIZE VOCABULARIES -"RTN","C0XUTIL",44,0) - S C0XVOC("dcterms")="http://purl.org/dc/terms/" -"RTN","C0XUTIL",45,0) - S C0XVOC("rdf")="http://www.w3.org/1999/02/22-rdf-syntax-ns#" -"RTN","C0XUTIL",46,0) - S C0XVOC("sp")="http://smartplatforms.org/terms#" -"RTN","C0XUTIL",47,0) - S C0XVOC("qds")="http://cms.gov/pqri/qds/" -"RTN","C0XUTIL",48,0) - S C0XVOC("smart")="http://sandbox-api.smartplatforms.org/records/" -"RTN","C0XUTIL",49,0) - S C0XVOC("snomed")="http://purl.bioontology.org/ontology/SNOMEDCT/" -"RTN","C0XUTIL",50,0) - S C0XVOC("rxnorm")="http://purl.bioontology.org/ontology/RXNORM/" -"RTN","C0XUTIL",51,0) - S C0XVOC("loinc")="http://purl.bioontology.org/ontology/LNC/" -"RTN","C0XUTIL",52,0) - S C0XVOC("file")="/home/glilly/fmts/trunk/samples/" -"RTN","C0XUTIL",53,0) - S C0XVOC("foaf")="http://xmlns.com/foaf/0.1/" -"RTN","C0XUTIL",54,0) - S C0XVOC("skos")="http://www.w3.org/2004/02/skos/core#" -"RTN","C0XUTIL",55,0) - S C0XVOC("gpl")="http://georgetriples.org/" -"RTN","C0XUTIL",56,0) - S C0XVOC("cg")="http://datasets.caregraf.org/" -"RTN","C0XUTIL",57,0) - S C0XVOC("mv")="http://metavista.name/foundation#" -"RTN","C0XUTIL",58,0) - S C0XVOC("rdfs")="http://www.w3.org/2000/01/rdf-schema#" -"RTN","C0XUTIL",59,0) - S C0XVOC("vistaSmart")="https://smart2.vistaewd.net/vista/smart/records/" -"RTN","C0XUTIL",60,0) - S C0XVOC("vmu")="http://vista.org/mu/" -"RTN","C0XUTIL",61,0) - S C0XVOC("vq")="http://vista.org/quality/" -"RTN","C0XUTIL",62,0) - S C0XVOC("nodeID")="iDPsDPss" -"RTN","C0XUTIL",63,0) - S C0XVOC("fmts")="http://glilly.net/fmts#" -"RTN","C0XUTIL",64,0) - S C0XVOC("oro")="http://oro.com/vista/sage" ;change to get URL from system -"RTN","C0XUTIL",65,0) - S C0XVOC("sage")="http://oro.com/sage/schema#" -"RTN","C0XUTIL",66,0) - S C0XVOC("v")="http://www.w3.org/2006/vcard/ns#" -"RTN","C0XUTIL",67,0) - Q -"RTN","C0XUTIL",68,0) - ; -"RTN","C0XUTIL",69,0) -EXT(C0XIN) ; EXTRINSIC WHICH EXPANDS NAMESPACES -"RTN","C0XUTIL",70,0) - ; SO skos:xxx would return http://www.w3.org/2004/02/skos/core#xxx -"RTN","C0XUTIL",71,0) - N C0XPRE -"RTN","C0XUTIL",72,0) - S C0XPRE=C0XIN -"RTN","C0XUTIL",73,0) - I '$D(C0XVOC) D VOCINIT ; INITIALIZE NAME SPACE TABLE -"RTN","C0XUTIL",74,0) - I C0XPRE[":" D ; expand using vocabulary -"RTN","C0XUTIL",75,0) - . N ZB,ZA -"RTN","C0XUTIL",76,0) - . S ZB=$P(C0XPRE,":",1) -"RTN","C0XUTIL",77,0) - . S ZA=$P(C0XPRE,":",2) -"RTN","C0XUTIL",78,0) - . I $G(C0XVOC(ZB))'="" D ; -"RTN","C0XUTIL",79,0) - . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded -"RTN","C0XUTIL",80,0) - Q C0XPRE -"RTN","C0XUTIL",81,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^6 -"^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.201O^C0X(201,^0;2^Q -"^DD",172.101,172.101,.02,.1) -TRIPLE GRAPH -"^DD",172.101,172.101,.02,2) -S Y(0)=Y S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.02,2.1) -S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.02,3) -Answer must be 3-240 characters in length -"^DD",172.101,172.101,.02,"DT") -3111207 -"^DD",172.101,172.101,.03,0) -SUBJECT^P172.201O^C0X(201,^0;3^Q -"^DD",172.101,172.101,.03,.1) -TRIPLE SUBJECT -"^DD",172.101,172.101,.03,2) -S Y(0)=Y S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.03,2.1) -S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.03,"DT") -3111207 -"^DD",172.101,172.101,.04,0) -PREDICATE^P172.201O^C0X(201,^0;4^Q -"^DD",172.101,172.101,.04,.1) -TRIPLE PREDICATE -"^DD",172.101,172.101,.04,2) -S Y(0)=Y S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.04,2.1) -S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.04,"DT") -3111207 -"^DD",172.101,172.101,.05,0) -OBJECT^P172.201O^C0X(201,^0;5^Q -"^DD",172.101,172.101,.05,.1) -TRIPLE OBJECT -"^DD",172.101,172.101,.05,2) -S Y(0)=Y S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.05,2.1) -S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.05,"DT") -3111207 -"^DD",172.101,172.101,1,0) -EVENTS^172.1011V^^1;0 -"^DD",172.101,172.1011,0) -EVENTS SUB-FIELD^^.01^1 -"^DD",172.101,172.1011,0,"DT") -3110510 -"^DD",172.101,172.1011,0,"IX","B",172.1011,.01) - -"^DD",172.101,172.1011,0,"NM","EVENTS") - -"^DD",172.101,172.1011,0,"UP") -172.101 -"^DD",172.101,172.1011,.01,0) -EVENTS^V^^0;1^ -"^DD",172.101,172.1011,.01,.1) -PATIENT CLINICAL EVENTS -"^DD",172.101,172.1011,.01,1,0) -^.1 -"^DD",172.101,172.1011,.01,1,1,0) -172.1011^B -"^DD",172.101,172.1011,.01,1,1,1) -S ^C0CXREF(DA(1),1,"B",$E(X,1,30),DA)="" -"^DD",172.101,172.1011,.01,1,1,2) -K ^C0CXREF(DA(1),1,"B",$E(X,1,30),DA) -"^DD",172.101,172.1011,.01,1,1,3) -Required for Variable Pointer -"^DD",172.101,172.1011,.01,"DT") -3110510 -"^DD",172.101,172.1011,.01,"V",0) -^.12P^^3 -"^DD",172.101,172.1011,.01,"V",1,0) -55^MEDICATIONS^1^M^n^y -"^DD",172.101,172.1011,.01,"V",1,1) - -"^DD",172.101,172.1011,.01,"V",1,2) - -"^DD",172.101,172.1011,.01,"V",2,0) -9000011^PATIENT PROBLEM^2^P^n^y -"^DD",172.101,172.1011,.01,"V",2,1) - -"^DD",172.101,172.1011,.01,"V",2,2) - -"^DD",172.101,172.1011,.01,"V",3,0) -69^PATIENT LAB ORDER^3^L^n^y -"^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** diff --git a/kids/C0X_1_0_0_T2.KID b/kids/C0X_1_0_0_T2.KID deleted file mode 100644 index c31345c..0000000 --- a/kids/C0X_1_0_0_T2.KID +++ /dev/null @@ -1,1078 +0,0 @@ -KIDS Distribution saved on Oct 30, 2011@11:45:44 -version which imports some rdf files YAY!!!! -**KIDS**:C0X*1.0*0^ - -**INSTALL NAME** -C0X*1.0*0 -"BLD",7885,0) -C0X*1.0*0^^0^3111030^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) -2 -"BLD",7885,"KRN",0) -^9.67PA^779.2^20 -"BLD",7885,"KRN",.4,0) -.4 -"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^1^1 -"BLD",7885,"KRN",9.8,"NM",1,0) -C0XMAIN^^0^B76730608 -"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,"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 -"MBREQ") -0 -"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") -1 -"RTN","C0XMAIN") -0^1^B76730608 -"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 2 -"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) - W !,"STARTED: ",$$NOW^XLFDT -"RTN","C0XMAIN",61,0) - W !,"READING IN: ",FNAME -"RTN","C0XMAIN",62,0) - I '$$FILEIN(ZTMP,FDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS -"RTN","C0XMAIN",63,0) - . W !,"ERROR READING FILE: ",FDIR,FNAME -"RTN","C0XMAIN",64,0) - S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT -"RTN","C0XMAIN",65,0) - W !,$O(@ZRDF@(""),-1)," LINES READ" -"RTN","C0XMAIN",66,0) - N ZGRAPH,ZSUBJECT -"RTN","C0XMAIN",67,0) - S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME -"RTN","C0XMAIN",68,0) - S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT -"RTN","C0XMAIN",69,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:url",FURL) -"RTN","C0XMAIN",70,0) - N ZTXTNM -"RTN","C0XMAIN",71,0) - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_$$LKY9 ; NAME FOR TEXT NODE -"RTN","C0XMAIN",72,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM) -"RTN","C0XMAIN",73,0) - D UPDIE(.C0XFDA) ; TRY IT OUT -"RTN","C0XMAIN",74,0) - K C0XCNT ;RESET FOR NEXT TIME -"RTN","C0XMAIN",75,0) - D PROCESS(.G,ZRDF,FURL,ZGRAPH) ; PARSE AND INSERT THE RDF -"RTN","C0XMAIN",76,0) - Q -"RTN","C0XMAIN",77,0) - ; -"RTN","C0XMAIN",78,0) -FILEIN(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH -"RTN","C0XMAIN",79,0) - ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT -"RTN","C0XMAIN",80,0) - ; IE ^TMP("C0X","FILEIN",1) -"RTN","C0XMAIN",81,0) - ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 -"RTN","C0XMAIN",82,0) - ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH -"RTN","C0XMAIN",83,0) - S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) -"RTN","C0XMAIN",84,0) - Q OK -"RTN","C0XMAIN",85,0) - ; -"RTN","C0XMAIN",86,0) -TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE -"RTN","C0XMAIN",87,0) - S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) -"RTN","C0XMAIN",88,0) - S ZGRAPH="/test/rdfFile" -"RTN","C0XMAIN",89,0) - S ZM="/test/rdfFile/meta" -"RTN","C0XMAIN",90,0) - D PROCESS(.G,ZIN,ZGRAPH,ZM) -"RTN","C0XMAIN",91,0) - Q -"RTN","C0XMAIN",92,0) - ; -"RTN","C0XMAIN",93,0) -PROCESS(ZRTN,ZRDF,ZGRF,ZMETA) ; PROCESS AN INCOMING RDF FILE -"RTN","C0XMAIN",94,0) - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING -"RTN","C0XMAIN",95,0) - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE -"RTN","C0XMAIN",96,0) - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS -"RTN","C0XMAIN",97,0) - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA -"RTN","C0XMAIN",98,0) - ; -"RTN","C0XMAIN",99,0) - ; -- first parse the rdf file with the MXML parser -"RTN","C0XMAIN",100,0) - S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML -"RTN","C0XMAIN",101,0) - ; -- assign the MXLM dom global name to ZDOM -"RTN","C0XMAIN",102,0) - S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID)) -"RTN","C0XMAIN",103,0) - W !,$O(@ZDOM@(""),-1)," XML NODES PARSED" -"RTN","C0XMAIN",104,0) - ; -- populate the metagraph to point to the graph with status unfinished -"RTN","C0XMAIN",105,0) - S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT -"RTN","C0XMAIN",106,0) - I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH -"RTN","C0XMAIN",107,0) - D ADD(ZMETA,METAS,"fmts:about",ZGRF) ; POINT THE META TO THE GRAPH -"RTN","C0XMAIN",108,0) - D ADD(ZMETA,METAS,"fmts:status","unfinished") ; mark as unfinished -"RTN","C0XMAIN",109,0) - S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT") -"RTN","C0XMAIN",110,0) - D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE) -"RTN","C0XMAIN",111,0) - D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store -"RTN","C0XMAIN",112,0) - ; -- -"RTN","C0XMAIN",113,0) - ; -- pull out the vocabularies in the RDF statement. marked with xmlns: -"RTN","C0XMAIN",114,0) - ; -- put them in a local variable for quick reference -"RTN","C0XMAIN",115,0) - ; -- TODO: create a graph for vocabularies and validate incoming against it -"RTN","C0XMAIN",116,0) - ; -"RTN","C0XMAIN",117,0) - S C0XVOC="" -"RTN","C0XMAIN",118,0) - N ZI,ZJ,ZK S ZI="" -"RTN","C0XMAIN",119,0) - F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns -"RTN","C0XMAIN",120,0) - . S ZVOC=$P(ZI,"xmlns:",2) -"RTN","C0XMAIN",121,0) - . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI)) -"RTN","C0XMAIN",122,0) - ;W !,"VOCABS:" ZWR C0XVOC -"RTN","C0XMAIN",123,0) - ; -"RTN","C0XMAIN",124,0) - ; -- look for children called rdf:Description. quit if none. not an rdf file -"RTN","C0XMAIN",125,0) - ; -"RTN","C0XMAIN",126,0) - S ZI=$O(@ZDOM@(1,"C","")) -"RTN","C0XMAIN",127,0) - I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file -"RTN","C0XMAIN",128,0) - . W !,"Error. Not an RDF file. Cannot process." -"RTN","C0XMAIN",129,0) - ; -"RTN","C0XMAIN",130,0) - ; -- now process the rdf description children -"RTN","C0XMAIN",131,0) - ; -"RTN","C0XMAIN",132,0) - S ZI="" -"RTN","C0XMAIN",133,0) - S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate -"RTN","C0XMAIN",134,0) - F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ; -"RTN","C0XMAIN",135,0) - . ; -- we are skipping any child that is not rdf:Description -"RTN","C0XMAIN",136,0) - . ; -- TODO: check to see if this is right in general -"RTN","C0XMAIN",137,0) - . ; -"RTN","C0XMAIN",138,0) - . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; -"RTN","C0XMAIN",139,0) - . . W !,"SKIPPING NODE: ",ZI -"RTN","C0XMAIN",140,0) - . ; -- now looking for the subject for the triples -"RTN","C0XMAIN",141,0) - . S ZX=$G(@ZDOM@(ZI,"A","rdf:about")) -"RTN","C0XMAIN",142,0) - . I ZX'="" D ; we have the subject -"RTN","C0XMAIN",143,0) - . . ;W " about: ",ZX -"RTN","C0XMAIN",144,0) - . . S C0XSUB=ZX -"RTN","C0XMAIN",145,0) - . E D ; -"RTN","C0XMAIN",146,0) - . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject -"RTN","C0XMAIN",147,0) - . . I ZX'="" D ; -"RTN","C0XMAIN",148,0) - . . . S C0XSUB=ZX -"RTN","C0XMAIN",149,0) - . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT -"RTN","C0XMAIN",150,0) - . ; -"RTN","C0XMAIN",151,0) - . ; -- we now have the subject. the children of this node have the rest -"RTN","C0XMAIN",152,0) - . ; -"RTN","C0XMAIN",153,0) - . S ZJ="" ; for the children of the rdf:Description nodes -"RTN","C0XMAIN",154,0) - . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child -"RTN","C0XMAIN",155,0) - . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix -"RTN","C0XMAIN",156,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space -"RTN","C0XMAIN",157,0) - . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix -"RTN","C0XMAIN",158,0) - . . I C0XPRE[":" D ; expand using vocabulary -"RTN","C0XMAIN",159,0) - . . . N ZB,ZA -"RTN","C0XMAIN",160,0) - . . . S ZB=$P(C0XPRE,":",1) -"RTN","C0XMAIN",161,0) - . . . S ZA=$P(C0XPRE,":",2) -"RTN","C0XMAIN",162,0) - . . . I $G(C0XVOC(ZB))'="" D ; -"RTN","C0XMAIN",163,0) - . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded -"RTN","C0XMAIN",164,0) - . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object -"RTN","C0XMAIN",165,0) - . . I ZY'="" D Q ; -"RTN","C0XMAIN",166,0) - . . . S C0XOBJ=ZY ; object -"RTN","C0XMAIN",167,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple -"RTN","C0XMAIN",168,0) - . . ; -- this is an else because of the quit above -"RTN","C0XMAIN",169,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object -"RTN","C0XMAIN",170,0) - . . I ZX'="" D Q ; got one -"RTN","C0XMAIN",171,0) - . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject -"RTN","C0XMAIN",172,0) - . . . ; without change... this could be foolish .. look at it again later -"RTN","C0XMAIN",173,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XMAIN",174,0) - . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here -"RTN","C0XMAIN",175,0) - . . I C0XOBJ="" D Q ; not a happy situation -"RTN","C0XMAIN",176,0) - . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ -"RTN","C0XMAIN",177,0) - . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XMAIN",178,0) - W !,"INSERTING ",C0XCNT," TRIPLES" -"RTN","C0XMAIN",179,0) - D UPDIE(.C0XFDA) ; commit the updates to the file -"RTN","C0XMAIN",180,0) - ; next, mark the graph as finished -"RTN","C0XMAIN",181,0) - W !," ENDED AT: ",$$NOW^XLFDT -"RTN","C0XMAIN",182,0) - Q -"RTN","C0XMAIN",183,0) - ; -"RTN","C0XMAIN",184,0) -SHOW(ZN) ; -"RTN","C0XMAIN",185,0) - ZWR ^TMP("MXMLDOM",$J,1,ZN,*) -"RTN","C0XMAIN",186,0) - Q -"RTN","C0XMAIN",187,0) - ; -"RTN","C0XMAIN",188,0) -ANONS() ; RETURNS AN ANONOMOUS SUBJECT -"RTN","C0XMAIN",189,0) - Q "_S:"_$$LKY9 -"RTN","C0XMAIN",190,0) - ; -"RTN","C0XMAIN",191,0) -NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED -"RTN","C0XMAIN",192,0) - ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT -"RTN","C0XMAIN",193,0) - ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN -"RTN","C0XMAIN",194,0) - S NGRAPH="G"_$$LKY9 -"RTN","C0XMAIN",195,0) - S NMETA=NGRAPH_"A" -"RTN","C0XMAIN",196,0) - Q -"RTN","C0XMAIN",197,0) - ; -"RTN","C0XMAIN",198,0) -ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT -"RTN","C0XMAIN",199,0) - ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE -"RTN","C0XMAIN",200,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",201,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",202,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",203,0) - D USEFARY(FARY) -"RTN","C0XMAIN",204,0) - I '$D(C0XCNT) S C0XCNT=0 -"RTN","C0XMAIN",205,0) - N ZNODE -"RTN","C0XMAIN",206,0) - S ZNODE="N"_$$LKY17 -"RTN","C0XMAIN",207,0) - N ZNARY ; GET READY TO CALL IENOFA -"RTN","C0XMAIN",208,0) - S ZNARY("ZG",ZG)="" -"RTN","C0XMAIN",209,0) - S ZNARY("ZS",ZS)="" -"RTN","C0XMAIN",210,0) - S ZNARY("ZP",ZP)="" -"RTN","C0XMAIN",211,0) - S ZNARY("ZO",ZO)="" -"RTN","C0XMAIN",212,0) - D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS -"RTN","C0XMAIN",213,0) - ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN -"RTN","C0XMAIN",214,0) - ;S ZSIEN=$$IENOF(ZS) -"RTN","C0XMAIN",215,0) - ;S ZPIEN=$$IENOF(ZP) -"RTN","C0XMAIN",216,0) - ;S ZOIEN=$$IENOF(ZO) -"RTN","C0XMAIN",217,0) - ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED -"RTN","C0XMAIN",218,0) - S C0XCNT=C0XCNT+1 -"RTN","C0XMAIN",219,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE -"RTN","C0XMAIN",220,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG","")) -"RTN","C0XMAIN",221,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS","")) -"RTN","C0XMAIN",222,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP","")) -"RTN","C0XMAIN",223,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO","")) -"RTN","C0XMAIN",224,0) - ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE -"RTN","C0XMAIN",225,0) - Q -"RTN","C0XMAIN",226,0) - ; -"RTN","C0XMAIN",227,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",228,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",229,0) - N ZN,ZI -"RTN","C0XMAIN",230,0) - S ZN="" -"RTN","C0XMAIN",231,0) - F ZI=1:1:9 D ; -"RTN","C0XMAIN",232,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",233,0) - Q ZN -"RTN","C0XMAIN",234,0) - ; -"RTN","C0XMAIN",235,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",236,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",237,0) - N ZN,ZI -"RTN","C0XMAIN",238,0) - S ZN="" -"RTN","C0XMAIN",239,0) - F ZI=1:1:17 D ; -"RTN","C0XMAIN",240,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",241,0) - Q ZN -"RTN","C0XMAIN",242,0) - ; -"RTN","C0XMAIN",243,0) -IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE -"RTN","C0XMAIN",244,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",245,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",246,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",247,0) - N ZIEN -"RTN","C0XMAIN",248,0) - S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",249,0) - I ZIEN="" D ; -"RTN","C0XMAIN",250,0) - . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING -"RTN","C0XMAIN",251,0) - . D UPDIE(.C0XFDA2) -"RTN","C0XMAIN",252,0) - . S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",253,0) - . K C0XFDA2 -"RTN","C0XMAIN",254,0) - Q ZIEN -"RTN","C0XMAIN",255,0) - ; -"RTN","C0XMAIN",256,0) -IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE -"RTN","C0XMAIN",257,0) - ; OR ADD THEM IF -"RTN","C0XMAIN",258,0) - ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE -"RTN","C0XMAIN",259,0) - ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")="" -"RTN","C0XMAIN",260,0) - ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" -"RTN","C0XMAIN",261,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",262,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",263,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",264,0) - K ZOUTARY ; START WITH CLEAN RESULTS -"RTN","C0XMAIN",265,0) - K C0XFDA2 ; USE A SEPARATE FDA FOR THIS -"RTN","C0XMAIN",266,0) - N ZI S ZI="" -"RTN","C0XMAIN",267,0) - N ZV,ZIEN -"RTN","C0XMAIN",268,0) - N ZCNT S ZCNT=0 -"RTN","C0XMAIN",269,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS -"RTN","C0XMAIN",270,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XMAIN",271,0) - . I $O(@C0XSN@("B",ZV,""))="" D ; -"RTN","C0XMAIN",272,0) - . . S ZCNT=ZCNT+1 -"RTN","C0XMAIN",273,0) - . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV -"RTN","C0XMAIN",274,0) - I $D(C0XFDA2) D ; -"RTN","C0XMAIN",275,0) - . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS -"RTN","C0XMAIN",276,0) - . K C0XFDA2 ; CLEAN UP -"RTN","C0XMAIN",277,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS -"RTN","C0XMAIN",278,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XMAIN",279,0) - . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW -"RTN","C0XMAIN",280,0) - . I ZIEN="" D ; -"RTN","C0XMAIN",281,0) - . . W !,"ERROR ADDING STRING: ",ZV -"RTN","C0XMAIN",282,0) - . . B -"RTN","C0XMAIN",283,0) - . S ZOUTARY("IEN",ZI,ZIEN)="" -"RTN","C0XMAIN",284,0) - Q -"RTN","C0XMAIN",285,0) - ; -"RTN","C0XMAIN",286,0) -UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS -"RTN","C0XMAIN",287,0) - ; ZFDA IS PASSED BY REFERENCE -"RTN","C0XMAIN",288,0) - ;ZWR ZFDA -"RTN","C0XMAIN",289,0) - ;B -"RTN","C0XMAIN",290,0) - K ZERR -"RTN","C0XMAIN",291,0) - D CLEAN^DILF -"RTN","C0XMAIN",292,0) - D UPDATE^DIE("","ZFDA","","ZERR") -"RTN","C0XMAIN",293,0) - I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, -"RTN","C0XMAIN",294,0) - ; INVOKE THE ERROR TRAP IF TASKED -"RTN","C0XMAIN",295,0) - ;. W "ERROR",! -"RTN","C0XMAIN",296,0) - ;. ZWR ZERR -"RTN","C0XMAIN",297,0) - ;. B -"RTN","C0XMAIN",298,0) - K ZFDA -"RTN","C0XMAIN",299,0) - Q -"RTN","C0XMAIN",300,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") -3111013 -"^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") -3111013 -"^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") -3111013 -"^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") -3111013 -"^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** diff --git a/kids/C0X_1_0_0_T3.KID b/kids/C0X_1_0_0_T3.KID deleted file mode 100644 index 81dfed7..0000000 --- a/kids/C0X_1_0_0_T3.KID +++ /dev/null @@ -1,1334 +0,0 @@ -KIDS Distribution saved on Oct 30, 2011@23:56:02 -WGET working and GSPO etc indexes almost ready to release -**KIDS**:C0X*1.0*0^ - -**INSTALL NAME** -C0X*1.0*0 -"BLD",7885,0) -C0X*1.0*0^^0^3111030^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) -3 -"BLD",7885,"KRN",0) -^9.67PA^779.2^20 -"BLD",7885,"KRN",.4,0) -.4 -"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^1^1 -"BLD",7885,"KRN",9.8,"NM",1,0) -C0XMAIN^^0^B115009682 -"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 -"MBREQ") -0 -"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") -1 -"RTN","C0XMAIN") -0^1^B115009682 -"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 3 -"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) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XMAIN",80,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XMAIN",81,0) - W !,"DOWNLOADING: ",ZURL -"RTN","C0XMAIN",82,0) - S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP) -"RTN","C0XMAIN",83,0) - M @ZLOC=ZTMP -"RTN","C0XMAIN",84,0) - W !,$O(@ZLOC@(""),-1)," LINES READ" -"RTN","C0XMAIN",85,0) - D INSRDF(ZLOC,ZURL,FARY) -"RTN","C0XMAIN",86,0) - Q -"RTN","C0XMAIN",87,0) - ; -"RTN","C0XMAIN",88,0) -INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS -"RTN","C0XMAIN",89,0) - ; ZRDF IS PASSED BY NAME -"RTN","C0XMAIN",90,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",91,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",92,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",93,0) - D USEFARY(FARY) -"RTN","C0XMAIN",94,0) - N ZGRAPH,ZSUBJECT -"RTN","C0XMAIN",95,0) - S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME -"RTN","C0XMAIN",96,0) - S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT -"RTN","C0XMAIN",97,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY) -"RTN","C0XMAIN",98,0) - N ZTXTNM -"RTN","C0XMAIN",99,0) - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE -"RTN","C0XMAIN",100,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY) -"RTN","C0XMAIN",101,0) - D UPDIE(.C0XFDA) ; TRY IT OUT -"RTN","C0XMAIN",102,0) - K C0XCNT ;RESET FOR NEXT TIME -"RTN","C0XMAIN",103,0) - D STORETXT(ZRDF,ZTXTNM,FARY) -"RTN","C0XMAIN",104,0) - W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM -"RTN","C0XMAIN",105,0) - D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF -"RTN","C0XMAIN",106,0) - Q -"RTN","C0XMAIN",107,0) - ; -"RTN","C0XMAIN",108,0) -STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME -"RTN","C0XMAIN",109,0) - ; -"RTN","C0XMAIN",110,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",111,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",112,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",113,0) - D USEFARY(FARY) -"RTN","C0XMAIN",114,0) - N ZIEN -"RTN","C0XMAIN",115,0) - S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN -"RTN","C0XMAIN",116,0) - D CLEAN^DILF -"RTN","C0XMAIN",117,0) - K ZERR -"RTN","C0XMAIN",118,0) - D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") -"RTN","C0XMAIN",119,0) - I $D(ZERR) D ; -"RTN","C0XMAIN",120,0) - . ZWR ZERR -"RTN","C0XMAIN",121,0) - Q -"RTN","C0XMAIN",122,0) - ; -"RTN","C0XMAIN",123,0) -GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT -"RTN","C0XMAIN",124,0) - ; ZRTN IS PASSED BY REFERENCE -"RTN","C0XMAIN",125,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",126,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",127,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",128,0) - D USEFARY(FARY) -"RTN","C0XMAIN",129,0) - N ZIEN -"RTN","C0XMAIN",130,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XMAIN",131,0) - S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") -"RTN","C0XMAIN",132,0) - Q -"RTN","C0XMAIN",133,0) - ; -"RTN","C0XMAIN",134,0) -WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL -"RTN","C0XMAIN",135,0) - ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING -"RTN","C0XMAIN",136,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",137,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",138,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",139,0) - D USEFARY(FARY) -"RTN","C0XMAIN",140,0) - N ZIEN -"RTN","C0XMAIN",141,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XMAIN",142,0) - Q $NA(@C0XSN@(ZIEN,1)) -"RTN","C0XMAIN",143,0) - ; -"RTN","C0XMAIN",144,0) -FILEIN(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH -"RTN","C0XMAIN",145,0) - ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT -"RTN","C0XMAIN",146,0) - ; IE ^TMP("C0X","FILEIN",1) -"RTN","C0XMAIN",147,0) - ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 -"RTN","C0XMAIN",148,0) - ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH -"RTN","C0XMAIN",149,0) - S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) -"RTN","C0XMAIN",150,0) - Q OK -"RTN","C0XMAIN",151,0) - ; -"RTN","C0XMAIN",152,0) -TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE -"RTN","C0XMAIN",153,0) - S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) -"RTN","C0XMAIN",154,0) - S ZGRAPH="/test/rdfFile" -"RTN","C0XMAIN",155,0) - S ZM="/test/rdfFile/meta" -"RTN","C0XMAIN",156,0) - D PROCESS(.G,ZIN,ZGRAPH,ZM) -"RTN","C0XMAIN",157,0) - Q -"RTN","C0XMAIN",158,0) - ; -"RTN","C0XMAIN",159,0) -PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE -"RTN","C0XMAIN",160,0) - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING -"RTN","C0XMAIN",161,0) - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE -"RTN","C0XMAIN",162,0) - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS -"RTN","C0XMAIN",163,0) - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA -"RTN","C0XMAIN",164,0) - ; -"RTN","C0XMAIN",165,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",166,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",167,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",168,0) - D USEFARY(FARY) -"RTN","C0XMAIN",169,0) - ; -- first parse the rdf file with the MXML parser -"RTN","C0XMAIN",170,0) - ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML -"RTN","C0XMAIN",171,0) - S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W") -"RTN","C0XMAIN",172,0) - ; -- assign the MXLM dom global name to ZDOM -"RTN","C0XMAIN",173,0) - S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID)) -"RTN","C0XMAIN",174,0) - W !,$O(@ZDOM@(""),-1)," XML NODES PARSED" -"RTN","C0XMAIN",175,0) - ; -- populate the metagraph to point to the graph with status unfinished -"RTN","C0XMAIN",176,0) - S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT -"RTN","C0XMAIN",177,0) - I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH -"RTN","C0XMAIN",178,0) - D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH -"RTN","C0XMAIN",179,0) - D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished -"RTN","C0XMAIN",180,0) - ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT") -"RTN","C0XMAIN",181,0) - S C0XDATE=$$NOW^XLFDT -"RTN","C0XMAIN",182,0) - D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY) -"RTN","C0XMAIN",183,0) - D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store -"RTN","C0XMAIN",184,0) - ; -- -"RTN","C0XMAIN",185,0) - ; -- pull out the vocabularies in the RDF statement. marked with xmlns: -"RTN","C0XMAIN",186,0) - ; -- put them in a local variable for quick reference -"RTN","C0XMAIN",187,0) - ; -- TODO: create a graph for vocabularies and validate incoming against it -"RTN","C0XMAIN",188,0) - ; -"RTN","C0XMAIN",189,0) - S C0XVOC="" -"RTN","C0XMAIN",190,0) - N ZI,ZJ,ZK S ZI="" -"RTN","C0XMAIN",191,0) - F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns -"RTN","C0XMAIN",192,0) - . S ZVOC=$P(ZI,"xmlns:",2) -"RTN","C0XMAIN",193,0) - . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI)) -"RTN","C0XMAIN",194,0) - ;W !,"VOCABS:" ZWR C0XVOC -"RTN","C0XMAIN",195,0) - ; -"RTN","C0XMAIN",196,0) - ; -- look for children called rdf:Description. quit if none. not an rdf file -"RTN","C0XMAIN",197,0) - ; -"RTN","C0XMAIN",198,0) - S ZI=$O(@ZDOM@(1,"C","")) -"RTN","C0XMAIN",199,0) - I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file -"RTN","C0XMAIN",200,0) - . W !,"Error. Not an RDF file. Cannot process." -"RTN","C0XMAIN",201,0) - ; -"RTN","C0XMAIN",202,0) - ; -- now process the rdf description children -"RTN","C0XMAIN",203,0) - ; -"RTN","C0XMAIN",204,0) - S ZI="" -"RTN","C0XMAIN",205,0) - S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate -"RTN","C0XMAIN",206,0) - F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ; -"RTN","C0XMAIN",207,0) - . ; -- we are skipping any child that is not rdf:Description -"RTN","C0XMAIN",208,0) - . ; -- TODO: check to see if this is right in general -"RTN","C0XMAIN",209,0) - . ; -"RTN","C0XMAIN",210,0) - . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; -"RTN","C0XMAIN",211,0) - . . W !,"SKIPPING NODE: ",ZI -"RTN","C0XMAIN",212,0) - . ; -- now looking for the subject for the triples -"RTN","C0XMAIN",213,0) - . S ZX=$G(@ZDOM@(ZI,"A","rdf:about")) -"RTN","C0XMAIN",214,0) - . I ZX'="" D ; we have the subject -"RTN","C0XMAIN",215,0) - . . ;W " about: ",ZX -"RTN","C0XMAIN",216,0) - . . S C0XSUB=ZX -"RTN","C0XMAIN",217,0) - . E D ; -"RTN","C0XMAIN",218,0) - . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject -"RTN","C0XMAIN",219,0) - . . I ZX'="" D ; -"RTN","C0XMAIN",220,0) - . . . S C0XSUB=ZX -"RTN","C0XMAIN",221,0) - . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT -"RTN","C0XMAIN",222,0) - . ; -"RTN","C0XMAIN",223,0) - . ; -- we now have the subject. the children of this node have the rest -"RTN","C0XMAIN",224,0) - . ; -"RTN","C0XMAIN",225,0) - . S ZJ="" ; for the children of the rdf:Description nodes -"RTN","C0XMAIN",226,0) - . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child -"RTN","C0XMAIN",227,0) - . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix -"RTN","C0XMAIN",228,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space -"RTN","C0XMAIN",229,0) - . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix -"RTN","C0XMAIN",230,0) - . . I C0XPRE[":" D ; expand using vocabulary -"RTN","C0XMAIN",231,0) - . . . N ZB,ZA -"RTN","C0XMAIN",232,0) - . . . S ZB=$P(C0XPRE,":",1) -"RTN","C0XMAIN",233,0) - . . . S ZA=$P(C0XPRE,":",2) -"RTN","C0XMAIN",234,0) - . . . I $G(C0XVOC(ZB))'="" D ; -"RTN","C0XMAIN",235,0) - . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded -"RTN","C0XMAIN",236,0) - . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object -"RTN","C0XMAIN",237,0) - . . I ZY'="" D Q ; -"RTN","C0XMAIN",238,0) - . . . S C0XOBJ=ZY ; object -"RTN","C0XMAIN",239,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple -"RTN","C0XMAIN",240,0) - . . ; -- this is an else because of the quit above -"RTN","C0XMAIN",241,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object -"RTN","C0XMAIN",242,0) - . . I ZX'="" D Q ; got one -"RTN","C0XMAIN",243,0) - . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject -"RTN","C0XMAIN",244,0) - . . . ; without change... this could be foolish .. look at it again later -"RTN","C0XMAIN",245,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XMAIN",246,0) - . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here -"RTN","C0XMAIN",247,0) - . . I C0XOBJ="" D Q ; not a happy situation -"RTN","C0XMAIN",248,0) - . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ -"RTN","C0XMAIN",249,0) - . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XMAIN",250,0) - W !,"INSERTING ",C0XCNT," TRIPLES" -"RTN","C0XMAIN",251,0) - D UPDIE(.C0XFDA) ; commit the updates to the file -"RTN","C0XMAIN",252,0) - ; next, mark the graph as finished -"RTN","C0XMAIN",253,0) - S C0XEND=$$NOW^XLFDT -"RTN","C0XMAIN",254,0) - W !," ENDED AT: ",C0XEND -"RTN","C0XMAIN",255,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2) -"RTN","C0XMAIN",256,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XMAIN",257,0) - W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" -"RTN","C0XMAIN",258,0) - Q -"RTN","C0XMAIN",259,0) - ; -"RTN","C0XMAIN",260,0) -SHOW(ZN) ; -"RTN","C0XMAIN",261,0) - ZWR ^TMP("MXMLDOM",$J,1,ZN,*) -"RTN","C0XMAIN",262,0) - Q -"RTN","C0XMAIN",263,0) - ; -"RTN","C0XMAIN",264,0) -ANONS() ; RETURNS AN ANONOMOUS SUBJECT -"RTN","C0XMAIN",265,0) - Q "_S:"_$$LKY9 -"RTN","C0XMAIN",266,0) - ; -"RTN","C0XMAIN",267,0) -NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED -"RTN","C0XMAIN",268,0) - ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT -"RTN","C0XMAIN",269,0) - ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN -"RTN","C0XMAIN",270,0) - S NGRAPH="G"_$$LKY9 -"RTN","C0XMAIN",271,0) - S NMETA=NGRAPH_"A" -"RTN","C0XMAIN",272,0) - Q -"RTN","C0XMAIN",273,0) - ; -"RTN","C0XMAIN",274,0) -ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT -"RTN","C0XMAIN",275,0) - ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE -"RTN","C0XMAIN",276,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",277,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",278,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",279,0) - D USEFARY(FARY) -"RTN","C0XMAIN",280,0) - I '$D(C0XCNT) S C0XCNT=0 -"RTN","C0XMAIN",281,0) - N ZNODE -"RTN","C0XMAIN",282,0) - S ZNODE="N"_$$LKY17 -"RTN","C0XMAIN",283,0) - N ZNARY ; GET READY TO CALL IENOFA -"RTN","C0XMAIN",284,0) - S ZNARY("ZG",ZG)="" -"RTN","C0XMAIN",285,0) - S ZNARY("ZS",ZS)="" -"RTN","C0XMAIN",286,0) - S ZNARY("ZP",ZP)="" -"RTN","C0XMAIN",287,0) - S ZNARY("ZO",ZO)="" -"RTN","C0XMAIN",288,0) - D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS -"RTN","C0XMAIN",289,0) - ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN -"RTN","C0XMAIN",290,0) - ;S ZSIEN=$$IENOF(ZS) -"RTN","C0XMAIN",291,0) - ;S ZPIEN=$$IENOF(ZP) -"RTN","C0XMAIN",292,0) - ;S ZOIEN=$$IENOF(ZO) -"RTN","C0XMAIN",293,0) - ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED -"RTN","C0XMAIN",294,0) - S C0XCNT=C0XCNT+1 -"RTN","C0XMAIN",295,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE -"RTN","C0XMAIN",296,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG","")) -"RTN","C0XMAIN",297,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS","")) -"RTN","C0XMAIN",298,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP","")) -"RTN","C0XMAIN",299,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO","")) -"RTN","C0XMAIN",300,0) - ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE -"RTN","C0XMAIN",301,0) - Q -"RTN","C0XMAIN",302,0) - ; -"RTN","C0XMAIN",303,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",304,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",305,0) - N ZN,ZI -"RTN","C0XMAIN",306,0) - S ZN="" -"RTN","C0XMAIN",307,0) - F ZI=1:1:9 D ; -"RTN","C0XMAIN",308,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",309,0) - Q ZN -"RTN","C0XMAIN",310,0) - ; -"RTN","C0XMAIN",311,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",312,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",313,0) - N ZN,ZI -"RTN","C0XMAIN",314,0) - S ZN="" -"RTN","C0XMAIN",315,0) - F ZI=1:1:17 D ; -"RTN","C0XMAIN",316,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",317,0) - Q ZN -"RTN","C0XMAIN",318,0) - ; -"RTN","C0XMAIN",319,0) -IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE -"RTN","C0XMAIN",320,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",321,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",322,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",323,0) - N ZIEN -"RTN","C0XMAIN",324,0) - S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",325,0) - I ZIEN="" D ; -"RTN","C0XMAIN",326,0) - . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING -"RTN","C0XMAIN",327,0) - . D UPDIE(.C0XFDA2) -"RTN","C0XMAIN",328,0) - . S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",329,0) - . K C0XFDA2 -"RTN","C0XMAIN",330,0) - Q ZIEN -"RTN","C0XMAIN",331,0) - ; -"RTN","C0XMAIN",332,0) -IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE -"RTN","C0XMAIN",333,0) - ; OR ADD THEM IF -"RTN","C0XMAIN",334,0) - ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE -"RTN","C0XMAIN",335,0) - ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")="" -"RTN","C0XMAIN",336,0) - ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" -"RTN","C0XMAIN",337,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",338,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",339,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",340,0) - K ZOUTARY ; START WITH CLEAN RESULTS -"RTN","C0XMAIN",341,0) - K C0XFDA2 ; USE A SEPARATE FDA FOR THIS -"RTN","C0XMAIN",342,0) - N ZI S ZI="" -"RTN","C0XMAIN",343,0) - N ZV,ZIEN -"RTN","C0XMAIN",344,0) - N ZCNT S ZCNT=0 -"RTN","C0XMAIN",345,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS -"RTN","C0XMAIN",346,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XMAIN",347,0) - . I $O(@C0XSN@("B",ZV,""))="" D ; -"RTN","C0XMAIN",348,0) - . . S ZCNT=ZCNT+1 -"RTN","C0XMAIN",349,0) - . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV -"RTN","C0XMAIN",350,0) - I $D(C0XFDA2) D ; -"RTN","C0XMAIN",351,0) - . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS -"RTN","C0XMAIN",352,0) - . K C0XFDA2 ; CLEAN UP -"RTN","C0XMAIN",353,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS -"RTN","C0XMAIN",354,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XMAIN",355,0) - . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW -"RTN","C0XMAIN",356,0) - . I ZIEN="" D ; -"RTN","C0XMAIN",357,0) - . . W !,"ERROR ADDING STRING: ",ZV -"RTN","C0XMAIN",358,0) - . . B -"RTN","C0XMAIN",359,0) - . S ZOUTARY("IEN",ZI,ZIEN)="" -"RTN","C0XMAIN",360,0) - Q -"RTN","C0XMAIN",361,0) - ; -"RTN","C0XMAIN",362,0) -UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS -"RTN","C0XMAIN",363,0) - ; ZFDA IS PASSED BY REFERENCE -"RTN","C0XMAIN",364,0) - ;ZWR ZFDA -"RTN","C0XMAIN",365,0) - ;B -"RTN","C0XMAIN",366,0) - K ZERR -"RTN","C0XMAIN",367,0) - D CLEAN^DILF -"RTN","C0XMAIN",368,0) - D UPDATE^DIE("","ZFDA","","ZERR") -"RTN","C0XMAIN",369,0) - I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, -"RTN","C0XMAIN",370,0) - ; INVOKE THE ERROR TRAP IF TASKED -"RTN","C0XMAIN",371,0) - ;. W "ERROR",! -"RTN","C0XMAIN",372,0) - ;. ZWR ZERR -"RTN","C0XMAIN",373,0) - ;. B -"RTN","C0XMAIN",374,0) - K ZFDA -"RTN","C0XMAIN",375,0) - Q -"RTN","C0XMAIN",376,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** diff --git a/kids/C0X_1_0_0_T4.KID b/kids/C0X_1_0_0_T4.KID deleted file mode 100644 index bdb88e3..0000000 --- a/kids/C0X_1_0_0_T4.KID +++ /dev/null @@ -1,1352 +0,0 @@ -KIDS Distribution saved on Oct 31, 2011@00:07:33 -includes WGET and print template -**KIDS**:C0X*1.0*0^ - -**INSTALL NAME** -C0X*1.0*0 -"BLD",7885,0) -C0X*1.0*0^^0^3111031^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) -4 -"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^1^1 -"BLD",7885,"KRN",9.8,"NM",1,0) -C0XMAIN^^0^B115009682 -"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") -1 -"RTN","C0XMAIN") -0^1^B115009682 -"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 4 -"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) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XMAIN",80,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XMAIN",81,0) - W !,"DOWNLOADING: ",ZURL -"RTN","C0XMAIN",82,0) - S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP) -"RTN","C0XMAIN",83,0) - M @ZLOC=ZTMP -"RTN","C0XMAIN",84,0) - W !,$O(@ZLOC@(""),-1)," LINES READ" -"RTN","C0XMAIN",85,0) - D INSRDF(ZLOC,ZURL,FARY) -"RTN","C0XMAIN",86,0) - Q -"RTN","C0XMAIN",87,0) - ; -"RTN","C0XMAIN",88,0) -INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS -"RTN","C0XMAIN",89,0) - ; ZRDF IS PASSED BY NAME -"RTN","C0XMAIN",90,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",91,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",92,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",93,0) - D USEFARY(FARY) -"RTN","C0XMAIN",94,0) - N ZGRAPH,ZSUBJECT -"RTN","C0XMAIN",95,0) - S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME -"RTN","C0XMAIN",96,0) - S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT -"RTN","C0XMAIN",97,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY) -"RTN","C0XMAIN",98,0) - N ZTXTNM -"RTN","C0XMAIN",99,0) - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE -"RTN","C0XMAIN",100,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY) -"RTN","C0XMAIN",101,0) - D UPDIE(.C0XFDA) ; TRY IT OUT -"RTN","C0XMAIN",102,0) - K C0XCNT ;RESET FOR NEXT TIME -"RTN","C0XMAIN",103,0) - D STORETXT(ZRDF,ZTXTNM,FARY) -"RTN","C0XMAIN",104,0) - W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM -"RTN","C0XMAIN",105,0) - D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF -"RTN","C0XMAIN",106,0) - Q -"RTN","C0XMAIN",107,0) - ; -"RTN","C0XMAIN",108,0) -STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME -"RTN","C0XMAIN",109,0) - ; -"RTN","C0XMAIN",110,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",111,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",112,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",113,0) - D USEFARY(FARY) -"RTN","C0XMAIN",114,0) - N ZIEN -"RTN","C0XMAIN",115,0) - S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN -"RTN","C0XMAIN",116,0) - D CLEAN^DILF -"RTN","C0XMAIN",117,0) - K ZERR -"RTN","C0XMAIN",118,0) - D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") -"RTN","C0XMAIN",119,0) - I $D(ZERR) D ; -"RTN","C0XMAIN",120,0) - . ZWR ZERR -"RTN","C0XMAIN",121,0) - Q -"RTN","C0XMAIN",122,0) - ; -"RTN","C0XMAIN",123,0) -GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT -"RTN","C0XMAIN",124,0) - ; ZRTN IS PASSED BY REFERENCE -"RTN","C0XMAIN",125,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",126,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",127,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",128,0) - D USEFARY(FARY) -"RTN","C0XMAIN",129,0) - N ZIEN -"RTN","C0XMAIN",130,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XMAIN",131,0) - S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") -"RTN","C0XMAIN",132,0) - Q -"RTN","C0XMAIN",133,0) - ; -"RTN","C0XMAIN",134,0) -WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL -"RTN","C0XMAIN",135,0) - ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING -"RTN","C0XMAIN",136,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",137,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",138,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",139,0) - D USEFARY(FARY) -"RTN","C0XMAIN",140,0) - N ZIEN -"RTN","C0XMAIN",141,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XMAIN",142,0) - Q $NA(@C0XSN@(ZIEN,1)) -"RTN","C0XMAIN",143,0) - ; -"RTN","C0XMAIN",144,0) -FILEIN(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH -"RTN","C0XMAIN",145,0) - ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT -"RTN","C0XMAIN",146,0) - ; IE ^TMP("C0X","FILEIN",1) -"RTN","C0XMAIN",147,0) - ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 -"RTN","C0XMAIN",148,0) - ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH -"RTN","C0XMAIN",149,0) - S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) -"RTN","C0XMAIN",150,0) - Q OK -"RTN","C0XMAIN",151,0) - ; -"RTN","C0XMAIN",152,0) -TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE -"RTN","C0XMAIN",153,0) - S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) -"RTN","C0XMAIN",154,0) - S ZGRAPH="/test/rdfFile" -"RTN","C0XMAIN",155,0) - S ZM="/test/rdfFile/meta" -"RTN","C0XMAIN",156,0) - D PROCESS(.G,ZIN,ZGRAPH,ZM) -"RTN","C0XMAIN",157,0) - Q -"RTN","C0XMAIN",158,0) - ; -"RTN","C0XMAIN",159,0) -PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE -"RTN","C0XMAIN",160,0) - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING -"RTN","C0XMAIN",161,0) - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE -"RTN","C0XMAIN",162,0) - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS -"RTN","C0XMAIN",163,0) - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA -"RTN","C0XMAIN",164,0) - ; -"RTN","C0XMAIN",165,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",166,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",167,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",168,0) - D USEFARY(FARY) -"RTN","C0XMAIN",169,0) - ; -- first parse the rdf file with the MXML parser -"RTN","C0XMAIN",170,0) - ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML -"RTN","C0XMAIN",171,0) - S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W") -"RTN","C0XMAIN",172,0) - ; -- assign the MXLM dom global name to ZDOM -"RTN","C0XMAIN",173,0) - S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID)) -"RTN","C0XMAIN",174,0) - W !,$O(@ZDOM@(""),-1)," XML NODES PARSED" -"RTN","C0XMAIN",175,0) - ; -- populate the metagraph to point to the graph with status unfinished -"RTN","C0XMAIN",176,0) - S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT -"RTN","C0XMAIN",177,0) - I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH -"RTN","C0XMAIN",178,0) - D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH -"RTN","C0XMAIN",179,0) - D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished -"RTN","C0XMAIN",180,0) - ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT") -"RTN","C0XMAIN",181,0) - S C0XDATE=$$NOW^XLFDT -"RTN","C0XMAIN",182,0) - D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY) -"RTN","C0XMAIN",183,0) - D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store -"RTN","C0XMAIN",184,0) - ; -- -"RTN","C0XMAIN",185,0) - ; -- pull out the vocabularies in the RDF statement. marked with xmlns: -"RTN","C0XMAIN",186,0) - ; -- put them in a local variable for quick reference -"RTN","C0XMAIN",187,0) - ; -- TODO: create a graph for vocabularies and validate incoming against it -"RTN","C0XMAIN",188,0) - ; -"RTN","C0XMAIN",189,0) - S C0XVOC="" -"RTN","C0XMAIN",190,0) - N ZI,ZJ,ZK S ZI="" -"RTN","C0XMAIN",191,0) - F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns -"RTN","C0XMAIN",192,0) - . S ZVOC=$P(ZI,"xmlns:",2) -"RTN","C0XMAIN",193,0) - . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI)) -"RTN","C0XMAIN",194,0) - ;W !,"VOCABS:" ZWR C0XVOC -"RTN","C0XMAIN",195,0) - ; -"RTN","C0XMAIN",196,0) - ; -- look for children called rdf:Description. quit if none. not an rdf file -"RTN","C0XMAIN",197,0) - ; -"RTN","C0XMAIN",198,0) - S ZI=$O(@ZDOM@(1,"C","")) -"RTN","C0XMAIN",199,0) - I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file -"RTN","C0XMAIN",200,0) - . W !,"Error. Not an RDF file. Cannot process." -"RTN","C0XMAIN",201,0) - ; -"RTN","C0XMAIN",202,0) - ; -- now process the rdf description children -"RTN","C0XMAIN",203,0) - ; -"RTN","C0XMAIN",204,0) - S ZI="" -"RTN","C0XMAIN",205,0) - S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate -"RTN","C0XMAIN",206,0) - F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ; -"RTN","C0XMAIN",207,0) - . ; -- we are skipping any child that is not rdf:Description -"RTN","C0XMAIN",208,0) - . ; -- TODO: check to see if this is right in general -"RTN","C0XMAIN",209,0) - . ; -"RTN","C0XMAIN",210,0) - . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; -"RTN","C0XMAIN",211,0) - . . W !,"SKIPPING NODE: ",ZI -"RTN","C0XMAIN",212,0) - . ; -- now looking for the subject for the triples -"RTN","C0XMAIN",213,0) - . S ZX=$G(@ZDOM@(ZI,"A","rdf:about")) -"RTN","C0XMAIN",214,0) - . I ZX'="" D ; we have the subject -"RTN","C0XMAIN",215,0) - . . ;W " about: ",ZX -"RTN","C0XMAIN",216,0) - . . S C0XSUB=ZX -"RTN","C0XMAIN",217,0) - . E D ; -"RTN","C0XMAIN",218,0) - . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject -"RTN","C0XMAIN",219,0) - . . I ZX'="" D ; -"RTN","C0XMAIN",220,0) - . . . S C0XSUB=ZX -"RTN","C0XMAIN",221,0) - . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT -"RTN","C0XMAIN",222,0) - . ; -"RTN","C0XMAIN",223,0) - . ; -- we now have the subject. the children of this node have the rest -"RTN","C0XMAIN",224,0) - . ; -"RTN","C0XMAIN",225,0) - . S ZJ="" ; for the children of the rdf:Description nodes -"RTN","C0XMAIN",226,0) - . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child -"RTN","C0XMAIN",227,0) - . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix -"RTN","C0XMAIN",228,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space -"RTN","C0XMAIN",229,0) - . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix -"RTN","C0XMAIN",230,0) - . . I C0XPRE[":" D ; expand using vocabulary -"RTN","C0XMAIN",231,0) - . . . N ZB,ZA -"RTN","C0XMAIN",232,0) - . . . S ZB=$P(C0XPRE,":",1) -"RTN","C0XMAIN",233,0) - . . . S ZA=$P(C0XPRE,":",2) -"RTN","C0XMAIN",234,0) - . . . I $G(C0XVOC(ZB))'="" D ; -"RTN","C0XMAIN",235,0) - . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded -"RTN","C0XMAIN",236,0) - . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object -"RTN","C0XMAIN",237,0) - . . I ZY'="" D Q ; -"RTN","C0XMAIN",238,0) - . . . S C0XOBJ=ZY ; object -"RTN","C0XMAIN",239,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple -"RTN","C0XMAIN",240,0) - . . ; -- this is an else because of the quit above -"RTN","C0XMAIN",241,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object -"RTN","C0XMAIN",242,0) - . . I ZX'="" D Q ; got one -"RTN","C0XMAIN",243,0) - . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject -"RTN","C0XMAIN",244,0) - . . . ; without change... this could be foolish .. look at it again later -"RTN","C0XMAIN",245,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XMAIN",246,0) - . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here -"RTN","C0XMAIN",247,0) - . . I C0XOBJ="" D Q ; not a happy situation -"RTN","C0XMAIN",248,0) - . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ -"RTN","C0XMAIN",249,0) - . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XMAIN",250,0) - W !,"INSERTING ",C0XCNT," TRIPLES" -"RTN","C0XMAIN",251,0) - D UPDIE(.C0XFDA) ; commit the updates to the file -"RTN","C0XMAIN",252,0) - ; next, mark the graph as finished -"RTN","C0XMAIN",253,0) - S C0XEND=$$NOW^XLFDT -"RTN","C0XMAIN",254,0) - W !," ENDED AT: ",C0XEND -"RTN","C0XMAIN",255,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2) -"RTN","C0XMAIN",256,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XMAIN",257,0) - W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" -"RTN","C0XMAIN",258,0) - Q -"RTN","C0XMAIN",259,0) - ; -"RTN","C0XMAIN",260,0) -SHOW(ZN) ; -"RTN","C0XMAIN",261,0) - ZWR ^TMP("MXMLDOM",$J,1,ZN,*) -"RTN","C0XMAIN",262,0) - Q -"RTN","C0XMAIN",263,0) - ; -"RTN","C0XMAIN",264,0) -ANONS() ; RETURNS AN ANONOMOUS SUBJECT -"RTN","C0XMAIN",265,0) - Q "_S:"_$$LKY9 -"RTN","C0XMAIN",266,0) - ; -"RTN","C0XMAIN",267,0) -NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED -"RTN","C0XMAIN",268,0) - ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT -"RTN","C0XMAIN",269,0) - ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN -"RTN","C0XMAIN",270,0) - S NGRAPH="G"_$$LKY9 -"RTN","C0XMAIN",271,0) - S NMETA=NGRAPH_"A" -"RTN","C0XMAIN",272,0) - Q -"RTN","C0XMAIN",273,0) - ; -"RTN","C0XMAIN",274,0) -ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT -"RTN","C0XMAIN",275,0) - ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE -"RTN","C0XMAIN",276,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",277,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",278,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",279,0) - D USEFARY(FARY) -"RTN","C0XMAIN",280,0) - I '$D(C0XCNT) S C0XCNT=0 -"RTN","C0XMAIN",281,0) - N ZNODE -"RTN","C0XMAIN",282,0) - S ZNODE="N"_$$LKY17 -"RTN","C0XMAIN",283,0) - N ZNARY ; GET READY TO CALL IENOFA -"RTN","C0XMAIN",284,0) - S ZNARY("ZG",ZG)="" -"RTN","C0XMAIN",285,0) - S ZNARY("ZS",ZS)="" -"RTN","C0XMAIN",286,0) - S ZNARY("ZP",ZP)="" -"RTN","C0XMAIN",287,0) - S ZNARY("ZO",ZO)="" -"RTN","C0XMAIN",288,0) - D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS -"RTN","C0XMAIN",289,0) - ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN -"RTN","C0XMAIN",290,0) - ;S ZSIEN=$$IENOF(ZS) -"RTN","C0XMAIN",291,0) - ;S ZPIEN=$$IENOF(ZP) -"RTN","C0XMAIN",292,0) - ;S ZOIEN=$$IENOF(ZO) -"RTN","C0XMAIN",293,0) - ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED -"RTN","C0XMAIN",294,0) - S C0XCNT=C0XCNT+1 -"RTN","C0XMAIN",295,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE -"RTN","C0XMAIN",296,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG","")) -"RTN","C0XMAIN",297,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS","")) -"RTN","C0XMAIN",298,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP","")) -"RTN","C0XMAIN",299,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO","")) -"RTN","C0XMAIN",300,0) - ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE -"RTN","C0XMAIN",301,0) - Q -"RTN","C0XMAIN",302,0) - ; -"RTN","C0XMAIN",303,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",304,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",305,0) - N ZN,ZI -"RTN","C0XMAIN",306,0) - S ZN="" -"RTN","C0XMAIN",307,0) - F ZI=1:1:9 D ; -"RTN","C0XMAIN",308,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",309,0) - Q ZN -"RTN","C0XMAIN",310,0) - ; -"RTN","C0XMAIN",311,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",312,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",313,0) - N ZN,ZI -"RTN","C0XMAIN",314,0) - S ZN="" -"RTN","C0XMAIN",315,0) - F ZI=1:1:17 D ; -"RTN","C0XMAIN",316,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",317,0) - Q ZN -"RTN","C0XMAIN",318,0) - ; -"RTN","C0XMAIN",319,0) -IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE -"RTN","C0XMAIN",320,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",321,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",322,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",323,0) - N ZIEN -"RTN","C0XMAIN",324,0) - S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",325,0) - I ZIEN="" D ; -"RTN","C0XMAIN",326,0) - . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING -"RTN","C0XMAIN",327,0) - . D UPDIE(.C0XFDA2) -"RTN","C0XMAIN",328,0) - . S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",329,0) - . K C0XFDA2 -"RTN","C0XMAIN",330,0) - Q ZIEN -"RTN","C0XMAIN",331,0) - ; -"RTN","C0XMAIN",332,0) -IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE -"RTN","C0XMAIN",333,0) - ; OR ADD THEM IF -"RTN","C0XMAIN",334,0) - ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE -"RTN","C0XMAIN",335,0) - ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")="" -"RTN","C0XMAIN",336,0) - ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" -"RTN","C0XMAIN",337,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",338,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",339,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",340,0) - K ZOUTARY ; START WITH CLEAN RESULTS -"RTN","C0XMAIN",341,0) - K C0XFDA2 ; USE A SEPARATE FDA FOR THIS -"RTN","C0XMAIN",342,0) - N ZI S ZI="" -"RTN","C0XMAIN",343,0) - N ZV,ZIEN -"RTN","C0XMAIN",344,0) - N ZCNT S ZCNT=0 -"RTN","C0XMAIN",345,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS -"RTN","C0XMAIN",346,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XMAIN",347,0) - . I $O(@C0XSN@("B",ZV,""))="" D ; -"RTN","C0XMAIN",348,0) - . . S ZCNT=ZCNT+1 -"RTN","C0XMAIN",349,0) - . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV -"RTN","C0XMAIN",350,0) - I $D(C0XFDA2) D ; -"RTN","C0XMAIN",351,0) - . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS -"RTN","C0XMAIN",352,0) - . K C0XFDA2 ; CLEAN UP -"RTN","C0XMAIN",353,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS -"RTN","C0XMAIN",354,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XMAIN",355,0) - . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW -"RTN","C0XMAIN",356,0) - . I ZIEN="" D ; -"RTN","C0XMAIN",357,0) - . . W !,"ERROR ADDING STRING: ",ZV -"RTN","C0XMAIN",358,0) - . . B -"RTN","C0XMAIN",359,0) - . S ZOUTARY("IEN",ZI,ZIEN)="" -"RTN","C0XMAIN",360,0) - Q -"RTN","C0XMAIN",361,0) - ; -"RTN","C0XMAIN",362,0) -UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS -"RTN","C0XMAIN",363,0) - ; ZFDA IS PASSED BY REFERENCE -"RTN","C0XMAIN",364,0) - ;ZWR ZFDA -"RTN","C0XMAIN",365,0) - ;B -"RTN","C0XMAIN",366,0) - K ZERR -"RTN","C0XMAIN",367,0) - D CLEAN^DILF -"RTN","C0XMAIN",368,0) - D UPDATE^DIE("","ZFDA","","ZERR") -"RTN","C0XMAIN",369,0) - I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, -"RTN","C0XMAIN",370,0) - ; INVOKE THE ERROR TRAP IF TASKED -"RTN","C0XMAIN",371,0) - ;. W "ERROR",! -"RTN","C0XMAIN",372,0) - ;. ZWR ZERR -"RTN","C0XMAIN",373,0) - ;. B -"RTN","C0XMAIN",374,0) - K ZFDA -"RTN","C0XMAIN",375,0) - Q -"RTN","C0XMAIN",376,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** diff --git a/kids/C0X_1_0_0_T5.KID b/kids/C0X_1_0_0_T5.KID deleted file mode 100644 index 85f5245..0000000 --- a/kids/C0X_1_0_0_T5.KID +++ /dev/null @@ -1,2836 +0,0 @@ -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** diff --git a/kids/C0X_1_0_0_T6.KID b/kids/C0X_1_0_0_T6.KID deleted file mode 100644 index de37676..0000000 --- a/kids/C0X_1_0_0_T6.KID +++ /dev/null @@ -1,2922 +0,0 @@ -KIDS Distribution saved on Nov 08, 2011@02:13:03 -includes FILEIN C0XF2N with BULKLOAD experiment -**KIDS**:C0X*1.0*0^ - -**INSTALL NAME** -C0X*1.0*0 -"BLD",7881,0) -C0X*1.0*0^^0^3111108^n -"BLD",7881,4,0) -^9.64PA^172.201^2 -"BLD",7881,4,172.101,0) -172.101 -"BLD",7881,4,172.101,222) -y^y^f^^^^n -"BLD",7881,4,172.201,0) -172.201 -"BLD",7881,4,172.201,222) -y^y^f^^^^n -"BLD",7881,4,"B",172.101,172.101) - -"BLD",7881,4,"B",172.201,172.201) - -"BLD",7881,6.3) -5 -"BLD",7881,"KRN",0) -^9.67PA^779.2^20 -"BLD",7881,"KRN",.4,0) -.4 -"BLD",7881,"KRN",.4,"NM",0) -^9.68A^1^1 -"BLD",7881,"KRN",.4,"NM",1,0) -C0X PRINT GRAPH FILE #172.101^172.101^0 -"BLD",7881,"KRN",.4,"NM","B","C0X PRINT GRAPH FILE #172.101",1) - -"BLD",7881,"KRN",.401,0) -.401 -"BLD",7881,"KRN",.402,0) -.402 -"BLD",7881,"KRN",.403,0) -.403 -"BLD",7881,"KRN",.5,0) -.5 -"BLD",7881,"KRN",.84,0) -.84 -"BLD",7881,"KRN",3.6,0) -3.6 -"BLD",7881,"KRN",3.8,0) -3.8 -"BLD",7881,"KRN",9.2,0) -9.2 -"BLD",7881,"KRN",9.8,0) -9.8 -"BLD",7881,"KRN",9.8,"NM",0) -^9.68A^3^3 -"BLD",7881,"KRN",9.8,"NM",1,0) -C0XMAIN^^0^B115393527 -"BLD",7881,"KRN",9.8,"NM",2,0) -C0XF2N^^0^B368065142 -"BLD",7881,"KRN",9.8,"NM",3,0) -C0XTEST^^0^B14490662 -"BLD",7881,"KRN",9.8,"NM","B","C0XF2N",2) - -"BLD",7881,"KRN",9.8,"NM","B","C0XMAIN",1) - -"BLD",7881,"KRN",9.8,"NM","B","C0XTEST",3) - -"BLD",7881,"KRN",19,0) -19 -"BLD",7881,"KRN",19.1,0) -19.1 -"BLD",7881,"KRN",101,0) -101 -"BLD",7881,"KRN",409.61,0) -409.61 -"BLD",7881,"KRN",771,0) -771 -"BLD",7881,"KRN",779.2,0) -779.2 -"BLD",7881,"KRN",870,0) -870 -"BLD",7881,"KRN",8989.51,0) -8989.51 -"BLD",7881,"KRN",8989.52,0) -8989.52 -"BLD",7881,"KRN",8994,0) -8994 -"BLD",7881,"KRN","B",.4,.4) - -"BLD",7881,"KRN","B",.401,.401) - -"BLD",7881,"KRN","B",.402,.402) - -"BLD",7881,"KRN","B",.403,.403) - -"BLD",7881,"KRN","B",.5,.5) - -"BLD",7881,"KRN","B",.84,.84) - -"BLD",7881,"KRN","B",3.6,3.6) - -"BLD",7881,"KRN","B",3.8,3.8) - -"BLD",7881,"KRN","B",9.2,9.2) - -"BLD",7881,"KRN","B",9.8,9.8) - -"BLD",7881,"KRN","B",19,19) - -"BLD",7881,"KRN","B",19.1,19.1) - -"BLD",7881,"KRN","B",101,101) - -"BLD",7881,"KRN","B",409.61,409.61) - -"BLD",7881,"KRN","B",771,771) - -"BLD",7881,"KRN","B",779.2,779.2) - -"BLD",7881,"KRN","B",870,870) - -"BLD",7881,"KRN","B",8989.51,8989.51) - -"BLD",7881,"KRN","B",8989.52,8989.52) - -"BLD",7881,"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,1492,-1) -0^1 -"KRN",.4,1492,0) -C0X PRINT GRAPH^3111029.121^@^172.101^^@^3111106 -"KRN",.4,1492,"F",2) -.03;W25;S~.04;C27;W25~.05;C54;W25~ -"KRN",.4,1492,"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") -3 -"RTN","C0XF2N") -0^2^B368065142 -"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/fmts/trunk/samples/qds/" -"RTN","C0XF2N",40,0) - S @ZFARY@("BLKLOAD")=0 ; this file supports block load -"RTN","C0XF2N",41,0) - S @ZFARY@("FMTSSTYLE")="F2N" ; fileman style -"RTN","C0XF2N",42,0) - D USEFARY(ZFARY) -"RTN","C0XF2N",43,0) - Q -"RTN","C0XF2N",44,0) - ; -"RTN","C0XF2N",45,0) -USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY -"RTN","C0XF2N",46,0) - N ZI S ZI="" -"RTN","C0XF2N",47,0) - F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D -"RTN","C0XF2N",48,0) - . ;N ZX -"RTN","C0XF2N",49,0) - . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_"""" -"RTN","C0XF2N",50,0) - . ;W !,ZX -"RTN","C0XF2N",51,0) - . X ZX -"RTN","C0XF2N",52,0) - Q -"RTN","C0XF2N",53,0) - ; -"RTN","C0XF2N",54,0) -FILEIN ; INTERACTIVE ENTRY POINT FOR OPTION TO READ IN A FILE -"RTN","C0XF2N",55,0) - I '$D(C0XFARY) D INITFARY("C0XFARY") -"RTN","C0XF2N",56,0) - D USEFARY("C0XFARY") -"RTN","C0XF2N",57,0) - S DIR(0)="F^3:240" -"RTN","C0XF2N",58,0) - S DIR("A")="File Directory" -"RTN","C0XF2N",59,0) - S DIR("B")=C0XDIR -"RTN","C0XF2N",60,0) - D ^DIR -"RTN","C0XF2N",61,0) - I Y="^" Q ; -"RTN","C0XF2N",62,0) - S C0XDIR=Y -"RTN","C0XF2N",63,0) - S C0XFARY("C0XDIR")=Y -"RTN","C0XF2N",64,0) - S DIR(0)="F^3:240" -"RTN","C0XF2N",65,0) - S DIR("A")="File Name" -"RTN","C0XF2N",66,0) - I '$D(C0XFN) S DIR("B")="qds.rdf" -"RTN","C0XF2N",67,0) - E S DIR("B")=C0XFN -"RTN","C0XF2N",68,0) - D ^DIR -"RTN","C0XF2N",69,0) - I Y="" Q ; -"RTN","C0XF2N",70,0) - I Y="^" Q ; -"RTN","C0XF2N",71,0) - S C0XFN=Y -"RTN","C0XF2N",72,0) - D IMPORT(C0XFN,C0XDIR,,"C0XFARY") -"RTN","C0XF2N",73,0) - Q -"RTN","C0XF2N",74,0) - ; -"RTN","C0XF2N",75,0) -IMPORT(FNAME,FDIR,FURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD -"RTN","C0XF2N",76,0) - ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE -"RTN","C0XF2N",77,0) - ; NODE NAME OF THE TEXT TRIPLE -"RTN","C0XF2N",78,0) - ; FDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR) -"RTN","C0XF2N",79,0) - ; FURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE -"RTN","C0XF2N",80,0) - ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE -"RTN","C0XF2N",81,0) - I '$D(FARY) D ; -"RTN","C0XF2N",82,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",83,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",84,0) - D USEFARY(FARY) -"RTN","C0XF2N",85,0) - N ZD,ZTMP -"RTN","C0XF2N",86,0) - I '$D(FDIR) S FDIR=C0XDIR ; DIRECTORY OF THE RDF FILE -"RTN","C0XF2N",87,0) - I '$D(FURL) D ; -"RTN","C0XF2N",88,0) - . N ZN2 S ZN2=$TR(FNAME,".","_") ; REMOVE THE DOT FROM THE NAME -"RTN","C0XF2N",89,0) - . S FURL=FDIR_ZN2 -"RTN","C0XF2N",90,0) - N ZTMP -"RTN","C0XF2N",91,0) - S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE -"RTN","C0XF2N",92,0) - K @ZTMP ; MAKE SURE IT'S CLEAR -"RTN","C0XF2N",93,0) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XF2N",94,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XF2N",95,0) - W !,"READING IN: ",FNAME -"RTN","C0XF2N",96,0) - I '$$FILEREAD(ZTMP,FDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS -"RTN","C0XF2N",97,0) - . W !,"ERROR READING FILE: ",FDIR,FNAME -"RTN","C0XF2N",98,0) - S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT -"RTN","C0XF2N",99,0) - W !,$O(@ZRDF@(""),-1)," LINES READ" -"RTN","C0XF2N",100,0) - D INSRDF(ZRDF,FURL,FARY) ; IMPORT AND PROCESS THE RDF -"RTN","C0XF2N",101,0) - Q -"RTN","C0XF2N",102,0) - ; -"RTN","C0XF2N",103,0) -WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT -"RTN","C0XF2N",104,0) - ; -"RTN","C0XF2N",105,0) - I '$D(FARY) D ; -"RTN","C0XF2N",106,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",107,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",108,0) - D USEFARY(FARY) -"RTN","C0XF2N",109,0) - ;N ZLOC,ZTMP -"RTN","C0XF2N",110,0) - K ZTMP -"RTN","C0XF2N",111,0) - S ZLOC=$NA(^TMP("C0X","WGET",$J)) -"RTN","C0XF2N",112,0) - K @ZLOC -"RTN","C0XF2N",113,0) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XF2N",114,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XF2N",115,0) - W !,"DOWNLOADING: ",ZURL -"RTN","C0XF2N",116,0) - S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP) -"RTN","C0XF2N",117,0) - M @ZLOC=ZTMP -"RTN","C0XF2N",118,0) - S C0XLINES=$O(@ZLOC@(""),-1) -"RTN","C0XF2N",119,0) - W !,C0XLINES," LINES READ" -"RTN","C0XF2N",120,0) - S C0XDLC=$$NOW^XLFDT ; DOWNLOAD COMPLETE -"RTN","C0XF2N",121,0) - W !,"DOWNLOAD COMPLETE AT ",C0XDLC -"RTN","C0XF2N",122,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XDLC,C0XSTART,2) -"RTN","C0XF2N",123,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",124,0) - I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XLINES/C0XDIFF,".")," LINES PER SEC" -"RTN","C0XF2N",125,0) - D INSRDF(ZLOC,ZURL,FARY) -"RTN","C0XF2N",126,0) - Q -"RTN","C0XF2N",127,0) - ; -"RTN","C0XF2N",128,0) -INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS -"RTN","C0XF2N",129,0) - ; ZRDF IS PASSED BY NAME -"RTN","C0XF2N",130,0) - I '$D(FARY) D ; -"RTN","C0XF2N",131,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",132,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",133,0) - D USEFARY(FARY) -"RTN","C0XF2N",134,0) - N ZGRAPH,ZSUBJECT -"RTN","C0XF2N",135,0) - S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME -"RTN","C0XF2N",136,0) - S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT -"RTN","C0XF2N",137,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY) -"RTN","C0XF2N",138,0) - N ZTXTNM -"RTN","C0XF2N",139,0) - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE -"RTN","C0XF2N",140,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY) -"RTN","C0XF2N",141,0) - D UPDIE(.C0XFDA) ; TRY IT OUT -"RTN","C0XF2N",142,0) - K C0XCNT ;RESET FOR NEXT TIME -"RTN","C0XF2N",143,0) - D STORETXT(ZRDF,ZTXTNM,FARY) -"RTN","C0XF2N",144,0) - W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM -"RTN","C0XF2N",145,0) - D PROCESS2(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF -"RTN","C0XF2N",146,0) - Q -"RTN","C0XF2N",147,0) - ; -"RTN","C0XF2N",148,0) -STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME -"RTN","C0XF2N",149,0) - ; -"RTN","C0XF2N",150,0) - I '$D(FARY) D ; -"RTN","C0XF2N",151,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",152,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",153,0) - D USEFARY(FARY) -"RTN","C0XF2N",154,0) - N ZIEN -"RTN","C0XF2N",155,0) - S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN -"RTN","C0XF2N",156,0) - D CLEAN^DILF -"RTN","C0XF2N",157,0) - K ZERR -"RTN","C0XF2N",158,0) - D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") -"RTN","C0XF2N",159,0) - I $D(ZERR) D ; -"RTN","C0XF2N",160,0) - . ZWR ZERR -"RTN","C0XF2N",161,0) - Q -"RTN","C0XF2N",162,0) - ; -"RTN","C0XF2N",163,0) -GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT -"RTN","C0XF2N",164,0) - ; ZRTN IS PASSED BY REFERENCE -"RTN","C0XF2N",165,0) - I '$D(FARY) D ; -"RTN","C0XF2N",166,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",167,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",168,0) - D USEFARY(FARY) -"RTN","C0XF2N",169,0) - N ZIEN -"RTN","C0XF2N",170,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XF2N",171,0) - S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") -"RTN","C0XF2N",172,0) - Q -"RTN","C0XF2N",173,0) - ; -"RTN","C0XF2N",174,0) -WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL -"RTN","C0XF2N",175,0) - ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING -"RTN","C0XF2N",176,0) - I '$D(FARY) D ; -"RTN","C0XF2N",177,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",178,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",179,0) - D USEFARY(FARY) -"RTN","C0XF2N",180,0) - N ZIEN -"RTN","C0XF2N",181,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XF2N",182,0) - Q $NA(@C0XSN@(ZIEN,1)) -"RTN","C0XF2N",183,0) - ; -"RTN","C0XF2N",184,0) -FILEREAD(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH -"RTN","C0XF2N",185,0) - ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT -"RTN","C0XF2N",186,0) - ; IE ^TMP("C0X","FILEIN",1) -"RTN","C0XF2N",187,0) - ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 -"RTN","C0XF2N",188,0) - ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH -"RTN","C0XF2N",189,0) - S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) -"RTN","C0XF2N",190,0) - Q OK -"RTN","C0XF2N",191,0) - ; -"RTN","C0XF2N",192,0) -TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE -"RTN","C0XF2N",193,0) - S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) -"RTN","C0XF2N",194,0) - S ZGRAPH="/test/rdfFile" -"RTN","C0XF2N",195,0) - S ZM="/test/rdfFile/meta" -"RTN","C0XF2N",196,0) - D PROCESS(.G,ZIN,ZGRAPH,ZM) -"RTN","C0XF2N",197,0) - Q -"RTN","C0XF2N",198,0) - ; -"RTN","C0XF2N",199,0) -PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE -"RTN","C0XF2N",200,0) - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING -"RTN","C0XF2N",201,0) - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE -"RTN","C0XF2N",202,0) - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS -"RTN","C0XF2N",203,0) - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA -"RTN","C0XF2N",204,0) - ; -"RTN","C0XF2N",205,0) - I '$D(FARY) D ; -"RTN","C0XF2N",206,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",207,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",208,0) - D USEFARY(FARY) -"RTN","C0XF2N",209,0) - ; -- first parse the rdf file with the MXML parser -"RTN","C0XF2N",210,0) - ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML -"RTN","C0XF2N",211,0) - S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W") -"RTN","C0XF2N",212,0) - ; -- assign the MXLM dom global name to ZDOM -"RTN","C0XF2N",213,0) - S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID)) -"RTN","C0XF2N",214,0) - W !,$O(@ZDOM@(""),-1)," XML NODES PARSED" -"RTN","C0XF2N",215,0) - ; -- populate the metagraph to point to the graph with status unfinished -"RTN","C0XF2N",216,0) - S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT -"RTN","C0XF2N",217,0) - I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH -"RTN","C0XF2N",218,0) - D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH -"RTN","C0XF2N",219,0) - D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished -"RTN","C0XF2N",220,0) - ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT") -"RTN","C0XF2N",221,0) - S C0XDATE=$$NOW^XLFDT -"RTN","C0XF2N",222,0) - D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY) -"RTN","C0XF2N",223,0) - D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store -"RTN","C0XF2N",224,0) - ; -- -"RTN","C0XF2N",225,0) - ; -- pull out the vocabularies in the RDF statement. marked with xmlns: -"RTN","C0XF2N",226,0) - ; -- put them in a local variable for quick reference -"RTN","C0XF2N",227,0) - ; -- TODO: create a graph for vocabularies and validate incoming against it -"RTN","C0XF2N",228,0) - ; -"RTN","C0XF2N",229,0) - S C0XVOC="" -"RTN","C0XF2N",230,0) - N ZI,ZJ,ZK S ZI="" -"RTN","C0XF2N",231,0) - F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns -"RTN","C0XF2N",232,0) - . S ZVOC=$P(ZI,"xmlns:",2) -"RTN","C0XF2N",233,0) - . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI)) -"RTN","C0XF2N",234,0) - ;W !,"VOCABS:" ZWR C0XVOC -"RTN","C0XF2N",235,0) - ; -"RTN","C0XF2N",236,0) - ; -- look for children called rdf:Description. quit if none. not an rdf file -"RTN","C0XF2N",237,0) - ; -"RTN","C0XF2N",238,0) - S ZI=$O(@ZDOM@(1,"C","")) -"RTN","C0XF2N",239,0) - I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file -"RTN","C0XF2N",240,0) - . W !,"Error. Not an RDF file. Cannot process." -"RTN","C0XF2N",241,0) - ; -"RTN","C0XF2N",242,0) - ; -- now process the rdf description children -"RTN","C0XF2N",243,0) - ; -"RTN","C0XF2N",244,0) - S ZI="" -"RTN","C0XF2N",245,0) - S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate -"RTN","C0XF2N",246,0) - F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ; -"RTN","C0XF2N",247,0) - . ; -- we are skipping any child that is not rdf:Description -"RTN","C0XF2N",248,0) - . ; -- TODO: check to see if this is right in general -"RTN","C0XF2N",249,0) - . ; -"RTN","C0XF2N",250,0) - . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; -"RTN","C0XF2N",251,0) - . . W !,"SKIPPING NODE: ",ZI -"RTN","C0XF2N",252,0) - . ; -- now looking for the subject for the triples -"RTN","C0XF2N",253,0) - . S ZX=$G(@ZDOM@(ZI,"A","rdf:about")) -"RTN","C0XF2N",254,0) - . I ZX'="" D ; we have the subject -"RTN","C0XF2N",255,0) - . . ;W " about: ",ZX -"RTN","C0XF2N",256,0) - . . S C0XSUB=ZX -"RTN","C0XF2N",257,0) - . E D ; -"RTN","C0XF2N",258,0) - . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject -"RTN","C0XF2N",259,0) - . . I ZX'="" D ; -"RTN","C0XF2N",260,0) - . . . S C0XSUB=ZX -"RTN","C0XF2N",261,0) - . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT -"RTN","C0XF2N",262,0) - . ; -"RTN","C0XF2N",263,0) - . ; -- we now have the subject. the children of this node have the rest -"RTN","C0XF2N",264,0) - . ; -"RTN","C0XF2N",265,0) - . S ZJ="" ; for the children of the rdf:Description nodes -"RTN","C0XF2N",266,0) - . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child -"RTN","C0XF2N",267,0) - . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix -"RTN","C0XF2N",268,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space -"RTN","C0XF2N",269,0) - . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix -"RTN","C0XF2N",270,0) - . . I C0XPRE[":" D ; expand using vocabulary -"RTN","C0XF2N",271,0) - . . . N ZB,ZA -"RTN","C0XF2N",272,0) - . . . S ZB=$P(C0XPRE,":",1) -"RTN","C0XF2N",273,0) - . . . S ZA=$P(C0XPRE,":",2) -"RTN","C0XF2N",274,0) - . . . I $G(C0XVOC(ZB))'="" D ; -"RTN","C0XF2N",275,0) - . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded -"RTN","C0XF2N",276,0) - . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object -"RTN","C0XF2N",277,0) - . . I ZY'="" D Q ; -"RTN","C0XF2N",278,0) - . . . S C0XOBJ=ZY ; object -"RTN","C0XF2N",279,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple -"RTN","C0XF2N",280,0) - . . ; -- this is an else because of the quit above -"RTN","C0XF2N",281,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object -"RTN","C0XF2N",282,0) - . . I ZX'="" D Q ; got one -"RTN","C0XF2N",283,0) - . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject -"RTN","C0XF2N",284,0) - . . . ; without change... this could be foolish .. look at it again later -"RTN","C0XF2N",285,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XF2N",286,0) - . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here -"RTN","C0XF2N",287,0) - . . I C0XOBJ="" D Q ; not a happy situation -"RTN","C0XF2N",288,0) - . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ -"RTN","C0XF2N",289,0) - . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XF2N",290,0) - W !,"INSERTING ",C0XCNT," TRIPLES" -"RTN","C0XF2N",291,0) - D UPDIE(.C0XFDA) ; commit the updates to the file -"RTN","C0XF2N",292,0) - ; next, mark the graph as finished -"RTN","C0XF2N",293,0) - S C0XEND=$$NOW^XLFDT -"RTN","C0XF2N",294,0) - W !," ENDED AT: ",C0XEND -"RTN","C0XF2N",295,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2) -"RTN","C0XF2N",296,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",297,0) - I C0XDIFF'=0 D ; -"RTN","C0XF2N",298,0) - . W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" -"RTN","C0XF2N",299,0) - Q -"RTN","C0XF2N",300,0) - ; -"RTN","C0XF2N",301,0) -PROCESS2(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE -"RTN","C0XF2N",302,0) - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING -"RTN","C0XF2N",303,0) - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE -"RTN","C0XF2N",304,0) - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS -"RTN","C0XF2N",305,0) - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA -"RTN","C0XF2N",306,0) - ; -"RTN","C0XF2N",307,0) - I '$D(FARY) D ; -"RTN","C0XF2N",308,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",309,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",310,0) - D USEFARY(FARY) -"RTN","C0XF2N",311,0) - ;N BATCNT -"RTN","C0XF2N",312,0) - ;N BATMAX -"RTN","C0XF2N",313,0) - S BATCNT=0 ; BATCH COUNTER -"RTN","C0XF2N",314,0) - S BATMAX=10000 ; TRY BATCHES OF THIS SIZE -"RTN","C0XF2N",315,0) - ; -- first parse the rdf file with the MXML parser -"RTN","C0XF2N",316,0) - ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML -"RTN","C0XF2N",317,0) - S C0XDLC2=$$NOW^XLFDT ; START OF PARSE -"RTN","C0XF2N",318,0) - S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W") -"RTN","C0XF2N",319,0) - ; -- assign the MXLM dom global name to ZDOM -"RTN","C0XF2N",320,0) - S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID)) -"RTN","C0XF2N",321,0) - S C0XNODE=$O(@ZDOM@(""),-1) -"RTN","C0XF2N",322,0) - W !,C0XNODE," XML NODES PARSED" -"RTN","C0XF2N",323,0) - S C0XPRS=$$NOW^XLFDT ; PARSE COMPLETE -"RTN","C0XF2N",324,0) - W !,"PARSE COMPLETE AT ",C0XPRS -"RTN","C0XF2N",325,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XPRS,C0XDLC2,2) -"RTN","C0XF2N",326,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",327,0) - I C0XDIFF'=0 D ; -"RTN","C0XF2N",328,0) - . W !," APPROXIMATELY ",$P(C0XNODE/C0XDIFF,".")," NODES PER SECOND" -"RTN","C0XF2N",329,0) - ; -- populate the metagraph to point to the graph with status unfinished -"RTN","C0XF2N",330,0) - S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT -"RTN","C0XF2N",331,0) - I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH -"RTN","C0XF2N",332,0) - D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH -"RTN","C0XF2N",333,0) - D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished -"RTN","C0XF2N",334,0) - ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT") -"RTN","C0XF2N",335,0) - S C0XDATE=$$NOW^XLFDT -"RTN","C0XF2N",336,0) - D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY) -"RTN","C0XF2N",337,0) - D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store -"RTN","C0XF2N",338,0) - ; -- -"RTN","C0XF2N",339,0) - ; -- pull out the vocabularies in the RDF statement. marked with xmlns: -"RTN","C0XF2N",340,0) - ; -- put them in a local variable for quick reference -"RTN","C0XF2N",341,0) - ; -- TODO: create a graph for vocabularies and validate incoming against it -"RTN","C0XF2N",342,0) - ; -"RTN","C0XF2N",343,0) - S C0XVOC="" -"RTN","C0XF2N",344,0) - N ZI,ZJ,ZK S ZI="" -"RTN","C0XF2N",345,0) - F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns -"RTN","C0XF2N",346,0) - . S ZVOC=$P(ZI,"xmlns:",2) -"RTN","C0XF2N",347,0) - . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI)) -"RTN","C0XF2N",348,0) - ;W !,"VOCABS:" ZWR C0XVOC -"RTN","C0XF2N",349,0) - ; -"RTN","C0XF2N",350,0) - ; -- look for children called rdf:Description. quit if none. not an rdf file -"RTN","C0XF2N",351,0) - ; -"RTN","C0XF2N",352,0) - S ZI=$O(@ZDOM@(1,"C","")) -"RTN","C0XF2N",353,0) - I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file -"RTN","C0XF2N",354,0) - . W !,"Error. Not an RDF file. Cannot process." -"RTN","C0XF2N",355,0) - ; -"RTN","C0XF2N",356,0) - ; -- now process the rdf description children -"RTN","C0XF2N",357,0) - ; -"RTN","C0XF2N",358,0) - S ZI="" -"RTN","C0XF2N",359,0) - S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate -"RTN","C0XF2N",360,0) - F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ; -"RTN","C0XF2N",361,0) - . ; -- we are skipping any child that is not rdf:Description -"RTN","C0XF2N",362,0) - . ; -- TODO: check to see if this is right in general -"RTN","C0XF2N",363,0) - . ; -"RTN","C0XF2N",364,0) - . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; -"RTN","C0XF2N",365,0) - . . W !,"SKIPPING NODE: ",ZI -"RTN","C0XF2N",366,0) - . ; -- now looking for the subject for the triples -"RTN","C0XF2N",367,0) - . S ZX=$G(@ZDOM@(ZI,"A","rdf:about")) -"RTN","C0XF2N",368,0) - . I ZX'="" D ; we have the subject -"RTN","C0XF2N",369,0) - . . ;W " about: ",ZX -"RTN","C0XF2N",370,0) - . . S C0XSUB=ZX -"RTN","C0XF2N",371,0) - . E D ; -"RTN","C0XF2N",372,0) - . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject -"RTN","C0XF2N",373,0) - . . I ZX'="" D ; -"RTN","C0XF2N",374,0) - . . . S C0XSUB=ZX -"RTN","C0XF2N",375,0) - . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT -"RTN","C0XF2N",376,0) - . ; -"RTN","C0XF2N",377,0) - . ; -- we now have the subject. the children of this node have the rest -"RTN","C0XF2N",378,0) - . ; -"RTN","C0XF2N",379,0) - . S ZJ="" ; for the children of the rdf:Description nodes -"RTN","C0XF2N",380,0) - . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child -"RTN","C0XF2N",381,0) - . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix -"RTN","C0XF2N",382,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space -"RTN","C0XF2N",383,0) - . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix -"RTN","C0XF2N",384,0) - . . I C0XPRE[":" D ; expand using vocabulary -"RTN","C0XF2N",385,0) - . . . N ZB,ZA -"RTN","C0XF2N",386,0) - . . . S ZB=$P(C0XPRE,":",1) -"RTN","C0XF2N",387,0) - . . . S ZA=$P(C0XPRE,":",2) -"RTN","C0XF2N",388,0) - . . . I $G(C0XVOC(ZB))'="" D ; -"RTN","C0XF2N",389,0) - . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded -"RTN","C0XF2N",390,0) - . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object -"RTN","C0XF2N",391,0) - . . I ZY'="" D Q ; -"RTN","C0XF2N",392,0) - . . . S C0XOBJ=ZY ; object -"RTN","C0XF2N",393,0) - . . . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple -"RTN","C0XF2N",394,0) - . . ; -- this is an else because of the quit above -"RTN","C0XF2N",395,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object -"RTN","C0XF2N",396,0) - . . I ZX'="" D Q ; got one -"RTN","C0XF2N",397,0) - . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject -"RTN","C0XF2N",398,0) - . . . ; without change... this could be foolish .. look at it again later -"RTN","C0XF2N",399,0) - . . . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XF2N",400,0) - . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here -"RTN","C0XF2N",401,0) - . . I C0XOBJ="" D Q ; not a happy situation -"RTN","C0XF2N",402,0) - . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ -"RTN","C0XF2N",403,0) - . . D ADD2(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XF2N",404,0) - S C0XTRP=$$NOW^XLFDT ; PARSE COMPLETE -"RTN","C0XF2N",405,0) - W !,"TRIPLES COMPLETE AT ",C0XTRP -"RTN","C0XF2N",406,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XTRP,C0XPRS,2) -"RTN","C0XF2N",407,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",408,0) - I C0XDIFF'=0 D ; -"RTN","C0XF2N",409,0) - . W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" -"RTN","C0XF2N",410,0) - W !,"INSERTING ",C0XCNT," TRIPLES" -"RTN","C0XF2N",411,0) - I $D(C0XFDA) D ; -"RTN","C0XF2N",412,0) - . I $G(BLKLOAD) D ; -"RTN","C0XF2N",413,0) - . . D BULKLOAD(.C0XFDA) -"RTN","C0XF2N",414,0) - . E D ; -"RTN","C0XF2N",415,0) - . . D UPDIE(.C0XFDA) ; commit the updates to the file -"RTN","C0XF2N",416,0) - ; next, mark the graph as finished -"RTN","C0XF2N",417,0) - S C0XINS=$$NOW^XLFDT ; PARSE COMPLETE -"RTN","C0XF2N",418,0) - W !,"INSERTION COMPLETE AT ",C0XPRS -"RTN","C0XF2N",419,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XINS,C0XTRP,2) -"RTN","C0XF2N",420,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",421,0) - I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," NODES PER SECOND" -"RTN","C0XF2N",422,0) - S C0XEND=$$NOW^XLFDT -"RTN","C0XF2N",423,0) - W !," ENDED AT: ",C0XEND -"RTN","C0XF2N",424,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2) -"RTN","C0XF2N",425,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",426,0) - I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" -"RTN","C0XF2N",427,0) - Q -"RTN","C0XF2N",428,0) - ; -"RTN","C0XF2N",429,0) -SHOW(ZN) ; -"RTN","C0XF2N",430,0) - ZWR ^TMP("MXMLDOM",$J,1,ZN,*) -"RTN","C0XF2N",431,0) - Q -"RTN","C0XF2N",432,0) - ; -"RTN","C0XF2N",433,0) -ANONS() ; RETURNS AN ANONOMOUS SUBJECT -"RTN","C0XF2N",434,0) - Q "_S:"_$$LKY9 -"RTN","C0XF2N",435,0) - ; -"RTN","C0XF2N",436,0) -NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED -"RTN","C0XF2N",437,0) - ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT -"RTN","C0XF2N",438,0) - ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN -"RTN","C0XF2N",439,0) - S NGRAPH="G"_$$LKY9 -"RTN","C0XF2N",440,0) - S NMETA=NGRAPH_"A" -"RTN","C0XF2N",441,0) - Q -"RTN","C0XF2N",442,0) - ; -"RTN","C0XF2N",443,0) -ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT -"RTN","C0XF2N",444,0) - ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE -"RTN","C0XF2N",445,0) - I '$D(FARY) D ; -"RTN","C0XF2N",446,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",447,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",448,0) - D USEFARY(FARY) -"RTN","C0XF2N",449,0) - I '$D(C0XCNT) S C0XCNT=0 -"RTN","C0XF2N",450,0) - N ZNODE -"RTN","C0XF2N",451,0) - S ZNODE="N"_$$LKY17 -"RTN","C0XF2N",452,0) - N ZNARY ; GET READY TO CALL IENOFA -"RTN","C0XF2N",453,0) - S ZNARY("ZG",ZG)="" -"RTN","C0XF2N",454,0) - S ZNARY("ZS",ZS)="" -"RTN","C0XF2N",455,0) - S ZNARY("ZP",ZP)="" -"RTN","C0XF2N",456,0) - S ZNARY("ZO",ZO)="" -"RTN","C0XF2N",457,0) - D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS -"RTN","C0XF2N",458,0) - ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN -"RTN","C0XF2N",459,0) - ;S ZSIEN=$$IENOF(ZS) -"RTN","C0XF2N",460,0) - ;S ZPIEN=$$IENOF(ZP) -"RTN","C0XF2N",461,0) - ;S ZOIEN=$$IENOF(ZO) -"RTN","C0XF2N",462,0) - ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED -"RTN","C0XF2N",463,0) - S C0XCNT=C0XCNT+1 -"RTN","C0XF2N",464,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE -"RTN","C0XF2N",465,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG","")) -"RTN","C0XF2N",466,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS","")) -"RTN","C0XF2N",467,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP","")) -"RTN","C0XF2N",468,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO","")) -"RTN","C0XF2N",469,0) - ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE -"RTN","C0XF2N",470,0) - Q -"RTN","C0XF2N",471,0) - ; -"RTN","C0XF2N",472,0) -ADD2(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT -"RTN","C0XF2N",473,0) - ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE -"RTN","C0XF2N",474,0) - I '$D(FARY) D ; -"RTN","C0XF2N",475,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",476,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",477,0) - D USEFARY(FARY) -"RTN","C0XF2N",478,0) - I '$D(C0XCNT) S C0XCNT=0 -"RTN","C0XF2N",479,0) - N ZNODE -"RTN","C0XF2N",480,0) - S ZNODE="N"_$$LKY17 -"RTN","C0XF2N",481,0) - N ZNARY ; GET READY TO CALL IENOFA -"RTN","C0XF2N",482,0) - S ZNARY("ZG",ZG)="" -"RTN","C0XF2N",483,0) - S ZNARY("ZS",ZS)="" -"RTN","C0XF2N",484,0) - S ZNARY("ZP",ZP)="" -"RTN","C0XF2N",485,0) - S ZNARY("ZO",ZO)="" -"RTN","C0XF2N",486,0) - D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS -"RTN","C0XF2N",487,0) - ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN -"RTN","C0XF2N",488,0) - ;S ZSIEN=$$IENOF(ZS) -"RTN","C0XF2N",489,0) - ;S ZPIEN=$$IENOF(ZP) -"RTN","C0XF2N",490,0) - ;S ZOIEN=$$IENOF(ZO) -"RTN","C0XF2N",491,0) - ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED -"RTN","C0XF2N",492,0) - S BATCNT=BATCNT+1 -"RTN","C0XF2N",493,0) - S C0XCNT=C0XCNT+1 -"RTN","C0XF2N",494,0) - I $G(BLKLOAD)=1 D ; we are using bulk load -"RTN","C0XF2N",495,0) - . S C0XFDA(C0XTFN,BATCNT,.01)=ZNODE -"RTN","C0XF2N",496,0) - . S C0XFDA(C0XTFN,BATCNT,.02)=$O(ZIENS("IEN","ZG","")) -"RTN","C0XF2N",497,0) - . S C0XFDA(C0XTFN,BATCNT,.03)=$O(ZIENS("IEN","ZS","")) -"RTN","C0XF2N",498,0) - . S C0XFDA(C0XTFN,BATCNT,.04)=$O(ZIENS("IEN","ZP","")) -"RTN","C0XF2N",499,0) - . S C0XFDA(C0XTFN,BATCNT,.05)=$O(ZIENS("IEN","ZO","")) -"RTN","C0XF2N",500,0) - E D ; -"RTN","C0XF2N",501,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.01)=ZNODE -"RTN","C0XF2N",502,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.02)=$O(ZIENS("IEN","ZG","")) -"RTN","C0XF2N",503,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.03)=$O(ZIENS("IEN","ZS","")) -"RTN","C0XF2N",504,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.04)=$O(ZIENS("IEN","ZP","")) -"RTN","C0XF2N",505,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.05)=$O(ZIENS("IEN","ZO","")) -"RTN","C0XF2N",506,0) - I BATCNT=BATMAX D ; BATCH IS DONE -"RTN","C0XF2N",507,0) - . I $G(BLKLOAD) D ; bulk load -"RTN","C0XF2N",508,0) - . . D BULKLOAD(.C0XFDA) ; bulk load the batch -"RTN","C0XF2N",509,0) - . E D ; no bulk load -"RTN","C0XF2N",510,0) - . . D UPDIE(.C0XFDA) -"RTN","C0XF2N",511,0) - . K C0XFDA -"RTN","C0XF2N",512,0) - . S BATCNT=0 ; RESET COUNTER -"RTN","C0XF2N",513,0) - ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE -"RTN","C0XF2N",514,0) - Q -"RTN","C0XF2N",515,0) - ; -"RTN","C0XF2N",516,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XF2N",517,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XF2N",518,0) - N ZN,ZI -"RTN","C0XF2N",519,0) - S ZN="" -"RTN","C0XF2N",520,0) - F ZI=1:1:9 D ; -"RTN","C0XF2N",521,0) - . S ZN=ZN_$R(10) -"RTN","C0XF2N",522,0) - Q ZN -"RTN","C0XF2N",523,0) - ; -"RTN","C0XF2N",524,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XF2N",525,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XF2N",526,0) - N ZN,ZI -"RTN","C0XF2N",527,0) - S ZN="" -"RTN","C0XF2N",528,0) - F ZI=1:1:17 D ; -"RTN","C0XF2N",529,0) - . S ZN=ZN_$R(10) -"RTN","C0XF2N",530,0) - Q ZN -"RTN","C0XF2N",531,0) - ; -"RTN","C0XF2N",532,0) -IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE -"RTN","C0XF2N",533,0) - I '$D(FARY) D ; -"RTN","C0XF2N",534,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",535,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",536,0) - N ZIEN -"RTN","C0XF2N",537,0) - S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XF2N",538,0) - I ZIEN="" D ; -"RTN","C0XF2N",539,0) - . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING -"RTN","C0XF2N",540,0) - . D UPDIE(.C0XFDA2) -"RTN","C0XF2N",541,0) - . S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XF2N",542,0) - . K C0XFDA2 -"RTN","C0XF2N",543,0) - Q ZIEN -"RTN","C0XF2N",544,0) - ; -"RTN","C0XF2N",545,0) -IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE -"RTN","C0XF2N",546,0) - ; OR ADD THEM IF -"RTN","C0XF2N",547,0) - ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE -"RTN","C0XF2N",548,0) - ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")="" -"RTN","C0XF2N",549,0) - ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" -"RTN","C0XF2N",550,0) - I '$D(FARY) D ; -"RTN","C0XF2N",551,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",552,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",553,0) - K ZOUTARY ; START WITH CLEAN RESULTS -"RTN","C0XF2N",554,0) - K C0XFDA2 ; USE A SEPARATE FDA FOR THIS -"RTN","C0XF2N",555,0) - N ZI S ZI="" -"RTN","C0XF2N",556,0) - N ZV,ZIEN -"RTN","C0XF2N",557,0) - N ZCNT S ZCNT=0 -"RTN","C0XF2N",558,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS -"RTN","C0XF2N",559,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XF2N",560,0) - . I $O(@C0XSN@("B",ZV,""))="" D ; -"RTN","C0XF2N",561,0) - . . S ZCNT=ZCNT+1 -"RTN","C0XF2N",562,0) - . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV -"RTN","C0XF2N",563,0) - I $D(C0XFDA2) D ; -"RTN","C0XF2N",564,0) - . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS -"RTN","C0XF2N",565,0) - . K C0XFDA2 ; CLEAN UP -"RTN","C0XF2N",566,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS -"RTN","C0XF2N",567,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XF2N",568,0) - . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW -"RTN","C0XF2N",569,0) - . I ZIEN="" D ; -"RTN","C0XF2N",570,0) - . . W !,"ERROR ADDING STRING: ",ZV -"RTN","C0XF2N",571,0) - . . B -"RTN","C0XF2N",572,0) - . S ZOUTARY("IEN",ZI,ZIEN)="" -"RTN","C0XF2N",573,0) - Q -"RTN","C0XF2N",574,0) - ; -"RTN","C0XF2N",575,0) -BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 -"RTN","C0XF2N",576,0) - ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE -"RTN","C0XF2N",577,0) - ; QUITS IF FILE IS NOT 172.101 -"RTN","C0XF2N",578,0) - ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 -"RTN","C0XF2N",579,0) - ; QUITS IF FIRST ENTRY IS NOT IENS 1 -"RTN","C0XF2N",580,0) - ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES -"RTN","C0XF2N",581,0) - ; ZBFDA IS PASSED BY REFERENCE -"RTN","C0XF2N",582,0) - ; -"RTN","C0XF2N",583,0) - ; -- reserves a block of iens from file 172.101 by locking the zero node -"RTN","C0XF2N",584,0) - ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 -"RTN","C0XF2N",585,0) - ; -- then unlocking to minimize the duration of the lock -"RTN","C0XF2N",586,0) - ; -"RTN","C0XF2N",587,0) - W !,"USING BULKLOAD" -"RTN","C0XF2N",588,0) - I '$D(ZBFDA) Q ; EMPTY FDA -"RTN","C0XF2N",589,0) - I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE -"RTN","C0XF2N",590,0) - N ZCNT,ZP3,ZP4 -"RTN","C0XF2N",591,0) - ; -- find the number of nodes to insert -"RTN","C0XF2N",592,0) - S ZCNT=$O(ZBFDA(172.101,""),-1) -"RTN","C0XF2N",593,0) - I ZCNT="" D Q ; -"RTN","C0XF2N",594,0) - . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" -"RTN","C0XF2N",595,0) - . B -"RTN","C0XF2N",596,0) - ; -- lock the zero node and reserve a block of iens to insert -"RTN","C0XF2N",597,0) - W !,"LOCKING ZERO NODE" -"RTN","C0XF2N",598,0) - LOCK +^C0X(101,0) -"RTN","C0XF2N",599,0) - S ZP3=$P(^C0X(101,0),U,3) -"RTN","C0XF2N",600,0) - S ZP4=$P(^C0X(101,0),U,4) -"RTN","C0XF2N",601,0) - S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 -"RTN","C0XF2N",602,0) - S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 -"RTN","C0XF2N",603,0) - LOCK -^C0X(101,0) -"RTN","C0XF2N",604,0) - N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE -"RTN","C0XF2N",605,0) - S ZBASE=ZP3 ; the last ien in the file -"RTN","C0XF2N",606,0) - W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT -"RTN","C0XF2N",607,0) - W !,$$NOW^XLFDT -"RTN","C0XF2N",608,0) - S ZI="" -"RTN","C0XF2N",609,0) - F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; -"RTN","C0XF2N",610,0) - . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name -"RTN","C0XF2N",611,0) - . I ZN="" D BLKERR Q ; -"RTN","C0XF2N",612,0) - . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer -"RTN","C0XF2N",613,0) - . I ZG="" D BLKERR Q ; -"RTN","C0XF2N",614,0) - . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer -"RTN","C0XF2N",615,0) - . I ZS="" D BLKERR Q ; -"RTN","C0XF2N",616,0) - . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer -"RTN","C0XF2N",617,0) - . I ZP="" D BLKERR Q ; -"RTN","C0XF2N",618,0) - . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer -"RTN","C0XF2N",619,0) - . I ZO="" D BLKERR Q ; -"RTN","C0XF2N",620,0) - . S ZIEN=ZI+ZBASE ; the new ien -"RTN","C0XF2N",621,0) - . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node -"RTN","C0XF2N",622,0) - . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index -"RTN","C0XF2N",623,0) - . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index -"RTN","C0XF2N",624,0) - . S ^C0X(101,"SPO",ZS,ZP,ZO)="" -"RTN","C0XF2N",625,0) - . S ^C0X(101,"SOP",ZS,ZO,ZP)="" -"RTN","C0XF2N",626,0) - . S ^C0X(101,"OPS",ZO,ZP,ZS)="" -"RTN","C0XF2N",627,0) - . S ^C0X(101,"OSP",ZO,ZS,ZP)="" -"RTN","C0XF2N",628,0) - . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" -"RTN","C0XF2N",629,0) - . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" -"RTN","C0XF2N",630,0) - . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" -"RTN","C0XF2N",631,0) - . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" -"RTN","C0XF2N",632,0) - Q -"RTN","C0XF2N",633,0) - ; -"RTN","C0XF2N",634,0) -BLKERR ; -"RTN","C0XF2N",635,0) - W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) -"RTN","C0XF2N",636,0) - B -"RTN","C0XF2N",637,0) - Q -"RTN","C0XF2N",638,0) - ; -"RTN","C0XF2N",639,0) -UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS -"RTN","C0XF2N",640,0) - ; ZFDA IS PASSED BY REFERENCE -"RTN","C0XF2N",641,0) - ;ZWR ZFDA -"RTN","C0XF2N",642,0) - ;B -"RTN","C0XF2N",643,0) - K ZERR -"RTN","C0XF2N",644,0) - D CLEAN^DILF -"RTN","C0XF2N",645,0) - D UPDATE^DIE("","ZFDA","","ZERR") -"RTN","C0XF2N",646,0) - I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, -"RTN","C0XF2N",647,0) - ; INVOKE THE ERROR TRAP IF TASKED -"RTN","C0XF2N",648,0) - ;. W "ERROR",! -"RTN","C0XF2N",649,0) - ;. ZWR ZERR -"RTN","C0XF2N",650,0) - ;. B -"RTN","C0XF2N",651,0) - K ZFDA -"RTN","C0XF2N",652,0) - Q -"RTN","C0XF2N",653,0) - ; -"RTN","C0XMAIN") -0^1^B115393527 -"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) - S @ZFARY@("C0XDIR")="/home/george/fmts/trunk/samples/" -"RTN","C0XMAIN",31,0) - D USEFARY(ZFARY) -"RTN","C0XMAIN",32,0) - Q -"RTN","C0XMAIN",33,0) - ; -"RTN","C0XMAIN",34,0) -USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY -"RTN","C0XMAIN",35,0) - N ZI S ZI="" -"RTN","C0XMAIN",36,0) - F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D -"RTN","C0XMAIN",37,0) - . ;N ZX -"RTN","C0XMAIN",38,0) - . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_"""" -"RTN","C0XMAIN",39,0) - . ;W !,ZX -"RTN","C0XMAIN",40,0) - . X ZX -"RTN","C0XMAIN",41,0) - Q -"RTN","C0XMAIN",42,0) - ; -"RTN","C0XMAIN",43,0) -IMPORT(FNAME,FDIR,FURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD -"RTN","C0XMAIN",44,0) - ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE -"RTN","C0XMAIN",45,0) - ; NODE NAME OF THE TEXT TRIPLE -"RTN","C0XMAIN",46,0) - ; FDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR) -"RTN","C0XMAIN",47,0) - ; FURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE -"RTN","C0XMAIN",48,0) - ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE -"RTN","C0XMAIN",49,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",50,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",51,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",52,0) - D USEFARY(FARY) -"RTN","C0XMAIN",53,0) - N ZD,ZTMP -"RTN","C0XMAIN",54,0) - I '$D(FDIR) S FDIR=C0XDIR ; DIRECTORY OF THE RDF FILE -"RTN","C0XMAIN",55,0) - I '$D(FURL) D ; -"RTN","C0XMAIN",56,0) - . N ZN2 S ZN2=$TR(FNAME,".","_") ; REMOVE THE DOT FROM THE NAME -"RTN","C0XMAIN",57,0) - . S FURL=FDIR_ZN2 -"RTN","C0XMAIN",58,0) - N ZTMP -"RTN","C0XMAIN",59,0) - S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE -"RTN","C0XMAIN",60,0) - K @ZTMP ; MAKE SURE IT'S CLEAR -"RTN","C0XMAIN",61,0) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XMAIN",62,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XMAIN",63,0) - W !,"READING IN: ",FNAME -"RTN","C0XMAIN",64,0) - I '$$FILEIN(ZTMP,FDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS -"RTN","C0XMAIN",65,0) - . W !,"ERROR READING FILE: ",FDIR,FNAME -"RTN","C0XMAIN",66,0) - S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT -"RTN","C0XMAIN",67,0) - W !,$O(@ZRDF@(""),-1)," LINES READ" -"RTN","C0XMAIN",68,0) - D INSRDF(ZRDF,FURL,FARY) ; IMPORT AND PROCESS THE RDF -"RTN","C0XMAIN",69,0) - Q -"RTN","C0XMAIN",70,0) - ; -"RTN","C0XMAIN",71,0) -WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT -"RTN","C0XMAIN",72,0) - ; -"RTN","C0XMAIN",73,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",74,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",75,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",76,0) - D USEFARY(FARY) -"RTN","C0XMAIN",77,0) - ;N ZLOC,ZTMP -"RTN","C0XMAIN",78,0) - K ZTMP -"RTN","C0XMAIN",79,0) - S ZLOC=$NA(^TMP("C0X","WGET",$J)) -"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) - W !,$O(@ZLOC@(""),-1)," LINES READ" -"RTN","C0XMAIN",86,0) - D INSRDF(ZLOC,ZURL,FARY) -"RTN","C0XMAIN",87,0) - Q -"RTN","C0XMAIN",88,0) - ; -"RTN","C0XMAIN",89,0) -INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS -"RTN","C0XMAIN",90,0) - ; ZRDF IS PASSED BY NAME -"RTN","C0XMAIN",91,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",92,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",93,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",94,0) - D USEFARY(FARY) -"RTN","C0XMAIN",95,0) - N ZGRAPH,ZSUBJECT -"RTN","C0XMAIN",96,0) - S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME -"RTN","C0XMAIN",97,0) - S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT -"RTN","C0XMAIN",98,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY) -"RTN","C0XMAIN",99,0) - N ZTXTNM -"RTN","C0XMAIN",100,0) - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE -"RTN","C0XMAIN",101,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY) -"RTN","C0XMAIN",102,0) - D UPDIE(.C0XFDA) ; TRY IT OUT -"RTN","C0XMAIN",103,0) - K C0XCNT ;RESET FOR NEXT TIME -"RTN","C0XMAIN",104,0) - D STORETXT(ZRDF,ZTXTNM,FARY) -"RTN","C0XMAIN",105,0) - W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM -"RTN","C0XMAIN",106,0) - D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF -"RTN","C0XMAIN",107,0) - Q -"RTN","C0XMAIN",108,0) - ; -"RTN","C0XMAIN",109,0) -STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME -"RTN","C0XMAIN",110,0) - ; -"RTN","C0XMAIN",111,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",112,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",113,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",114,0) - D USEFARY(FARY) -"RTN","C0XMAIN",115,0) - N ZIEN -"RTN","C0XMAIN",116,0) - S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN -"RTN","C0XMAIN",117,0) - D CLEAN^DILF -"RTN","C0XMAIN",118,0) - K ZERR -"RTN","C0XMAIN",119,0) - D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") -"RTN","C0XMAIN",120,0) - I $D(ZERR) D ; -"RTN","C0XMAIN",121,0) - . ZWR ZERR -"RTN","C0XMAIN",122,0) - Q -"RTN","C0XMAIN",123,0) - ; -"RTN","C0XMAIN",124,0) -GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT -"RTN","C0XMAIN",125,0) - ; ZRTN IS PASSED BY REFERENCE -"RTN","C0XMAIN",126,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",127,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",128,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",129,0) - D USEFARY(FARY) -"RTN","C0XMAIN",130,0) - N ZIEN -"RTN","C0XMAIN",131,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XMAIN",132,0) - S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") -"RTN","C0XMAIN",133,0) - Q -"RTN","C0XMAIN",134,0) - ; -"RTN","C0XMAIN",135,0) -WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL -"RTN","C0XMAIN",136,0) - ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING -"RTN","C0XMAIN",137,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",138,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",139,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",140,0) - D USEFARY(FARY) -"RTN","C0XMAIN",141,0) - N ZIEN -"RTN","C0XMAIN",142,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XMAIN",143,0) - Q $NA(@C0XSN@(ZIEN,1)) -"RTN","C0XMAIN",144,0) - ; -"RTN","C0XMAIN",145,0) -FILEIN(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH -"RTN","C0XMAIN",146,0) - ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT -"RTN","C0XMAIN",147,0) - ; IE ^TMP("C0X","FILEIN",1) -"RTN","C0XMAIN",148,0) - ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 -"RTN","C0XMAIN",149,0) - ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH -"RTN","C0XMAIN",150,0) - S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) -"RTN","C0XMAIN",151,0) - Q OK -"RTN","C0XMAIN",152,0) - ; -"RTN","C0XMAIN",153,0) -TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE -"RTN","C0XMAIN",154,0) - S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) -"RTN","C0XMAIN",155,0) - S ZGRAPH="/test/rdfFile" -"RTN","C0XMAIN",156,0) - S ZM="/test/rdfFile/meta" -"RTN","C0XMAIN",157,0) - D PROCESS(.G,ZIN,ZGRAPH,ZM) -"RTN","C0XMAIN",158,0) - Q -"RTN","C0XMAIN",159,0) - ; -"RTN","C0XMAIN",160,0) -PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE -"RTN","C0XMAIN",161,0) - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING -"RTN","C0XMAIN",162,0) - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE -"RTN","C0XMAIN",163,0) - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS -"RTN","C0XMAIN",164,0) - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA -"RTN","C0XMAIN",165,0) - ; -"RTN","C0XMAIN",166,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",167,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",168,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",169,0) - D USEFARY(FARY) -"RTN","C0XMAIN",170,0) - ; -- first parse the rdf file with the MXML parser -"RTN","C0XMAIN",171,0) - ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML -"RTN","C0XMAIN",172,0) - S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W") -"RTN","C0XMAIN",173,0) - ; -- assign the MXLM dom global name to ZDOM -"RTN","C0XMAIN",174,0) - S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID)) -"RTN","C0XMAIN",175,0) - W !,$O(@ZDOM@(""),-1)," XML NODES PARSED" -"RTN","C0XMAIN",176,0) - ; -- populate the metagraph to point to the graph with status unfinished -"RTN","C0XMAIN",177,0) - S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT -"RTN","C0XMAIN",178,0) - I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH -"RTN","C0XMAIN",179,0) - D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH -"RTN","C0XMAIN",180,0) - D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished -"RTN","C0XMAIN",181,0) - ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT") -"RTN","C0XMAIN",182,0) - S C0XDATE=$$NOW^XLFDT -"RTN","C0XMAIN",183,0) - D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY) -"RTN","C0XMAIN",184,0) - D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store -"RTN","C0XMAIN",185,0) - ; -- -"RTN","C0XMAIN",186,0) - ; -- pull out the vocabularies in the RDF statement. marked with xmlns: -"RTN","C0XMAIN",187,0) - ; -- put them in a local variable for quick reference -"RTN","C0XMAIN",188,0) - ; -- TODO: create a graph for vocabularies and validate incoming against it -"RTN","C0XMAIN",189,0) - ; -"RTN","C0XMAIN",190,0) - S C0XVOC="" -"RTN","C0XMAIN",191,0) - N ZI,ZJ,ZK S ZI="" -"RTN","C0XMAIN",192,0) - F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns -"RTN","C0XMAIN",193,0) - . S ZVOC=$P(ZI,"xmlns:",2) -"RTN","C0XMAIN",194,0) - . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI)) -"RTN","C0XMAIN",195,0) - ;W !,"VOCABS:" ZWR C0XVOC -"RTN","C0XMAIN",196,0) - ; -"RTN","C0XMAIN",197,0) - ; -- look for children called rdf:Description. quit if none. not an rdf file -"RTN","C0XMAIN",198,0) - ; -"RTN","C0XMAIN",199,0) - S ZI=$O(@ZDOM@(1,"C","")) -"RTN","C0XMAIN",200,0) - I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file -"RTN","C0XMAIN",201,0) - . W !,"Error. Not an RDF file. Cannot process." -"RTN","C0XMAIN",202,0) - ; -"RTN","C0XMAIN",203,0) - ; -- now process the rdf description children -"RTN","C0XMAIN",204,0) - ; -"RTN","C0XMAIN",205,0) - S ZI="" -"RTN","C0XMAIN",206,0) - S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate -"RTN","C0XMAIN",207,0) - F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ; -"RTN","C0XMAIN",208,0) - . ; -- we are skipping any child that is not rdf:Description -"RTN","C0XMAIN",209,0) - . ; -- TODO: check to see if this is right in general -"RTN","C0XMAIN",210,0) - . ; -"RTN","C0XMAIN",211,0) - . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; -"RTN","C0XMAIN",212,0) - . . W !,"SKIPPING NODE: ",ZI -"RTN","C0XMAIN",213,0) - . ; -- now looking for the subject for the triples -"RTN","C0XMAIN",214,0) - . S ZX=$G(@ZDOM@(ZI,"A","rdf:about")) -"RTN","C0XMAIN",215,0) - . I ZX'="" D ; we have the subject -"RTN","C0XMAIN",216,0) - . . ;W " about: ",ZX -"RTN","C0XMAIN",217,0) - . . S C0XSUB=ZX -"RTN","C0XMAIN",218,0) - . E D ; -"RTN","C0XMAIN",219,0) - . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject -"RTN","C0XMAIN",220,0) - . . I ZX'="" D ; -"RTN","C0XMAIN",221,0) - . . . S C0XSUB=ZX -"RTN","C0XMAIN",222,0) - . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT -"RTN","C0XMAIN",223,0) - . ; -"RTN","C0XMAIN",224,0) - . ; -- we now have the subject. the children of this node have the rest -"RTN","C0XMAIN",225,0) - . ; -"RTN","C0XMAIN",226,0) - . S ZJ="" ; for the children of the rdf:Description nodes -"RTN","C0XMAIN",227,0) - . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child -"RTN","C0XMAIN",228,0) - . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix -"RTN","C0XMAIN",229,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space -"RTN","C0XMAIN",230,0) - . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix -"RTN","C0XMAIN",231,0) - . . I C0XPRE[":" D ; expand using vocabulary -"RTN","C0XMAIN",232,0) - . . . N ZB,ZA -"RTN","C0XMAIN",233,0) - . . . S ZB=$P(C0XPRE,":",1) -"RTN","C0XMAIN",234,0) - . . . S ZA=$P(C0XPRE,":",2) -"RTN","C0XMAIN",235,0) - . . . I $G(C0XVOC(ZB))'="" D ; -"RTN","C0XMAIN",236,0) - . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded -"RTN","C0XMAIN",237,0) - . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object -"RTN","C0XMAIN",238,0) - . . I ZY'="" D Q ; -"RTN","C0XMAIN",239,0) - . . . S C0XOBJ=ZY ; object -"RTN","C0XMAIN",240,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple -"RTN","C0XMAIN",241,0) - . . ; -- this is an else because of the quit above -"RTN","C0XMAIN",242,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object -"RTN","C0XMAIN",243,0) - . . I ZX'="" D Q ; got one -"RTN","C0XMAIN",244,0) - . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject -"RTN","C0XMAIN",245,0) - . . . ; without change... this could be foolish .. look at it again later -"RTN","C0XMAIN",246,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XMAIN",247,0) - . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here -"RTN","C0XMAIN",248,0) - . . I C0XOBJ="" D Q ; not a happy situation -"RTN","C0XMAIN",249,0) - . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ -"RTN","C0XMAIN",250,0) - . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XMAIN",251,0) - W !,"INSERTING ",C0XCNT," TRIPLES" -"RTN","C0XMAIN",252,0) - D UPDIE(.C0XFDA) ; commit the updates to the file -"RTN","C0XMAIN",253,0) - ; next, mark the graph as finished -"RTN","C0XMAIN",254,0) - S C0XEND=$$NOW^XLFDT -"RTN","C0XMAIN",255,0) - W !," ENDED AT: ",C0XEND -"RTN","C0XMAIN",256,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2) -"RTN","C0XMAIN",257,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XMAIN",258,0) - W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" -"RTN","C0XMAIN",259,0) - Q -"RTN","C0XMAIN",260,0) - ; -"RTN","C0XMAIN",261,0) -SHOW(ZN) ; -"RTN","C0XMAIN",262,0) - ZWR ^TMP("MXMLDOM",$J,1,ZN,*) -"RTN","C0XMAIN",263,0) - Q -"RTN","C0XMAIN",264,0) - ; -"RTN","C0XMAIN",265,0) -ANONS() ; RETURNS AN ANONOMOUS SUBJECT -"RTN","C0XMAIN",266,0) - Q "_S:"_$$LKY9 -"RTN","C0XMAIN",267,0) - ; -"RTN","C0XMAIN",268,0) -NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED -"RTN","C0XMAIN",269,0) - ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT -"RTN","C0XMAIN",270,0) - ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN -"RTN","C0XMAIN",271,0) - S NGRAPH="G"_$$LKY9 -"RTN","C0XMAIN",272,0) - S NMETA=NGRAPH_"A" -"RTN","C0XMAIN",273,0) - Q -"RTN","C0XMAIN",274,0) - ; -"RTN","C0XMAIN",275,0) -ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT -"RTN","C0XMAIN",276,0) - ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE -"RTN","C0XMAIN",277,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",278,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",279,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",280,0) - D USEFARY(FARY) -"RTN","C0XMAIN",281,0) - I '$D(C0XCNT) S C0XCNT=0 -"RTN","C0XMAIN",282,0) - N ZNODE -"RTN","C0XMAIN",283,0) - S ZNODE="N"_$$LKY17 -"RTN","C0XMAIN",284,0) - N ZNARY ; GET READY TO CALL IENOFA -"RTN","C0XMAIN",285,0) - S ZNARY("ZG",ZG)="" -"RTN","C0XMAIN",286,0) - S ZNARY("ZS",ZS)="" -"RTN","C0XMAIN",287,0) - S ZNARY("ZP",ZP)="" -"RTN","C0XMAIN",288,0) - S ZNARY("ZO",ZO)="" -"RTN","C0XMAIN",289,0) - D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS -"RTN","C0XMAIN",290,0) - ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN -"RTN","C0XMAIN",291,0) - ;S ZSIEN=$$IENOF(ZS) -"RTN","C0XMAIN",292,0) - ;S ZPIEN=$$IENOF(ZP) -"RTN","C0XMAIN",293,0) - ;S ZOIEN=$$IENOF(ZO) -"RTN","C0XMAIN",294,0) - ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED -"RTN","C0XMAIN",295,0) - S C0XCNT=C0XCNT+1 -"RTN","C0XMAIN",296,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE -"RTN","C0XMAIN",297,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG","")) -"RTN","C0XMAIN",298,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS","")) -"RTN","C0XMAIN",299,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP","")) -"RTN","C0XMAIN",300,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO","")) -"RTN","C0XMAIN",301,0) - ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE -"RTN","C0XMAIN",302,0) - Q -"RTN","C0XMAIN",303,0) - ; -"RTN","C0XMAIN",304,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",305,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",306,0) - N ZN,ZI -"RTN","C0XMAIN",307,0) - S ZN="" -"RTN","C0XMAIN",308,0) - F ZI=1:1:9 D ; -"RTN","C0XMAIN",309,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",310,0) - Q ZN -"RTN","C0XMAIN",311,0) - ; -"RTN","C0XMAIN",312,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",313,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",314,0) - N ZN,ZI -"RTN","C0XMAIN",315,0) - S ZN="" -"RTN","C0XMAIN",316,0) - F ZI=1:1:17 D ; -"RTN","C0XMAIN",317,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",318,0) - Q ZN -"RTN","C0XMAIN",319,0) - ; -"RTN","C0XMAIN",320,0) -IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE -"RTN","C0XMAIN",321,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",322,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",323,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",324,0) - N ZIEN -"RTN","C0XMAIN",325,0) - S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",326,0) - I ZIEN="" D ; -"RTN","C0XMAIN",327,0) - . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING -"RTN","C0XMAIN",328,0) - . D UPDIE(.C0XFDA2) -"RTN","C0XMAIN",329,0) - . S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",330,0) - . K C0XFDA2 -"RTN","C0XMAIN",331,0) - Q ZIEN -"RTN","C0XMAIN",332,0) - ; -"RTN","C0XMAIN",333,0) -IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE -"RTN","C0XMAIN",334,0) - ; OR ADD THEM IF -"RTN","C0XMAIN",335,0) - ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE -"RTN","C0XMAIN",336,0) - ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")="" -"RTN","C0XMAIN",337,0) - ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" -"RTN","C0XMAIN",338,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",339,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",340,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",341,0) - K ZOUTARY ; START WITH CLEAN RESULTS -"RTN","C0XMAIN",342,0) - K C0XFDA2 ; USE A SEPARATE FDA FOR THIS -"RTN","C0XMAIN",343,0) - N ZI S ZI="" -"RTN","C0XMAIN",344,0) - N ZV,ZIEN -"RTN","C0XMAIN",345,0) - N ZCNT S ZCNT=0 -"RTN","C0XMAIN",346,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS -"RTN","C0XMAIN",347,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XMAIN",348,0) - . I $O(@C0XSN@("B",ZV,""))="" D ; -"RTN","C0XMAIN",349,0) - . . S ZCNT=ZCNT+1 -"RTN","C0XMAIN",350,0) - . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV -"RTN","C0XMAIN",351,0) - I $D(C0XFDA2) D ; -"RTN","C0XMAIN",352,0) - . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS -"RTN","C0XMAIN",353,0) - . K C0XFDA2 ; CLEAN UP -"RTN","C0XMAIN",354,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS -"RTN","C0XMAIN",355,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XMAIN",356,0) - . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW -"RTN","C0XMAIN",357,0) - . I ZIEN="" D ; -"RTN","C0XMAIN",358,0) - . . W !,"ERROR ADDING STRING: ",ZV -"RTN","C0XMAIN",359,0) - . . B -"RTN","C0XMAIN",360,0) - . S ZOUTARY("IEN",ZI,ZIEN)="" -"RTN","C0XMAIN",361,0) - Q -"RTN","C0XMAIN",362,0) - ; -"RTN","C0XMAIN",363,0) -UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS -"RTN","C0XMAIN",364,0) - ; ZFDA IS PASSED BY REFERENCE -"RTN","C0XMAIN",365,0) - ;ZWR ZFDA -"RTN","C0XMAIN",366,0) - ;B -"RTN","C0XMAIN",367,0) - K ZERR -"RTN","C0XMAIN",368,0) - D CLEAN^DILF -"RTN","C0XMAIN",369,0) - D UPDATE^DIE("","ZFDA","","ZERR") -"RTN","C0XMAIN",370,0) - I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, -"RTN","C0XMAIN",371,0) - ; INVOKE THE ERROR TRAP IF TASKED -"RTN","C0XMAIN",372,0) - ;. W "ERROR",! -"RTN","C0XMAIN",373,0) - ;. ZWR ZERR -"RTN","C0XMAIN",374,0) - ;. B -"RTN","C0XMAIN",375,0) - K ZFDA -"RTN","C0XMAIN",376,0) - Q -"RTN","C0XMAIN",377,0) - ; -"RTN","C0XTEST") -0^3^B14490662 -"RTN","C0XTEST",1,0) -C0XTEST ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05 -"RTN","C0XTEST",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 5 -"RTN","C0XTEST",3,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU -"RTN","C0XTEST",4,0) - ;General Public License See attached copy of the License. -"RTN","C0XTEST",5,0) - ; -"RTN","C0XTEST",6,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XTEST",7,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XTEST",8,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XTEST",9,0) - ;(at your option) any later version. -"RTN","C0XTEST",10,0) - ; -"RTN","C0XTEST",11,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XTEST",12,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XTEST",13,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XTEST",14,0) - ;GNU General Public License for more details. -"RTN","C0XTEST",15,0) - ; -"RTN","C0XTEST",16,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XTEST",17,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XTEST",18,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XTEST",19,0) - ; -"RTN","C0XTEST",20,0) - Q -"RTN","C0XTEST",21,0) - ; -"RTN","C0XTEST",22,0) -EN ; run the test -"RTN","C0XTEST",23,0) - ; -"RTN","C0XTEST",24,0) - k C0XFDA ; clear the node variable -"RTN","C0XTEST",25,0) - i '$d(^C0X(101,0)) d ; global doesn't exist -"RTN","C0XTEST",26,0) - . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1" -"RTN","C0XTEST",27,0) - n zg -"RTN","C0XTEST",28,0) - S zg="_:G"_$$LKY9 ; all nodes are in the same graph -"RTN","C0XTEST",29,0) - n zi -"RTN","C0XTEST",30,0) - f zi=1:1:100000 d ; try a test of 10000 nodes -"RTN","C0XTEST",31,0) - . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name -"RTN","C0XTEST",32,0) - . s C0XFDA(172.101,zi,.02)=zg -"RTN","C0XTEST",33,0) - . s C0XFDA(172.101,zi,.03)=$R(100000) -"RTN","C0XTEST",34,0) - . s C0XFDA(172.101,zi,.04)=$R(100000) -"RTN","C0XTEST",35,0) - . s C0XFDA(172.101,zi,.05)=$R(100000) -"RTN","C0XTEST",36,0) - S C0XST=$$NOW^XLFDT ; start of the insertion test -"RTN","C0XTEST",37,0) - W !,"INSERTION STARTS AT ",C0XST,! -"RTN","C0XTEST",38,0) - d BULKLOAD(.C0XFDA) -"RTN","C0XTEST",39,0) - s C0XEND=$$NOW^XLFDT ; end of the insertion test -"RTN","C0XTEST",40,0) - W !,"INSERTION ENDS AT ",C0XEND -"RTN","C0XTEST",41,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XST,2) -"RTN","C0XTEST",42,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XTEST",43,0) - I C0XDIFF>0 W !," APPROXIMATELY ",$P(100000/C0XDIFF,".")," NODES PER SECOND" -"RTN","C0XTEST",44,0) - q -"RTN","C0XTEST",45,0) - ; -"RTN","C0XTEST",46,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTEST",47,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTEST",48,0) - N ZN,ZI -"RTN","C0XTEST",49,0) - S ZN="" -"RTN","C0XTEST",50,0) - F ZI=1:1:9 D ; -"RTN","C0XTEST",51,0) - . S ZN=ZN_$R(10) -"RTN","C0XTEST",52,0) - Q ZN -"RTN","C0XTEST",53,0) - ; -"RTN","C0XTEST",54,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTEST",55,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTEST",56,0) - N ZN,ZI -"RTN","C0XTEST",57,0) - S ZN="" -"RTN","C0XTEST",58,0) - F ZI=1:1:17 D ; -"RTN","C0XTEST",59,0) - . S ZN=ZN_$R(10) -"RTN","C0XTEST",60,0) - Q ZN -"RTN","C0XTEST",61,0) - ; -"RTN","C0XTEST",62,0) -BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 -"RTN","C0XTEST",63,0) - ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE -"RTN","C0XTEST",64,0) - ; QUITS IF FILE IS NOT 172.101 -"RTN","C0XTEST",65,0) - ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 -"RTN","C0XTEST",66,0) - ; QUITS IF FIRST ENTRY IS NOT IENS 1 -"RTN","C0XTEST",67,0) - ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES -"RTN","C0XTEST",68,0) - ; ZBFDA IS PASSED BY REFERENCE -"RTN","C0XTEST",69,0) - ; -"RTN","C0XTEST",70,0) - ; -- reserves a block of iens from file 172.101 by locking the zero node -"RTN","C0XTEST",71,0) - ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 -"RTN","C0XTEST",72,0) - ; -- then unlocking to minimize the duration of the lock -"RTN","C0XTEST",73,0) - ; -"RTN","C0XTEST",74,0) - W !,"USING BULKLOAD" -"RTN","C0XTEST",75,0) - I '$D(ZBFDA) Q ; EMPTY FDA -"RTN","C0XTEST",76,0) - I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE -"RTN","C0XTEST",77,0) - N ZCNT,ZP3,ZP4 -"RTN","C0XTEST",78,0) - ; -- find the number of nodes to insert -"RTN","C0XTEST",79,0) - S ZCNT=$O(ZBFDA(172.101,""),-1) -"RTN","C0XTEST",80,0) - I ZCNT="" D Q ; -"RTN","C0XTEST",81,0) - . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" -"RTN","C0XTEST",82,0) - . B -"RTN","C0XTEST",83,0) - ; -- lock the zero node and reserve a block of iens to insert -"RTN","C0XTEST",84,0) - W !,"LOCKING ZERO NODE" -"RTN","C0XTEST",85,0) - LOCK +^C0X(101,0) -"RTN","C0XTEST",86,0) - S ZP3=$P(^C0X(101,0),U,3) -"RTN","C0XTEST",87,0) - S ZP4=$P(^C0X(101,0),U,4) -"RTN","C0XTEST",88,0) - S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 -"RTN","C0XTEST",89,0) - S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 -"RTN","C0XTEST",90,0) - LOCK -^C0X(101,0) -"RTN","C0XTEST",91,0) - N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE -"RTN","C0XTEST",92,0) - S ZBASE=ZP3 ; the last ien in the file -"RTN","C0XTEST",93,0) - W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT -"RTN","C0XTEST",94,0) - W !,$$NOW^XLFDT -"RTN","C0XTEST",95,0) - S ZI="" -"RTN","C0XTEST",96,0) - F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; -"RTN","C0XTEST",97,0) - . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name -"RTN","C0XTEST",98,0) - . I ZN="" D BLKERR Q ; -"RTN","C0XTEST",99,0) - . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer -"RTN","C0XTEST",100,0) - . I ZG="" D BLKERR Q ; -"RTN","C0XTEST",101,0) - . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer -"RTN","C0XTEST",102,0) - . I ZS="" D BLKERR Q ; -"RTN","C0XTEST",103,0) - . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer -"RTN","C0XTEST",104,0) - . I ZP="" D BLKERR Q ; -"RTN","C0XTEST",105,0) - . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer -"RTN","C0XTEST",106,0) - . I ZO="" D BLKERR Q ; -"RTN","C0XTEST",107,0) - . S ZIEN=ZI+ZBASE ; the new ien -"RTN","C0XTEST",108,0) - . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node -"RTN","C0XTEST",109,0) - . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index -"RTN","C0XTEST",110,0) - . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index -"RTN","C0XTEST",111,0) - . S ^C0X(101,"SPO",ZS,ZP,ZO)="" -"RTN","C0XTEST",112,0) - . S ^C0X(101,"SOP",ZS,ZO,ZP)="" -"RTN","C0XTEST",113,0) - . S ^C0X(101,"OPS",ZO,ZP,ZS)="" -"RTN","C0XTEST",114,0) - . S ^C0X(101,"OSP",ZO,ZS,ZP)="" -"RTN","C0XTEST",115,0) - . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" -"RTN","C0XTEST",116,0) - . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" -"RTN","C0XTEST",117,0) - . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" -"RTN","C0XTEST",118,0) - . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" -"RTN","C0XTEST",119,0) - Q -"RTN","C0XTEST",120,0) - ; -"RTN","C0XTEST",121,0) -BLKERR ; -"RTN","C0XTEST",122,0) - W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) -"RTN","C0XTEST",123,0) - B -"RTN","C0XTEST",124,0) - Q -"RTN","C0XTEST",125,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** diff --git a/kids/C0X_1_0_0_T7.KID b/kids/C0X_1_0_0_T7.KID deleted file mode 100644 index ce765f8..0000000 --- a/kids/C0X_1_0_0_T7.KID +++ /dev/null @@ -1,2930 +0,0 @@ -KIDS Distribution saved on Nov 12, 2011@18:16:41 -includes INIT C0XINIT to initialize and load the fmts -**KIDS**:C0X*1.0*0^ - -**INSTALL NAME** -C0X*1.0*0 -"BLD",7883,0) -C0X*1.0*0^^0^3111112^n -"BLD",7883,4,0) -^9.64PA^172.201^2 -"BLD",7883,4,172.101,0) -172.101 -"BLD",7883,4,172.101,222) -y^y^f^^^^n -"BLD",7883,4,172.201,0) -172.201 -"BLD",7883,4,172.201,222) -y^y^f^^^^n -"BLD",7883,4,"B",172.101,172.101) - -"BLD",7883,4,"B",172.201,172.201) - -"BLD",7883,6.3) -6 -"BLD",7883,"KRN",0) -^9.67PA^779.2^20 -"BLD",7883,"KRN",.4,0) -.4 -"BLD",7883,"KRN",.4,"NM",0) -^9.68A^1^1 -"BLD",7883,"KRN",.4,"NM",1,0) -C0X PRINT GRAPH FILE #172.101^172.101^0 -"BLD",7883,"KRN",.4,"NM","B","C0X PRINT GRAPH FILE #172.101",1) - -"BLD",7883,"KRN",.401,0) -.401 -"BLD",7883,"KRN",.402,0) -.402 -"BLD",7883,"KRN",.403,0) -.403 -"BLD",7883,"KRN",.5,0) -.5 -"BLD",7883,"KRN",.84,0) -.84 -"BLD",7883,"KRN",3.6,0) -3.6 -"BLD",7883,"KRN",3.8,0) -3.8 -"BLD",7883,"KRN",9.2,0) -9.2 -"BLD",7883,"KRN",9.8,0) -9.8 -"BLD",7883,"KRN",9.8,"NM",0) -^9.68A^4^4 -"BLD",7883,"KRN",9.8,"NM",1,0) -C0XMAIN^^0^B115393527 -"BLD",7883,"KRN",9.8,"NM",2,0) -C0XF2N^^0^B235898354 -"BLD",7883,"KRN",9.8,"NM",3,0) -C0XTEST^^0^B14490662 -"BLD",7883,"KRN",9.8,"NM",4,0) -C0XINIT^^0^B20874536 -"BLD",7883,"KRN",9.8,"NM","B","C0XF2N",2) - -"BLD",7883,"KRN",9.8,"NM","B","C0XINIT",4) - -"BLD",7883,"KRN",9.8,"NM","B","C0XMAIN",1) - -"BLD",7883,"KRN",9.8,"NM","B","C0XTEST",3) - -"BLD",7883,"KRN",19,0) -19 -"BLD",7883,"KRN",19.1,0) -19.1 -"BLD",7883,"KRN",101,0) -101 -"BLD",7883,"KRN",409.61,0) -409.61 -"BLD",7883,"KRN",771,0) -771 -"BLD",7883,"KRN",779.2,0) -779.2 -"BLD",7883,"KRN",870,0) -870 -"BLD",7883,"KRN",8989.51,0) -8989.51 -"BLD",7883,"KRN",8989.52,0) -8989.52 -"BLD",7883,"KRN",8994,0) -8994 -"BLD",7883,"KRN","B",.4,.4) - -"BLD",7883,"KRN","B",.401,.401) - -"BLD",7883,"KRN","B",.402,.402) - -"BLD",7883,"KRN","B",.403,.403) - -"BLD",7883,"KRN","B",.5,.5) - -"BLD",7883,"KRN","B",.84,.84) - -"BLD",7883,"KRN","B",3.6,3.6) - -"BLD",7883,"KRN","B",3.8,3.8) - -"BLD",7883,"KRN","B",9.2,9.2) - -"BLD",7883,"KRN","B",9.8,9.8) - -"BLD",7883,"KRN","B",19,19) - -"BLD",7883,"KRN","B",19.1,19.1) - -"BLD",7883,"KRN","B",101,101) - -"BLD",7883,"KRN","B",409.61,409.61) - -"BLD",7883,"KRN","B",771,771) - -"BLD",7883,"KRN","B",779.2,779.2) - -"BLD",7883,"KRN","B",870,870) - -"BLD",7883,"KRN","B",8989.51,8989.51) - -"BLD",7883,"KRN","B",8989.52,8989.52) - -"BLD",7883,"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^^@^3111112 -"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") -4 -"RTN","C0XF2N") -0^2^B235898354 -"RTN","C0XF2N",1,0) -C0XF2N ; GPL - Fileman Triples entry point routine ;10/13/11 17:05 -"RTN","C0XF2N",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 6 -"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) - I $D(@ZFARY) Q ; ALREADY INITIALIZED -"RTN","C0XF2N",36,0) - S @ZFARY@("C0XTFN")=172.101 ; TRIPLES FILE NUMBER -"RTN","C0XF2N",37,0) - S @ZFARY@("C0XSFN")=172.201 ; TRIPLES STRINGS FILE NUMBER -"RTN","C0XF2N",38,0) - S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME -"RTN","C0XF2N",39,0) - S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME -"RTN","C0XF2N",40,0) - S @ZFARY@("C0XDIR")="/home/glilly/fmts/trunk/samples/" -"RTN","C0XF2N",41,0) - S @ZFARY@("BLKLOAD")=1 ; this file supports block load -"RTN","C0XF2N",42,0) - S @ZFARY@("FMTSSTYLE")="F2N" ; fileman style -"RTN","C0XF2N",43,0) - D USEFARY(ZFARY) -"RTN","C0XF2N",44,0) - Q -"RTN","C0XF2N",45,0) - ; -"RTN","C0XF2N",46,0) -USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY -"RTN","C0XF2N",47,0) - N ZI S ZI="" -"RTN","C0XF2N",48,0) - F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D -"RTN","C0XF2N",49,0) - . ;N ZX -"RTN","C0XF2N",50,0) - . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_"""" -"RTN","C0XF2N",51,0) - . ;W !,ZX -"RTN","C0XF2N",52,0) - . X ZX -"RTN","C0XF2N",53,0) - Q -"RTN","C0XF2N",54,0) - ; -"RTN","C0XF2N",55,0) -FILEIN ; INTERACTIVE ENTRY POINT FOR OPTION TO READ IN A FILE -"RTN","C0XF2N",56,0) - I '$D(C0XFARY) D INITFARY("C0XFARY") -"RTN","C0XF2N",57,0) - D USEFARY("C0XFARY") -"RTN","C0XF2N",58,0) - S DIR(0)="F^3:240" -"RTN","C0XF2N",59,0) - S DIR("A")="File Directory" -"RTN","C0XF2N",60,0) - S DIR("B")=C0XDIR -"RTN","C0XF2N",61,0) - D ^DIR -"RTN","C0XF2N",62,0) - I Y="^" Q ; -"RTN","C0XF2N",63,0) - S C0XDIR=Y -"RTN","C0XF2N",64,0) - S C0XFARY("C0XDIR")=Y -"RTN","C0XF2N",65,0) - S DIR(0)="F^3:240" -"RTN","C0XF2N",66,0) - S DIR("A")="File Name" -"RTN","C0XF2N",67,0) - I '$D(C0XFN) S DIR("B")="qds.rdf" -"RTN","C0XF2N",68,0) - E S DIR("B")=C0XFN -"RTN","C0XF2N",69,0) - D ^DIR -"RTN","C0XF2N",70,0) - I Y="" Q ; -"RTN","C0XF2N",71,0) - I Y="^" Q ; -"RTN","C0XF2N",72,0) - S C0XFN=Y -"RTN","C0XF2N",73,0) - D IMPORT(C0XFN,C0XDIR,,"C0XFARY") -"RTN","C0XF2N",74,0) - K C0XFDA -"RTN","C0XF2N",75,0) - Q -"RTN","C0XF2N",76,0) - ; -"RTN","C0XF2N",77,0) -IMPORT(FNAME,INDIR,INURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD -"RTN","C0XF2N",78,0) - ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE -"RTN","C0XF2N",79,0) - ; NODE NAME OF THE TEXT TRIPLE -"RTN","C0XF2N",80,0) - ; INDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR) -"RTN","C0XF2N",81,0) - ; INURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE -"RTN","C0XF2N",82,0) - ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE -"RTN","C0XF2N",83,0) - I '$D(FARY) D ; -"RTN","C0XF2N",84,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",85,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",86,0) - D USEFARY(FARY) -"RTN","C0XF2N",87,0) - N ZD,ZTMP -"RTN","C0XF2N",88,0) - I '$D(INDIR) S INDIR=C0XDIR ; DIRECTORY OF THE RDF FILE -"RTN","C0XF2N",89,0) - I $G(INURL)="" D ; -"RTN","C0XF2N",90,0) - . ;N ZN2 S ZN2=$P(FNAME,".",1)_"_"_$P(FNAME,".",2) ; REMOVE THE DOT -"RTN","C0XF2N",91,0) - . ;S INURL=FDIR_ZN2 -"RTN","C0XF2N",92,0) - . S INURL=INDIR_FNAME -"RTN","C0XF2N",93,0) - N ZTMP -"RTN","C0XF2N",94,0) - S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE -"RTN","C0XF2N",95,0) - K @ZTMP ; MAKE SURE IT'S CLEAR -"RTN","C0XF2N",96,0) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XF2N",97,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XF2N",98,0) - W !,"READING IN: ",FNAME -"RTN","C0XF2N",99,0) - I '$$FILEREAD(ZTMP,INDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS -"RTN","C0XF2N",100,0) - . W !,"ERROR READING FILE: ",INDIR,FNAME -"RTN","C0XF2N",101,0) - S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT -"RTN","C0XF2N",102,0) - W !,$O(@ZRDF@(""),-1)," LINES READ" -"RTN","C0XF2N",103,0) - D INSRDF(ZRDF,INURL,FARY) ; IMPORT AND PROCESS THE RDF -"RTN","C0XF2N",104,0) - K INURL -"RTN","C0XF2N",105,0) - K C0XFDA -"RTN","C0XF2N",106,0) - K ^TMP("MXMLDOM",$J) -"RTN","C0XF2N",107,0) - Q -"RTN","C0XF2N",108,0) - ; -"RTN","C0XF2N",109,0) -WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT -"RTN","C0XF2N",110,0) - ; -"RTN","C0XF2N",111,0) - I '$D(FARY) D ; -"RTN","C0XF2N",112,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",113,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",114,0) - D USEFARY(FARY) -"RTN","C0XF2N",115,0) - ;N ZLOC,ZTMP -"RTN","C0XF2N",116,0) - K ZTMP -"RTN","C0XF2N",117,0) - S ZLOC=$NA(^TMP("C0X","WGET",$J)) -"RTN","C0XF2N",118,0) - K @ZLOC -"RTN","C0XF2N",119,0) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XF2N",120,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XF2N",121,0) - W !,"DOWNLOADING: ",ZURL -"RTN","C0XF2N",122,0) - S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP) -"RTN","C0XF2N",123,0) - M @ZLOC=ZTMP -"RTN","C0XF2N",124,0) - S C0XLINES=$O(@ZLOC@(""),-1) -"RTN","C0XF2N",125,0) - W !,C0XLINES," LINES READ" -"RTN","C0XF2N",126,0) - S C0XDLC=$$NOW^XLFDT ; DOWNLOAD COMPLETE -"RTN","C0XF2N",127,0) - W !,"DOWNLOAD COMPLETE AT ",C0XDLC -"RTN","C0XF2N",128,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XDLC,C0XSTART,2) -"RTN","C0XF2N",129,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",130,0) - I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XLINES/C0XDIFF,".")," LINES PER SEC" -"RTN","C0XF2N",131,0) - D INSRDF(ZLOC,ZURL,FARY) -"RTN","C0XF2N",132,0) - Q -"RTN","C0XF2N",133,0) - ; -"RTN","C0XF2N",134,0) -INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS -"RTN","C0XF2N",135,0) - ; ZRDF IS PASSED BY NAME -"RTN","C0XF2N",136,0) - I '$D(FARY) D ; -"RTN","C0XF2N",137,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",138,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",139,0) - D USEFARY(FARY) -"RTN","C0XF2N",140,0) - S BATCNT=0 ; BATCH COUNTER -"RTN","C0XF2N",141,0) - S BATMAX=10000 ; TRY BATCHES OF THIS SIZE -"RTN","C0XF2N",142,0) - N ZGRAPH,ZSUBJECT -"RTN","C0XF2N",143,0) - S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME -"RTN","C0XF2N",144,0) - S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT -"RTN","C0XF2N",145,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY) -"RTN","C0XF2N",146,0) - N ZTXTNM -"RTN","C0XF2N",147,0) - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE -"RTN","C0XF2N",148,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY) -"RTN","C0XF2N",149,0) - D SWUPDIE(.C0XFDA) ; TRY IT OUT -"RTN","C0XF2N",150,0) - K C0XCNT ;RESET FOR NEXT TIME -"RTN","C0XF2N",151,0) - D STORETXT(ZRDF,ZTXTNM,FARY) -"RTN","C0XF2N",152,0) - W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM -"RTN","C0XF2N",153,0) - D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF -"RTN","C0XF2N",154,0) - Q -"RTN","C0XF2N",155,0) - ; -"RTN","C0XF2N",156,0) -STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME -"RTN","C0XF2N",157,0) - ; -"RTN","C0XF2N",158,0) - I '$D(FARY) D ; -"RTN","C0XF2N",159,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",160,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",161,0) - D USEFARY(FARY) -"RTN","C0XF2N",162,0) - N ZIEN -"RTN","C0XF2N",163,0) - S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN -"RTN","C0XF2N",164,0) - D CLEAN^DILF -"RTN","C0XF2N",165,0) - K ZERR -"RTN","C0XF2N",166,0) - D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") -"RTN","C0XF2N",167,0) - I $D(ZERR) D ; -"RTN","C0XF2N",168,0) - . ZWR ZERR -"RTN","C0XF2N",169,0) - Q -"RTN","C0XF2N",170,0) - ; -"RTN","C0XF2N",171,0) -GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT -"RTN","C0XF2N",172,0) - ; ZRTN IS PASSED BY REFERENCE -"RTN","C0XF2N",173,0) - I '$D(FARY) D ; -"RTN","C0XF2N",174,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",175,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",176,0) - D USEFARY(FARY) -"RTN","C0XF2N",177,0) - N ZIEN -"RTN","C0XF2N",178,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XF2N",179,0) - S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") -"RTN","C0XF2N",180,0) - Q -"RTN","C0XF2N",181,0) - ; -"RTN","C0XF2N",182,0) -WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL -"RTN","C0XF2N",183,0) - ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING -"RTN","C0XF2N",184,0) - I '$D(FARY) D ; -"RTN","C0XF2N",185,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",186,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",187,0) - D USEFARY(FARY) -"RTN","C0XF2N",188,0) - N ZIEN -"RTN","C0XF2N",189,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XF2N",190,0) - Q $NA(@C0XSN@(ZIEN,1)) -"RTN","C0XF2N",191,0) - ; -"RTN","C0XF2N",192,0) -FILEREAD(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH -"RTN","C0XF2N",193,0) - ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT -"RTN","C0XF2N",194,0) - ; IE ^TMP("C0X","FILEIN",1) -"RTN","C0XF2N",195,0) - ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 -"RTN","C0XF2N",196,0) - ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH -"RTN","C0XF2N",197,0) - S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) -"RTN","C0XF2N",198,0) - Q OK -"RTN","C0XF2N",199,0) - ; -"RTN","C0XF2N",200,0) -TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE -"RTN","C0XF2N",201,0) - S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) -"RTN","C0XF2N",202,0) - S ZGRAPH="/test/rdfFile" -"RTN","C0XF2N",203,0) - S ZM="/test/rdfFile/meta" -"RTN","C0XF2N",204,0) - D PROCESS(.G,ZIN,ZGRAPH,ZM) -"RTN","C0XF2N",205,0) - Q -"RTN","C0XF2N",206,0) - ; -"RTN","C0XF2N",207,0) -PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE -"RTN","C0XF2N",208,0) - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING -"RTN","C0XF2N",209,0) - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE -"RTN","C0XF2N",210,0) - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS -"RTN","C0XF2N",211,0) - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA -"RTN","C0XF2N",212,0) - ; -"RTN","C0XF2N",213,0) - I '$D(FARY) D ; -"RTN","C0XF2N",214,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",215,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",216,0) - D USEFARY(FARY) -"RTN","C0XF2N",217,0) - ;N BATCNT -"RTN","C0XF2N",218,0) - ;N BATMAX -"RTN","C0XF2N",219,0) - ; -- first parse the rdf file with the MXML parser -"RTN","C0XF2N",220,0) - ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML -"RTN","C0XF2N",221,0) - S C0XDLC2=$$NOW^XLFDT ; START OF PARSE -"RTN","C0XF2N",222,0) - S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W") -"RTN","C0XF2N",223,0) - K @ZRDF ; DON'T NEED INPUT BUFFER ANYMORE -"RTN","C0XF2N",224,0) - ; -- assign the MXLM dom global name to ZDOM -"RTN","C0XF2N",225,0) - S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID)) -"RTN","C0XF2N",226,0) - S C0XNODE=$O(@ZDOM@(""),-1) -"RTN","C0XF2N",227,0) - W !,C0XNODE," XML NODES PARSED" -"RTN","C0XF2N",228,0) - S C0XPRS=$$NOW^XLFDT ; PARSE COMPLETE -"RTN","C0XF2N",229,0) - W !,"PARSE COMPLETE AT ",C0XPRS -"RTN","C0XF2N",230,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XPRS,C0XDLC2,2) -"RTN","C0XF2N",231,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",232,0) - I C0XDIFF'=0 D ; -"RTN","C0XF2N",233,0) - . W !," APPROXIMATELY ",$P(C0XNODE/C0XDIFF,".")," NODES PER SECOND" -"RTN","C0XF2N",234,0) - ; -- populate the metagraph to point to the graph with status unfinished -"RTN","C0XF2N",235,0) - S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT -"RTN","C0XF2N",236,0) - I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH -"RTN","C0XF2N",237,0) - D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH -"RTN","C0XF2N",238,0) - D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished -"RTN","C0XF2N",239,0) - W !,"INSERTING GRAPH: ",ZGRF -"RTN","C0XF2N",240,0) - ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT") -"RTN","C0XF2N",241,0) - S C0XDATE=$$NOW^XLFDT -"RTN","C0XF2N",242,0) - D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY) -"RTN","C0XF2N",243,0) - D SWUPDIE(.C0XFDA) ; commit the metagraph changes to the triple store -"RTN","C0XF2N",244,0) - ; -- -"RTN","C0XF2N",245,0) - ; -- pull out the vocabularies in the RDF statement. marked with xmlns: -"RTN","C0XF2N",246,0) - ; -- put them in a local variable for quick reference -"RTN","C0XF2N",247,0) - ; -- TODO: create a graph for vocabularies and validate incoming against it -"RTN","C0XF2N",248,0) - ; -"RTN","C0XF2N",249,0) - S C0XVOC="" -"RTN","C0XF2N",250,0) - N ZI,ZJ,ZK S ZI="" -"RTN","C0XF2N",251,0) - F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns -"RTN","C0XF2N",252,0) - . S ZVOC=$P(ZI,"xmlns:",2) -"RTN","C0XF2N",253,0) - . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI)) -"RTN","C0XF2N",254,0) - ;W !,"VOCABS:" ZWR C0XVOC -"RTN","C0XF2N",255,0) - ; -"RTN","C0XF2N",256,0) - ; -- look for children called rdf:Description. quit if none. not an rdf file -"RTN","C0XF2N",257,0) - ; -"RTN","C0XF2N",258,0) - S ZI=$O(@ZDOM@(1,"C","")) -"RTN","C0XF2N",259,0) - I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file -"RTN","C0XF2N",260,0) - . W !,"Error. Not an RDF file. Cannot process." -"RTN","C0XF2N",261,0) - ; -"RTN","C0XF2N",262,0) - ; -- now process the rdf description children -"RTN","C0XF2N",263,0) - ; -"RTN","C0XF2N",264,0) - S ZI="" -"RTN","C0XF2N",265,0) - S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate -"RTN","C0XF2N",266,0) - F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ; -"RTN","C0XF2N",267,0) - . ; -- we are skipping any child that is not rdf:Description -"RTN","C0XF2N",268,0) - . ; -- TODO: check to see if this is right in general -"RTN","C0XF2N",269,0) - . ; -"RTN","C0XF2N",270,0) - . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; -"RTN","C0XF2N",271,0) - . . W !,"SKIPPING NODE: ",ZI -"RTN","C0XF2N",272,0) - . ; -- now looking for the subject for the triples -"RTN","C0XF2N",273,0) - . S ZX=$G(@ZDOM@(ZI,"A","rdf:about")) -"RTN","C0XF2N",274,0) - . I ZX'="" D ; we have the subject -"RTN","C0XF2N",275,0) - . . ;W " about: ",ZX -"RTN","C0XF2N",276,0) - . . S C0XSUB=ZX -"RTN","C0XF2N",277,0) - . E D ; -"RTN","C0XF2N",278,0) - . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject -"RTN","C0XF2N",279,0) - . . I ZX'="" D ; -"RTN","C0XF2N",280,0) - . . . S C0XSUB=ZX -"RTN","C0XF2N",281,0) - . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT -"RTN","C0XF2N",282,0) - . ; -"RTN","C0XF2N",283,0) - . ; -- we now have the subject. the children of this node have the rest -"RTN","C0XF2N",284,0) - . ; -"RTN","C0XF2N",285,0) - . S ZJ="" ; for the children of the rdf:Description nodes -"RTN","C0XF2N",286,0) - . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child -"RTN","C0XF2N",287,0) - . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix -"RTN","C0XF2N",288,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space -"RTN","C0XF2N",289,0) - . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix -"RTN","C0XF2N",290,0) - . . I C0XPRE[":" D ; expand using vocabulary -"RTN","C0XF2N",291,0) - . . . N ZB,ZA -"RTN","C0XF2N",292,0) - . . . S ZB=$P(C0XPRE,":",1) -"RTN","C0XF2N",293,0) - . . . S ZA=$P(C0XPRE,":",2) -"RTN","C0XF2N",294,0) - . . . I $G(C0XVOC(ZB))'="" D ; -"RTN","C0XF2N",295,0) - . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded -"RTN","C0XF2N",296,0) - . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object -"RTN","C0XF2N",297,0) - . . I ZY'="" D Q ; -"RTN","C0XF2N",298,0) - . . . S C0XOBJ=ZY ; object -"RTN","C0XF2N",299,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple -"RTN","C0XF2N",300,0) - . . ; -- this is an else because of the quit above -"RTN","C0XF2N",301,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object -"RTN","C0XF2N",302,0) - . . I ZX'="" D Q ; got one -"RTN","C0XF2N",303,0) - . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject -"RTN","C0XF2N",304,0) - . . . ; without change... this could be foolish .. look at it again later -"RTN","C0XF2N",305,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XF2N",306,0) - . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here -"RTN","C0XF2N",307,0) - . . I C0XOBJ="" D Q ; not a happy situation -"RTN","C0XF2N",308,0) - . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ -"RTN","C0XF2N",309,0) - . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XF2N",310,0) - S C0XTRP=$$NOW^XLFDT ; PARSE COMPLETE -"RTN","C0XF2N",311,0) - W !,"TRIPLES COMPLETE AT ",C0XTRP -"RTN","C0XF2N",312,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XTRP,C0XPRS,2) -"RTN","C0XF2N",313,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",314,0) - I C0XDIFF'=0 D ; -"RTN","C0XF2N",315,0) - . W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" -"RTN","C0XF2N",316,0) - W !,"INSERTING ",C0XCNT," TRIPLES" -"RTN","C0XF2N",317,0) - I $D(C0XFDA) D ; -"RTN","C0XF2N",318,0) - . I $G(BLKLOAD) D ; -"RTN","C0XF2N",319,0) - . . D BULKLOAD(.C0XFDA) -"RTN","C0XF2N",320,0) - . E D ; -"RTN","C0XF2N",321,0) - . . D UPDIE(.C0XFDA) ; commit the updates to the file -"RTN","C0XF2N",322,0) - ; next, mark the graph as finished -"RTN","C0XF2N",323,0) - S C0XINS=$$NOW^XLFDT ; PARSE COMPLETE -"RTN","C0XF2N",324,0) - W !,"INSERTION COMPLETE AT ",C0XPRS -"RTN","C0XF2N",325,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XINS,C0XTRP,2) -"RTN","C0XF2N",326,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",327,0) - I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," NODES PER SECOND" -"RTN","C0XF2N",328,0) - S C0XEND=$$NOW^XLFDT -"RTN","C0XF2N",329,0) - W !," ENDED AT: ",C0XEND -"RTN","C0XF2N",330,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2) -"RTN","C0XF2N",331,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",332,0) - I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" -"RTN","C0XF2N",333,0) - Q -"RTN","C0XF2N",334,0) - ; -"RTN","C0XF2N",335,0) -SHOW(ZN) ; -"RTN","C0XF2N",336,0) - ZWR ^TMP("MXMLDOM",$J,1,ZN,*) -"RTN","C0XF2N",337,0) - Q -"RTN","C0XF2N",338,0) - ; -"RTN","C0XF2N",339,0) -ANONS() ; RETURNS AN ANONOMOUS SUBJECT -"RTN","C0XF2N",340,0) - Q "_:S"_$$LKY9 -"RTN","C0XF2N",341,0) - ; -"RTN","C0XF2N",342,0) -NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED -"RTN","C0XF2N",343,0) - ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT -"RTN","C0XF2N",344,0) - ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN -"RTN","C0XF2N",345,0) - S NGRAPH="G"_$$LKY9 -"RTN","C0XF2N",346,0) - S NMETA=NGRAPH_"A" -"RTN","C0XF2N",347,0) - Q -"RTN","C0XF2N",348,0) - ; -"RTN","C0XF2N",349,0) -ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT -"RTN","C0XF2N",350,0) - ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE -"RTN","C0XF2N",351,0) - I '$D(FARY) D ; -"RTN","C0XF2N",352,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",353,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",354,0) - D USEFARY(FARY) -"RTN","C0XF2N",355,0) - I '$D(C0XCNT) S C0XCNT=0 -"RTN","C0XF2N",356,0) - N ZNODE -"RTN","C0XF2N",357,0) - S ZNODE="N"_$$LKY17 -"RTN","C0XF2N",358,0) - N ZNARY ; GET READY TO CALL IENOFA -"RTN","C0XF2N",359,0) - S ZNARY("ZG",ZG)="" -"RTN","C0XF2N",360,0) - S ZNARY("ZS",ZS)="" -"RTN","C0XF2N",361,0) - S ZNARY("ZP",ZP)="" -"RTN","C0XF2N",362,0) - S ZNARY("ZO",ZO)="" -"RTN","C0XF2N",363,0) - D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS -"RTN","C0XF2N",364,0) - ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN -"RTN","C0XF2N",365,0) - ;S ZSIEN=$$IENOF(ZS) -"RTN","C0XF2N",366,0) - ;S ZPIEN=$$IENOF(ZP) -"RTN","C0XF2N",367,0) - ;S ZOIEN=$$IENOF(ZO) -"RTN","C0XF2N",368,0) - ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED -"RTN","C0XF2N",369,0) - S BATCNT=BATCNT+1 -"RTN","C0XF2N",370,0) - S C0XCNT=C0XCNT+1 -"RTN","C0XF2N",371,0) - I $G(BLKLOAD)=1 D ; we are using bulk load -"RTN","C0XF2N",372,0) - . S C0XFDA(C0XTFN,BATCNT,.01)=ZNODE -"RTN","C0XF2N",373,0) - . S C0XFDA(C0XTFN,BATCNT,.02)=$O(ZIENS("IEN","ZG","")) -"RTN","C0XF2N",374,0) - . S C0XFDA(C0XTFN,BATCNT,.03)=$O(ZIENS("IEN","ZS","")) -"RTN","C0XF2N",375,0) - . S C0XFDA(C0XTFN,BATCNT,.04)=$O(ZIENS("IEN","ZP","")) -"RTN","C0XF2N",376,0) - . S C0XFDA(C0XTFN,BATCNT,.05)=$O(ZIENS("IEN","ZO","")) -"RTN","C0XF2N",377,0) - E D ; -"RTN","C0XF2N",378,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.01)=ZNODE -"RTN","C0XF2N",379,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.02)=$O(ZIENS("IEN","ZG","")) -"RTN","C0XF2N",380,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.03)=$O(ZIENS("IEN","ZS","")) -"RTN","C0XF2N",381,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.04)=$O(ZIENS("IEN","ZP","")) -"RTN","C0XF2N",382,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.05)=$O(ZIENS("IEN","ZO","")) -"RTN","C0XF2N",383,0) - I BATCNT=BATMAX D ; BATCH IS DONE -"RTN","C0XF2N",384,0) - . I $G(BLKLOAD) D ; bulk load -"RTN","C0XF2N",385,0) - . . D BULKLOAD(.C0XFDA) ; bulk load the batch -"RTN","C0XF2N",386,0) - . E D ; no bulk load -"RTN","C0XF2N",387,0) - . . D UPDIE(.C0XFDA) -"RTN","C0XF2N",388,0) - . K C0XFDA -"RTN","C0XF2N",389,0) - . S BATCNT=0 ; RESET COUNTER -"RTN","C0XF2N",390,0) - ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE -"RTN","C0XF2N",391,0) - Q -"RTN","C0XF2N",392,0) - ; -"RTN","C0XF2N",393,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XF2N",394,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XF2N",395,0) - N ZN,ZI -"RTN","C0XF2N",396,0) - S ZN="" -"RTN","C0XF2N",397,0) - F ZI=1:1:9 D ; -"RTN","C0XF2N",398,0) - . S ZN=ZN_$R(10) -"RTN","C0XF2N",399,0) - Q ZN -"RTN","C0XF2N",400,0) - ; -"RTN","C0XF2N",401,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XF2N",402,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XF2N",403,0) - N ZN,ZI -"RTN","C0XF2N",404,0) - S ZN="" -"RTN","C0XF2N",405,0) - F ZI=1:1:17 D ; -"RTN","C0XF2N",406,0) - . S ZN=ZN_$R(10) -"RTN","C0XF2N",407,0) - Q ZN -"RTN","C0XF2N",408,0) - ; -"RTN","C0XF2N",409,0) -IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE -"RTN","C0XF2N",410,0) - I '$D(FARY) D ; -"RTN","C0XF2N",411,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",412,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",413,0) - N ZIEN -"RTN","C0XF2N",414,0) - S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XF2N",415,0) - I ZIEN="" D ; -"RTN","C0XF2N",416,0) - . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING -"RTN","C0XF2N",417,0) - . D UPDIE(.C0XFDA2) -"RTN","C0XF2N",418,0) - . S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XF2N",419,0) - . K C0XFDA2 -"RTN","C0XF2N",420,0) - Q ZIEN -"RTN","C0XF2N",421,0) - ; -"RTN","C0XF2N",422,0) -IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE -"RTN","C0XF2N",423,0) - ; OR ADD THEM IF -"RTN","C0XF2N",424,0) - ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE -"RTN","C0XF2N",425,0) - ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")="" -"RTN","C0XF2N",426,0) - ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" -"RTN","C0XF2N",427,0) - I '$D(FARY) D ; -"RTN","C0XF2N",428,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",429,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",430,0) - K ZOUTARY ; START WITH CLEAN RESULTS -"RTN","C0XF2N",431,0) - K C0XFDA2 ; USE A SEPARATE FDA FOR THIS -"RTN","C0XF2N",432,0) - N ZI S ZI="" -"RTN","C0XF2N",433,0) - N ZV,ZIEN -"RTN","C0XF2N",434,0) - N ZCNT S ZCNT=0 -"RTN","C0XF2N",435,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS -"RTN","C0XF2N",436,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XF2N",437,0) - . I $O(@C0XSN@("B",ZV,""))="" D ; -"RTN","C0XF2N",438,0) - . . S ZCNT=ZCNT+1 -"RTN","C0XF2N",439,0) - . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV -"RTN","C0XF2N",440,0) - I $D(C0XFDA2) D ; -"RTN","C0XF2N",441,0) - . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS -"RTN","C0XF2N",442,0) - . K C0XFDA2 ; CLEAN UP -"RTN","C0XF2N",443,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS -"RTN","C0XF2N",444,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XF2N",445,0) - . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW -"RTN","C0XF2N",446,0) - . I ZIEN="" D ; -"RTN","C0XF2N",447,0) - . . W !,"ERROR ADDING STRING: ",ZV -"RTN","C0XF2N",448,0) - . . B -"RTN","C0XF2N",449,0) - . S ZOUTARY("IEN",ZI,ZIEN)="" -"RTN","C0XF2N",450,0) - Q -"RTN","C0XF2N",451,0) - ; -"RTN","C0XF2N",452,0) -BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 -"RTN","C0XF2N",453,0) - ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE -"RTN","C0XF2N",454,0) - ; QUITS IF FILE IS NOT 172.101 -"RTN","C0XF2N",455,0) - ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 -"RTN","C0XF2N",456,0) - ; QUITS IF FIRST ENTRY IS NOT IENS 1 -"RTN","C0XF2N",457,0) - ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES -"RTN","C0XF2N",458,0) - ; ZBFDA IS PASSED BY REFERENCE -"RTN","C0XF2N",459,0) - ; -"RTN","C0XF2N",460,0) - ; -- reserves a block of iens from file 172.101 by locking the zero node -"RTN","C0XF2N",461,0) - ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 -"RTN","C0XF2N",462,0) - ; -- then unlocking to minimize the duration of the lock -"RTN","C0XF2N",463,0) - ; -"RTN","C0XF2N",464,0) - W !,"USING BULKLOAD" -"RTN","C0XF2N",465,0) - I '$D(ZBFDA) Q ; EMPTY FDA -"RTN","C0XF2N",466,0) - I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE -"RTN","C0XF2N",467,0) - N ZCNT,ZP3,ZP4 -"RTN","C0XF2N",468,0) - ; -- find the number of nodes to insert -"RTN","C0XF2N",469,0) - S ZCNT=$O(ZBFDA(172.101,""),-1) -"RTN","C0XF2N",470,0) - I ZCNT="" D Q ; -"RTN","C0XF2N",471,0) - . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" -"RTN","C0XF2N",472,0) - . B -"RTN","C0XF2N",473,0) - ; -- lock the zero node and reserve a block of iens to insert -"RTN","C0XF2N",474,0) - W !,"LOCKING ZERO NODE" -"RTN","C0XF2N",475,0) - LOCK +^C0X(101,0) -"RTN","C0XF2N",476,0) - S ZP3=$P(^C0X(101,0),U,3) -"RTN","C0XF2N",477,0) - S ZP4=$P(^C0X(101,0),U,4) -"RTN","C0XF2N",478,0) - S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 -"RTN","C0XF2N",479,0) - S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 -"RTN","C0XF2N",480,0) - LOCK -^C0X(101,0) -"RTN","C0XF2N",481,0) - N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE -"RTN","C0XF2N",482,0) - S ZBASE=ZP3 ; the last ien in the file -"RTN","C0XF2N",483,0) - W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT -"RTN","C0XF2N",484,0) - W !,$$NOW^XLFDT -"RTN","C0XF2N",485,0) - S ZI="" -"RTN","C0XF2N",486,0) - F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; -"RTN","C0XF2N",487,0) - . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name -"RTN","C0XF2N",488,0) - . I ZN="" D BLKERR Q ; -"RTN","C0XF2N",489,0) - . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer -"RTN","C0XF2N",490,0) - . I ZG="" D BLKERR Q ; -"RTN","C0XF2N",491,0) - . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer -"RTN","C0XF2N",492,0) - . I ZS="" D BLKERR Q ; -"RTN","C0XF2N",493,0) - . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer -"RTN","C0XF2N",494,0) - . I ZP="" D BLKERR Q ; -"RTN","C0XF2N",495,0) - . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer -"RTN","C0XF2N",496,0) - . I ZO="" D BLKERR Q ; -"RTN","C0XF2N",497,0) - . S ZIEN=ZI+ZBASE ; the new ien -"RTN","C0XF2N",498,0) - . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node -"RTN","C0XF2N",499,0) - . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index -"RTN","C0XF2N",500,0) - . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index -"RTN","C0XF2N",501,0) - . S ^C0X(101,"SPO",ZS,ZP,ZO)="" -"RTN","C0XF2N",502,0) - . S ^C0X(101,"SOP",ZS,ZO,ZP)="" -"RTN","C0XF2N",503,0) - . S ^C0X(101,"OPS",ZO,ZP,ZS)="" -"RTN","C0XF2N",504,0) - . S ^C0X(101,"OSP",ZO,ZS,ZP)="" -"RTN","C0XF2N",505,0) - . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" -"RTN","C0XF2N",506,0) - . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" -"RTN","C0XF2N",507,0) - . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" -"RTN","C0XF2N",508,0) - . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" -"RTN","C0XF2N",509,0) - Q -"RTN","C0XF2N",510,0) - ; -"RTN","C0XF2N",511,0) -BLKERR ; -"RTN","C0XF2N",512,0) - W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) -"RTN","C0XF2N",513,0) - B -"RTN","C0XF2N",514,0) - Q -"RTN","C0XF2N",515,0) - ; -"RTN","C0XF2N",516,0) -SWUPDIE(ZFDA) ; SWITCH BETWEEN UPDIE AND BULKLOAD -"RTN","C0XF2N",517,0) - . I $G(BLKLOAD) D ; bulk load -"RTN","C0XF2N",518,0) - . . D BULKLOAD(.ZFDA) ; bulk load the batch -"RTN","C0XF2N",519,0) - . E D ; no bulk load -"RTN","C0XF2N",520,0) - . . D UPDIE(.ZFDA) -"RTN","C0XF2N",521,0) - . K ZFDA -"RTN","C0XF2N",522,0) - Q -"RTN","C0XF2N",523,0) - ; -"RTN","C0XF2N",524,0) -UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS -"RTN","C0XF2N",525,0) - ; ZFDA IS PASSED BY REFERENCE -"RTN","C0XF2N",526,0) - ;ZWR ZFDA -"RTN","C0XF2N",527,0) - ;B -"RTN","C0XF2N",528,0) - K ZERR -"RTN","C0XF2N",529,0) - D CLEAN^DILF -"RTN","C0XF2N",530,0) - D UPDATE^DIE("","ZFDA","","ZERR") -"RTN","C0XF2N",531,0) - I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, -"RTN","C0XF2N",532,0) - ; INVOKE THE ERROR TRAP IF TASKED -"RTN","C0XF2N",533,0) - ;. W "ERROR",! -"RTN","C0XF2N",534,0) - ;. ZWR ZERR -"RTN","C0XF2N",535,0) - ;. B -"RTN","C0XF2N",536,0) - K ZFDA -"RTN","C0XF2N",537,0) - Q -"RTN","C0XF2N",538,0) - ; -"RTN","C0XINIT") -0^4^B20874536 -"RTN","C0XINIT",1,0) -C0XINIT ; GPL - Fileman Triples initialization routine ;10/13/11 17:05 -"RTN","C0XINIT",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 6 -"RTN","C0XINIT",3,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU -"RTN","C0XINIT",4,0) - ;General Public License See attached copy of the License. -"RTN","C0XINIT",5,0) - ; -"RTN","C0XINIT",6,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XINIT",7,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XINIT",8,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XINIT",9,0) - ;(at your option) any later version. -"RTN","C0XINIT",10,0) - ; -"RTN","C0XINIT",11,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XINIT",12,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XINIT",13,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XINIT",14,0) - ;GNU General Public License for more details. -"RTN","C0XINIT",15,0) - ; -"RTN","C0XINIT",16,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XINIT",17,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XINIT",18,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XINIT",19,0) - ; -"RTN","C0XINIT",20,0) - Q -"RTN","C0XINIT",21,0) - ; -"RTN","C0XINIT",22,0) -CLEAR ; DELETE THE FILESTORE -"RTN","C0XINIT",23,0) - K ^C0X -"RTN","C0XINIT",24,0) - S ^C0X(101,0)="C0X TRIPLE^172.101I^^" -"RTN","C0XINIT",25,0) - S ^C0X(201,0)="C0X STRING^172.201I^^" -"RTN","C0XINIT",26,0) - Q -"RTN","C0XINIT",27,0) - ; -"RTN","C0XINIT",28,0) -INIT ; INITIALIZE THE TRIPLE STORE - THIS DELETES THE GLOBALS AND -"RTN","C0XINIT",29,0) - ; START ALL OVER... USE WITH CAUTION -"RTN","C0XINIT",30,0) - ; -"RTN","C0XINIT",31,0) - ; -- we should be more sophisticated here.. at least warn the user -"RTN","C0XINIT",32,0) - ; -- and give them a chance to cancel -"RTN","C0XINIT",33,0) - ; -"RTN","C0XINIT",34,0) - D CLEAR ; DELETE THE TRIPLESTORE -"RTN","C0XINIT",35,0) - ; -"RTN","C0XINIT",36,0) - ; -- we are assuming that FARY is set up properly in C0XF2N -"RTN","C0XINIT",37,0) - ; -- with repect to the default directory and the defaut fileman files -"RTN","C0XINIT",38,0) - ; -- here's what it is now: "/home/glilly/fmts/trunk/samples/" -"RTN","C0XINIT",39,0) - ; -- that means that all the sample files will look like: -"RTN","C0XINIT",40,0) - ; --- qds/QDS_0001.rdf -"RTN","C0XINIT",41,0) - ; --- smart-rdf-in/small.rdf -"RTN","C0XINIT",42,0) - ; -"RTN","C0XINIT",43,0) - S FARY="C0XFARY" -"RTN","C0XINIT",44,0) - D INITFARY^C0XF2N(FARY) -"RTN","C0XINIT",45,0) - D USEFARY^C0XF2N(FARY) -"RTN","C0XINIT",46,0) - S C0XFARY("C0XDIR")="/home/glilly/fmts/trunk/samples/smart-rdf-in/" ; -"RTN","C0XINIT",47,0) - D USEFARY^C0XF2N(FARY) -"RTN","C0XINIT",48,0) - S SMART(1)="cole-susan.rdf" -"RTN","C0XINIT",49,0) - S SMART(2)="jones-cynthia.rdf" -"RTN","C0XINIT",50,0) - S SMART(3)="small.rdf" -"RTN","C0XINIT",51,0) - S SMART(4)="collins-frank.rdf" -"RTN","C0XINIT",52,0) - S SMART(5)="kelly-david.rdf" -"RTN","C0XINIT",53,0) - S SMART(6)="smith-maria.rdf" -"RTN","C0XINIT",54,0) - S SMART(7)="ford-shirley.rdf" -"RTN","C0XINIT",55,0) - S SMART(8)="morgan-jason.rdf" -"RTN","C0XINIT",56,0) - S SMART(9)="west-lisa.rdf" -"RTN","C0XINIT",57,0) - S SMART(10)="gracia-paul.rdf" -"RTN","C0XINIT",58,0) - S SMART(11)="reed-richard.rdf" -"RTN","C0XINIT",59,0) - S SMART(12)="west-sandra.rdf" -"RTN","C0XINIT",60,0) - S SMART(13)="jackson-jessica.rdf" -"RTN","C0XINIT",61,0) - S SMART(14)="small-allergies.rdf" -"RTN","C0XINIT",62,0) - S SMART(15)="white-patricia.rdf" -"RTN","C0XINIT",63,0) - N ZI S ZI="" -"RTN","C0XINIT",64,0) - F S ZI=$O(SMART(ZI)) Q:ZI="" D ; for each smart file -"RTN","C0XINIT",65,0) - . D IMPORT^C0XF2N(SMART(ZI),C0XDIR,,FARY) ; import to the triplestore -"RTN","C0XINIT",66,0) - S FARY="C0XFARY" -"RTN","C0XINIT",67,0) - S C0XFARY("C0XDIR")="/home/glilly/fmts/trunk/samples/qds/" -"RTN","C0XINIT",68,0) - D USEFARY^C0XF2N(FARY) -"RTN","C0XINIT",69,0) - D IMPORT^C0XF2N("QDS_0001.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",70,0) - D IMPORT^C0XF2N("QDS_0028b.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",71,0) - D IMPORT^C0XF2N("QDS_0052.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",72,0) - D IMPORT^C0XF2N("QDS_0073.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",73,0) - D IMPORT^C0XF2N("QDS_0385.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",74,0) - D IMPORT^C0XF2N("QDS_0002.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",75,0) - D IMPORT^C0XF2N("QDS_0031.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",76,0) - D IMPORT^C0XF2N("QDS_0055.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",77,0) - D IMPORT^C0XF2N("QDS_0074.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",78,0) - D IMPORT^C0XF2N("QDS_0387.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",79,0) - D IMPORT^C0XF2N("QDS_0004.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",80,0) - D IMPORT^C0XF2N("QDS_0032.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",81,0) - D IMPORT^C0XF2N("QDS_0056.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",82,0) - D IMPORT^C0XF2N("QDS_0075.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",83,0) - D IMPORT^C0XF2N("QDS_0389.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",84,0) - D IMPORT^C0XF2N("QDS_0012.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",85,0) - D IMPORT^C0XF2N("QDS_0033.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",86,0) - D IMPORT^C0XF2N("QDS_0059.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",87,0) - D IMPORT^C0XF2N("QDS_0081.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",88,0) - D IMPORT^C0XF2N("QDS_0421.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",89,0) - D IMPORT^C0XF2N("QDS_0013.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",90,0) - D IMPORT^C0XF2N("QDS_0034.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",91,0) - D IMPORT^C0XF2N("QDS_0061.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",92,0) - D IMPORT^C0XF2N("QDS_0083.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",93,0) - D IMPORT^C0XF2N("QDS_0575.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",94,0) - D IMPORT^C0XF2N("QDS_0014.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",95,0) - D IMPORT^C0XF2N("QDS_0036.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",96,0) - D IMPORT^C0XF2N("QDS_0062.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",97,0) - D IMPORT^C0XF2N("QDS_0084.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",98,0) - D IMPORT^C0XF2N("QDS_0018.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",99,0) - D IMPORT^C0XF2N("QDS_0038.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",100,0) - D IMPORT^C0XF2N("QDS_0064.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",101,0) - D IMPORT^C0XF2N("QDS_0086.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",102,0) - D IMPORT^C0XF2N("QDS_0024.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",103,0) - D IMPORT^C0XF2N("QDS_0041.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",104,0) - D IMPORT^C0XF2N("QDS_0067.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",105,0) - D IMPORT^C0XF2N("QDS_0088.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",106,0) - D IMPORT^C0XF2N("QDS_0027.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",107,0) - D IMPORT^C0XF2N("QDS_0043.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",108,0) - D IMPORT^C0XF2N("QDS_0068.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",109,0) - D IMPORT^C0XF2N("QDS_0089.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",110,0) - D IMPORT^C0XF2N("QDS_0028a.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",111,0) - D IMPORT^C0XF2N("QDS_0047.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",112,0) - D IMPORT^C0XF2N("QDS_0070.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",113,0) - D IMPORT^C0XF2N("QDS_0105.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",114,0) - ;D IMPORT^C0XF2N("qds.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",115,0) - Q -"RTN","C0XINIT",116,0) - ; -"RTN","C0XMAIN") -0^1^B115393527 -"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 6 -"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) - S @ZFARY@("C0XDIR")="/home/george/fmts/trunk/samples/" -"RTN","C0XMAIN",31,0) - D USEFARY(ZFARY) -"RTN","C0XMAIN",32,0) - Q -"RTN","C0XMAIN",33,0) - ; -"RTN","C0XMAIN",34,0) -USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY -"RTN","C0XMAIN",35,0) - N ZI S ZI="" -"RTN","C0XMAIN",36,0) - F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D -"RTN","C0XMAIN",37,0) - . ;N ZX -"RTN","C0XMAIN",38,0) - . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_"""" -"RTN","C0XMAIN",39,0) - . ;W !,ZX -"RTN","C0XMAIN",40,0) - . X ZX -"RTN","C0XMAIN",41,0) - Q -"RTN","C0XMAIN",42,0) - ; -"RTN","C0XMAIN",43,0) -IMPORT(FNAME,FDIR,FURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD -"RTN","C0XMAIN",44,0) - ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE -"RTN","C0XMAIN",45,0) - ; NODE NAME OF THE TEXT TRIPLE -"RTN","C0XMAIN",46,0) - ; FDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR) -"RTN","C0XMAIN",47,0) - ; FURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE -"RTN","C0XMAIN",48,0) - ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE -"RTN","C0XMAIN",49,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",50,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",51,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",52,0) - D USEFARY(FARY) -"RTN","C0XMAIN",53,0) - N ZD,ZTMP -"RTN","C0XMAIN",54,0) - I '$D(FDIR) S FDIR=C0XDIR ; DIRECTORY OF THE RDF FILE -"RTN","C0XMAIN",55,0) - I '$D(FURL) D ; -"RTN","C0XMAIN",56,0) - . N ZN2 S ZN2=$TR(FNAME,".","_") ; REMOVE THE DOT FROM THE NAME -"RTN","C0XMAIN",57,0) - . S FURL=FDIR_ZN2 -"RTN","C0XMAIN",58,0) - N ZTMP -"RTN","C0XMAIN",59,0) - S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE -"RTN","C0XMAIN",60,0) - K @ZTMP ; MAKE SURE IT'S CLEAR -"RTN","C0XMAIN",61,0) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XMAIN",62,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XMAIN",63,0) - W !,"READING IN: ",FNAME -"RTN","C0XMAIN",64,0) - I '$$FILEIN(ZTMP,FDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS -"RTN","C0XMAIN",65,0) - . W !,"ERROR READING FILE: ",FDIR,FNAME -"RTN","C0XMAIN",66,0) - S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT -"RTN","C0XMAIN",67,0) - W !,$O(@ZRDF@(""),-1)," LINES READ" -"RTN","C0XMAIN",68,0) - D INSRDF(ZRDF,FURL,FARY) ; IMPORT AND PROCESS THE RDF -"RTN","C0XMAIN",69,0) - Q -"RTN","C0XMAIN",70,0) - ; -"RTN","C0XMAIN",71,0) -WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT -"RTN","C0XMAIN",72,0) - ; -"RTN","C0XMAIN",73,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",74,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",75,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",76,0) - D USEFARY(FARY) -"RTN","C0XMAIN",77,0) - ;N ZLOC,ZTMP -"RTN","C0XMAIN",78,0) - K ZTMP -"RTN","C0XMAIN",79,0) - S ZLOC=$NA(^TMP("C0X","WGET",$J)) -"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) - W !,$O(@ZLOC@(""),-1)," LINES READ" -"RTN","C0XMAIN",86,0) - D INSRDF(ZLOC,ZURL,FARY) -"RTN","C0XMAIN",87,0) - Q -"RTN","C0XMAIN",88,0) - ; -"RTN","C0XMAIN",89,0) -INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS -"RTN","C0XMAIN",90,0) - ; ZRDF IS PASSED BY NAME -"RTN","C0XMAIN",91,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",92,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",93,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",94,0) - D USEFARY(FARY) -"RTN","C0XMAIN",95,0) - N ZGRAPH,ZSUBJECT -"RTN","C0XMAIN",96,0) - S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME -"RTN","C0XMAIN",97,0) - S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT -"RTN","C0XMAIN",98,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY) -"RTN","C0XMAIN",99,0) - N ZTXTNM -"RTN","C0XMAIN",100,0) - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE -"RTN","C0XMAIN",101,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY) -"RTN","C0XMAIN",102,0) - D UPDIE(.C0XFDA) ; TRY IT OUT -"RTN","C0XMAIN",103,0) - K C0XCNT ;RESET FOR NEXT TIME -"RTN","C0XMAIN",104,0) - D STORETXT(ZRDF,ZTXTNM,FARY) -"RTN","C0XMAIN",105,0) - W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM -"RTN","C0XMAIN",106,0) - D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF -"RTN","C0XMAIN",107,0) - Q -"RTN","C0XMAIN",108,0) - ; -"RTN","C0XMAIN",109,0) -STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME -"RTN","C0XMAIN",110,0) - ; -"RTN","C0XMAIN",111,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",112,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",113,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",114,0) - D USEFARY(FARY) -"RTN","C0XMAIN",115,0) - N ZIEN -"RTN","C0XMAIN",116,0) - S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN -"RTN","C0XMAIN",117,0) - D CLEAN^DILF -"RTN","C0XMAIN",118,0) - K ZERR -"RTN","C0XMAIN",119,0) - D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") -"RTN","C0XMAIN",120,0) - I $D(ZERR) D ; -"RTN","C0XMAIN",121,0) - . ZWR ZERR -"RTN","C0XMAIN",122,0) - Q -"RTN","C0XMAIN",123,0) - ; -"RTN","C0XMAIN",124,0) -GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT -"RTN","C0XMAIN",125,0) - ; ZRTN IS PASSED BY REFERENCE -"RTN","C0XMAIN",126,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",127,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",128,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",129,0) - D USEFARY(FARY) -"RTN","C0XMAIN",130,0) - N ZIEN -"RTN","C0XMAIN",131,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XMAIN",132,0) - S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") -"RTN","C0XMAIN",133,0) - Q -"RTN","C0XMAIN",134,0) - ; -"RTN","C0XMAIN",135,0) -WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL -"RTN","C0XMAIN",136,0) - ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING -"RTN","C0XMAIN",137,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",138,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",139,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",140,0) - D USEFARY(FARY) -"RTN","C0XMAIN",141,0) - N ZIEN -"RTN","C0XMAIN",142,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XMAIN",143,0) - Q $NA(@C0XSN@(ZIEN,1)) -"RTN","C0XMAIN",144,0) - ; -"RTN","C0XMAIN",145,0) -FILEIN(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH -"RTN","C0XMAIN",146,0) - ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT -"RTN","C0XMAIN",147,0) - ; IE ^TMP("C0X","FILEIN",1) -"RTN","C0XMAIN",148,0) - ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 -"RTN","C0XMAIN",149,0) - ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH -"RTN","C0XMAIN",150,0) - S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) -"RTN","C0XMAIN",151,0) - Q OK -"RTN","C0XMAIN",152,0) - ; -"RTN","C0XMAIN",153,0) -TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE -"RTN","C0XMAIN",154,0) - S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) -"RTN","C0XMAIN",155,0) - S ZGRAPH="/test/rdfFile" -"RTN","C0XMAIN",156,0) - S ZM="/test/rdfFile/meta" -"RTN","C0XMAIN",157,0) - D PROCESS(.G,ZIN,ZGRAPH,ZM) -"RTN","C0XMAIN",158,0) - Q -"RTN","C0XMAIN",159,0) - ; -"RTN","C0XMAIN",160,0) -PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE -"RTN","C0XMAIN",161,0) - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING -"RTN","C0XMAIN",162,0) - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE -"RTN","C0XMAIN",163,0) - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS -"RTN","C0XMAIN",164,0) - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA -"RTN","C0XMAIN",165,0) - ; -"RTN","C0XMAIN",166,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",167,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",168,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",169,0) - D USEFARY(FARY) -"RTN","C0XMAIN",170,0) - ; -- first parse the rdf file with the MXML parser -"RTN","C0XMAIN",171,0) - ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML -"RTN","C0XMAIN",172,0) - S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W") -"RTN","C0XMAIN",173,0) - ; -- assign the MXLM dom global name to ZDOM -"RTN","C0XMAIN",174,0) - S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID)) -"RTN","C0XMAIN",175,0) - W !,$O(@ZDOM@(""),-1)," XML NODES PARSED" -"RTN","C0XMAIN",176,0) - ; -- populate the metagraph to point to the graph with status unfinished -"RTN","C0XMAIN",177,0) - S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT -"RTN","C0XMAIN",178,0) - I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH -"RTN","C0XMAIN",179,0) - D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH -"RTN","C0XMAIN",180,0) - D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished -"RTN","C0XMAIN",181,0) - ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT") -"RTN","C0XMAIN",182,0) - S C0XDATE=$$NOW^XLFDT -"RTN","C0XMAIN",183,0) - D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY) -"RTN","C0XMAIN",184,0) - D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store -"RTN","C0XMAIN",185,0) - ; -- -"RTN","C0XMAIN",186,0) - ; -- pull out the vocabularies in the RDF statement. marked with xmlns: -"RTN","C0XMAIN",187,0) - ; -- put them in a local variable for quick reference -"RTN","C0XMAIN",188,0) - ; -- TODO: create a graph for vocabularies and validate incoming against it -"RTN","C0XMAIN",189,0) - ; -"RTN","C0XMAIN",190,0) - S C0XVOC="" -"RTN","C0XMAIN",191,0) - N ZI,ZJ,ZK S ZI="" -"RTN","C0XMAIN",192,0) - F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns -"RTN","C0XMAIN",193,0) - . S ZVOC=$P(ZI,"xmlns:",2) -"RTN","C0XMAIN",194,0) - . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI)) -"RTN","C0XMAIN",195,0) - ;W !,"VOCABS:" ZWR C0XVOC -"RTN","C0XMAIN",196,0) - ; -"RTN","C0XMAIN",197,0) - ; -- look for children called rdf:Description. quit if none. not an rdf file -"RTN","C0XMAIN",198,0) - ; -"RTN","C0XMAIN",199,0) - S ZI=$O(@ZDOM@(1,"C","")) -"RTN","C0XMAIN",200,0) - I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file -"RTN","C0XMAIN",201,0) - . W !,"Error. Not an RDF file. Cannot process." -"RTN","C0XMAIN",202,0) - ; -"RTN","C0XMAIN",203,0) - ; -- now process the rdf description children -"RTN","C0XMAIN",204,0) - ; -"RTN","C0XMAIN",205,0) - S ZI="" -"RTN","C0XMAIN",206,0) - S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate -"RTN","C0XMAIN",207,0) - F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ; -"RTN","C0XMAIN",208,0) - . ; -- we are skipping any child that is not rdf:Description -"RTN","C0XMAIN",209,0) - . ; -- TODO: check to see if this is right in general -"RTN","C0XMAIN",210,0) - . ; -"RTN","C0XMAIN",211,0) - . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; -"RTN","C0XMAIN",212,0) - . . W !,"SKIPPING NODE: ",ZI -"RTN","C0XMAIN",213,0) - . ; -- now looking for the subject for the triples -"RTN","C0XMAIN",214,0) - . S ZX=$G(@ZDOM@(ZI,"A","rdf:about")) -"RTN","C0XMAIN",215,0) - . I ZX'="" D ; we have the subject -"RTN","C0XMAIN",216,0) - . . ;W " about: ",ZX -"RTN","C0XMAIN",217,0) - . . S C0XSUB=ZX -"RTN","C0XMAIN",218,0) - . E D ; -"RTN","C0XMAIN",219,0) - . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject -"RTN","C0XMAIN",220,0) - . . I ZX'="" D ; -"RTN","C0XMAIN",221,0) - . . . S C0XSUB=ZX -"RTN","C0XMAIN",222,0) - . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT -"RTN","C0XMAIN",223,0) - . ; -"RTN","C0XMAIN",224,0) - . ; -- we now have the subject. the children of this node have the rest -"RTN","C0XMAIN",225,0) - . ; -"RTN","C0XMAIN",226,0) - . S ZJ="" ; for the children of the rdf:Description nodes -"RTN","C0XMAIN",227,0) - . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child -"RTN","C0XMAIN",228,0) - . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix -"RTN","C0XMAIN",229,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space -"RTN","C0XMAIN",230,0) - . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix -"RTN","C0XMAIN",231,0) - . . I C0XPRE[":" D ; expand using vocabulary -"RTN","C0XMAIN",232,0) - . . . N ZB,ZA -"RTN","C0XMAIN",233,0) - . . . S ZB=$P(C0XPRE,":",1) -"RTN","C0XMAIN",234,0) - . . . S ZA=$P(C0XPRE,":",2) -"RTN","C0XMAIN",235,0) - . . . I $G(C0XVOC(ZB))'="" D ; -"RTN","C0XMAIN",236,0) - . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded -"RTN","C0XMAIN",237,0) - . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object -"RTN","C0XMAIN",238,0) - . . I ZY'="" D Q ; -"RTN","C0XMAIN",239,0) - . . . S C0XOBJ=ZY ; object -"RTN","C0XMAIN",240,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple -"RTN","C0XMAIN",241,0) - . . ; -- this is an else because of the quit above -"RTN","C0XMAIN",242,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object -"RTN","C0XMAIN",243,0) - . . I ZX'="" D Q ; got one -"RTN","C0XMAIN",244,0) - . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject -"RTN","C0XMAIN",245,0) - . . . ; without change... this could be foolish .. look at it again later -"RTN","C0XMAIN",246,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XMAIN",247,0) - . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here -"RTN","C0XMAIN",248,0) - . . I C0XOBJ="" D Q ; not a happy situation -"RTN","C0XMAIN",249,0) - . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ -"RTN","C0XMAIN",250,0) - . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XMAIN",251,0) - W !,"INSERTING ",C0XCNT," TRIPLES" -"RTN","C0XMAIN",252,0) - D UPDIE(.C0XFDA) ; commit the updates to the file -"RTN","C0XMAIN",253,0) - ; next, mark the graph as finished -"RTN","C0XMAIN",254,0) - S C0XEND=$$NOW^XLFDT -"RTN","C0XMAIN",255,0) - W !," ENDED AT: ",C0XEND -"RTN","C0XMAIN",256,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2) -"RTN","C0XMAIN",257,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XMAIN",258,0) - W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" -"RTN","C0XMAIN",259,0) - Q -"RTN","C0XMAIN",260,0) - ; -"RTN","C0XMAIN",261,0) -SHOW(ZN) ; -"RTN","C0XMAIN",262,0) - ZWR ^TMP("MXMLDOM",$J,1,ZN,*) -"RTN","C0XMAIN",263,0) - Q -"RTN","C0XMAIN",264,0) - ; -"RTN","C0XMAIN",265,0) -ANONS() ; RETURNS AN ANONOMOUS SUBJECT -"RTN","C0XMAIN",266,0) - Q "_S:"_$$LKY9 -"RTN","C0XMAIN",267,0) - ; -"RTN","C0XMAIN",268,0) -NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED -"RTN","C0XMAIN",269,0) - ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT -"RTN","C0XMAIN",270,0) - ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN -"RTN","C0XMAIN",271,0) - S NGRAPH="G"_$$LKY9 -"RTN","C0XMAIN",272,0) - S NMETA=NGRAPH_"A" -"RTN","C0XMAIN",273,0) - Q -"RTN","C0XMAIN",274,0) - ; -"RTN","C0XMAIN",275,0) -ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT -"RTN","C0XMAIN",276,0) - ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE -"RTN","C0XMAIN",277,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",278,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",279,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",280,0) - D USEFARY(FARY) -"RTN","C0XMAIN",281,0) - I '$D(C0XCNT) S C0XCNT=0 -"RTN","C0XMAIN",282,0) - N ZNODE -"RTN","C0XMAIN",283,0) - S ZNODE="N"_$$LKY17 -"RTN","C0XMAIN",284,0) - N ZNARY ; GET READY TO CALL IENOFA -"RTN","C0XMAIN",285,0) - S ZNARY("ZG",ZG)="" -"RTN","C0XMAIN",286,0) - S ZNARY("ZS",ZS)="" -"RTN","C0XMAIN",287,0) - S ZNARY("ZP",ZP)="" -"RTN","C0XMAIN",288,0) - S ZNARY("ZO",ZO)="" -"RTN","C0XMAIN",289,0) - D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS -"RTN","C0XMAIN",290,0) - ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN -"RTN","C0XMAIN",291,0) - ;S ZSIEN=$$IENOF(ZS) -"RTN","C0XMAIN",292,0) - ;S ZPIEN=$$IENOF(ZP) -"RTN","C0XMAIN",293,0) - ;S ZOIEN=$$IENOF(ZO) -"RTN","C0XMAIN",294,0) - ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED -"RTN","C0XMAIN",295,0) - S C0XCNT=C0XCNT+1 -"RTN","C0XMAIN",296,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE -"RTN","C0XMAIN",297,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG","")) -"RTN","C0XMAIN",298,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS","")) -"RTN","C0XMAIN",299,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP","")) -"RTN","C0XMAIN",300,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO","")) -"RTN","C0XMAIN",301,0) - ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE -"RTN","C0XMAIN",302,0) - Q -"RTN","C0XMAIN",303,0) - ; -"RTN","C0XMAIN",304,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",305,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",306,0) - N ZN,ZI -"RTN","C0XMAIN",307,0) - S ZN="" -"RTN","C0XMAIN",308,0) - F ZI=1:1:9 D ; -"RTN","C0XMAIN",309,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",310,0) - Q ZN -"RTN","C0XMAIN",311,0) - ; -"RTN","C0XMAIN",312,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",313,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",314,0) - N ZN,ZI -"RTN","C0XMAIN",315,0) - S ZN="" -"RTN","C0XMAIN",316,0) - F ZI=1:1:17 D ; -"RTN","C0XMAIN",317,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",318,0) - Q ZN -"RTN","C0XMAIN",319,0) - ; -"RTN","C0XMAIN",320,0) -IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE -"RTN","C0XMAIN",321,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",322,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",323,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",324,0) - N ZIEN -"RTN","C0XMAIN",325,0) - S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",326,0) - I ZIEN="" D ; -"RTN","C0XMAIN",327,0) - . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING -"RTN","C0XMAIN",328,0) - . D UPDIE(.C0XFDA2) -"RTN","C0XMAIN",329,0) - . S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",330,0) - . K C0XFDA2 -"RTN","C0XMAIN",331,0) - Q ZIEN -"RTN","C0XMAIN",332,0) - ; -"RTN","C0XMAIN",333,0) -IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE -"RTN","C0XMAIN",334,0) - ; OR ADD THEM IF -"RTN","C0XMAIN",335,0) - ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE -"RTN","C0XMAIN",336,0) - ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")="" -"RTN","C0XMAIN",337,0) - ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" -"RTN","C0XMAIN",338,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",339,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",340,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",341,0) - K ZOUTARY ; START WITH CLEAN RESULTS -"RTN","C0XMAIN",342,0) - K C0XFDA2 ; USE A SEPARATE FDA FOR THIS -"RTN","C0XMAIN",343,0) - N ZI S ZI="" -"RTN","C0XMAIN",344,0) - N ZV,ZIEN -"RTN","C0XMAIN",345,0) - N ZCNT S ZCNT=0 -"RTN","C0XMAIN",346,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS -"RTN","C0XMAIN",347,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XMAIN",348,0) - . I $O(@C0XSN@("B",ZV,""))="" D ; -"RTN","C0XMAIN",349,0) - . . S ZCNT=ZCNT+1 -"RTN","C0XMAIN",350,0) - . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV -"RTN","C0XMAIN",351,0) - I $D(C0XFDA2) D ; -"RTN","C0XMAIN",352,0) - . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS -"RTN","C0XMAIN",353,0) - . K C0XFDA2 ; CLEAN UP -"RTN","C0XMAIN",354,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS -"RTN","C0XMAIN",355,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XMAIN",356,0) - . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW -"RTN","C0XMAIN",357,0) - . I ZIEN="" D ; -"RTN","C0XMAIN",358,0) - . . W !,"ERROR ADDING STRING: ",ZV -"RTN","C0XMAIN",359,0) - . . B -"RTN","C0XMAIN",360,0) - . S ZOUTARY("IEN",ZI,ZIEN)="" -"RTN","C0XMAIN",361,0) - Q -"RTN","C0XMAIN",362,0) - ; -"RTN","C0XMAIN",363,0) -UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS -"RTN","C0XMAIN",364,0) - ; ZFDA IS PASSED BY REFERENCE -"RTN","C0XMAIN",365,0) - ;ZWR ZFDA -"RTN","C0XMAIN",366,0) - ;B -"RTN","C0XMAIN",367,0) - K ZERR -"RTN","C0XMAIN",368,0) - D CLEAN^DILF -"RTN","C0XMAIN",369,0) - D UPDATE^DIE("","ZFDA","","ZERR") -"RTN","C0XMAIN",370,0) - I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, -"RTN","C0XMAIN",371,0) - ; INVOKE THE ERROR TRAP IF TASKED -"RTN","C0XMAIN",372,0) - ;. W "ERROR",! -"RTN","C0XMAIN",373,0) - ;. ZWR ZERR -"RTN","C0XMAIN",374,0) - ;. B -"RTN","C0XMAIN",375,0) - K ZFDA -"RTN","C0XMAIN",376,0) - Q -"RTN","C0XMAIN",377,0) - ; -"RTN","C0XTEST") -0^3^B14490662 -"RTN","C0XTEST",1,0) -C0XTEST ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05 -"RTN","C0XTEST",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 6 -"RTN","C0XTEST",3,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU -"RTN","C0XTEST",4,0) - ;General Public License See attached copy of the License. -"RTN","C0XTEST",5,0) - ; -"RTN","C0XTEST",6,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XTEST",7,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XTEST",8,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XTEST",9,0) - ;(at your option) any later version. -"RTN","C0XTEST",10,0) - ; -"RTN","C0XTEST",11,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XTEST",12,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XTEST",13,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XTEST",14,0) - ;GNU General Public License for more details. -"RTN","C0XTEST",15,0) - ; -"RTN","C0XTEST",16,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XTEST",17,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XTEST",18,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XTEST",19,0) - ; -"RTN","C0XTEST",20,0) - Q -"RTN","C0XTEST",21,0) - ; -"RTN","C0XTEST",22,0) -EN ; run the test -"RTN","C0XTEST",23,0) - ; -"RTN","C0XTEST",24,0) - k C0XFDA ; clear the node variable -"RTN","C0XTEST",25,0) - i '$d(^C0X(101,0)) d ; global doesn't exist -"RTN","C0XTEST",26,0) - . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1" -"RTN","C0XTEST",27,0) - n zg -"RTN","C0XTEST",28,0) - S zg="_:G"_$$LKY9 ; all nodes are in the same graph -"RTN","C0XTEST",29,0) - n zi -"RTN","C0XTEST",30,0) - f zi=1:1:100000 d ; try a test of 10000 nodes -"RTN","C0XTEST",31,0) - . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name -"RTN","C0XTEST",32,0) - . s C0XFDA(172.101,zi,.02)=zg -"RTN","C0XTEST",33,0) - . s C0XFDA(172.101,zi,.03)=$R(100000) -"RTN","C0XTEST",34,0) - . s C0XFDA(172.101,zi,.04)=$R(100000) -"RTN","C0XTEST",35,0) - . s C0XFDA(172.101,zi,.05)=$R(100000) -"RTN","C0XTEST",36,0) - S C0XST=$$NOW^XLFDT ; start of the insertion test -"RTN","C0XTEST",37,0) - W !,"INSERTION STARTS AT ",C0XST,! -"RTN","C0XTEST",38,0) - d BULKLOAD(.C0XFDA) -"RTN","C0XTEST",39,0) - s C0XEND=$$NOW^XLFDT ; end of the insertion test -"RTN","C0XTEST",40,0) - W !,"INSERTION ENDS AT ",C0XEND -"RTN","C0XTEST",41,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XST,2) -"RTN","C0XTEST",42,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XTEST",43,0) - I C0XDIFF>0 W !," APPROXIMATELY ",$P(100000/C0XDIFF,".")," NODES PER SECOND" -"RTN","C0XTEST",44,0) - q -"RTN","C0XTEST",45,0) - ; -"RTN","C0XTEST",46,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTEST",47,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTEST",48,0) - N ZN,ZI -"RTN","C0XTEST",49,0) - S ZN="" -"RTN","C0XTEST",50,0) - F ZI=1:1:9 D ; -"RTN","C0XTEST",51,0) - . S ZN=ZN_$R(10) -"RTN","C0XTEST",52,0) - Q ZN -"RTN","C0XTEST",53,0) - ; -"RTN","C0XTEST",54,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTEST",55,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTEST",56,0) - N ZN,ZI -"RTN","C0XTEST",57,0) - S ZN="" -"RTN","C0XTEST",58,0) - F ZI=1:1:17 D ; -"RTN","C0XTEST",59,0) - . S ZN=ZN_$R(10) -"RTN","C0XTEST",60,0) - Q ZN -"RTN","C0XTEST",61,0) - ; -"RTN","C0XTEST",62,0) -BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 -"RTN","C0XTEST",63,0) - ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE -"RTN","C0XTEST",64,0) - ; QUITS IF FILE IS NOT 172.101 -"RTN","C0XTEST",65,0) - ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 -"RTN","C0XTEST",66,0) - ; QUITS IF FIRST ENTRY IS NOT IENS 1 -"RTN","C0XTEST",67,0) - ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES -"RTN","C0XTEST",68,0) - ; ZBFDA IS PASSED BY REFERENCE -"RTN","C0XTEST",69,0) - ; -"RTN","C0XTEST",70,0) - ; -- reserves a block of iens from file 172.101 by locking the zero node -"RTN","C0XTEST",71,0) - ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 -"RTN","C0XTEST",72,0) - ; -- then unlocking to minimize the duration of the lock -"RTN","C0XTEST",73,0) - ; -"RTN","C0XTEST",74,0) - W !,"USING BULKLOAD" -"RTN","C0XTEST",75,0) - I '$D(ZBFDA) Q ; EMPTY FDA -"RTN","C0XTEST",76,0) - I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE -"RTN","C0XTEST",77,0) - N ZCNT,ZP3,ZP4 -"RTN","C0XTEST",78,0) - ; -- find the number of nodes to insert -"RTN","C0XTEST",79,0) - S ZCNT=$O(ZBFDA(172.101,""),-1) -"RTN","C0XTEST",80,0) - I ZCNT="" D Q ; -"RTN","C0XTEST",81,0) - . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" -"RTN","C0XTEST",82,0) - . B -"RTN","C0XTEST",83,0) - ; -- lock the zero node and reserve a block of iens to insert -"RTN","C0XTEST",84,0) - W !,"LOCKING ZERO NODE" -"RTN","C0XTEST",85,0) - LOCK +^C0X(101,0) -"RTN","C0XTEST",86,0) - S ZP3=$P(^C0X(101,0),U,3) -"RTN","C0XTEST",87,0) - S ZP4=$P(^C0X(101,0),U,4) -"RTN","C0XTEST",88,0) - S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 -"RTN","C0XTEST",89,0) - S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 -"RTN","C0XTEST",90,0) - LOCK -^C0X(101,0) -"RTN","C0XTEST",91,0) - N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE -"RTN","C0XTEST",92,0) - S ZBASE=ZP3 ; the last ien in the file -"RTN","C0XTEST",93,0) - W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT -"RTN","C0XTEST",94,0) - W !,$$NOW^XLFDT -"RTN","C0XTEST",95,0) - S ZI="" -"RTN","C0XTEST",96,0) - F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; -"RTN","C0XTEST",97,0) - . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name -"RTN","C0XTEST",98,0) - . I ZN="" D BLKERR Q ; -"RTN","C0XTEST",99,0) - . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer -"RTN","C0XTEST",100,0) - . I ZG="" D BLKERR Q ; -"RTN","C0XTEST",101,0) - . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer -"RTN","C0XTEST",102,0) - . I ZS="" D BLKERR Q ; -"RTN","C0XTEST",103,0) - . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer -"RTN","C0XTEST",104,0) - . I ZP="" D BLKERR Q ; -"RTN","C0XTEST",105,0) - . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer -"RTN","C0XTEST",106,0) - . I ZO="" D BLKERR Q ; -"RTN","C0XTEST",107,0) - . S ZIEN=ZI+ZBASE ; the new ien -"RTN","C0XTEST",108,0) - . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node -"RTN","C0XTEST",109,0) - . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index -"RTN","C0XTEST",110,0) - . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index -"RTN","C0XTEST",111,0) - . S ^C0X(101,"SPO",ZS,ZP,ZO)="" -"RTN","C0XTEST",112,0) - . S ^C0X(101,"SOP",ZS,ZO,ZP)="" -"RTN","C0XTEST",113,0) - . S ^C0X(101,"OPS",ZO,ZP,ZS)="" -"RTN","C0XTEST",114,0) - . S ^C0X(101,"OSP",ZO,ZS,ZP)="" -"RTN","C0XTEST",115,0) - . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" -"RTN","C0XTEST",116,0) - . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" -"RTN","C0XTEST",117,0) - . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" -"RTN","C0XTEST",118,0) - . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" -"RTN","C0XTEST",119,0) - Q -"RTN","C0XTEST",120,0) - ; -"RTN","C0XTEST",121,0) -BLKERR ; -"RTN","C0XTEST",122,0) - W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) -"RTN","C0XTEST",123,0) - B -"RTN","C0XTEST",124,0) - Q -"RTN","C0XTEST",125,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** diff --git a/kids/C0X_1_0_0_T8.KID b/kids/C0X_1_0_0_T8.KID deleted file mode 100644 index 00a0a34..0000000 --- a/kids/C0X_1_0_0_T8.KID +++ /dev/null @@ -1,3338 +0,0 @@ -KIDS Distribution saved on Dec 13, 2011@19:51:36 -fileman output transform using namespaces -**KIDS**:C0X*1.0*0^ - -**INSTALL NAME** -C0X*1.0*0 -"BLD",7883,0) -C0X*1.0*0^^0^3111213^n -"BLD",7883,4,0) -^9.64PA^172.201^2 -"BLD",7883,4,172.101,0) -172.101 -"BLD",7883,4,172.101,222) -y^y^f^^^^n -"BLD",7883,4,172.201,0) -172.201 -"BLD",7883,4,172.201,222) -y^y^f^^^^n -"BLD",7883,4,"B",172.101,172.101) - -"BLD",7883,4,"B",172.201,172.201) - -"BLD",7883,6.3) -7 -"BLD",7883,"KRN",0) -^9.67PA^779.2^20 -"BLD",7883,"KRN",.4,0) -.4 -"BLD",7883,"KRN",.4,"NM",0) -^9.68A^1^1 -"BLD",7883,"KRN",.4,"NM",1,0) -C0X PRINT GRAPH FILE #172.101^172.101^0 -"BLD",7883,"KRN",.4,"NM","B","C0X PRINT GRAPH FILE #172.101",1) - -"BLD",7883,"KRN",.401,0) -.401 -"BLD",7883,"KRN",.402,0) -.402 -"BLD",7883,"KRN",.403,0) -.403 -"BLD",7883,"KRN",.5,0) -.5 -"BLD",7883,"KRN",.84,0) -.84 -"BLD",7883,"KRN",3.6,0) -3.6 -"BLD",7883,"KRN",3.8,0) -3.8 -"BLD",7883,"KRN",9.2,0) -9.2 -"BLD",7883,"KRN",9.8,0) -9.8 -"BLD",7883,"KRN",9.8,"NM",0) -^9.68A^6^6 -"BLD",7883,"KRN",9.8,"NM",1,0) -C0XMAIN^^0^B115393527 -"BLD",7883,"KRN",9.8,"NM",2,0) -C0XF2N^^0^B239229985 -"BLD",7883,"KRN",9.8,"NM",3,0) -C0XTEST^^0^B14490662 -"BLD",7883,"KRN",9.8,"NM",4,0) -C0XINIT^^0^B20874536 -"BLD",7883,"KRN",9.8,"NM",5,0) -C0XUTIL^^0^B4546956 -"BLD",7883,"KRN",9.8,"NM",6,0) -C0XTKSB^^0^B15924104 -"BLD",7883,"KRN",9.8,"NM","B","C0XF2N",2) - -"BLD",7883,"KRN",9.8,"NM","B","C0XINIT",4) - -"BLD",7883,"KRN",9.8,"NM","B","C0XMAIN",1) - -"BLD",7883,"KRN",9.8,"NM","B","C0XTEST",3) - -"BLD",7883,"KRN",9.8,"NM","B","C0XTKSB",6) - -"BLD",7883,"KRN",9.8,"NM","B","C0XUTIL",5) - -"BLD",7883,"KRN",19,0) -19 -"BLD",7883,"KRN",19.1,0) -19.1 -"BLD",7883,"KRN",101,0) -101 -"BLD",7883,"KRN",409.61,0) -409.61 -"BLD",7883,"KRN",771,0) -771 -"BLD",7883,"KRN",779.2,0) -779.2 -"BLD",7883,"KRN",870,0) -870 -"BLD",7883,"KRN",8989.51,0) -8989.51 -"BLD",7883,"KRN",8989.52,0) -8989.52 -"BLD",7883,"KRN",8994,0) -8994 -"BLD",7883,"KRN","B",.4,.4) - -"BLD",7883,"KRN","B",.401,.401) - -"BLD",7883,"KRN","B",.402,.402) - -"BLD",7883,"KRN","B",.403,.403) - -"BLD",7883,"KRN","B",.5,.5) - -"BLD",7883,"KRN","B",.84,.84) - -"BLD",7883,"KRN","B",3.6,3.6) - -"BLD",7883,"KRN","B",3.8,3.8) - -"BLD",7883,"KRN","B",9.2,9.2) - -"BLD",7883,"KRN","B",9.8,9.8) - -"BLD",7883,"KRN","B",19,19) - -"BLD",7883,"KRN","B",19.1,19.1) - -"BLD",7883,"KRN","B",101,101) - -"BLD",7883,"KRN","B",409.61,409.61) - -"BLD",7883,"KRN","B",771,771) - -"BLD",7883,"KRN","B",779.2,779.2) - -"BLD",7883,"KRN","B",870,870) - -"BLD",7883,"KRN","B",8989.51,8989.51) - -"BLD",7883,"KRN","B",8989.52,8989.52) - -"BLD",7883,"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^3111207.1727^@^172.101^^@^3111207 -"KRN",.4,1498,"F",1) -.03;W25;S~.04;C28;W25~.05;C54;W24~ -"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") -6 -"RTN","C0XF2N") -0^2^B239229985 -"RTN","C0XF2N",1,0) -C0XF2N ; GPL - Fileman Triples entry point routine ;10/13/11 17:05 -"RTN","C0XF2N",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 7 -"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) - I $D(@ZFARY) Q ; ALREADY INITIALIZED -"RTN","C0XF2N",36,0) - S @ZFARY@("C0XTFN")=172.101 ; TRIPLES FILE NUMBER -"RTN","C0XF2N",37,0) - S @ZFARY@("C0XSFN")=172.201 ; TRIPLES STRINGS FILE NUMBER -"RTN","C0XF2N",38,0) - S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME -"RTN","C0XF2N",39,0) - S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME -"RTN","C0XF2N",40,0) - S @ZFARY@("C0XDIR")="/home/glilly/snomed/" -"RTN","C0XF2N",41,0) - S @ZFARY@("BLKLOAD")=1 ; this file supports block load -"RTN","C0XF2N",42,0) - S @ZFARY@("FMTSSTYLE")="F2N" ; fileman style -"RTN","C0XF2N",43,0) - D USEFARY(ZFARY) -"RTN","C0XF2N",44,0) - Q -"RTN","C0XF2N",45,0) - ; -"RTN","C0XF2N",46,0) -USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY -"RTN","C0XF2N",47,0) - N ZI S ZI="" -"RTN","C0XF2N",48,0) - F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D -"RTN","C0XF2N",49,0) - . ;N ZX -"RTN","C0XF2N",50,0) - . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_"""" -"RTN","C0XF2N",51,0) - . ;W !,ZX -"RTN","C0XF2N",52,0) - . X ZX -"RTN","C0XF2N",53,0) - Q -"RTN","C0XF2N",54,0) - ; -"RTN","C0XF2N",55,0) -FILEIN ; INTERACTIVE ENTRY POINT FOR OPTION TO READ IN A FILE -"RTN","C0XF2N",56,0) - I '$D(C0XFARY) D INITFARY("C0XFARY") -"RTN","C0XF2N",57,0) - D USEFARY("C0XFARY") -"RTN","C0XF2N",58,0) - S DIR(0)="F^3:240" -"RTN","C0XF2N",59,0) - S DIR("A")="File Directory" -"RTN","C0XF2N",60,0) - S DIR("B")=C0XDIR -"RTN","C0XF2N",61,0) - D ^DIR -"RTN","C0XF2N",62,0) - I Y="^" Q ; -"RTN","C0XF2N",63,0) - S C0XDIR=Y -"RTN","C0XF2N",64,0) - S C0XFARY("C0XDIR")=Y -"RTN","C0XF2N",65,0) - S DIR(0)="F^3:240" -"RTN","C0XF2N",66,0) - S DIR("A")="File Name" -"RTN","C0XF2N",67,0) - I '$D(C0XFN) S DIR("B")="qds.rdf" -"RTN","C0XF2N",68,0) - E S DIR("B")=C0XFN -"RTN","C0XF2N",69,0) - D ^DIR -"RTN","C0XF2N",70,0) - I Y="" Q ; -"RTN","C0XF2N",71,0) - I Y="^" Q ; -"RTN","C0XF2N",72,0) - S C0XFN=Y -"RTN","C0XF2N",73,0) - D IMPORT(C0XFN,C0XDIR,,"C0XFARY") -"RTN","C0XF2N",74,0) - K C0XFDA -"RTN","C0XF2N",75,0) - Q -"RTN","C0XF2N",76,0) - ; -"RTN","C0XF2N",77,0) -IMPORT(FNAME,INDIR,INURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD -"RTN","C0XF2N",78,0) - ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE -"RTN","C0XF2N",79,0) - ; NODE NAME OF THE TEXT TRIPLE -"RTN","C0XF2N",80,0) - ; INDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR) -"RTN","C0XF2N",81,0) - ; INURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE -"RTN","C0XF2N",82,0) - ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE -"RTN","C0XF2N",83,0) - I '$D(FARY) D ; -"RTN","C0XF2N",84,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",85,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",86,0) - D USEFARY(FARY) -"RTN","C0XF2N",87,0) - N ZD,ZTMP -"RTN","C0XF2N",88,0) - I '$D(INDIR) S INDIR=C0XDIR ; DIRECTORY OF THE RDF FILE -"RTN","C0XF2N",89,0) - I $G(INURL)="" D ; -"RTN","C0XF2N",90,0) - . ;N ZN2 S ZN2=$P(FNAME,".",1)_"_"_$P(FNAME,".",2) ; REMOVE THE DOT -"RTN","C0XF2N",91,0) - . ;S INURL=FDIR_ZN2 -"RTN","C0XF2N",92,0) - . S INURL=INDIR_FNAME -"RTN","C0XF2N",93,0) - N ZTMP -"RTN","C0XF2N",94,0) - S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE -"RTN","C0XF2N",95,0) - K @ZTMP ; MAKE SURE IT'S CLEAR -"RTN","C0XF2N",96,0) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XF2N",97,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XF2N",98,0) - W !,"READING IN: ",FNAME -"RTN","C0XF2N",99,0) - I '$$FILEREAD(ZTMP,INDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS -"RTN","C0XF2N",100,0) - . W !,"ERROR READING FILE: ",INDIR,FNAME -"RTN","C0XF2N",101,0) - S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT -"RTN","C0XF2N",102,0) - W !,$O(@ZRDF@(""),-1)," LINES READ" -"RTN","C0XF2N",103,0) - D INSRDF(ZRDF,INURL,FARY) ; IMPORT AND PROCESS THE RDF -"RTN","C0XF2N",104,0) - K INURL -"RTN","C0XF2N",105,0) - K C0XFDA -"RTN","C0XF2N",106,0) - ;K ^TMP("MXMLDOM",$J) -"RTN","C0XF2N",107,0) - Q -"RTN","C0XF2N",108,0) - ; -"RTN","C0XF2N",109,0) -WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT -"RTN","C0XF2N",110,0) - ; -"RTN","C0XF2N",111,0) - I '$D(FARY) D ; -"RTN","C0XF2N",112,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",113,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",114,0) - D USEFARY(FARY) -"RTN","C0XF2N",115,0) - ;N ZLOC,ZTMP -"RTN","C0XF2N",116,0) - K ZTMP -"RTN","C0XF2N",117,0) - S ZLOC=$NA(^TMP("C0X","WGET",$J)) -"RTN","C0XF2N",118,0) - K @ZLOC -"RTN","C0XF2N",119,0) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XF2N",120,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XF2N",121,0) - W !,"DOWNLOADING: ",ZURL -"RTN","C0XF2N",122,0) - S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP) -"RTN","C0XF2N",123,0) - M @ZLOC=ZTMP -"RTN","C0XF2N",124,0) - S C0XLINES=$O(@ZLOC@(""),-1) -"RTN","C0XF2N",125,0) - W !,C0XLINES," LINES READ" -"RTN","C0XF2N",126,0) - S C0XDLC=$$NOW^XLFDT ; DOWNLOAD COMPLETE -"RTN","C0XF2N",127,0) - W !,"DOWNLOAD COMPLETE AT ",C0XDLC -"RTN","C0XF2N",128,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XDLC,C0XSTART,2) -"RTN","C0XF2N",129,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",130,0) - I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XLINES/C0XDIFF,".")," LINES PER SEC" -"RTN","C0XF2N",131,0) - D INSRDF(ZLOC,ZURL,FARY) -"RTN","C0XF2N",132,0) - Q -"RTN","C0XF2N",133,0) - ; -"RTN","C0XF2N",134,0) -INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS -"RTN","C0XF2N",135,0) - ; ZRDF IS PASSED BY NAME -"RTN","C0XF2N",136,0) - I '$D(FARY) D ; -"RTN","C0XF2N",137,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",138,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",139,0) - D USEFARY(FARY) -"RTN","C0XF2N",140,0) - S BATCNT=0 ; BATCH COUNTER -"RTN","C0XF2N",141,0) - S BATMAX=10000 ; TRY BATCHES OF THIS SIZE -"RTN","C0XF2N",142,0) - N ZGRAPH,ZSUBJECT -"RTN","C0XF2N",143,0) - S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME -"RTN","C0XF2N",144,0) - S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT -"RTN","C0XF2N",145,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY) -"RTN","C0XF2N",146,0) - N ZTXTNM -"RTN","C0XF2N",147,0) - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE -"RTN","C0XF2N",148,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY) -"RTN","C0XF2N",149,0) - D SWUPDIE(.C0XFDA) ; TRY IT OUT -"RTN","C0XF2N",150,0) - K C0XCNT ;RESET FOR NEXT TIME -"RTN","C0XF2N",151,0) - D STORETXT(ZRDF,ZTXTNM,FARY) -"RTN","C0XF2N",152,0) - W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM -"RTN","C0XF2N",153,0) - D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF -"RTN","C0XF2N",154,0) - Q -"RTN","C0XF2N",155,0) - ; -"RTN","C0XF2N",156,0) -STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME -"RTN","C0XF2N",157,0) - ; -"RTN","C0XF2N",158,0) - I '$D(FARY) D ; -"RTN","C0XF2N",159,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",160,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",161,0) - D USEFARY(FARY) -"RTN","C0XF2N",162,0) - N ZIEN -"RTN","C0XF2N",163,0) - S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN -"RTN","C0XF2N",164,0) - D CLEAN^DILF -"RTN","C0XF2N",165,0) - K ZERR -"RTN","C0XF2N",166,0) - D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") -"RTN","C0XF2N",167,0) - I $D(ZERR) D ; -"RTN","C0XF2N",168,0) - . ZWR ZERR -"RTN","C0XF2N",169,0) - Q -"RTN","C0XF2N",170,0) - ; -"RTN","C0XF2N",171,0) -GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT -"RTN","C0XF2N",172,0) - ; ZRTN IS PASSED BY REFERENCE -"RTN","C0XF2N",173,0) - I '$D(FARY) D ; -"RTN","C0XF2N",174,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",175,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",176,0) - D USEFARY(FARY) -"RTN","C0XF2N",177,0) - N ZIEN -"RTN","C0XF2N",178,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XF2N",179,0) - S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") -"RTN","C0XF2N",180,0) - Q -"RTN","C0XF2N",181,0) - ; -"RTN","C0XF2N",182,0) -WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL -"RTN","C0XF2N",183,0) - ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING -"RTN","C0XF2N",184,0) - I '$D(FARY) D ; -"RTN","C0XF2N",185,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",186,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",187,0) - D USEFARY(FARY) -"RTN","C0XF2N",188,0) - N ZIEN -"RTN","C0XF2N",189,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XF2N",190,0) - Q $NA(@C0XSN@(ZIEN,1)) -"RTN","C0XF2N",191,0) - ; -"RTN","C0XF2N",192,0) -FILEREAD(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH -"RTN","C0XF2N",193,0) - ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT -"RTN","C0XF2N",194,0) - ; IE ^TMP("C0X","FILEIN",1) -"RTN","C0XF2N",195,0) - ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 -"RTN","C0XF2N",196,0) - ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH -"RTN","C0XF2N",197,0) - S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) -"RTN","C0XF2N",198,0) - Q OK -"RTN","C0XF2N",199,0) - ; -"RTN","C0XF2N",200,0) -TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE -"RTN","C0XF2N",201,0) - S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) -"RTN","C0XF2N",202,0) - S ZGRAPH="/test/rdfFile" -"RTN","C0XF2N",203,0) - S ZM="/test/rdfFile/meta" -"RTN","C0XF2N",204,0) - D PROCESS(.G,ZIN,ZGRAPH,ZM) -"RTN","C0XF2N",205,0) - Q -"RTN","C0XF2N",206,0) - ; -"RTN","C0XF2N",207,0) -PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE -"RTN","C0XF2N",208,0) - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING -"RTN","C0XF2N",209,0) - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE -"RTN","C0XF2N",210,0) - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS -"RTN","C0XF2N",211,0) - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA -"RTN","C0XF2N",212,0) - ; -"RTN","C0XF2N",213,0) - I '$D(FARY) D ; -"RTN","C0XF2N",214,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",215,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",216,0) - D USEFARY(FARY) -"RTN","C0XF2N",217,0) - ;N BATCNT -"RTN","C0XF2N",218,0) - ;N BATMAX -"RTN","C0XF2N",219,0) - ; -- first parse the rdf file with the MXML parser -"RTN","C0XF2N",220,0) - ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML -"RTN","C0XF2N",221,0) - S C0XDLC2=$$NOW^XLFDT ; START OF PARSE -"RTN","C0XF2N",222,0) - S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W") -"RTN","C0XF2N",223,0) - ;B -"RTN","C0XF2N",224,0) - K @ZRDF ; DON'T NEED INPUT BUFFER ANYMORE -"RTN","C0XF2N",225,0) - ; -- assign the MXLM dom global name to ZDOM -"RTN","C0XF2N",226,0) - S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID)) -"RTN","C0XF2N",227,0) - S C0XNODE=$O(@ZDOM@(""),-1) -"RTN","C0XF2N",228,0) - W !,C0XNODE," XML NODES PARSED" -"RTN","C0XF2N",229,0) - S C0XPRS=$$NOW^XLFDT ; PARSE COMPLETE -"RTN","C0XF2N",230,0) - W !,"PARSE COMPLETE AT ",C0XPRS -"RTN","C0XF2N",231,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XPRS,C0XDLC2,2) -"RTN","C0XF2N",232,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",233,0) - I C0XDIFF'=0 D ; -"RTN","C0XF2N",234,0) - . W !," APPROXIMATELY ",$P(C0XNODE/C0XDIFF,".")," NODES PER SECOND" -"RTN","C0XF2N",235,0) - ; -- populate the metagraph to point to the graph with status unfinished -"RTN","C0XF2N",236,0) - S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT -"RTN","C0XF2N",237,0) - I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH -"RTN","C0XF2N",238,0) - D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH -"RTN","C0XF2N",239,0) - D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished -"RTN","C0XF2N",240,0) - W !,"INSERTING GRAPH: ",ZGRF -"RTN","C0XF2N",241,0) - ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT") -"RTN","C0XF2N",242,0) - S C0XDATE=$$NOW^XLFDT -"RTN","C0XF2N",243,0) - D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY) -"RTN","C0XF2N",244,0) - D SWUPDIE(.C0XFDA) ; commit the metagraph changes to the triple store -"RTN","C0XF2N",245,0) - ; -- -"RTN","C0XF2N",246,0) - ; -- pull out the vocabularies in the RDF statement. marked with xmlns: -"RTN","C0XF2N",247,0) - ; -- put them in a local variable for quick reference -"RTN","C0XF2N",248,0) - ; -- TODO: create a graph for vocabularies and validate incoming against it -"RTN","C0XF2N",249,0) - ; -"RTN","C0XF2N",250,0) - S C0XVOC="" -"RTN","C0XF2N",251,0) - N ZI,ZJ,ZK S ZI="" -"RTN","C0XF2N",252,0) - F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns -"RTN","C0XF2N",253,0) - . S ZVOC=$P(ZI,"xmlns:",2) -"RTN","C0XF2N",254,0) - . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI)) -"RTN","C0XF2N",255,0) - W !,"VOCABS:" ZWR C0XVOC -"RTN","C0XF2N",256,0) - ; -"RTN","C0XF2N",257,0) - ; -- look for children called rdf:Description. quit if none. not an rdf file -"RTN","C0XF2N",258,0) - ; -"RTN","C0XF2N",259,0) - S C0XTYPE("rdf:Description")=1 -"RTN","C0XF2N",260,0) - S C0XTYPE("owl:ObjectProperty")=1 -"RTN","C0XF2N",261,0) - S ZI=$O(@ZDOM@(1,"C","")) -"RTN","C0XF2N",262,0) - I '$G(C0XTYPE(@ZDOM@(1,"C",ZI))) D Q ; not an rdf file -"RTN","C0XF2N",263,0) - . W !,"Error. Not an RDF file. Cannot process." -"RTN","C0XF2N",264,0) - . zwr ^TMP("MXMLDOM",$J,*) -"RTN","C0XF2N",265,0) - ; -"RTN","C0XF2N",266,0) - ; -- now process the rdf description children -"RTN","C0XF2N",267,0) - ; -"RTN","C0XF2N",268,0) - S ZI="" -"RTN","C0XF2N",269,0) - S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate -"RTN","C0XF2N",270,0) - F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ; -"RTN","C0XF2N",271,0) - . ; -- we are skipping any child that is not rdf:Description -"RTN","C0XF2N",272,0) - . ; -- TODO: check to see if this is right in general -"RTN","C0XF2N",273,0) - . ; -"RTN","C0XF2N",274,0) - . IF '$G(C0XTYPE(@ZDOM@(1,"C",ZI))) D Q ; -"RTN","C0XF2N",275,0) - . . W !,"SKIPPING NODE: ",ZI -"RTN","C0XF2N",276,0) - . ; -- now looking for the subject for the triples -"RTN","C0XF2N",277,0) - . S ZX=$G(@ZDOM@(ZI,"A","rdf:about")) -"RTN","C0XF2N",278,0) - . I ZX'="" D ; we have the subject -"RTN","C0XF2N",279,0) - . . ;W " about: ",ZX -"RTN","C0XF2N",280,0) - . . S C0XSUB=ZX -"RTN","C0XF2N",281,0) - . E D ; -"RTN","C0XF2N",282,0) - . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject -"RTN","C0XF2N",283,0) - . . I ZX'="" D ; -"RTN","C0XF2N",284,0) - . . . S C0XSUB=ZX -"RTN","C0XF2N",285,0) - . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT -"RTN","C0XF2N",286,0) - . ; -"RTN","C0XF2N",287,0) - . ; -- we now have the subject. the children of this node have the rest -"RTN","C0XF2N",288,0) - . ; -"RTN","C0XF2N",289,0) - . S ZJ="" ; for the children of the rdf:Description nodes -"RTN","C0XF2N",290,0) - . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child -"RTN","C0XF2N",291,0) - . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix -"RTN","C0XF2N",292,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space -"RTN","C0XF2N",293,0) - . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix -"RTN","C0XF2N",294,0) - . . I C0XPRE[":" D ; expand using vocabulary -"RTN","C0XF2N",295,0) - . . . N ZB,ZA -"RTN","C0XF2N",296,0) - . . . S ZB=$P(C0XPRE,":",1) -"RTN","C0XF2N",297,0) - . . . S ZA=$P(C0XPRE,":",2) -"RTN","C0XF2N",298,0) - . . . I $G(C0XVOC(ZB))'="" D ; -"RTN","C0XF2N",299,0) - . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded -"RTN","C0XF2N",300,0) - . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object -"RTN","C0XF2N",301,0) - . . I ZY'="" D Q ; -"RTN","C0XF2N",302,0) - . . . S C0XOBJ=ZY ; object -"RTN","C0XF2N",303,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple -"RTN","C0XF2N",304,0) - . . ; -- this is an else because of the quit above -"RTN","C0XF2N",305,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object -"RTN","C0XF2N",306,0) - . . I ZX'="" D Q ; got one -"RTN","C0XF2N",307,0) - . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject -"RTN","C0XF2N",308,0) - . . . ; without change... this could be foolish .. look at it again later -"RTN","C0XF2N",309,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XF2N",310,0) - . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here -"RTN","C0XF2N",311,0) - . . I C0XOBJ="" D Q ; not a happy situation -"RTN","C0XF2N",312,0) - . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ -"RTN","C0XF2N",313,0) - . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XF2N",314,0) - S C0XTRP=$$NOW^XLFDT ; PARSE COMPLETE -"RTN","C0XF2N",315,0) - W !,"TRIPLES COMPLETE AT ",C0XTRP -"RTN","C0XF2N",316,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XTRP,C0XPRS,2) -"RTN","C0XF2N",317,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",318,0) - I C0XDIFF'=0 D ; -"RTN","C0XF2N",319,0) - . W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" -"RTN","C0XF2N",320,0) - W !,"INSERTING ",C0XCNT," TRIPLES" -"RTN","C0XF2N",321,0) - I $D(C0XFDA) D ; -"RTN","C0XF2N",322,0) - . I $G(BLKLOAD) D ; -"RTN","C0XF2N",323,0) - . . D BULKLOAD(.C0XFDA) -"RTN","C0XF2N",324,0) - . E D ; -"RTN","C0XF2N",325,0) - . . D UPDIE(.C0XFDA) ; commit the updates to the file -"RTN","C0XF2N",326,0) - ; next, mark the graph as finished -"RTN","C0XF2N",327,0) - S C0XINS=$$NOW^XLFDT ; PARSE COMPLETE -"RTN","C0XF2N",328,0) - W !,"INSERTION COMPLETE AT ",C0XPRS -"RTN","C0XF2N",329,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XINS,C0XTRP,2) -"RTN","C0XF2N",330,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",331,0) - I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," NODES PER SECOND" -"RTN","C0XF2N",332,0) - S C0XEND=$$NOW^XLFDT -"RTN","C0XF2N",333,0) - W !," ENDED AT: ",C0XEND -"RTN","C0XF2N",334,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2) -"RTN","C0XF2N",335,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",336,0) - I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" -"RTN","C0XF2N",337,0) - Q -"RTN","C0XF2N",338,0) - ; -"RTN","C0XF2N",339,0) -SHOW(ZN) ; -"RTN","C0XF2N",340,0) - ZWR ^TMP("MXMLDOM",$J,1,ZN,*) -"RTN","C0XF2N",341,0) - Q -"RTN","C0XF2N",342,0) - ; -"RTN","C0XF2N",343,0) -ANONS() ; RETURNS AN ANONOMOUS SUBJECT -"RTN","C0XF2N",344,0) - Q "_:S"_$$LKY9 -"RTN","C0XF2N",345,0) - ; -"RTN","C0XF2N",346,0) -NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED -"RTN","C0XF2N",347,0) - ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT -"RTN","C0XF2N",348,0) - ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN -"RTN","C0XF2N",349,0) - S NGRAPH="G"_$$LKY9 -"RTN","C0XF2N",350,0) - S NMETA=NGRAPH_"A" -"RTN","C0XF2N",351,0) - Q -"RTN","C0XF2N",352,0) - ; -"RTN","C0XF2N",353,0) -ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT -"RTN","C0XF2N",354,0) - ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE -"RTN","C0XF2N",355,0) - I '$D(FARY) D ; -"RTN","C0XF2N",356,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",357,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",358,0) - D USEFARY(FARY) -"RTN","C0XF2N",359,0) - I '$D(C0XCNT) S C0XCNT=0 -"RTN","C0XF2N",360,0) - N ZNODE -"RTN","C0XF2N",361,0) - S ZNODE="N"_$$LKY17 -"RTN","C0XF2N",362,0) - N ZNARY ; GET READY TO CALL IENOFA -"RTN","C0XF2N",363,0) - S ZNARY("ZG",ZG)="" -"RTN","C0XF2N",364,0) - S ZNARY("ZS",ZS)="" -"RTN","C0XF2N",365,0) - S ZNARY("ZP",ZP)="" -"RTN","C0XF2N",366,0) - S ZNARY("ZO",ZO)="" -"RTN","C0XF2N",367,0) - D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS -"RTN","C0XF2N",368,0) - ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN -"RTN","C0XF2N",369,0) - ;S ZSIEN=$$IENOF(ZS) -"RTN","C0XF2N",370,0) - ;S ZPIEN=$$IENOF(ZP) -"RTN","C0XF2N",371,0) - ;S ZOIEN=$$IENOF(ZO) -"RTN","C0XF2N",372,0) - ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED -"RTN","C0XF2N",373,0) - S BATCNT=BATCNT+1 -"RTN","C0XF2N",374,0) - S C0XCNT=C0XCNT+1 -"RTN","C0XF2N",375,0) - I $G(BLKLOAD)=1 D ; we are using bulk load -"RTN","C0XF2N",376,0) - . S C0XFDA(C0XTFN,BATCNT,.01)=ZNODE -"RTN","C0XF2N",377,0) - . S C0XFDA(C0XTFN,BATCNT,.02)=$O(ZIENS("IEN","ZG","")) -"RTN","C0XF2N",378,0) - . S C0XFDA(C0XTFN,BATCNT,.03)=$O(ZIENS("IEN","ZS","")) -"RTN","C0XF2N",379,0) - . S C0XFDA(C0XTFN,BATCNT,.04)=$O(ZIENS("IEN","ZP","")) -"RTN","C0XF2N",380,0) - . S C0XFDA(C0XTFN,BATCNT,.05)=$O(ZIENS("IEN","ZO","")) -"RTN","C0XF2N",381,0) - E D ; -"RTN","C0XF2N",382,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.01)=ZNODE -"RTN","C0XF2N",383,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.02)=$O(ZIENS("IEN","ZG","")) -"RTN","C0XF2N",384,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.03)=$O(ZIENS("IEN","ZS","")) -"RTN","C0XF2N",385,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.04)=$O(ZIENS("IEN","ZP","")) -"RTN","C0XF2N",386,0) - . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.05)=$O(ZIENS("IEN","ZO","")) -"RTN","C0XF2N",387,0) - I BATCNT=BATMAX D ; BATCH IS DONE -"RTN","C0XF2N",388,0) - . I $G(BLKLOAD) D ; bulk load -"RTN","C0XF2N",389,0) - . . D BULKLOAD(.C0XFDA) ; bulk load the batch -"RTN","C0XF2N",390,0) - . E D ; no bulk load -"RTN","C0XF2N",391,0) - . . D UPDIE(.C0XFDA) -"RTN","C0XF2N",392,0) - . K C0XFDA -"RTN","C0XF2N",393,0) - . S BATCNT=0 ; RESET COUNTER -"RTN","C0XF2N",394,0) - ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE -"RTN","C0XF2N",395,0) - Q -"RTN","C0XF2N",396,0) - ; -"RTN","C0XF2N",397,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XF2N",398,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XF2N",399,0) - N ZN,ZI -"RTN","C0XF2N",400,0) - S ZN="" -"RTN","C0XF2N",401,0) - F ZI=1:1:9 D ; -"RTN","C0XF2N",402,0) - . S ZN=ZN_$R(10) -"RTN","C0XF2N",403,0) - Q ZN -"RTN","C0XF2N",404,0) - ; -"RTN","C0XF2N",405,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XF2N",406,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XF2N",407,0) - N ZN,ZI -"RTN","C0XF2N",408,0) - S ZN="" -"RTN","C0XF2N",409,0) - F ZI=1:1:17 D ; -"RTN","C0XF2N",410,0) - . S ZN=ZN_$R(10) -"RTN","C0XF2N",411,0) - Q ZN -"RTN","C0XF2N",412,0) - ; -"RTN","C0XF2N",413,0) -IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE -"RTN","C0XF2N",414,0) - I '$D(FARY) D ; -"RTN","C0XF2N",415,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",416,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",417,0) - N ZIEN -"RTN","C0XF2N",418,0) - S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XF2N",419,0) - I ZIEN="" D ; -"RTN","C0XF2N",420,0) - . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING -"RTN","C0XF2N",421,0) - . D UPDIE(.C0XFDA2) -"RTN","C0XF2N",422,0) - . S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XF2N",423,0) - . K C0XFDA2 -"RTN","C0XF2N",424,0) - Q ZIEN -"RTN","C0XF2N",425,0) - ; -"RTN","C0XF2N",426,0) -IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE -"RTN","C0XF2N",427,0) - ; OR ADD THEM IF -"RTN","C0XF2N",428,0) - ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE -"RTN","C0XF2N",429,0) - ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")="" -"RTN","C0XF2N",430,0) - ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" -"RTN","C0XF2N",431,0) - I '$D(FARY) D ; -"RTN","C0XF2N",432,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",433,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",434,0) - K ZOUTARY ; START WITH CLEAN RESULTS -"RTN","C0XF2N",435,0) - K C0XFDA2 ; USE A SEPARATE FDA FOR THIS -"RTN","C0XF2N",436,0) - N ZI S ZI="" -"RTN","C0XF2N",437,0) - N ZV,ZIEN -"RTN","C0XF2N",438,0) - N ZCNT S ZCNT=0 -"RTN","C0XF2N",439,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS -"RTN","C0XF2N",440,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XF2N",441,0) - . I $O(@C0XSN@("B",ZV,""))="" D ; -"RTN","C0XF2N",442,0) - . . S ZCNT=ZCNT+1 -"RTN","C0XF2N",443,0) - . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV -"RTN","C0XF2N",444,0) - I $D(C0XFDA2) D ; -"RTN","C0XF2N",445,0) - . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS -"RTN","C0XF2N",446,0) - . K C0XFDA2 ; CLEAN UP -"RTN","C0XF2N",447,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS -"RTN","C0XF2N",448,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XF2N",449,0) - . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW -"RTN","C0XF2N",450,0) - . I ZIEN="" D ; -"RTN","C0XF2N",451,0) - . . W !,"ERROR ADDING STRING: ",ZV -"RTN","C0XF2N",452,0) - . . B -"RTN","C0XF2N",453,0) - . S ZOUTARY("IEN",ZI,ZIEN)="" -"RTN","C0XF2N",454,0) - Q -"RTN","C0XF2N",455,0) - ; -"RTN","C0XF2N",456,0) -BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 -"RTN","C0XF2N",457,0) - ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE -"RTN","C0XF2N",458,0) - ; QUITS IF FILE IS NOT 172.101 -"RTN","C0XF2N",459,0) - ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 -"RTN","C0XF2N",460,0) - ; QUITS IF FIRST ENTRY IS NOT IENS 1 -"RTN","C0XF2N",461,0) - ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES -"RTN","C0XF2N",462,0) - ; ZBFDA IS PASSED BY REFERENCE -"RTN","C0XF2N",463,0) - ; -"RTN","C0XF2N",464,0) - ; -- reserves a block of iens from file 172.101 by locking the zero node -"RTN","C0XF2N",465,0) - ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 -"RTN","C0XF2N",466,0) - ; -- then unlocking to minimize the duration of the lock -"RTN","C0XF2N",467,0) - ; -"RTN","C0XF2N",468,0) - W !,"USING BULKLOAD" -"RTN","C0XF2N",469,0) - I '$D(ZBFDA) Q ; EMPTY FDA -"RTN","C0XF2N",470,0) - I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE -"RTN","C0XF2N",471,0) - N ZCNT,ZP3,ZP4 -"RTN","C0XF2N",472,0) - ; -- find the number of nodes to insert -"RTN","C0XF2N",473,0) - S ZCNT=$O(ZBFDA(172.101,""),-1) -"RTN","C0XF2N",474,0) - I ZCNT="" D Q ; -"RTN","C0XF2N",475,0) - . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" -"RTN","C0XF2N",476,0) - . B -"RTN","C0XF2N",477,0) - ; -- lock the zero node and reserve a block of iens to insert -"RTN","C0XF2N",478,0) - W !,"LOCKING ZERO NODE" -"RTN","C0XF2N",479,0) - LOCK +^C0X(101,0) -"RTN","C0XF2N",480,0) - S ZP3=$P(^C0X(101,0),U,3) -"RTN","C0XF2N",481,0) - S ZP4=$P(^C0X(101,0),U,4) -"RTN","C0XF2N",482,0) - S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 -"RTN","C0XF2N",483,0) - S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 -"RTN","C0XF2N",484,0) - LOCK -^C0X(101,0) -"RTN","C0XF2N",485,0) - N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE -"RTN","C0XF2N",486,0) - S ZBASE=ZP3 ; the last ien in the file -"RTN","C0XF2N",487,0) - W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT -"RTN","C0XF2N",488,0) - W !,$$NOW^XLFDT -"RTN","C0XF2N",489,0) - S ZI="" -"RTN","C0XF2N",490,0) - F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; -"RTN","C0XF2N",491,0) - . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name -"RTN","C0XF2N",492,0) - . I ZN="" D BLKERR Q ; -"RTN","C0XF2N",493,0) - . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer -"RTN","C0XF2N",494,0) - . I ZG="" D BLKERR Q ; -"RTN","C0XF2N",495,0) - . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer -"RTN","C0XF2N",496,0) - . I ZS="" D BLKERR Q ; -"RTN","C0XF2N",497,0) - . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer -"RTN","C0XF2N",498,0) - . I ZP="" D BLKERR Q ; -"RTN","C0XF2N",499,0) - . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer -"RTN","C0XF2N",500,0) - . I ZO="" D BLKERR Q ; -"RTN","C0XF2N",501,0) - . S ZIEN=ZI+ZBASE ; the new ien -"RTN","C0XF2N",502,0) - . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node -"RTN","C0XF2N",503,0) - . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index -"RTN","C0XF2N",504,0) - . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index -"RTN","C0XF2N",505,0) - . S ^C0X(101,"SPO",ZS,ZP,ZO)="" -"RTN","C0XF2N",506,0) - . S ^C0X(101,"SOP",ZS,ZO,ZP)="" -"RTN","C0XF2N",507,0) - . S ^C0X(101,"OPS",ZO,ZP,ZS)="" -"RTN","C0XF2N",508,0) - . S ^C0X(101,"OSP",ZO,ZS,ZP)="" -"RTN","C0XF2N",509,0) - . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" -"RTN","C0XF2N",510,0) - . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" -"RTN","C0XF2N",511,0) - . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" -"RTN","C0XF2N",512,0) - . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" -"RTN","C0XF2N",513,0) - Q -"RTN","C0XF2N",514,0) - ; -"RTN","C0XF2N",515,0) -BLKERR ; -"RTN","C0XF2N",516,0) - W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) -"RTN","C0XF2N",517,0) - B -"RTN","C0XF2N",518,0) - Q -"RTN","C0XF2N",519,0) - ; -"RTN","C0XF2N",520,0) -SWUPDIE(ZFDA) ; SWITCH BETWEEN UPDIE AND BULKLOAD -"RTN","C0XF2N",521,0) - . I $G(BLKLOAD) D ; bulk load -"RTN","C0XF2N",522,0) - . . D BULKLOAD(.ZFDA) ; bulk load the batch -"RTN","C0XF2N",523,0) - . E D ; no bulk load -"RTN","C0XF2N",524,0) - . . D UPDIE(.ZFDA) -"RTN","C0XF2N",525,0) - . K ZFDA -"RTN","C0XF2N",526,0) - Q -"RTN","C0XF2N",527,0) - ; -"RTN","C0XF2N",528,0) -UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS -"RTN","C0XF2N",529,0) - ; ZFDA IS PASSED BY REFERENCE -"RTN","C0XF2N",530,0) - ;ZWR ZFDA -"RTN","C0XF2N",531,0) - ;B -"RTN","C0XF2N",532,0) - K ZERR -"RTN","C0XF2N",533,0) - D CLEAN^DILF -"RTN","C0XF2N",534,0) - D UPDATE^DIE("","ZFDA","","ZERR") -"RTN","C0XF2N",535,0) - I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, -"RTN","C0XF2N",536,0) - ; INVOKE THE ERROR TRAP IF TASKED -"RTN","C0XF2N",537,0) - ;. W "ERROR",! -"RTN","C0XF2N",538,0) - ;. ZWR ZERR -"RTN","C0XF2N",539,0) - ;. B -"RTN","C0XF2N",540,0) - K ZFDA -"RTN","C0XF2N",541,0) - Q -"RTN","C0XF2N",542,0) - ; -"RTN","C0XINIT") -0^4^B20874536 -"RTN","C0XINIT",1,0) -C0XINIT ; GPL - Fileman Triples initialization routine ;10/13/11 17:05 -"RTN","C0XINIT",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 7 -"RTN","C0XINIT",3,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU -"RTN","C0XINIT",4,0) - ;General Public License See attached copy of the License. -"RTN","C0XINIT",5,0) - ; -"RTN","C0XINIT",6,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XINIT",7,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XINIT",8,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XINIT",9,0) - ;(at your option) any later version. -"RTN","C0XINIT",10,0) - ; -"RTN","C0XINIT",11,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XINIT",12,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XINIT",13,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XINIT",14,0) - ;GNU General Public License for more details. -"RTN","C0XINIT",15,0) - ; -"RTN","C0XINIT",16,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XINIT",17,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XINIT",18,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XINIT",19,0) - ; -"RTN","C0XINIT",20,0) - Q -"RTN","C0XINIT",21,0) - ; -"RTN","C0XINIT",22,0) -CLEAR ; DELETE THE FILESTORE -"RTN","C0XINIT",23,0) - K ^C0X -"RTN","C0XINIT",24,0) - S ^C0X(101,0)="C0X TRIPLE^172.101I^^" -"RTN","C0XINIT",25,0) - S ^C0X(201,0)="C0X STRING^172.201I^^" -"RTN","C0XINIT",26,0) - Q -"RTN","C0XINIT",27,0) - ; -"RTN","C0XINIT",28,0) -INIT ; INITIALIZE THE TRIPLE STORE - THIS DELETES THE GLOBALS AND -"RTN","C0XINIT",29,0) - ; START ALL OVER... USE WITH CAUTION -"RTN","C0XINIT",30,0) - ; -"RTN","C0XINIT",31,0) - ; -- we should be more sophisticated here.. at least warn the user -"RTN","C0XINIT",32,0) - ; -- and give them a chance to cancel -"RTN","C0XINIT",33,0) - ; -"RTN","C0XINIT",34,0) - D CLEAR ; DELETE THE TRIPLESTORE -"RTN","C0XINIT",35,0) - ; -"RTN","C0XINIT",36,0) - ; -- we are assuming that FARY is set up properly in C0XF2N -"RTN","C0XINIT",37,0) - ; -- with repect to the default directory and the defaut fileman files -"RTN","C0XINIT",38,0) - ; -- here's what it is now: "/home/glilly/fmts/trunk/samples/" -"RTN","C0XINIT",39,0) - ; -- that means that all the sample files will look like: -"RTN","C0XINIT",40,0) - ; --- qds/QDS_0001.rdf -"RTN","C0XINIT",41,0) - ; --- smart-rdf-in/small.rdf -"RTN","C0XINIT",42,0) - ; -"RTN","C0XINIT",43,0) - S FARY="C0XFARY" -"RTN","C0XINIT",44,0) - D INITFARY^C0XF2N(FARY) -"RTN","C0XINIT",45,0) - D USEFARY^C0XF2N(FARY) -"RTN","C0XINIT",46,0) - S C0XFARY("C0XDIR")="/home/glilly/fmts/trunk/samples/smart-rdf-in/" ; -"RTN","C0XINIT",47,0) - D USEFARY^C0XF2N(FARY) -"RTN","C0XINIT",48,0) - S SMART(1)="cole-susan.rdf" -"RTN","C0XINIT",49,0) - S SMART(2)="jones-cynthia.rdf" -"RTN","C0XINIT",50,0) - S SMART(3)="small.rdf" -"RTN","C0XINIT",51,0) - S SMART(4)="collins-frank.rdf" -"RTN","C0XINIT",52,0) - S SMART(5)="kelly-david.rdf" -"RTN","C0XINIT",53,0) - S SMART(6)="smith-maria.rdf" -"RTN","C0XINIT",54,0) - S SMART(7)="ford-shirley.rdf" -"RTN","C0XINIT",55,0) - S SMART(8)="morgan-jason.rdf" -"RTN","C0XINIT",56,0) - S SMART(9)="west-lisa.rdf" -"RTN","C0XINIT",57,0) - S SMART(10)="gracia-paul.rdf" -"RTN","C0XINIT",58,0) - S SMART(11)="reed-richard.rdf" -"RTN","C0XINIT",59,0) - S SMART(12)="west-sandra.rdf" -"RTN","C0XINIT",60,0) - S SMART(13)="jackson-jessica.rdf" -"RTN","C0XINIT",61,0) - S SMART(14)="small-allergies.rdf" -"RTN","C0XINIT",62,0) - S SMART(15)="white-patricia.rdf" -"RTN","C0XINIT",63,0) - N ZI S ZI="" -"RTN","C0XINIT",64,0) - F S ZI=$O(SMART(ZI)) Q:ZI="" D ; for each smart file -"RTN","C0XINIT",65,0) - . D IMPORT^C0XF2N(SMART(ZI),C0XDIR,,FARY) ; import to the triplestore -"RTN","C0XINIT",66,0) - S FARY="C0XFARY" -"RTN","C0XINIT",67,0) - S C0XFARY("C0XDIR")="/home/glilly/fmts/trunk/samples/qds/" -"RTN","C0XINIT",68,0) - D USEFARY^C0XF2N(FARY) -"RTN","C0XINIT",69,0) - D IMPORT^C0XF2N("QDS_0001.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",70,0) - D IMPORT^C0XF2N("QDS_0028b.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",71,0) - D IMPORT^C0XF2N("QDS_0052.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",72,0) - D IMPORT^C0XF2N("QDS_0073.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",73,0) - D IMPORT^C0XF2N("QDS_0385.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",74,0) - D IMPORT^C0XF2N("QDS_0002.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",75,0) - D IMPORT^C0XF2N("QDS_0031.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",76,0) - D IMPORT^C0XF2N("QDS_0055.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",77,0) - D IMPORT^C0XF2N("QDS_0074.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",78,0) - D IMPORT^C0XF2N("QDS_0387.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",79,0) - D IMPORT^C0XF2N("QDS_0004.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",80,0) - D IMPORT^C0XF2N("QDS_0032.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",81,0) - D IMPORT^C0XF2N("QDS_0056.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",82,0) - D IMPORT^C0XF2N("QDS_0075.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",83,0) - D IMPORT^C0XF2N("QDS_0389.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",84,0) - D IMPORT^C0XF2N("QDS_0012.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",85,0) - D IMPORT^C0XF2N("QDS_0033.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",86,0) - D IMPORT^C0XF2N("QDS_0059.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",87,0) - D IMPORT^C0XF2N("QDS_0081.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",88,0) - D IMPORT^C0XF2N("QDS_0421.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",89,0) - D IMPORT^C0XF2N("QDS_0013.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",90,0) - D IMPORT^C0XF2N("QDS_0034.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",91,0) - D IMPORT^C0XF2N("QDS_0061.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",92,0) - D IMPORT^C0XF2N("QDS_0083.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",93,0) - D IMPORT^C0XF2N("QDS_0575.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",94,0) - D IMPORT^C0XF2N("QDS_0014.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",95,0) - D IMPORT^C0XF2N("QDS_0036.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",96,0) - D IMPORT^C0XF2N("QDS_0062.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",97,0) - D IMPORT^C0XF2N("QDS_0084.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",98,0) - D IMPORT^C0XF2N("QDS_0018.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",99,0) - D IMPORT^C0XF2N("QDS_0038.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",100,0) - D IMPORT^C0XF2N("QDS_0064.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",101,0) - D IMPORT^C0XF2N("QDS_0086.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",102,0) - D IMPORT^C0XF2N("QDS_0024.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",103,0) - D IMPORT^C0XF2N("QDS_0041.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",104,0) - D IMPORT^C0XF2N("QDS_0067.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",105,0) - D IMPORT^C0XF2N("QDS_0088.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",106,0) - D IMPORT^C0XF2N("QDS_0027.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",107,0) - D IMPORT^C0XF2N("QDS_0043.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",108,0) - D IMPORT^C0XF2N("QDS_0068.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",109,0) - D IMPORT^C0XF2N("QDS_0089.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",110,0) - D IMPORT^C0XF2N("QDS_0028a.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",111,0) - D IMPORT^C0XF2N("QDS_0047.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",112,0) - D IMPORT^C0XF2N("QDS_0070.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",113,0) - D IMPORT^C0XF2N("QDS_0105.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",114,0) - ;D IMPORT^C0XF2N("qds.rdf",C0XDIR,,FARY) -"RTN","C0XINIT",115,0) - Q -"RTN","C0XINIT",116,0) - ; -"RTN","C0XMAIN") -0^1^B115393527 -"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 7 -"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) - S @ZFARY@("C0XDIR")="/home/george/fmts/trunk/samples/" -"RTN","C0XMAIN",31,0) - D USEFARY(ZFARY) -"RTN","C0XMAIN",32,0) - Q -"RTN","C0XMAIN",33,0) - ; -"RTN","C0XMAIN",34,0) -USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY -"RTN","C0XMAIN",35,0) - N ZI S ZI="" -"RTN","C0XMAIN",36,0) - F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D -"RTN","C0XMAIN",37,0) - . ;N ZX -"RTN","C0XMAIN",38,0) - . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_"""" -"RTN","C0XMAIN",39,0) - . ;W !,ZX -"RTN","C0XMAIN",40,0) - . X ZX -"RTN","C0XMAIN",41,0) - Q -"RTN","C0XMAIN",42,0) - ; -"RTN","C0XMAIN",43,0) -IMPORT(FNAME,FDIR,FURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD -"RTN","C0XMAIN",44,0) - ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE -"RTN","C0XMAIN",45,0) - ; NODE NAME OF THE TEXT TRIPLE -"RTN","C0XMAIN",46,0) - ; FDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR) -"RTN","C0XMAIN",47,0) - ; FURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE -"RTN","C0XMAIN",48,0) - ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE -"RTN","C0XMAIN",49,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",50,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",51,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",52,0) - D USEFARY(FARY) -"RTN","C0XMAIN",53,0) - N ZD,ZTMP -"RTN","C0XMAIN",54,0) - I '$D(FDIR) S FDIR=C0XDIR ; DIRECTORY OF THE RDF FILE -"RTN","C0XMAIN",55,0) - I '$D(FURL) D ; -"RTN","C0XMAIN",56,0) - . N ZN2 S ZN2=$TR(FNAME,".","_") ; REMOVE THE DOT FROM THE NAME -"RTN","C0XMAIN",57,0) - . S FURL=FDIR_ZN2 -"RTN","C0XMAIN",58,0) - N ZTMP -"RTN","C0XMAIN",59,0) - S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE -"RTN","C0XMAIN",60,0) - K @ZTMP ; MAKE SURE IT'S CLEAR -"RTN","C0XMAIN",61,0) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XMAIN",62,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XMAIN",63,0) - W !,"READING IN: ",FNAME -"RTN","C0XMAIN",64,0) - I '$$FILEIN(ZTMP,FDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS -"RTN","C0XMAIN",65,0) - . W !,"ERROR READING FILE: ",FDIR,FNAME -"RTN","C0XMAIN",66,0) - S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT -"RTN","C0XMAIN",67,0) - W !,$O(@ZRDF@(""),-1)," LINES READ" -"RTN","C0XMAIN",68,0) - D INSRDF(ZRDF,FURL,FARY) ; IMPORT AND PROCESS THE RDF -"RTN","C0XMAIN",69,0) - Q -"RTN","C0XMAIN",70,0) - ; -"RTN","C0XMAIN",71,0) -WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT -"RTN","C0XMAIN",72,0) - ; -"RTN","C0XMAIN",73,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",74,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",75,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",76,0) - D USEFARY(FARY) -"RTN","C0XMAIN",77,0) - ;N ZLOC,ZTMP -"RTN","C0XMAIN",78,0) - K ZTMP -"RTN","C0XMAIN",79,0) - S ZLOC=$NA(^TMP("C0X","WGET",$J)) -"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) - W !,$O(@ZLOC@(""),-1)," LINES READ" -"RTN","C0XMAIN",86,0) - D INSRDF(ZLOC,ZURL,FARY) -"RTN","C0XMAIN",87,0) - Q -"RTN","C0XMAIN",88,0) - ; -"RTN","C0XMAIN",89,0) -INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS -"RTN","C0XMAIN",90,0) - ; ZRDF IS PASSED BY NAME -"RTN","C0XMAIN",91,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",92,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",93,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",94,0) - D USEFARY(FARY) -"RTN","C0XMAIN",95,0) - N ZGRAPH,ZSUBJECT -"RTN","C0XMAIN",96,0) - S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME -"RTN","C0XMAIN",97,0) - S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT -"RTN","C0XMAIN",98,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY) -"RTN","C0XMAIN",99,0) - N ZTXTNM -"RTN","C0XMAIN",100,0) - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE -"RTN","C0XMAIN",101,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY) -"RTN","C0XMAIN",102,0) - D UPDIE(.C0XFDA) ; TRY IT OUT -"RTN","C0XMAIN",103,0) - K C0XCNT ;RESET FOR NEXT TIME -"RTN","C0XMAIN",104,0) - D STORETXT(ZRDF,ZTXTNM,FARY) -"RTN","C0XMAIN",105,0) - W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM -"RTN","C0XMAIN",106,0) - D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF -"RTN","C0XMAIN",107,0) - Q -"RTN","C0XMAIN",108,0) - ; -"RTN","C0XMAIN",109,0) -STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME -"RTN","C0XMAIN",110,0) - ; -"RTN","C0XMAIN",111,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",112,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",113,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",114,0) - D USEFARY(FARY) -"RTN","C0XMAIN",115,0) - N ZIEN -"RTN","C0XMAIN",116,0) - S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN -"RTN","C0XMAIN",117,0) - D CLEAN^DILF -"RTN","C0XMAIN",118,0) - K ZERR -"RTN","C0XMAIN",119,0) - D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") -"RTN","C0XMAIN",120,0) - I $D(ZERR) D ; -"RTN","C0XMAIN",121,0) - . ZWR ZERR -"RTN","C0XMAIN",122,0) - Q -"RTN","C0XMAIN",123,0) - ; -"RTN","C0XMAIN",124,0) -GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT -"RTN","C0XMAIN",125,0) - ; ZRTN IS PASSED BY REFERENCE -"RTN","C0XMAIN",126,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",127,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",128,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",129,0) - D USEFARY(FARY) -"RTN","C0XMAIN",130,0) - N ZIEN -"RTN","C0XMAIN",131,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XMAIN",132,0) - S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") -"RTN","C0XMAIN",133,0) - Q -"RTN","C0XMAIN",134,0) - ; -"RTN","C0XMAIN",135,0) -WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL -"RTN","C0XMAIN",136,0) - ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING -"RTN","C0XMAIN",137,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",138,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",139,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",140,0) - D USEFARY(FARY) -"RTN","C0XMAIN",141,0) - N ZIEN -"RTN","C0XMAIN",142,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XMAIN",143,0) - Q $NA(@C0XSN@(ZIEN,1)) -"RTN","C0XMAIN",144,0) - ; -"RTN","C0XMAIN",145,0) -FILEIN(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH -"RTN","C0XMAIN",146,0) - ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT -"RTN","C0XMAIN",147,0) - ; IE ^TMP("C0X","FILEIN",1) -"RTN","C0XMAIN",148,0) - ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 -"RTN","C0XMAIN",149,0) - ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH -"RTN","C0XMAIN",150,0) - S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) -"RTN","C0XMAIN",151,0) - Q OK -"RTN","C0XMAIN",152,0) - ; -"RTN","C0XMAIN",153,0) -TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE -"RTN","C0XMAIN",154,0) - S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) -"RTN","C0XMAIN",155,0) - S ZGRAPH="/test/rdfFile" -"RTN","C0XMAIN",156,0) - S ZM="/test/rdfFile/meta" -"RTN","C0XMAIN",157,0) - D PROCESS(.G,ZIN,ZGRAPH,ZM) -"RTN","C0XMAIN",158,0) - Q -"RTN","C0XMAIN",159,0) - ; -"RTN","C0XMAIN",160,0) -PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE -"RTN","C0XMAIN",161,0) - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING -"RTN","C0XMAIN",162,0) - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE -"RTN","C0XMAIN",163,0) - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS -"RTN","C0XMAIN",164,0) - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA -"RTN","C0XMAIN",165,0) - ; -"RTN","C0XMAIN",166,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",167,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",168,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",169,0) - D USEFARY(FARY) -"RTN","C0XMAIN",170,0) - ; -- first parse the rdf file with the MXML parser -"RTN","C0XMAIN",171,0) - ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML -"RTN","C0XMAIN",172,0) - S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W") -"RTN","C0XMAIN",173,0) - ; -- assign the MXLM dom global name to ZDOM -"RTN","C0XMAIN",174,0) - S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID)) -"RTN","C0XMAIN",175,0) - W !,$O(@ZDOM@(""),-1)," XML NODES PARSED" -"RTN","C0XMAIN",176,0) - ; -- populate the metagraph to point to the graph with status unfinished -"RTN","C0XMAIN",177,0) - S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT -"RTN","C0XMAIN",178,0) - I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH -"RTN","C0XMAIN",179,0) - D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH -"RTN","C0XMAIN",180,0) - D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished -"RTN","C0XMAIN",181,0) - ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT") -"RTN","C0XMAIN",182,0) - S C0XDATE=$$NOW^XLFDT -"RTN","C0XMAIN",183,0) - D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY) -"RTN","C0XMAIN",184,0) - D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store -"RTN","C0XMAIN",185,0) - ; -- -"RTN","C0XMAIN",186,0) - ; -- pull out the vocabularies in the RDF statement. marked with xmlns: -"RTN","C0XMAIN",187,0) - ; -- put them in a local variable for quick reference -"RTN","C0XMAIN",188,0) - ; -- TODO: create a graph for vocabularies and validate incoming against it -"RTN","C0XMAIN",189,0) - ; -"RTN","C0XMAIN",190,0) - S C0XVOC="" -"RTN","C0XMAIN",191,0) - N ZI,ZJ,ZK S ZI="" -"RTN","C0XMAIN",192,0) - F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns -"RTN","C0XMAIN",193,0) - . S ZVOC=$P(ZI,"xmlns:",2) -"RTN","C0XMAIN",194,0) - . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI)) -"RTN","C0XMAIN",195,0) - ;W !,"VOCABS:" ZWR C0XVOC -"RTN","C0XMAIN",196,0) - ; -"RTN","C0XMAIN",197,0) - ; -- look for children called rdf:Description. quit if none. not an rdf file -"RTN","C0XMAIN",198,0) - ; -"RTN","C0XMAIN",199,0) - S ZI=$O(@ZDOM@(1,"C","")) -"RTN","C0XMAIN",200,0) - I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file -"RTN","C0XMAIN",201,0) - . W !,"Error. Not an RDF file. Cannot process." -"RTN","C0XMAIN",202,0) - ; -"RTN","C0XMAIN",203,0) - ; -- now process the rdf description children -"RTN","C0XMAIN",204,0) - ; -"RTN","C0XMAIN",205,0) - S ZI="" -"RTN","C0XMAIN",206,0) - S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate -"RTN","C0XMAIN",207,0) - F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ; -"RTN","C0XMAIN",208,0) - . ; -- we are skipping any child that is not rdf:Description -"RTN","C0XMAIN",209,0) - . ; -- TODO: check to see if this is right in general -"RTN","C0XMAIN",210,0) - . ; -"RTN","C0XMAIN",211,0) - . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; -"RTN","C0XMAIN",212,0) - . . W !,"SKIPPING NODE: ",ZI -"RTN","C0XMAIN",213,0) - . ; -- now looking for the subject for the triples -"RTN","C0XMAIN",214,0) - . S ZX=$G(@ZDOM@(ZI,"A","rdf:about")) -"RTN","C0XMAIN",215,0) - . I ZX'="" D ; we have the subject -"RTN","C0XMAIN",216,0) - . . ;W " about: ",ZX -"RTN","C0XMAIN",217,0) - . . S C0XSUB=ZX -"RTN","C0XMAIN",218,0) - . E D ; -"RTN","C0XMAIN",219,0) - . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject -"RTN","C0XMAIN",220,0) - . . I ZX'="" D ; -"RTN","C0XMAIN",221,0) - . . . S C0XSUB=ZX -"RTN","C0XMAIN",222,0) - . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT -"RTN","C0XMAIN",223,0) - . ; -"RTN","C0XMAIN",224,0) - . ; -- we now have the subject. the children of this node have the rest -"RTN","C0XMAIN",225,0) - . ; -"RTN","C0XMAIN",226,0) - . S ZJ="" ; for the children of the rdf:Description nodes -"RTN","C0XMAIN",227,0) - . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child -"RTN","C0XMAIN",228,0) - . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix -"RTN","C0XMAIN",229,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space -"RTN","C0XMAIN",230,0) - . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix -"RTN","C0XMAIN",231,0) - . . I C0XPRE[":" D ; expand using vocabulary -"RTN","C0XMAIN",232,0) - . . . N ZB,ZA -"RTN","C0XMAIN",233,0) - . . . S ZB=$P(C0XPRE,":",1) -"RTN","C0XMAIN",234,0) - . . . S ZA=$P(C0XPRE,":",2) -"RTN","C0XMAIN",235,0) - . . . I $G(C0XVOC(ZB))'="" D ; -"RTN","C0XMAIN",236,0) - . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded -"RTN","C0XMAIN",237,0) - . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object -"RTN","C0XMAIN",238,0) - . . I ZY'="" D Q ; -"RTN","C0XMAIN",239,0) - . . . S C0XOBJ=ZY ; object -"RTN","C0XMAIN",240,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple -"RTN","C0XMAIN",241,0) - . . ; -- this is an else because of the quit above -"RTN","C0XMAIN",242,0) - . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object -"RTN","C0XMAIN",243,0) - . . I ZX'="" D Q ; got one -"RTN","C0XMAIN",244,0) - . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject -"RTN","C0XMAIN",245,0) - . . . ; without change... this could be foolish .. look at it again later -"RTN","C0XMAIN",246,0) - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XMAIN",247,0) - . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here -"RTN","C0XMAIN",248,0) - . . I C0XOBJ="" D Q ; not a happy situation -"RTN","C0XMAIN",249,0) - . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ -"RTN","C0XMAIN",250,0) - . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node -"RTN","C0XMAIN",251,0) - W !,"INSERTING ",C0XCNT," TRIPLES" -"RTN","C0XMAIN",252,0) - D UPDIE(.C0XFDA) ; commit the updates to the file -"RTN","C0XMAIN",253,0) - ; next, mark the graph as finished -"RTN","C0XMAIN",254,0) - S C0XEND=$$NOW^XLFDT -"RTN","C0XMAIN",255,0) - W !," ENDED AT: ",C0XEND -"RTN","C0XMAIN",256,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2) -"RTN","C0XMAIN",257,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XMAIN",258,0) - W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" -"RTN","C0XMAIN",259,0) - Q -"RTN","C0XMAIN",260,0) - ; -"RTN","C0XMAIN",261,0) -SHOW(ZN) ; -"RTN","C0XMAIN",262,0) - ZWR ^TMP("MXMLDOM",$J,1,ZN,*) -"RTN","C0XMAIN",263,0) - Q -"RTN","C0XMAIN",264,0) - ; -"RTN","C0XMAIN",265,0) -ANONS() ; RETURNS AN ANONOMOUS SUBJECT -"RTN","C0XMAIN",266,0) - Q "_S:"_$$LKY9 -"RTN","C0XMAIN",267,0) - ; -"RTN","C0XMAIN",268,0) -NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED -"RTN","C0XMAIN",269,0) - ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT -"RTN","C0XMAIN",270,0) - ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN -"RTN","C0XMAIN",271,0) - S NGRAPH="G"_$$LKY9 -"RTN","C0XMAIN",272,0) - S NMETA=NGRAPH_"A" -"RTN","C0XMAIN",273,0) - Q -"RTN","C0XMAIN",274,0) - ; -"RTN","C0XMAIN",275,0) -ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT -"RTN","C0XMAIN",276,0) - ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE -"RTN","C0XMAIN",277,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",278,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",279,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",280,0) - D USEFARY(FARY) -"RTN","C0XMAIN",281,0) - I '$D(C0XCNT) S C0XCNT=0 -"RTN","C0XMAIN",282,0) - N ZNODE -"RTN","C0XMAIN",283,0) - S ZNODE="N"_$$LKY17 -"RTN","C0XMAIN",284,0) - N ZNARY ; GET READY TO CALL IENOFA -"RTN","C0XMAIN",285,0) - S ZNARY("ZG",ZG)="" -"RTN","C0XMAIN",286,0) - S ZNARY("ZS",ZS)="" -"RTN","C0XMAIN",287,0) - S ZNARY("ZP",ZP)="" -"RTN","C0XMAIN",288,0) - S ZNARY("ZO",ZO)="" -"RTN","C0XMAIN",289,0) - D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS -"RTN","C0XMAIN",290,0) - ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN -"RTN","C0XMAIN",291,0) - ;S ZSIEN=$$IENOF(ZS) -"RTN","C0XMAIN",292,0) - ;S ZPIEN=$$IENOF(ZP) -"RTN","C0XMAIN",293,0) - ;S ZOIEN=$$IENOF(ZO) -"RTN","C0XMAIN",294,0) - ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED -"RTN","C0XMAIN",295,0) - S C0XCNT=C0XCNT+1 -"RTN","C0XMAIN",296,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE -"RTN","C0XMAIN",297,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG","")) -"RTN","C0XMAIN",298,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS","")) -"RTN","C0XMAIN",299,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP","")) -"RTN","C0XMAIN",300,0) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO","")) -"RTN","C0XMAIN",301,0) - ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE -"RTN","C0XMAIN",302,0) - Q -"RTN","C0XMAIN",303,0) - ; -"RTN","C0XMAIN",304,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",305,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",306,0) - N ZN,ZI -"RTN","C0XMAIN",307,0) - S ZN="" -"RTN","C0XMAIN",308,0) - F ZI=1:1:9 D ; -"RTN","C0XMAIN",309,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",310,0) - Q ZN -"RTN","C0XMAIN",311,0) - ; -"RTN","C0XMAIN",312,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XMAIN",313,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XMAIN",314,0) - N ZN,ZI -"RTN","C0XMAIN",315,0) - S ZN="" -"RTN","C0XMAIN",316,0) - F ZI=1:1:17 D ; -"RTN","C0XMAIN",317,0) - . S ZN=ZN_$R(10) -"RTN","C0XMAIN",318,0) - Q ZN -"RTN","C0XMAIN",319,0) - ; -"RTN","C0XMAIN",320,0) -IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE -"RTN","C0XMAIN",321,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",322,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",323,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",324,0) - N ZIEN -"RTN","C0XMAIN",325,0) - S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",326,0) - I ZIEN="" D ; -"RTN","C0XMAIN",327,0) - . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING -"RTN","C0XMAIN",328,0) - . D UPDIE(.C0XFDA2) -"RTN","C0XMAIN",329,0) - . S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) -"RTN","C0XMAIN",330,0) - . K C0XFDA2 -"RTN","C0XMAIN",331,0) - Q ZIEN -"RTN","C0XMAIN",332,0) - ; -"RTN","C0XMAIN",333,0) -IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE -"RTN","C0XMAIN",334,0) - ; OR ADD THEM IF -"RTN","C0XMAIN",335,0) - ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE -"RTN","C0XMAIN",336,0) - ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")="" -"RTN","C0XMAIN",337,0) - ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" -"RTN","C0XMAIN",338,0) - I '$D(FARY) D ; -"RTN","C0XMAIN",339,0) - . D INITFARY("C0XFARY") -"RTN","C0XMAIN",340,0) - . S FARY="C0XFARY" -"RTN","C0XMAIN",341,0) - K ZOUTARY ; START WITH CLEAN RESULTS -"RTN","C0XMAIN",342,0) - K C0XFDA2 ; USE A SEPARATE FDA FOR THIS -"RTN","C0XMAIN",343,0) - N ZI S ZI="" -"RTN","C0XMAIN",344,0) - N ZV,ZIEN -"RTN","C0XMAIN",345,0) - N ZCNT S ZCNT=0 -"RTN","C0XMAIN",346,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS -"RTN","C0XMAIN",347,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XMAIN",348,0) - . I $O(@C0XSN@("B",ZV,""))="" D ; -"RTN","C0XMAIN",349,0) - . . S ZCNT=ZCNT+1 -"RTN","C0XMAIN",350,0) - . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV -"RTN","C0XMAIN",351,0) - I $D(C0XFDA2) D ; -"RTN","C0XMAIN",352,0) - . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS -"RTN","C0XMAIN",353,0) - . K C0XFDA2 ; CLEAN UP -"RTN","C0XMAIN",354,0) - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS -"RTN","C0XMAIN",355,0) - . S ZV=$O(ZINARY(ZI,"")) -"RTN","C0XMAIN",356,0) - . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW -"RTN","C0XMAIN",357,0) - . I ZIEN="" D ; -"RTN","C0XMAIN",358,0) - . . W !,"ERROR ADDING STRING: ",ZV -"RTN","C0XMAIN",359,0) - . . B -"RTN","C0XMAIN",360,0) - . S ZOUTARY("IEN",ZI,ZIEN)="" -"RTN","C0XMAIN",361,0) - Q -"RTN","C0XMAIN",362,0) - ; -"RTN","C0XMAIN",363,0) -UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS -"RTN","C0XMAIN",364,0) - ; ZFDA IS PASSED BY REFERENCE -"RTN","C0XMAIN",365,0) - ;ZWR ZFDA -"RTN","C0XMAIN",366,0) - ;B -"RTN","C0XMAIN",367,0) - K ZERR -"RTN","C0XMAIN",368,0) - D CLEAN^DILF -"RTN","C0XMAIN",369,0) - D UPDATE^DIE("","ZFDA","","ZERR") -"RTN","C0XMAIN",370,0) - I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, -"RTN","C0XMAIN",371,0) - ; INVOKE THE ERROR TRAP IF TASKED -"RTN","C0XMAIN",372,0) - ;. W "ERROR",! -"RTN","C0XMAIN",373,0) - ;. ZWR ZERR -"RTN","C0XMAIN",374,0) - ;. B -"RTN","C0XMAIN",375,0) - K ZFDA -"RTN","C0XMAIN",376,0) - Q -"RTN","C0XMAIN",377,0) - ; -"RTN","C0XTEST") -0^3^B14490662 -"RTN","C0XTEST",1,0) -C0XTEST ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05 -"RTN","C0XTEST",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 7 -"RTN","C0XTEST",3,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU -"RTN","C0XTEST",4,0) - ;General Public License See attached copy of the License. -"RTN","C0XTEST",5,0) - ; -"RTN","C0XTEST",6,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XTEST",7,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XTEST",8,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XTEST",9,0) - ;(at your option) any later version. -"RTN","C0XTEST",10,0) - ; -"RTN","C0XTEST",11,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XTEST",12,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XTEST",13,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XTEST",14,0) - ;GNU General Public License for more details. -"RTN","C0XTEST",15,0) - ; -"RTN","C0XTEST",16,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XTEST",17,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XTEST",18,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XTEST",19,0) - ; -"RTN","C0XTEST",20,0) - Q -"RTN","C0XTEST",21,0) - ; -"RTN","C0XTEST",22,0) -EN ; run the test -"RTN","C0XTEST",23,0) - ; -"RTN","C0XTEST",24,0) - k C0XFDA ; clear the node variable -"RTN","C0XTEST",25,0) - i '$d(^C0X(101,0)) d ; global doesn't exist -"RTN","C0XTEST",26,0) - . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1" -"RTN","C0XTEST",27,0) - n zg -"RTN","C0XTEST",28,0) - S zg="_:G"_$$LKY9 ; all nodes are in the same graph -"RTN","C0XTEST",29,0) - n zi -"RTN","C0XTEST",30,0) - f zi=1:1:100000 d ; try a test of 10000 nodes -"RTN","C0XTEST",31,0) - . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name -"RTN","C0XTEST",32,0) - . s C0XFDA(172.101,zi,.02)=zg -"RTN","C0XTEST",33,0) - . s C0XFDA(172.101,zi,.03)=$R(100000) -"RTN","C0XTEST",34,0) - . s C0XFDA(172.101,zi,.04)=$R(100000) -"RTN","C0XTEST",35,0) - . s C0XFDA(172.101,zi,.05)=$R(100000) -"RTN","C0XTEST",36,0) - S C0XST=$$NOW^XLFDT ; start of the insertion test -"RTN","C0XTEST",37,0) - W !,"INSERTION STARTS AT ",C0XST,! -"RTN","C0XTEST",38,0) - d BULKLOAD(.C0XFDA) -"RTN","C0XTEST",39,0) - s C0XEND=$$NOW^XLFDT ; end of the insertion test -"RTN","C0XTEST",40,0) - W !,"INSERTION ENDS AT ",C0XEND -"RTN","C0XTEST",41,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XST,2) -"RTN","C0XTEST",42,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XTEST",43,0) - I C0XDIFF>0 W !," APPROXIMATELY ",$P(100000/C0XDIFF,".")," NODES PER SECOND" -"RTN","C0XTEST",44,0) - q -"RTN","C0XTEST",45,0) - ; -"RTN","C0XTEST",46,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTEST",47,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTEST",48,0) - N ZN,ZI -"RTN","C0XTEST",49,0) - S ZN="" -"RTN","C0XTEST",50,0) - F ZI=1:1:9 D ; -"RTN","C0XTEST",51,0) - . S ZN=ZN_$R(10) -"RTN","C0XTEST",52,0) - Q ZN -"RTN","C0XTEST",53,0) - ; -"RTN","C0XTEST",54,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTEST",55,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTEST",56,0) - N ZN,ZI -"RTN","C0XTEST",57,0) - S ZN="" -"RTN","C0XTEST",58,0) - F ZI=1:1:17 D ; -"RTN","C0XTEST",59,0) - . S ZN=ZN_$R(10) -"RTN","C0XTEST",60,0) - Q ZN -"RTN","C0XTEST",61,0) - ; -"RTN","C0XTEST",62,0) -BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 -"RTN","C0XTEST",63,0) - ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE -"RTN","C0XTEST",64,0) - ; QUITS IF FILE IS NOT 172.101 -"RTN","C0XTEST",65,0) - ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 -"RTN","C0XTEST",66,0) - ; QUITS IF FIRST ENTRY IS NOT IENS 1 -"RTN","C0XTEST",67,0) - ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES -"RTN","C0XTEST",68,0) - ; ZBFDA IS PASSED BY REFERENCE -"RTN","C0XTEST",69,0) - ; -"RTN","C0XTEST",70,0) - ; -- reserves a block of iens from file 172.101 by locking the zero node -"RTN","C0XTEST",71,0) - ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 -"RTN","C0XTEST",72,0) - ; -- then unlocking to minimize the duration of the lock -"RTN","C0XTEST",73,0) - ; -"RTN","C0XTEST",74,0) - W !,"USING BULKLOAD" -"RTN","C0XTEST",75,0) - I '$D(ZBFDA) Q ; EMPTY FDA -"RTN","C0XTEST",76,0) - I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE -"RTN","C0XTEST",77,0) - N ZCNT,ZP3,ZP4 -"RTN","C0XTEST",78,0) - ; -- find the number of nodes to insert -"RTN","C0XTEST",79,0) - S ZCNT=$O(ZBFDA(172.101,""),-1) -"RTN","C0XTEST",80,0) - I ZCNT="" D Q ; -"RTN","C0XTEST",81,0) - . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" -"RTN","C0XTEST",82,0) - . B -"RTN","C0XTEST",83,0) - ; -- lock the zero node and reserve a block of iens to insert -"RTN","C0XTEST",84,0) - W !,"LOCKING ZERO NODE" -"RTN","C0XTEST",85,0) - LOCK +^C0X(101,0) -"RTN","C0XTEST",86,0) - S ZP3=$P(^C0X(101,0),U,3) -"RTN","C0XTEST",87,0) - S ZP4=$P(^C0X(101,0),U,4) -"RTN","C0XTEST",88,0) - S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 -"RTN","C0XTEST",89,0) - S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 -"RTN","C0XTEST",90,0) - LOCK -^C0X(101,0) -"RTN","C0XTEST",91,0) - N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE -"RTN","C0XTEST",92,0) - S ZBASE=ZP3 ; the last ien in the file -"RTN","C0XTEST",93,0) - W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT -"RTN","C0XTEST",94,0) - W !,$$NOW^XLFDT -"RTN","C0XTEST",95,0) - S ZI="" -"RTN","C0XTEST",96,0) - F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; -"RTN","C0XTEST",97,0) - . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name -"RTN","C0XTEST",98,0) - . I ZN="" D BLKERR Q ; -"RTN","C0XTEST",99,0) - . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer -"RTN","C0XTEST",100,0) - . I ZG="" D BLKERR Q ; -"RTN","C0XTEST",101,0) - . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer -"RTN","C0XTEST",102,0) - . I ZS="" D BLKERR Q ; -"RTN","C0XTEST",103,0) - . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer -"RTN","C0XTEST",104,0) - . I ZP="" D BLKERR Q ; -"RTN","C0XTEST",105,0) - . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer -"RTN","C0XTEST",106,0) - . I ZO="" D BLKERR Q ; -"RTN","C0XTEST",107,0) - . S ZIEN=ZI+ZBASE ; the new ien -"RTN","C0XTEST",108,0) - . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node -"RTN","C0XTEST",109,0) - . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index -"RTN","C0XTEST",110,0) - . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index -"RTN","C0XTEST",111,0) - . S ^C0X(101,"SPO",ZS,ZP,ZO)="" -"RTN","C0XTEST",112,0) - . S ^C0X(101,"SOP",ZS,ZO,ZP)="" -"RTN","C0XTEST",113,0) - . S ^C0X(101,"OPS",ZO,ZP,ZS)="" -"RTN","C0XTEST",114,0) - . S ^C0X(101,"OSP",ZO,ZS,ZP)="" -"RTN","C0XTEST",115,0) - . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" -"RTN","C0XTEST",116,0) - . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" -"RTN","C0XTEST",117,0) - . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" -"RTN","C0XTEST",118,0) - . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" -"RTN","C0XTEST",119,0) - Q -"RTN","C0XTEST",120,0) - ; -"RTN","C0XTEST",121,0) -BLKERR ; -"RTN","C0XTEST",122,0) - W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) -"RTN","C0XTEST",123,0) - B -"RTN","C0XTEST",124,0) - Q -"RTN","C0XTEST",125,0) - ; -"RTN","C0XTKSB") -0^6^B15924104 -"RTN","C0XTKSB",1,0) -C0XTESTKSB ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05 -"RTN","C0XTKSB",2,0) - ; KSB - modified to fix a minor bug and to use;;;;;Build 7 -"RTN","C0XTKSB",3,0) - ; high resolution time if routines available ; 11/19/11 1410 EST -"RTN","C0XTKSB",4,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 1 -"RTN","C0XTKSB",5,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU -"RTN","C0XTKSB",6,0) - ;General Public License See attached copy of the License. -"RTN","C0XTKSB",7,0) - ; -"RTN","C0XTKSB",8,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XTKSB",9,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XTKSB",10,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XTKSB",11,0) - ;(at your option) any later version. -"RTN","C0XTKSB",12,0) - ; -"RTN","C0XTKSB",13,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XTKSB",14,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XTKSB",15,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XTKSB",16,0) - ;GNU General Public License for more details. -"RTN","C0XTKSB",17,0) - ; -"RTN","C0XTKSB",18,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XTKSB",19,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XTKSB",20,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XTKSB",21,0) - ; -"RTN","C0XTKSB",22,0) - Q -"RTN","C0XTKSB",23,0) - ; -"RTN","C0XTKSB",24,0) -EN ; run the test -"RTN","C0XTKSB",25,0) - ; -"RTN","C0XTKSB",26,0) - k C0XFDA ; clear the node variable -"RTN","C0XTKSB",27,0) - s U="^" ; initialization - Bhaskar 20111119 -"RTN","C0XTKSB",28,0) - i '$d(^C0X(101,0)) d ; global doesn't exist -"RTN","C0XTKSB",29,0) - . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1" -"RTN","C0XTKSB",30,0) - n zg -"RTN","C0XTKSB",31,0) - S zg="_:G"_$$LKY9 ; all nodes are in the same graph -"RTN","C0XTKSB",32,0) - n zi -"RTN","C0XTKSB",33,0) - f zi=1:1:10000 d ; try a test of 10000 nodes -"RTN","C0XTKSB",34,0) - . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name -"RTN","C0XTKSB",35,0) - . s C0XFDA(172.101,zi,.02)=zg -"RTN","C0XTKSB",36,0) - . s C0XFDA(172.101,zi,.03)=$R(100000) -"RTN","C0XTKSB",37,0) - . s C0XFDA(172.101,zi,.04)=$R(100000) -"RTN","C0XTKSB",38,0) - . s C0XFDA(172.101,zi,.05)=$R(100000) -"RTN","C0XTKSB",39,0) - S C0XST=$$H ; start of the insertion test -"RTN","C0XTKSB",40,0) - W !,"INSERTION STARTS AT ",$ZDATE(C0XST,"YEAR-MM-DD:24:60:SS"),! -"RTN","C0XTKSB",41,0) - d BULKLOAD(.C0XFDA) -"RTN","C0XTKSB",42,0) - s C0XEND=$$H ; end of the insertion test -"RTN","C0XTKSB",43,0) - W !,"INSERTION ENDS AT ",$ZDATE(C0XEND,"YEAR-MM-DD:24:60:SS") -"RTN","C0XTKSB",44,0) - S C0XDIFF=(86400*($P(C0XEND,",",1)-$P(C0XST,",",1)))+$P(C0XEND,",",2)-$P(C0XST,",",2) -"RTN","C0XTKSB",45,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XTKSB",46,0) - W ! -"RTN","C0XTKSB",47,0) - W:C0XDIFF>0 " APPROXIMATELY ",$FN(10000/C0XDIFF,",",0)," NODES PER SECOND",! -"RTN","C0XTKSB",48,0) - q -"RTN","C0XTKSB",49,0) - ; -"RTN","C0XTKSB",50,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTKSB",51,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTKSB",52,0) - N ZN,ZI -"RTN","C0XTKSB",53,0) - S ZN="" -"RTN","C0XTKSB",54,0) - F ZI=1:1:9 D ; -"RTN","C0XTKSB",55,0) - . S ZN=ZN_$R(10) -"RTN","C0XTKSB",56,0) - Q ZN -"RTN","C0XTKSB",57,0) - ; -"RTN","C0XTKSB",58,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTKSB",59,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTKSB",60,0) - N ZN,ZI -"RTN","C0XTKSB",61,0) - S ZN="" -"RTN","C0XTKSB",62,0) - F ZI=1:1:17 D ; -"RTN","C0XTKSB",63,0) - . S ZN=ZN_$R(10) -"RTN","C0XTKSB",64,0) - Q ZN -"RTN","C0XTKSB",65,0) - ; -"RTN","C0XTKSB",66,0) -BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 -"RTN","C0XTKSB",67,0) - ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE -"RTN","C0XTKSB",68,0) - ; QUITS IF FILE IS NOT 172.101 -"RTN","C0XTKSB",69,0) - ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 -"RTN","C0XTKSB",70,0) - ; QUITS IF FIRST ENTRY IS NOT IENS 1 -"RTN","C0XTKSB",71,0) - ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES -"RTN","C0XTKSB",72,0) - ; ZBFDA IS PASSED BY REFERENCE -"RTN","C0XTKSB",73,0) - ; -"RTN","C0XTKSB",74,0) - ; -- reserves a block of iens from file 172.101 by locking the zero node -"RTN","C0XTKSB",75,0) - ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 -"RTN","C0XTKSB",76,0) - ; -- then unlocking to minimize the duration of the lock -"RTN","C0XTKSB",77,0) - ; -"RTN","C0XTKSB",78,0) - W !,"USING BULKLOAD" -"RTN","C0XTKSB",79,0) - I '$D(ZBFDA) Q ; EMPTY FDA -"RTN","C0XTKSB",80,0) - I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE -"RTN","C0XTKSB",81,0) - N ZCNT,ZP3,ZP4 -"RTN","C0XTKSB",82,0) - ; -- find the number of nodes to insert -"RTN","C0XTKSB",83,0) - S ZCNT=$O(ZBFDA(172.101,""),-1) -"RTN","C0XTKSB",84,0) - I ZCNT="" D Q ; -"RTN","C0XTKSB",85,0) - . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" -"RTN","C0XTKSB",86,0) - . B -"RTN","C0XTKSB",87,0) - ; -- lock the zero node and reserve a block of iens to insert -"RTN","C0XTKSB",88,0) - W !,"LOCKING ZERO NODE" -"RTN","C0XTKSB",89,0) - LOCK +^C0X(101,0) -"RTN","C0XTKSB",90,0) - S ZP3=$P(^C0X(101,0),U,3) -"RTN","C0XTKSB",91,0) - S ZP4=$P(^C0X(101,0),U,4) -"RTN","C0XTKSB",92,0) - S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 -"RTN","C0XTKSB",93,0) - S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 -"RTN","C0XTKSB",94,0) - LOCK -^C0X(101,0) -"RTN","C0XTKSB",95,0) - N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE -"RTN","C0XTKSB",96,0) - S ZBASE=ZP3 ; the last ien in the file -"RTN","C0XTKSB",97,0) - W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT -"RTN","C0XTKSB",98,0) - W !,$ZDATE($$H,"YEAR-MM-DD:24:60:SS") -"RTN","C0XTKSB",99,0) - S ZI="" -"RTN","C0XTKSB",100,0) - F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; -"RTN","C0XTKSB",101,0) - . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name -"RTN","C0XTKSB",102,0) - . I ZN="" D BLKERR Q ; -"RTN","C0XTKSB",103,0) - . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer -"RTN","C0XTKSB",104,0) - . I ZG="" D BLKERR Q ; -"RTN","C0XTKSB",105,0) - . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer -"RTN","C0XTKSB",106,0) - . I ZS="" D BLKERR Q ; -"RTN","C0XTKSB",107,0) - . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer -"RTN","C0XTKSB",108,0) - . I ZP="" D BLKERR Q ; -"RTN","C0XTKSB",109,0) - . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer -"RTN","C0XTKSB",110,0) - . I ZO="" D BLKERR Q ; -"RTN","C0XTKSB",111,0) - . S ZIEN=ZI+ZBASE ; the new ien -"RTN","C0XTKSB",112,0) - . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node -"RTN","C0XTKSB",113,0) - . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index -"RTN","C0XTKSB",114,0) - . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index -"RTN","C0XTKSB",115,0) - . S ^C0X(101,"SPO",ZS,ZP,ZO)="" -"RTN","C0XTKSB",116,0) - . S ^C0X(101,"SOP",ZS,ZO,ZP)="" -"RTN","C0XTKSB",117,0) - . S ^C0X(101,"OPS",ZO,ZP,ZS)="" -"RTN","C0XTKSB",118,0) - . S ^C0X(101,"OSP",ZO,ZS,ZP)="" -"RTN","C0XTKSB",119,0) - . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" -"RTN","C0XTKSB",120,0) - . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" -"RTN","C0XTKSB",121,0) - . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" -"RTN","C0XTKSB",122,0) - . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" -"RTN","C0XTKSB",123,0) - Q -"RTN","C0XTKSB",124,0) - ; -"RTN","C0XTKSB",125,0) -BLKERR ; -"RTN","C0XTKSB",126,0) - W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) -"RTN","C0XTKSB",127,0) - B -"RTN","C0XTKSB",128,0) - Q -"RTN","C0XTKSB",129,0) - ; -"RTN","C0XTKSB",130,0) -H() -"RTN","C0XTKSB",131,0) - quit:$length($ztrnlnm("GTMXC_posix"))&$length($text(zhorolog^%POSIX)) $$zhorolog^%POSIX quit $horolog -"RTN","C0XUTIL") -0^5^B4546956 -"RTN","C0XUTIL",1,0) -C0XUTIL ; GPL - Fileman Triples utilities ;11/07/11 17:05 -"RTN","C0XUTIL",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 7 -"RTN","C0XUTIL",3,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU -"RTN","C0XUTIL",4,0) - ;General Public License See attached copy of the License. -"RTN","C0XUTIL",5,0) - ; -"RTN","C0XUTIL",6,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XUTIL",7,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XUTIL",8,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XUTIL",9,0) - ;(at your option) any later version. -"RTN","C0XUTIL",10,0) - ; -"RTN","C0XUTIL",11,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XUTIL",12,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XUTIL",13,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XUTIL",14,0) - ;GNU General Public License for more details. -"RTN","C0XUTIL",15,0) - ; -"RTN","C0XUTIL",16,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XUTIL",17,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XUTIL",18,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XUTIL",19,0) - ; -"RTN","C0XUTIL",20,0) - Q -"RTN","C0XUTIL",21,0) - ; -"RTN","C0XUTIL",22,0) -NSP(ZX) ; OUTPUT TRANSFORM EXTRINSIC -"RTN","C0XUTIL",23,0) - ; -"RTN","C0XUTIL",24,0) - N ZR -"RTN","C0XUTIL",25,0) - ; I WOULD REALLY LIKE TO NOT HAVE THE FILE NUMBER HARD CODED HERE -"RTN","C0XUTIL",26,0) - ; ANYONE KNOW HOW I COULD DO THAT? :) GPL -"RTN","C0XUTIL",27,0) - S ZR=$$GET1^DIQ(172.201,ZX_",",.01) -"RTN","C0XUTIL",28,0) - I '$D(C0XNSP) S C0XNSP=1 ; DEFAULT ON -"RTN","C0XUTIL",29,0) - I C0XNSP=0 Q ZR ; SWITCHED OFF -"RTN","C0XUTIL",30,0) - I '$D(C0XVOC) D VOCINIT ; INITIALIZE THE VOCABULARIES -"RTN","C0XUTIL",31,0) - N ZI,ZJ,ZK S ZI="" -"RTN","C0XUTIL",32,0) - N DONE S DONE=0 -"RTN","C0XUTIL",33,0) - F S ZI=$O(C0XVOC(ZI)) Q:(DONE=1)!(ZI="") D ; -"RTN","C0XUTIL",34,0) - . ;W !,ZI -"RTN","C0XUTIL",35,0) - . S ZJ=C0XVOC(ZI) -"RTN","C0XUTIL",36,0) - . S ZK=$P(ZR,ZJ,2) -"RTN","C0XUTIL",37,0) - . ;W !,"ZK=",ZK -"RTN","C0XUTIL",38,0) - . I ZK'="" D ; BINGO -"RTN","C0XUTIL",39,0) - . . S ZR=ZI_":"_ZK -"RTN","C0XUTIL",40,0) - . . S DONE=1 -"RTN","C0XUTIL",41,0) - Q ZR -"RTN","C0XUTIL",42,0) - ; -"RTN","C0XUTIL",43,0) -VOCINIT ; INITIALIZE VOCABULARIES -"RTN","C0XUTIL",44,0) - S C0XVOC("dcterms")="http://purl.org/dc/terms/" -"RTN","C0XUTIL",45,0) - S C0XVOC("rdf")="http://www.w3.org/1999/02/22-rdf-syntax-ns#" -"RTN","C0XUTIL",46,0) - S C0XVOC("sp")="http://smartplatforms.org/terms#" -"RTN","C0XUTIL",47,0) - S C0XVOC("qds")="http://cms.gov/pqri/qds/" -"RTN","C0XUTIL",48,0) - S C0XVOC("smart")="http://sandbox-api.smartplatforms.org/records/" -"RTN","C0XUTIL",49,0) - S C0XVOC("snomed")="http://www.ihtsdo.org/snomed-ct/concepts/" -"RTN","C0XUTIL",50,0) - S C0XVOC("rxnorm")="http://rxnav.nlm.nih.gov/REST/rxcui/" -"RTN","C0XUTIL",51,0) - S C0XVOC("loinc")="http://loinc.org/codes/" -"RTN","C0XUTIL",52,0) - S C0XVOC("file")="/home/glilly/fmts/trunk/samples/" -"RTN","C0XUTIL",53,0) - S C0XVOC("foaf")="http://xmlns.com/foaf/0.1/" -"RTN","C0XUTIL",54,0) - Q -"RTN","C0XUTIL",55,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.201O^C0X(201,^0;2^Q -"^DD",172.101,172.101,.02,.1) -TRIPLE GRAPH -"^DD",172.101,172.101,.02,2) -S Y(0)=Y S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.02,2.1) -S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.02,3) -Answer must be 3-240 characters in length -"^DD",172.101,172.101,.02,"DT") -3111207 -"^DD",172.101,172.101,.03,0) -SUBJECT^P172.201O^C0X(201,^0;3^Q -"^DD",172.101,172.101,.03,.1) -TRIPLE SUBJECT -"^DD",172.101,172.101,.03,2) -S Y(0)=Y S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.03,2.1) -S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.03,"DT") -3111207 -"^DD",172.101,172.101,.04,0) -PREDICATE^P172.201O^C0X(201,^0;4^Q -"^DD",172.101,172.101,.04,.1) -TRIPLE PREDICATE -"^DD",172.101,172.101,.04,2) -S Y(0)=Y S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.04,2.1) -S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.04,"DT") -3111207 -"^DD",172.101,172.101,.05,0) -OBJECT^P172.201O^C0X(201,^0;5^Q -"^DD",172.101,172.101,.05,.1) -TRIPLE OBJECT -"^DD",172.101,172.101,.05,2) -S Y(0)=Y S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.05,2.1) -S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.05,"DT") -3111207 -"^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** diff --git a/kids/C0X_1_0_0_T9.KID b/kids/C0X_1_0_0_T9.KID deleted file mode 100644 index a601bc3..0000000 --- a/kids/C0X_1_0_0_T9.KID +++ /dev/null @@ -1,3936 +0,0 @@ -KIDS Distribution saved on Sep 07, 2012@18:24:21 -smart container support -**KIDS**:C0X*1.0*0^ - -**INSTALL NAME** -C0X*1.0*0 -"BLD",7921,0) -C0X*1.0*0^^0^3120907^n -"BLD",7921,4,0) -^9.64PA^172.201^2 -"BLD",7921,4,172.101,0) -172.101 -"BLD",7921,4,172.101,222) -y^y^f^^^^n -"BLD",7921,4,172.201,0) -172.201 -"BLD",7921,4,172.201,222) -y^y^f^^^^n -"BLD",7921,4,"B",172.101,172.101) - -"BLD",7921,4,"B",172.201,172.201) - -"BLD",7921,6.3) -8 -"BLD",7921,"KRN",0) -^9.67PA^779.2^20 -"BLD",7921,"KRN",.4,0) -.4 -"BLD",7921,"KRN",.4,"NM",0) -^9.68A^1^1 -"BLD",7921,"KRN",.4,"NM",1,0) -C0X PRINT GRAPH FILE #172.101^172.101^0 -"BLD",7921,"KRN",.4,"NM","B","C0X PRINT GRAPH FILE #172.101",1) - -"BLD",7921,"KRN",.401,0) -.401 -"BLD",7921,"KRN",.402,0) -.402 -"BLD",7921,"KRN",.403,0) -.403 -"BLD",7921,"KRN",.5,0) -.5 -"BLD",7921,"KRN",.84,0) -.84 -"BLD",7921,"KRN",3.6,0) -3.6 -"BLD",7921,"KRN",3.8,0) -3.8 -"BLD",7921,"KRN",9.2,0) -9.2 -"BLD",7921,"KRN",9.8,0) -9.8 -"BLD",7921,"KRN",9.8,"NM",0) -^9.68A^7^7 -"BLD",7921,"KRN",9.8,"NM",1,0) -C0XMAIN^^0^B115393527 -"BLD",7921,"KRN",9.8,"NM",2,0) -C0XF2N^^0^B367797666 -"BLD",7921,"KRN",9.8,"NM",3,0) -C0XTEST^^0^B14490662 -"BLD",7921,"KRN",9.8,"NM",4,0) -C0XINIT^^0^B21176787 -"BLD",7921,"KRN",9.8,"NM",5,0) -C0XUTIL^^0^B11155926 -"BLD",7921,"KRN",9.8,"NM",6,0) -C0XTKSB^^0^B17580555 -"BLD",7921,"KRN",9.8,"NM",7,0) -C0XRDF^^0^B4392 -"BLD",7921,"KRN",9.8,"NM","B","C0XF2N",2) - -"BLD",7921,"KRN",9.8,"NM","B","C0XINIT",4) - -"BLD",7921,"KRN",9.8,"NM","B","C0XMAIN",1) - -"BLD",7921,"KRN",9.8,"NM","B","C0XRDF",7) - -"BLD",7921,"KRN",9.8,"NM","B","C0XTEST",3) - -"BLD",7921,"KRN",9.8,"NM","B","C0XTKSB",6) - -"BLD",7921,"KRN",9.8,"NM","B","C0XUTIL",5) - -"BLD",7921,"KRN",19,0) -19 -"BLD",7921,"KRN",19.1,0) -19.1 -"BLD",7921,"KRN",101,0) -101 -"BLD",7921,"KRN",409.61,0) -409.61 -"BLD",7921,"KRN",771,0) -771 -"BLD",7921,"KRN",779.2,0) -779.2 -"BLD",7921,"KRN",870,0) -870 -"BLD",7921,"KRN",8989.51,0) -8989.51 -"BLD",7921,"KRN",8989.52,0) -8989.52 -"BLD",7921,"KRN",8994,0) -8994 -"BLD",7921,"KRN","B",.4,.4) - -"BLD",7921,"KRN","B",.401,.401) - -"BLD",7921,"KRN","B",.402,.402) - -"BLD",7921,"KRN","B",.403,.403) - -"BLD",7921,"KRN","B",.5,.5) - -"BLD",7921,"KRN","B",.84,.84) - -"BLD",7921,"KRN","B",3.6,3.6) - -"BLD",7921,"KRN","B",3.8,3.8) - -"BLD",7921,"KRN","B",9.2,9.2) - -"BLD",7921,"KRN","B",9.8,9.8) - -"BLD",7921,"KRN","B",19,19) - -"BLD",7921,"KRN","B",19.1,19.1) - -"BLD",7921,"KRN","B",101,101) - -"BLD",7921,"KRN","B",409.61,409.61) - -"BLD",7921,"KRN","B",771,771) - -"BLD",7921,"KRN","B",779.2,779.2) - -"BLD",7921,"KRN","B",870,870) - -"BLD",7921,"KRN","B",8989.51,8989.51) - -"BLD",7921,"KRN","B",8989.52,8989.52) - -"BLD",7921,"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.101,172.1011) -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,1511,-1) -0^1 -"KRN",.4,1511,0) -C0X PRINT GRAPH^3111207.1727^@^172.101^^@^3120605 -"KRN",.4,1511,"F",1) -.03;W25;S~.04;C28;W25~.05;C54;W24~ -"KRN",.4,1511,"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") -7 -"RTN","C0XF2N") -0^2^B367797666 -"RTN","C0XF2N",1,0) -C0XF2N ; GPL - Fileman Triples entry point routine ;10/13/11 17:05 -"RTN","C0XF2N",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 8 -"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) - I $D(@ZFARY) Q ; ALREADY INITIALIZED -"RTN","C0XF2N",36,0) - S @ZFARY@("C0XTFN")=172.101 ; TRIPLES FILE NUMBER -"RTN","C0XF2N",37,0) - S @ZFARY@("C0XSFN")=172.201 ; TRIPLES STRINGS FILE NUMBER -"RTN","C0XF2N",38,0) - S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME -"RTN","C0XF2N",39,0) - S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME -"RTN","C0XF2N",40,0) - S @ZFARY@("C0XDIR")="/home/glilly/fmts/trunk/samples/smart-new/" -"RTN","C0XF2N",41,0) - S @ZFARY@("BLKLOAD")=1 ; this file supports block load -"RTN","C0XF2N",42,0) - S @ZFARY@("FMTSSTYLE")="F2N" ; fileman style -"RTN","C0XF2N",43,0) - S @ZFARY@("REPLYFMT")="JSON" -"RTN","C0XF2N",44,0) - D USEFARY(ZFARY) -"RTN","C0XF2N",45,0) - Q -"RTN","C0XF2N",46,0) - ; -"RTN","C0XF2N",47,0) -USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY -"RTN","C0XF2N",48,0) - N ZI S ZI="" -"RTN","C0XF2N",49,0) - F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D -"RTN","C0XF2N",50,0) - . ;N ZX -"RTN","C0XF2N",51,0) - . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_"""" -"RTN","C0XF2N",52,0) - . ;W !,ZX -"RTN","C0XF2N",53,0) - . X ZX -"RTN","C0XF2N",54,0) - Q -"RTN","C0XF2N",55,0) - ; -"RTN","C0XF2N",56,0) -FILEIN ; INTERACTIVE ENTRY POINT FOR OPTION TO READ IN A FILE -"RTN","C0XF2N",57,0) - I '$D(C0XFARY) D INITFARY("C0XFARY") -"RTN","C0XF2N",58,0) - D USEFARY("C0XFARY") -"RTN","C0XF2N",59,0) - S DIR(0)="F^3:240" -"RTN","C0XF2N",60,0) - S DIR("A")="File Directory" -"RTN","C0XF2N",61,0) - S DIR("B")=C0XDIR -"RTN","C0XF2N",62,0) - D ^DIR -"RTN","C0XF2N",63,0) - I Y="^" Q ; -"RTN","C0XF2N",64,0) - S C0XDIR=Y -"RTN","C0XF2N",65,0) - S C0XFARY("C0XDIR")=Y -"RTN","C0XF2N",66,0) - S DIR(0)="F^3:240" -"RTN","C0XF2N",67,0) - S DIR("A")="File Name" -"RTN","C0XF2N",68,0) - I '$D(C0XFN) S DIR("B")="qds.rdf" -"RTN","C0XF2N",69,0) - E S DIR("B")=C0XFN -"RTN","C0XF2N",70,0) - D ^DIR -"RTN","C0XF2N",71,0) - I Y="" Q ; -"RTN","C0XF2N",72,0) - I Y="^" Q ; -"RTN","C0XF2N",73,0) - S C0XFN=Y -"RTN","C0XF2N",74,0) - D IMPORT(C0XFN,C0XDIR,,"C0XFARY") -"RTN","C0XF2N",75,0) - K C0XFDA -"RTN","C0XF2N",76,0) - Q -"RTN","C0XF2N",77,0) - ; -"RTN","C0XF2N",78,0) -IMPORT(FNAME,INDIR,INURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD -"RTN","C0XF2N",79,0) - ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE -"RTN","C0XF2N",80,0) - ; NODE NAME OF THE TEXT TRIPLE -"RTN","C0XF2N",81,0) - ; INDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR) -"RTN","C0XF2N",82,0) - ; INURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE -"RTN","C0XF2N",83,0) - ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE -"RTN","C0XF2N",84,0) - I '$D(FARY) D ; -"RTN","C0XF2N",85,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",86,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",87,0) - D USEFARY(FARY) -"RTN","C0XF2N",88,0) - N ZD,ZTMP -"RTN","C0XF2N",89,0) - I '$D(INDIR) S INDIR=C0XDIR ; DIRECTORY OF THE RDF FILE -"RTN","C0XF2N",90,0) - I $G(INURL)="" D ; -"RTN","C0XF2N",91,0) - . ;N ZN2 S ZN2=$P(FNAME,".",1)_"_"_$P(FNAME,".",2) ; REMOVE THE DOT -"RTN","C0XF2N",92,0) - . ;S INURL=FDIR_ZN2 -"RTN","C0XF2N",93,0) - . S INURL=INDIR_FNAME -"RTN","C0XF2N",94,0) - N ZTMP -"RTN","C0XF2N",95,0) - S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE -"RTN","C0XF2N",96,0) - K @ZTMP ; MAKE SURE IT'S CLEAR -"RTN","C0XF2N",97,0) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XF2N",98,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XF2N",99,0) - W !,"READING IN: ",FNAME -"RTN","C0XF2N",100,0) - I '$$FILEREAD(ZTMP,INDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS -"RTN","C0XF2N",101,0) - . W !,"ERROR READING FILE: ",INDIR,FNAME -"RTN","C0XF2N",102,0) - S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT -"RTN","C0XF2N",103,0) - W !,$O(@ZRDF@(""),-1)," LINES READ" -"RTN","C0XF2N",104,0) - D INSRDF(ZRDF,INURL,FARY) ; IMPORT AND PROCESS THE RDF -"RTN","C0XF2N",105,0) - K INURL -"RTN","C0XF2N",106,0) - K C0XFDA -"RTN","C0XF2N",107,0) - ;K ^TMP("MXMLDOM",$J) -"RTN","C0XF2N",108,0) - Q -"RTN","C0XF2N",109,0) - ; -"RTN","C0XF2N",110,0) -WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT -"RTN","C0XF2N",111,0) - ; -"RTN","C0XF2N",112,0) - I '$D(FARY) D ; -"RTN","C0XF2N",113,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",114,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",115,0) - D USEFARY(FARY) -"RTN","C0XF2N",116,0) - ;N ZLOC,ZTMP -"RTN","C0XF2N",117,0) - K ZTMP -"RTN","C0XF2N",118,0) - S ZLOC=$NA(^TMP("C0X","WGET",$J)) -"RTN","C0XF2N",119,0) - K @ZLOC -"RTN","C0XF2N",120,0) - S C0XSTART=$$NOW^XLFDT -"RTN","C0XF2N",121,0) - W !,"STARTED: ",C0XSTART -"RTN","C0XF2N",122,0) - W !,"DOWNLOADING: ",ZURL -"RTN","C0XF2N",123,0) - S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP) -"RTN","C0XF2N",124,0) - M @ZLOC=ZTMP -"RTN","C0XF2N",125,0) - S C0XLINES=$O(@ZLOC@(""),-1) -"RTN","C0XF2N",126,0) - W !,C0XLINES," LINES READ" -"RTN","C0XF2N",127,0) - S C0XDLC=$$NOW^XLFDT ; DOWNLOAD COMPLETE -"RTN","C0XF2N",128,0) - W !,"DOWNLOAD COMPLETE AT ",C0XDLC -"RTN","C0XF2N",129,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XDLC,C0XSTART,2) -"RTN","C0XF2N",130,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XF2N",131,0) - I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XLINES/C0XDIFF,".")," LINES PER SEC" -"RTN","C0XF2N",132,0) - D INSRDF(ZLOC,ZURL,FARY) -"RTN","C0XF2N",133,0) - Q -"RTN","C0XF2N",134,0) - ; -"RTN","C0XF2N",135,0) -INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS -"RTN","C0XF2N",136,0) - ; ZRDF IS PASSED BY NAME -"RTN","C0XF2N",137,0) - I '$D(FARY) D ; -"RTN","C0XF2N",138,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",139,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",140,0) - D USEFARY(FARY) -"RTN","C0XF2N",141,0) - S BATCNT=0 ; BATCH COUNTER -"RTN","C0XF2N",142,0) - S BATMAX=10000 ; TRY BATCHES OF THIS SIZE -"RTN","C0XF2N",143,0) - N ZGRAPH,ZSUBJECT -"RTN","C0XF2N",144,0) - S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME -"RTN","C0XF2N",145,0) - S ZSUBJECT=$$ANONS() ; RANDOM ANOYMOUS SUBJECT -"RTN","C0XF2N",146,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY) -"RTN","C0XF2N",147,0) - N ZTXTNM -"RTN","C0XF2N",148,0) - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE -"RTN","C0XF2N",149,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:fileSource",ZTXTNM,FARY) -"RTN","C0XF2N",150,0) - D ADD(ZGRAPH,ZSUBJECT,"fmts:fileTag",$$name2tag(ZNAME),FARY) -"RTN","C0XF2N",151,0) - D SWUPDIE(.C0XFDA) ; TRY IT OUT -"RTN","C0XF2N",152,0) - K C0XCNT ;RESET FOR NEXT TIME -"RTN","C0XF2N",153,0) - D STORETXT(ZRDF,ZTXTNM,FARY) -"RTN","C0XF2N",154,0) - W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:fileSource ",ZTXTNM -"RTN","C0XF2N",155,0) - D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF -"RTN","C0XF2N",156,0) - Q -"RTN","C0XF2N",157,0) - ; -"RTN","C0XF2N",158,0) -name2tag(zname) ; extrinsic which returns a tag derived from a name -"RTN","C0XF2N",159,0) - ; /home/vista/project.xml ==> project -"RTN","C0XF2N",160,0) - q $p($re($p($re(zname),"/")),".") -"RTN","C0XF2N",161,0) - ; -"RTN","C0XF2N",162,0) -STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME -"RTN","C0XF2N",163,0) - ; -"RTN","C0XF2N",164,0) - I '$D(FARY) D ; -"RTN","C0XF2N",165,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",166,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",167,0) - D USEFARY(FARY) -"RTN","C0XF2N",168,0) - N ZIEN -"RTN","C0XF2N",169,0) - S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN -"RTN","C0XF2N",170,0) - D CLEAN^DILF -"RTN","C0XF2N",171,0) - K ZERR -"RTN","C0XF2N",172,0) - D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") -"RTN","C0XF2N",173,0) - I $D(ZERR) D Q ; -"RTN","C0XF2N",174,0) - . W !,"ERROR CREATING WORD PROCESSING FIELD" -"RTN","C0XF2N",175,0) - . S C0XERR="ERROR CREATING WORD PROCESSING FIELD" -"RTN","C0XF2N",176,0) - . D ^%ZTER ; error trap -"RTN","C0XF2N",177,0) - Q -"RTN","C0XF2N",178,0) - ; -"RTN","C0XF2N",179,0) -GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT -"RTN","C0XF2N",180,0) - ; ZRTN IS PASSED BY REFERENCE -"RTN","C0XF2N",181,0) - I '$D(FARY) D ; -"RTN","C0XF2N",182,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",183,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",184,0) - D USEFARY(FARY) -"RTN","C0XF2N",185,0) - N ZIEN -"RTN","C0XF2N",186,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XF2N",187,0) - S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") -"RTN","C0XF2N",188,0) - Q -"RTN","C0XF2N",189,0) - ; -"RTN","C0XF2N",190,0) -WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL -"RTN","C0XF2N",191,0) - ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING -"RTN","C0XF2N",192,0) - I '$D(FARY) D ; -"RTN","C0XF2N",193,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",194,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",195,0) - D USEFARY(FARY) -"RTN","C0XF2N",196,0) - N ZIEN -"RTN","C0XF2N",197,0) - S ZIEN=$$IENOF(ZNAME) -"RTN","C0XF2N",198,0) - Q $NA(@C0XSN@(ZIEN,1)) -"RTN","C0XF2N",199,0) - ; -"RTN","C0XF2N",200,0) -FILEREAD(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH -"RTN","C0XF2N",201,0) - ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT -"RTN","C0XF2N",202,0) - ; IE ^TMP("C0X","FILEIN",1) -"RTN","C0XF2N",203,0) - ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 -"RTN","C0XF2N",204,0) - ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH -"RTN","C0XF2N",205,0) - S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) -"RTN","C0XF2N",206,0) - Q OK -"RTN","C0XF2N",207,0) - ; -"RTN","C0XF2N",208,0) -TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE -"RTN","C0XF2N",209,0) - S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) -"RTN","C0XF2N",210,0) - S ZGRAPH="/test/rdfFile" -"RTN","C0XF2N",211,0) - S ZM="/test/rdfFile/meta" -"RTN","C0XF2N",212,0) - D PROCESS(.G,ZIN,ZGRAPH,ZM) -"RTN","C0XF2N",213,0) - Q -"RTN","C0XF2N",214,0) - ; -"RTN","C0XF2N",215,0) -VISTAOWL ; -"RTN","C0XF2N",216,0) - S ZRDF=$NA(^TMP("C0X",542,"FILEIN")) -"RTN","C0XF2N",217,0) - S ZNAME="/home/glilly/vistaowl/VistAOWL.owl" -"RTN","C0XF2N",218,0) - S ZGRAPH="_:G431590209" -"RTN","C0XF2N",219,0) - S FARY="C0XFARY" -"RTN","C0XF2N",220,0) - D INITFARY(FARY) -"RTN","C0XF2N",221,0) - S C0XDOCID=1 -"RTN","C0XF2N",222,0) - S BATCNT=0 -"RTN","C0XF2N",223,0) - S BATMAX=10000 -"RTN","C0XF2N",224,0) - D PROCESS(.G,ZRDF,ZGRAPH,ZNAME,FARY) -"RTN","C0XF2N",225,0) - Q -"RTN","C0XF2N",226,0) - ; -"RTN","C0XF2N",227,0) -PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE -"RTN","C0XF2N",228,0) - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING -"RTN","C0XF2N",229,0) - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE -"RTN","C0XF2N",230,0) - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS -"RTN","C0XF2N",231,0) - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA -"RTN","C0XF2N",232,0) - ; -"RTN","C0XF2N",233,0) - I '$D(FARY) D ; -"RTN","C0XF2N",234,0) - . D INITFARY("C0XFARY") -"RTN","C0XF2N",235,0) - . S FARY="C0XFARY" -"RTN","C0XF2N",236,0) - D USEFARY(FARY) -"RTN","C0XF2N",237,0) - ;N BATCNT -"RTN","C0XF2N",238,0) - ;N BATMAX -"RTN","C0XF2N",239,0) - ; -- first parse the rdf file with the MXML parser -"RTN","C0XF2N",240,0) - ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML -"RTN","C0XF2N",241,0) - S C0XDLC2=$$NOW^XLFDT ; START OF PARSE -"RTN","C0XF2N",242,0) - I @ZRDF@(1)'["") -"RTN","C0XRDF",24,0) - D ADD(ZARY,"") -"RTN","C0XRDF",25,0) - Q -"RTN","C0XRDF",26,0) - ; -"RTN","C0XRDF",27,0) -LISTSTART(ZARY,ZNAM) -"RTN","C0XRDF",28,0) - Q -"RTN","C0XRDF",29,0) - ; -"RTN","C0XRDF",30,0) -DICTSTART(ZARY,ZSUB) -"RTN","C0XRDF",31,0) - I ZSUB["http" D Q ; -"RTN","C0XRDF",32,0) - . D ADD(ZARY,"") -"RTN","C0XRDF",33,0) - I $E(ZSUB,1,1)="/" D Q ; -"RTN","C0XRDF",34,0) - . D ADD(ZARY,"") -"RTN","C0XRDF",35,0) - D ADD(ZARY,"") -"RTN","C0XRDF",36,0) - Q -"RTN","C0XRDF",37,0) - ; -"RTN","C0XRDF",38,0) -DASSERT(ZARY,ZPRED,ZOBJ) -"RTN","C0XRDF",39,0) - I ZPRED[":" D Q ; -"RTN","C0XRDF",40,0) - . I ZPRED="rdf:type" D Q ; -"RTN","C0XRDF",41,0) - . . D ADD(ZARY,"") -"RTN","C0XRDF",42,0) - . N ZA,ZB,ZC -"RTN","C0XRDF",43,0) - . S ZA=$P(ZPRED,":",1) -"RTN","C0XRDF",44,0) - . S ZB=$P(ZPRED,":",2) -"RTN","C0XRDF",45,0) - . I $E(ZB,1,1)="/" D ; -"RTN","C0XRDF",46,0) - . . S ZB=$P(ZB,"/",2) ; handling gpltest:/note situations -"RTN","C0XRDF",47,0) - . S ZC=C0XVOC(ZA) -"RTN","C0XRDF",48,0) - . I ZOBJ["nodeID:" D Q ; -"RTN","C0XRDF",49,0) - . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:nodeID="""_$$EXT^C0XUTIL(ZOBJ)_"""/>") -"RTN","C0XRDF",50,0) - . S ZOBJ=$$EXT^C0XUTIL(ZOBJ) -"RTN","C0XRDF",51,0) - . I ZOBJ["http" D Q ; -"RTN","C0XRDF",52,0) - . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:resource="""_ZOBJ_"""/>") -"RTN","C0XRDF",53,0) - . I $E(ZOBJ,1,1)="/" D Q ; -"RTN","C0XRDF",54,0) - . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:resource="""_ZOBJ_"""/>") -"RTN","C0XRDF",55,0) - . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""">"_$$EXT^C0XUTIL(ZOBJ)_"") -"RTN","C0XRDF",56,0) - Q -"RTN","C0XRDF",57,0) - ; -"RTN","C0XRDF",58,0) -DICTEND(ZARY) -"RTN","C0XRDF",59,0) - D ADD(ZARY,"") -"RTN","C0XRDF",60,0) - Q -"RTN","C0XRDF",61,0) - ; -"RTN","C0XRDF",62,0) -LISTEND(ZARY) -"RTN","C0XRDF",63,0) - Q -"RTN","C0XRDF",64,0) - ; -"RTN","C0XRDF",65,0) -REPLYEND(ZARY) -"RTN","C0XRDF",66,0) - D ADD(ZARY,"") -"RTN","C0XRDF",67,0) - Q -"RTN","C0XRDF",68,0) - ; -"RTN","C0XRDF",69,0) -ADD(ZARY,ZELE) -"RTN","C0XRDF",70,0) - N ZI -"RTN","C0XRDF",71,0) - I '$D(ZARY) S @ZARY@(1)=ZELE Q ; -"RTN","C0XRDF",72,0) - S ZI=$O(@ZARY@(""),-1) -"RTN","C0XRDF",73,0) - S @ZARY@(ZI+1)=ZELE -"RTN","C0XRDF",74,0) - Q -"RTN","C0XRDF",75,0) - ; -"RTN","C0XRDF",76,0) -rdfout(rdfout,zary) ; -"RTN","C0XRDF",77,0) - d REPLYSTART("rdfout") -"RTN","C0XRDF",78,0) - d LISTSTART("rdfout","results") -"RTN","C0XRDF",79,0) - n zi s zi="" -"RTN","C0XRDF",80,0) - f s zi=$o(zary(zi)) q:zi="" d ; for each subject -"RTN","C0XRDF",81,0) - . n zii s zii="" -"RTN","C0XRDF",82,0) - . D DICTSTART("rdfout",$$EXT^C0XUTIL(zi)) -"RTN","C0XRDF",83,0) - . f s zii=$o(zary(zi,zii)) q:zii="" d ; for each pred^obj pair -"RTN","C0XRDF",84,0) - . . d DASSERT("rdfout",$p(zii,"^",1),$p(zii,"^",2)) -"RTN","C0XRDF",85,0) - . D DICTEND("rdfout") -"RTN","C0XRDF",86,0) - d LISTEND("rdfout") -"RTN","C0XRDF",87,0) - d REPLYEND("rdfout") -"RTN","C0XRDF",88,0) - q -"RTN","C0XRDF",89,0) - ; -"RTN","C0XTEST") -0^3^B14490662 -"RTN","C0XTEST",1,0) -C0XTEST ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05 -"RTN","C0XTEST",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 8 -"RTN","C0XTEST",3,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU -"RTN","C0XTEST",4,0) - ;General Public License See attached copy of the License. -"RTN","C0XTEST",5,0) - ; -"RTN","C0XTEST",6,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XTEST",7,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XTEST",8,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XTEST",9,0) - ;(at your option) any later version. -"RTN","C0XTEST",10,0) - ; -"RTN","C0XTEST",11,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XTEST",12,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XTEST",13,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XTEST",14,0) - ;GNU General Public License for more details. -"RTN","C0XTEST",15,0) - ; -"RTN","C0XTEST",16,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XTEST",17,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XTEST",18,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XTEST",19,0) - ; -"RTN","C0XTEST",20,0) - Q -"RTN","C0XTEST",21,0) - ; -"RTN","C0XTEST",22,0) -EN ; run the test -"RTN","C0XTEST",23,0) - ; -"RTN","C0XTEST",24,0) - k C0XFDA ; clear the node variable -"RTN","C0XTEST",25,0) - i '$d(^C0X(101,0)) d ; global doesn't exist -"RTN","C0XTEST",26,0) - . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1" -"RTN","C0XTEST",27,0) - n zg -"RTN","C0XTEST",28,0) - S zg="_:G"_$$LKY9 ; all nodes are in the same graph -"RTN","C0XTEST",29,0) - n zi -"RTN","C0XTEST",30,0) - f zi=1:1:100000 d ; try a test of 10000 nodes -"RTN","C0XTEST",31,0) - . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name -"RTN","C0XTEST",32,0) - . s C0XFDA(172.101,zi,.02)=zg -"RTN","C0XTEST",33,0) - . s C0XFDA(172.101,zi,.03)=$R(100000) -"RTN","C0XTEST",34,0) - . s C0XFDA(172.101,zi,.04)=$R(100000) -"RTN","C0XTEST",35,0) - . s C0XFDA(172.101,zi,.05)=$R(100000) -"RTN","C0XTEST",36,0) - S C0XST=$$NOW^XLFDT ; start of the insertion test -"RTN","C0XTEST",37,0) - W !,"INSERTION STARTS AT ",C0XST,! -"RTN","C0XTEST",38,0) - d BULKLOAD(.C0XFDA) -"RTN","C0XTEST",39,0) - s C0XEND=$$NOW^XLFDT ; end of the insertion test -"RTN","C0XTEST",40,0) - W !,"INSERTION ENDS AT ",C0XEND -"RTN","C0XTEST",41,0) - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XST,2) -"RTN","C0XTEST",42,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XTEST",43,0) - I C0XDIFF>0 W !," APPROXIMATELY ",$P(100000/C0XDIFF,".")," NODES PER SECOND" -"RTN","C0XTEST",44,0) - q -"RTN","C0XTEST",45,0) - ; -"RTN","C0XTEST",46,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTEST",47,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTEST",48,0) - N ZN,ZI -"RTN","C0XTEST",49,0) - S ZN="" -"RTN","C0XTEST",50,0) - F ZI=1:1:9 D ; -"RTN","C0XTEST",51,0) - . S ZN=ZN_$R(10) -"RTN","C0XTEST",52,0) - Q ZN -"RTN","C0XTEST",53,0) - ; -"RTN","C0XTEST",54,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTEST",55,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTEST",56,0) - N ZN,ZI -"RTN","C0XTEST",57,0) - S ZN="" -"RTN","C0XTEST",58,0) - F ZI=1:1:17 D ; -"RTN","C0XTEST",59,0) - . S ZN=ZN_$R(10) -"RTN","C0XTEST",60,0) - Q ZN -"RTN","C0XTEST",61,0) - ; -"RTN","C0XTEST",62,0) -BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 -"RTN","C0XTEST",63,0) - ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE -"RTN","C0XTEST",64,0) - ; QUITS IF FILE IS NOT 172.101 -"RTN","C0XTEST",65,0) - ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 -"RTN","C0XTEST",66,0) - ; QUITS IF FIRST ENTRY IS NOT IENS 1 -"RTN","C0XTEST",67,0) - ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES -"RTN","C0XTEST",68,0) - ; ZBFDA IS PASSED BY REFERENCE -"RTN","C0XTEST",69,0) - ; -"RTN","C0XTEST",70,0) - ; -- reserves a block of iens from file 172.101 by locking the zero node -"RTN","C0XTEST",71,0) - ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 -"RTN","C0XTEST",72,0) - ; -- then unlocking to minimize the duration of the lock -"RTN","C0XTEST",73,0) - ; -"RTN","C0XTEST",74,0) - W !,"USING BULKLOAD" -"RTN","C0XTEST",75,0) - I '$D(ZBFDA) Q ; EMPTY FDA -"RTN","C0XTEST",76,0) - I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE -"RTN","C0XTEST",77,0) - N ZCNT,ZP3,ZP4 -"RTN","C0XTEST",78,0) - ; -- find the number of nodes to insert -"RTN","C0XTEST",79,0) - S ZCNT=$O(ZBFDA(172.101,""),-1) -"RTN","C0XTEST",80,0) - I ZCNT="" D Q ; -"RTN","C0XTEST",81,0) - . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" -"RTN","C0XTEST",82,0) - . B -"RTN","C0XTEST",83,0) - ; -- lock the zero node and reserve a block of iens to insert -"RTN","C0XTEST",84,0) - W !,"LOCKING ZERO NODE" -"RTN","C0XTEST",85,0) - LOCK +^C0X(101,0) -"RTN","C0XTEST",86,0) - S ZP3=$P(^C0X(101,0),U,3) -"RTN","C0XTEST",87,0) - S ZP4=$P(^C0X(101,0),U,4) -"RTN","C0XTEST",88,0) - S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 -"RTN","C0XTEST",89,0) - S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 -"RTN","C0XTEST",90,0) - LOCK -^C0X(101,0) -"RTN","C0XTEST",91,0) - N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE -"RTN","C0XTEST",92,0) - S ZBASE=ZP3 ; the last ien in the file -"RTN","C0XTEST",93,0) - W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT -"RTN","C0XTEST",94,0) - W !,$$NOW^XLFDT -"RTN","C0XTEST",95,0) - S ZI="" -"RTN","C0XTEST",96,0) - F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; -"RTN","C0XTEST",97,0) - . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name -"RTN","C0XTEST",98,0) - . I ZN="" D BLKERR Q ; -"RTN","C0XTEST",99,0) - . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer -"RTN","C0XTEST",100,0) - . I ZG="" D BLKERR Q ; -"RTN","C0XTEST",101,0) - . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer -"RTN","C0XTEST",102,0) - . I ZS="" D BLKERR Q ; -"RTN","C0XTEST",103,0) - . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer -"RTN","C0XTEST",104,0) - . I ZP="" D BLKERR Q ; -"RTN","C0XTEST",105,0) - . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer -"RTN","C0XTEST",106,0) - . I ZO="" D BLKERR Q ; -"RTN","C0XTEST",107,0) - . S ZIEN=ZI+ZBASE ; the new ien -"RTN","C0XTEST",108,0) - . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node -"RTN","C0XTEST",109,0) - . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index -"RTN","C0XTEST",110,0) - . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index -"RTN","C0XTEST",111,0) - . S ^C0X(101,"SPO",ZS,ZP,ZO)="" -"RTN","C0XTEST",112,0) - . S ^C0X(101,"SOP",ZS,ZO,ZP)="" -"RTN","C0XTEST",113,0) - . S ^C0X(101,"OPS",ZO,ZP,ZS)="" -"RTN","C0XTEST",114,0) - . S ^C0X(101,"OSP",ZO,ZS,ZP)="" -"RTN","C0XTEST",115,0) - . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" -"RTN","C0XTEST",116,0) - . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" -"RTN","C0XTEST",117,0) - . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" -"RTN","C0XTEST",118,0) - . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" -"RTN","C0XTEST",119,0) - Q -"RTN","C0XTEST",120,0) - ; -"RTN","C0XTEST",121,0) -BLKERR ; -"RTN","C0XTEST",122,0) - W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) -"RTN","C0XTEST",123,0) - B -"RTN","C0XTEST",124,0) - Q -"RTN","C0XTEST",125,0) - ; -"RTN","C0XTKSB") -0^6^B17580555 -"RTN","C0XTKSB",1,0) -C0XTESTKSB ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05 -"RTN","C0XTKSB",2,0) - ; KSB - modified to fix a minor bug and to use;;;;;Build 8 -"RTN","C0XTKSB",3,0) - ; high resolution time if routines available ; 11/19/11 1410 EST -"RTN","C0XTKSB",4,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 1 -"RTN","C0XTKSB",5,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU -"RTN","C0XTKSB",6,0) - ;General Public License See attached copy of the License. -"RTN","C0XTKSB",7,0) - ; -"RTN","C0XTKSB",8,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XTKSB",9,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XTKSB",10,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XTKSB",11,0) - ;(at your option) any later version. -"RTN","C0XTKSB",12,0) - ; -"RTN","C0XTKSB",13,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XTKSB",14,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XTKSB",15,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XTKSB",16,0) - ;GNU General Public License for more details. -"RTN","C0XTKSB",17,0) - ; -"RTN","C0XTKSB",18,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XTKSB",19,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XTKSB",20,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XTKSB",21,0) - ; -"RTN","C0XTKSB",22,0) - Q -"RTN","C0XTKSB",23,0) - ; -"RTN","C0XTKSB",24,0) -EN ; run the test -"RTN","C0XTKSB",25,0) - ; -"RTN","C0XTKSB",26,0) - k C0XFDA ; clear the node variable -"RTN","C0XTKSB",27,0) - s U="^" ; initialization - Bhaskar 20111119 -"RTN","C0XTKSB",28,0) - i '$d(^C0X(101,0)) d ; global doesn't exist -"RTN","C0XTKSB",29,0) - . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1" -"RTN","C0XTKSB",30,0) - n zg -"RTN","C0XTKSB",31,0) - S zg="_:G"_$$LKY9 ; all nodes are in the same graph -"RTN","C0XTKSB",32,0) - n zi -"RTN","C0XTKSB",33,0) - f zi=1:1:10000 d ; try a test of 10000 nodes -"RTN","C0XTKSB",34,0) - . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name -"RTN","C0XTKSB",35,0) - . s C0XFDA(172.101,zi,.02)=zg -"RTN","C0XTKSB",36,0) - . s C0XFDA(172.101,zi,.03)=$R(100000) -"RTN","C0XTKSB",37,0) - . s C0XFDA(172.101,zi,.04)=$R(100000) -"RTN","C0XTKSB",38,0) - . s C0XFDA(172.101,zi,.05)=$R(100000) -"RTN","C0XTKSB",39,0) - S C0XST=$$H ; start of the insertion test -"RTN","C0XTKSB",40,0) - W !,"INSERTION STARTS AT ",$ZDATE(C0XST,"YEAR-MM-DD:24:60:SS"),! -"RTN","C0XTKSB",41,0) - d BULKLOAD(.C0XFDA) -"RTN","C0XTKSB",42,0) - s C0XEND=$$H ; end of the insertion test -"RTN","C0XTKSB",43,0) - W !,"INSERTION ENDS AT ",$ZDATE(C0XEND,"YEAR-MM-DD:24:60:SS") -"RTN","C0XTKSB",44,0) - S C0XDIFF=(86400*($P(C0XEND,",",1)-$P(C0XST,",",1)))+$P(C0XEND,",",2)-$P(C0XST,",",2) -"RTN","C0XTKSB",45,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" -"RTN","C0XTKSB",46,0) - W ! -"RTN","C0XTKSB",47,0) - W:C0XDIFF>0 " APPROXIMATELY ",$FN(10000/C0XDIFF,",",0)," NODES PER SECOND",! -"RTN","C0XTKSB",48,0) - q -"RTN","C0XTKSB",49,0) - ; -"RTN","C0XTKSB",50,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTKSB",51,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTKSB",52,0) - N ZN,ZI -"RTN","C0XTKSB",53,0) - S ZN="" -"RTN","C0XTKSB",54,0) - F ZI=1:1:9 D ; -"RTN","C0XTKSB",55,0) - . S ZN=ZN_$R(10) -"RTN","C0XTKSB",56,0) - Q ZN -"RTN","C0XTKSB",57,0) - ; -"RTN","C0XTKSB",58,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTKSB",59,0) - ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTKSB",60,0) - N ZN,ZI -"RTN","C0XTKSB",61,0) - S ZN="" -"RTN","C0XTKSB",62,0) - F ZI=1:1:17 D ; -"RTN","C0XTKSB",63,0) - . S ZN=ZN_$R(10) -"RTN","C0XTKSB",64,0) - Q ZN -"RTN","C0XTKSB",65,0) - ; -"RTN","C0XTKSB",66,0) -BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 -"RTN","C0XTKSB",67,0) - ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE -"RTN","C0XTKSB",68,0) - ; QUITS IF FILE IS NOT 172.101 -"RTN","C0XTKSB",69,0) - ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 -"RTN","C0XTKSB",70,0) - ; QUITS IF FIRST ENTRY IS NOT IENS 1 -"RTN","C0XTKSB",71,0) - ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES -"RTN","C0XTKSB",72,0) - ; ZBFDA IS PASSED BY REFERENCE -"RTN","C0XTKSB",73,0) - ; -"RTN","C0XTKSB",74,0) - ; -- reserves a block of iens from file 172.101 by locking the zero node -"RTN","C0XTKSB",75,0) - ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 -"RTN","C0XTKSB",76,0) - ; -- then unlocking to minimize the duration of the lock -"RTN","C0XTKSB",77,0) - ; -"RTN","C0XTKSB",78,0) - W !,"USING BULKLOAD" -"RTN","C0XTKSB",79,0) - I '$D(ZBFDA) Q ; EMPTY FDA -"RTN","C0XTKSB",80,0) - I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE -"RTN","C0XTKSB",81,0) - N ZCNT,ZP3,ZP4 -"RTN","C0XTKSB",82,0) - ; -- find the number of nodes to insert -"RTN","C0XTKSB",83,0) - S ZCNT=$O(ZBFDA(172.101,""),-1) -"RTN","C0XTKSB",84,0) - I ZCNT="" D Q ; -"RTN","C0XTKSB",85,0) - . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" -"RTN","C0XTKSB",86,0) - . B -"RTN","C0XTKSB",87,0) - ; -- lock the zero node and reserve a block of iens to insert -"RTN","C0XTKSB",88,0) - W !,"LOCKING ZERO NODE" -"RTN","C0XTKSB",89,0) - LOCK +^C0X(101,0) -"RTN","C0XTKSB",90,0) - S ZP3=$P(^C0X(101,0),U,3) -"RTN","C0XTKSB",91,0) - S ZP4=$P(^C0X(101,0),U,4) -"RTN","C0XTKSB",92,0) - S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 -"RTN","C0XTKSB",93,0) - S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 -"RTN","C0XTKSB",94,0) - LOCK -^C0X(101,0) -"RTN","C0XTKSB",95,0) - N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE -"RTN","C0XTKSB",96,0) - S ZBASE=ZP3 ; the last ien in the file -"RTN","C0XTKSB",97,0) - W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT -"RTN","C0XTKSB",98,0) - W !,$ZDATE($$H,"YEAR-MM-DD:24:60:SS") -"RTN","C0XTKSB",99,0) - S ZI="" -"RTN","C0XTKSB",100,0) - F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; -"RTN","C0XTKSB",101,0) - . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name -"RTN","C0XTKSB",102,0) - . I ZN="" D BLKERR Q ; -"RTN","C0XTKSB",103,0) - . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer -"RTN","C0XTKSB",104,0) - . I ZG="" D BLKERR Q ; -"RTN","C0XTKSB",105,0) - . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer -"RTN","C0XTKSB",106,0) - . I ZS="" D BLKERR Q ; -"RTN","C0XTKSB",107,0) - . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer -"RTN","C0XTKSB",108,0) - . I ZP="" D BLKERR Q ; -"RTN","C0XTKSB",109,0) - . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer -"RTN","C0XTKSB",110,0) - . I ZO="" D BLKERR Q ; -"RTN","C0XTKSB",111,0) - . S ZIEN=ZI+ZBASE ; the new ien -"RTN","C0XTKSB",112,0) - . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node -"RTN","C0XTKSB",113,0) - . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index -"RTN","C0XTKSB",114,0) - . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index -"RTN","C0XTKSB",115,0) - . S ^C0X(101,"SPO",ZS,ZP,ZO)="" -"RTN","C0XTKSB",116,0) - . S ^C0X(101,"SOP",ZS,ZO,ZP)="" -"RTN","C0XTKSB",117,0) - . S ^C0X(101,"OPS",ZO,ZP,ZS)="" -"RTN","C0XTKSB",118,0) - . S ^C0X(101,"OSP",ZO,ZS,ZP)="" -"RTN","C0XTKSB",119,0) - . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" -"RTN","C0XTKSB",120,0) - . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" -"RTN","C0XTKSB",121,0) - . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" -"RTN","C0XTKSB",122,0) - . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" -"RTN","C0XTKSB",123,0) - Q -"RTN","C0XTKSB",124,0) - ; -"RTN","C0XTKSB",125,0) -BLKERR ; -"RTN","C0XTKSB",126,0) - W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) -"RTN","C0XTKSB",127,0) - B -"RTN","C0XTKSB",128,0) - Q -"RTN","C0XTKSB",129,0) - ; -"RTN","C0XTKSB",130,0) -H() -"RTN","C0XTKSB",131,0) - quit:$length($ztrnlnm("GTMXC_posix"))&$length($text(zhorolog^%POSIX)) $$zhorolog^%POSIX quit $horolog -"RTN","C0XUTIL") -0^5^B11155926 -"RTN","C0XUTIL",1,0) -C0XUTIL ; GPL - Fileman Triples utilities ;11/07/11 17:05 -"RTN","C0XUTIL",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 8 -"RTN","C0XUTIL",3,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU -"RTN","C0XUTIL",4,0) - ;General Public License See attached copy of the License. -"RTN","C0XUTIL",5,0) - ; -"RTN","C0XUTIL",6,0) - ;This program is free software; you can redistribute it and/or modify -"RTN","C0XUTIL",7,0) - ;it under the terms of the GNU General Public License as published by -"RTN","C0XUTIL",8,0) - ;the Free Software Foundation; either version 2 of the License, or -"RTN","C0XUTIL",9,0) - ;(at your option) any later version. -"RTN","C0XUTIL",10,0) - ; -"RTN","C0XUTIL",11,0) - ;This program is distributed in the hope that it will be useful, -"RTN","C0XUTIL",12,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of -"RTN","C0XUTIL",13,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"RTN","C0XUTIL",14,0) - ;GNU General Public License for more details. -"RTN","C0XUTIL",15,0) - ; -"RTN","C0XUTIL",16,0) - ;You should have received a copy of the GNU General Public License along -"RTN","C0XUTIL",17,0) - ;with this program; if not, write to the Free Software Foundation, Inc., -"RTN","C0XUTIL",18,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"RTN","C0XUTIL",19,0) - ; -"RTN","C0XUTIL",20,0) - Q -"RTN","C0XUTIL",21,0) - ; -"RTN","C0XUTIL",22,0) -NSP(ZX) ; OUTPUT TRANSFORM EXTRINSIC -"RTN","C0XUTIL",23,0) - ; -"RTN","C0XUTIL",24,0) - N ZR -"RTN","C0XUTIL",25,0) - ; I WOULD REALLY LIKE TO NOT HAVE THE FILE NUMBER HARD CODED HERE -"RTN","C0XUTIL",26,0) - ; ANYONE KNOW HOW I COULD DO THAT? :) GPL -"RTN","C0XUTIL",27,0) - S ZR=$$GET1^DIQ(172.201,ZX_",",.01) -"RTN","C0XUTIL",28,0) - I '$D(C0XNSP) S C0XNSP=1 ; DEFAULT ON -"RTN","C0XUTIL",29,0) - I C0XNSP=0 Q ZR ; SWITCHED OFF -"RTN","C0XUTIL",30,0) - I '$D(C0XVOC) D VOCINIT ; INITIALIZE THE VOCABULARIES -"RTN","C0XUTIL",31,0) - N ZI,ZJ,ZK S ZI="" -"RTN","C0XUTIL",32,0) - N DONE S DONE=0 -"RTN","C0XUTIL",33,0) - F S ZI=$O(C0XVOC(ZI)) Q:(DONE=1)!(ZI="") D ; -"RTN","C0XUTIL",34,0) - . ;W !,ZI -"RTN","C0XUTIL",35,0) - . S ZJ=C0XVOC(ZI) -"RTN","C0XUTIL",36,0) - . S ZK=$P(ZR,ZJ,2) -"RTN","C0XUTIL",37,0) - . ;W !,"ZK=",ZK -"RTN","C0XUTIL",38,0) - . I ZK'="" D ; BINGO -"RTN","C0XUTIL",39,0) - . . S ZR=ZI_":"_ZK -"RTN","C0XUTIL",40,0) - . . S DONE=1 -"RTN","C0XUTIL",41,0) - Q ZR -"RTN","C0XUTIL",42,0) - ; -"RTN","C0XUTIL",43,0) -VOCINIT ; INITIALIZE VOCABULARIES -"RTN","C0XUTIL",44,0) - S C0XVOC("dcterms")="http://purl.org/dc/terms/" -"RTN","C0XUTIL",45,0) - S C0XVOC("rdf")="http://www.w3.org/1999/02/22-rdf-syntax-ns#" -"RTN","C0XUTIL",46,0) - S C0XVOC("sp")="http://smartplatforms.org/terms#" -"RTN","C0XUTIL",47,0) - S C0XVOC("qds")="http://cms.gov/pqri/qds/" -"RTN","C0XUTIL",48,0) - S C0XVOC("smart")="http://sandbox-api.smartplatforms.org/records/" -"RTN","C0XUTIL",49,0) - S C0XVOC("snomed")="http://purl.bioontology.org/ontology/SNOMEDCT/" -"RTN","C0XUTIL",50,0) - S C0XVOC("rxnorm")="http://purl.bioontology.org/ontology/RXNORM/" -"RTN","C0XUTIL",51,0) - S C0XVOC("loinc")="http://purl.bioontology.org/ontology/LNC/" -"RTN","C0XUTIL",52,0) - S C0XVOC("file")="/home/glilly/fmts/trunk/samples/" -"RTN","C0XUTIL",53,0) - S C0XVOC("foaf")="http://xmlns.com/foaf/0.1/" -"RTN","C0XUTIL",54,0) - S C0XVOC("skos")="http://www.w3.org/2004/02/skos/core#" -"RTN","C0XUTIL",55,0) - S C0XVOC("gpl")="http://georgetriples.org/" -"RTN","C0XUTIL",56,0) - S C0XVOC("cg")="http://datasets.caregraf.org/" -"RTN","C0XUTIL",57,0) - S C0XVOC("mv")="http://metavista.name/foundation#" -"RTN","C0XUTIL",58,0) - S C0XVOC("rdfs")="http://www.w3.org/2000/01/rdf-schema#" -"RTN","C0XUTIL",59,0) - S C0XVOC("vistaSmart")="https://smart2.vistaewd.net/vista/smart/records/" -"RTN","C0XUTIL",60,0) - S C0XVOC("vmu")="http://vista.org/mu/" -"RTN","C0XUTIL",61,0) - S C0XVOC("vq")="http://vista.org/quality/" -"RTN","C0XUTIL",62,0) - S C0XVOC("nodeID")="iDPsDPss" -"RTN","C0XUTIL",63,0) - S C0XVOC("fmts")="http://glilly.net/fmts#" -"RTN","C0XUTIL",64,0) - S C0XVOC("oro")="http://oro.com/vista/sage" ;change to get URL from system -"RTN","C0XUTIL",65,0) - S C0XVOC("sage")="http://oro.com/sage/schema#" -"RTN","C0XUTIL",66,0) - S C0XVOC("v")="http://www.w3.org/2006/vcard/ns#" -"RTN","C0XUTIL",67,0) - Q -"RTN","C0XUTIL",68,0) - ; -"RTN","C0XUTIL",69,0) -EXT(C0XIN) ; EXTRINSIC WHICH EXPANDS NAMESPACES -"RTN","C0XUTIL",70,0) - ; SO skos:xxx would return http://www.w3.org/2004/02/skos/core#xxx -"RTN","C0XUTIL",71,0) - N C0XPRE -"RTN","C0XUTIL",72,0) - S C0XPRE=C0XIN -"RTN","C0XUTIL",73,0) - I '$D(C0XVOC) D VOCINIT ; INITIALIZE NAME SPACE TABLE -"RTN","C0XUTIL",74,0) - I C0XPRE[":" D ; expand using vocabulary -"RTN","C0XUTIL",75,0) - . N ZB,ZA -"RTN","C0XUTIL",76,0) - . S ZB=$P(C0XPRE,":",1) -"RTN","C0XUTIL",77,0) - . S ZA=$P(C0XPRE,":",2) -"RTN","C0XUTIL",78,0) - . I $G(C0XVOC(ZB))'="" D ; -"RTN","C0XUTIL",79,0) - . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded -"RTN","C0XUTIL",80,0) - Q C0XPRE -"RTN","C0XUTIL",81,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^6 -"^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.201O^C0X(201,^0;2^Q -"^DD",172.101,172.101,.02,.1) -TRIPLE GRAPH -"^DD",172.101,172.101,.02,2) -S Y(0)=Y S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.02,2.1) -S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.02,3) -Answer must be 3-240 characters in length -"^DD",172.101,172.101,.02,"DT") -3111207 -"^DD",172.101,172.101,.03,0) -SUBJECT^P172.201O^C0X(201,^0;3^Q -"^DD",172.101,172.101,.03,.1) -TRIPLE SUBJECT -"^DD",172.101,172.101,.03,2) -S Y(0)=Y S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.03,2.1) -S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.03,"DT") -3111207 -"^DD",172.101,172.101,.04,0) -PREDICATE^P172.201O^C0X(201,^0;4^Q -"^DD",172.101,172.101,.04,.1) -TRIPLE PREDICATE -"^DD",172.101,172.101,.04,2) -S Y(0)=Y S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.04,2.1) -S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.04,"DT") -3111207 -"^DD",172.101,172.101,.05,0) -OBJECT^P172.201O^C0X(201,^0;5^Q -"^DD",172.101,172.101,.05,.1) -TRIPLE OBJECT -"^DD",172.101,172.101,.05,2) -S Y(0)=Y S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.05,2.1) -S Y=$$NSP^C0XUTIL(Y) -"^DD",172.101,172.101,.05,"DT") -3111207 -"^DD",172.101,172.101,1,0) -EVENTS^172.1011V^^1;0 -"^DD",172.101,172.1011,0) -EVENTS SUB-FIELD^^.01^1 -"^DD",172.101,172.1011,0,"DT") -3110510 -"^DD",172.101,172.1011,0,"IX","B",172.1011,.01) - -"^DD",172.101,172.1011,0,"NM","EVENTS") - -"^DD",172.101,172.1011,0,"UP") -172.101 -"^DD",172.101,172.1011,.01,0) -EVENTS^V^^0;1^ -"^DD",172.101,172.1011,.01,.1) -PATIENT CLINICAL EVENTS -"^DD",172.101,172.1011,.01,1,0) -^.1 -"^DD",172.101,172.1011,.01,1,1,0) -172.1011^B -"^DD",172.101,172.1011,.01,1,1,1) -S ^C0CXREF(DA(1),1,"B",$E(X,1,30),DA)="" -"^DD",172.101,172.1011,.01,1,1,2) -K ^C0CXREF(DA(1),1,"B",$E(X,1,30),DA) -"^DD",172.101,172.1011,.01,1,1,3) -Required for Variable Pointer -"^DD",172.101,172.1011,.01,"DT") -3110510 -"^DD",172.101,172.1011,.01,"V",0) -^.12P^^3 -"^DD",172.101,172.1011,.01,"V",1,0) -55^MEDICATIONS^1^M^n^y -"^DD",172.101,172.1011,.01,"V",1,1) - -"^DD",172.101,172.1011,.01,"V",1,2) - -"^DD",172.101,172.1011,.01,"V",2,0) -9000011^PATIENT PROBLEM^2^P^n^y -"^DD",172.101,172.1011,.01,"V",2,1) - -"^DD",172.101,172.1011,.01,"V",2,2) - -"^DD",172.101,172.1011,.01,"V",3,0) -69^PATIENT LAB ORDER^3^L^n^y -"^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** diff --git a/kids/C0X_1_0_0_T11.KID b/kids/FILEMAN_TRIPLE_STORE_1T12.KID similarity index 97% rename from kids/C0X_1_0_0_T11.KID rename to kids/FILEMAN_TRIPLE_STORE_1T12.KID index 24bda0c..ee0a8d5 100644 --- a/kids/C0X_1_0_0_T11.KID +++ b/kids/FILEMAN_TRIPLE_STORE_1T12.KID @@ -1,149 +1,159 @@ -KIDS Distribution saved on Sep 26, 2012@04:22:32 -fixes for smart snomed lookup -**KIDS**:C0X*1.0*0^ +KIDS Distribution saved on Sep 26, 2012@11:18:36 +Fileman Triple Store +**KIDS**:FILEMAN TRIPLE STORE 1.0^ **INSTALL NAME** -C0X*1.0*0 -"BLD",7921,0) -C0X*1.0*0^^0^3120926^n -"BLD",7921,4,0) +FILEMAN TRIPLE STORE 1.0 +"BLD",8490,0) +FILEMAN TRIPLE STORE 1.0^FILEMAN TRIPLE STORE^0^3120926^y +"BLD",8490,1,0) +^^1^1^3120926^ +"BLD",8490,1,1,0) +Version 1.0 +"BLD",8490,4,0) ^9.64PA^172.201^2 -"BLD",7921,4,172.101,0) +"BLD",8490,4,172.101,0) 172.101 -"BLD",7921,4,172.101,222) +"BLD",8490,4,172.101,222) y^y^f^^^^n -"BLD",7921,4,172.201,0) +"BLD",8490,4,172.201,0) 172.201 -"BLD",7921,4,172.201,222) +"BLD",8490,4,172.201,222) y^y^f^^^^n -"BLD",7921,4,"B",172.101,172.101) +"BLD",8490,4,"B",172.101,172.101) -"BLD",7921,4,"B",172.201,172.201) +"BLD",8490,4,"B",172.201,172.201) -"BLD",7921,6.3) -10 -"BLD",7921,"KRN",0) +"BLD",8490,6.3) +11 +"BLD",8490,"ABPKG") +n +"BLD",8490,"KRN",0) ^9.67PA^779.2^20 -"BLD",7921,"KRN",.4,0) +"BLD",8490,"KRN",.4,0) .4 -"BLD",7921,"KRN",.4,"NM",0) +"BLD",8490,"KRN",.4,"NM",0) ^9.68A^1^1 -"BLD",7921,"KRN",.4,"NM",1,0) +"BLD",8490,"KRN",.4,"NM",1,0) C0X PRINT GRAPH FILE #172.101^172.101^0 -"BLD",7921,"KRN",.4,"NM","B","C0X PRINT GRAPH FILE #172.101",1) +"BLD",8490,"KRN",.4,"NM","B","C0X PRINT GRAPH FILE #172.101",1) -"BLD",7921,"KRN",.401,0) +"BLD",8490,"KRN",.401,0) .401 -"BLD",7921,"KRN",.402,0) +"BLD",8490,"KRN",.402,0) .402 -"BLD",7921,"KRN",.403,0) +"BLD",8490,"KRN",.403,0) .403 -"BLD",7921,"KRN",.5,0) +"BLD",8490,"KRN",.5,0) .5 -"BLD",7921,"KRN",.84,0) +"BLD",8490,"KRN",.84,0) .84 -"BLD",7921,"KRN",3.6,0) +"BLD",8490,"KRN",3.6,0) 3.6 -"BLD",7921,"KRN",3.8,0) +"BLD",8490,"KRN",3.8,0) 3.8 -"BLD",7921,"KRN",9.2,0) +"BLD",8490,"KRN",9.2,0) 9.2 -"BLD",7921,"KRN",9.8,0) +"BLD",8490,"KRN",9.8,0) 9.8 -"BLD",7921,"KRN",9.8,"NM",0) +"BLD",8490,"KRN",9.8,"NM",0) ^9.68A^8^8 -"BLD",7921,"KRN",9.8,"NM",1,0) +"BLD",8490,"KRN",9.8,"NM",1,0) C0XMAIN^^0^B115393527 -"BLD",7921,"KRN",9.8,"NM",2,0) +"BLD",8490,"KRN",9.8,"NM",2,0) C0XF2N^^0^B367797666 -"BLD",7921,"KRN",9.8,"NM",3,0) +"BLD",8490,"KRN",9.8,"NM",3,0) C0XTEST^^0^B14490662 -"BLD",7921,"KRN",9.8,"NM",4,0) +"BLD",8490,"KRN",9.8,"NM",4,0) C0XINIT^^0^B21176787 -"BLD",7921,"KRN",9.8,"NM",5,0) +"BLD",8490,"KRN",9.8,"NM",5,0) C0XUTIL^^0^B11676522 -"BLD",7921,"KRN",9.8,"NM",6,0) -C0XTKSB^^0^B17580555 -"BLD",7921,"KRN",9.8,"NM",7,0) -C0XRDF^^0^B4392 -"BLD",7921,"KRN",9.8,"NM",8,0) -C0XGET1^^0^B4808799 -"BLD",7921,"KRN",9.8,"NM","B","C0XF2N",2) +"BLD",8490,"KRN",9.8,"NM",6,0) +C0XTKSB^^0^B17753558 +"BLD",8490,"KRN",9.8,"NM",7,0) +C0XRDF^^0^B9306574 +"BLD",8490,"KRN",9.8,"NM",8,0) +C0XGET1^^0^B237497267 +"BLD",8490,"KRN",9.8,"NM","B","C0XF2N",2) -"BLD",7921,"KRN",9.8,"NM","B","C0XGET1",8) +"BLD",8490,"KRN",9.8,"NM","B","C0XGET1",8) -"BLD",7921,"KRN",9.8,"NM","B","C0XINIT",4) +"BLD",8490,"KRN",9.8,"NM","B","C0XINIT",4) -"BLD",7921,"KRN",9.8,"NM","B","C0XMAIN",1) +"BLD",8490,"KRN",9.8,"NM","B","C0XMAIN",1) -"BLD",7921,"KRN",9.8,"NM","B","C0XRDF",7) +"BLD",8490,"KRN",9.8,"NM","B","C0XRDF",7) -"BLD",7921,"KRN",9.8,"NM","B","C0XTEST",3) +"BLD",8490,"KRN",9.8,"NM","B","C0XTEST",3) -"BLD",7921,"KRN",9.8,"NM","B","C0XTKSB",6) +"BLD",8490,"KRN",9.8,"NM","B","C0XTKSB",6) -"BLD",7921,"KRN",9.8,"NM","B","C0XUTIL",5) +"BLD",8490,"KRN",9.8,"NM","B","C0XUTIL",5) -"BLD",7921,"KRN",19,0) +"BLD",8490,"KRN",19,0) 19 -"BLD",7921,"KRN",19.1,0) +"BLD",8490,"KRN",19.1,0) 19.1 -"BLD",7921,"KRN",101,0) +"BLD",8490,"KRN",101,0) 101 -"BLD",7921,"KRN",409.61,0) +"BLD",8490,"KRN",409.61,0) 409.61 -"BLD",7921,"KRN",771,0) +"BLD",8490,"KRN",771,0) 771 -"BLD",7921,"KRN",779.2,0) +"BLD",8490,"KRN",779.2,0) 779.2 -"BLD",7921,"KRN",870,0) +"BLD",8490,"KRN",870,0) 870 -"BLD",7921,"KRN",8989.51,0) +"BLD",8490,"KRN",8989.51,0) 8989.51 -"BLD",7921,"KRN",8989.52,0) +"BLD",8490,"KRN",8989.52,0) 8989.52 -"BLD",7921,"KRN",8994,0) +"BLD",8490,"KRN",8994,0) 8994 -"BLD",7921,"KRN","B",.4,.4) +"BLD",8490,"KRN","B",.4,.4) -"BLD",7921,"KRN","B",.401,.401) +"BLD",8490,"KRN","B",.401,.401) -"BLD",7921,"KRN","B",.402,.402) +"BLD",8490,"KRN","B",.402,.402) -"BLD",7921,"KRN","B",.403,.403) +"BLD",8490,"KRN","B",.403,.403) -"BLD",7921,"KRN","B",.5,.5) +"BLD",8490,"KRN","B",.5,.5) -"BLD",7921,"KRN","B",.84,.84) +"BLD",8490,"KRN","B",.84,.84) -"BLD",7921,"KRN","B",3.6,3.6) +"BLD",8490,"KRN","B",3.6,3.6) -"BLD",7921,"KRN","B",3.8,3.8) +"BLD",8490,"KRN","B",3.8,3.8) -"BLD",7921,"KRN","B",9.2,9.2) +"BLD",8490,"KRN","B",9.2,9.2) -"BLD",7921,"KRN","B",9.8,9.8) +"BLD",8490,"KRN","B",9.8,9.8) -"BLD",7921,"KRN","B",19,19) +"BLD",8490,"KRN","B",19,19) -"BLD",7921,"KRN","B",19.1,19.1) +"BLD",8490,"KRN","B",19.1,19.1) -"BLD",7921,"KRN","B",101,101) +"BLD",8490,"KRN","B",101,101) -"BLD",7921,"KRN","B",409.61,409.61) +"BLD",8490,"KRN","B",409.61,409.61) -"BLD",7921,"KRN","B",771,771) +"BLD",8490,"KRN","B",771,771) -"BLD",7921,"KRN","B",779.2,779.2) +"BLD",8490,"KRN","B",779.2,779.2) -"BLD",7921,"KRN","B",870,870) +"BLD",8490,"KRN","B",870,870) -"BLD",7921,"KRN","B",8989.51,8989.51) +"BLD",8490,"KRN","B",8989.51,8989.51) -"BLD",7921,"KRN","B",8989.52,8989.52) +"BLD",8490,"KRN","B",8989.52,8989.52) -"BLD",7921,"KRN","B",8994,8994) +"BLD",8490,"KRN","B",8994,8994) +"BLD",8490,"QUES",0) +^9.62^^ +"BLD",8490,"REQB",0) +^9.611^^ "FIA",172.101) C0X TRIPLE "FIA",172.101,0) @@ -158,6 +168,8 @@ y^y^f^^^^n "FIA",172.101,0,"RLRO") +"FIA",172.101,0,"VR") +1.0^FILEMAN TRIPLE STORE "FIA",172.101,172.101) 0 "FIA",172.101,172.1011) @@ -176,6 +188,8 @@ y^y^f^^^^n "FIA",172.201,0,"RLRO") +"FIA",172.201,0,"VR") +1.0^FILEMAN TRIPLE STORE "FIA",172.201,172.201) 0 "FIA",172.201,172.2011) @@ -398,13 +412,13 @@ K ^C0X(201,"B") ^.114IA^1^1 "IX",172.201,172.201,"B",11.1,1,0) 1^F^172.201^.01^240^1^F -"KRN",.4,1511,-1) +"KRN",.4,1513,-1) 0^1 -"KRN",.4,1511,0) +"KRN",.4,1513,0) C0X PRINT GRAPH^3111207.1727^@^172.101^^@^3120605 -"KRN",.4,1511,"F",1) +"KRN",.4,1513,"F",1) .03;W25;S~.04;C28;W25~.05;C54;W24~ -"KRN",.4,1511,"H") +"KRN",.4,1513,"H") C0X TRIPLE LIST "MBREQ") 0 @@ -412,6 +426,24 @@ C0X TRIPLE LIST .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 +"PKG",219,-1) +1^1 +"PKG",219,0) +FILEMAN TRIPLE STORE^C0X^Triple Store based on Fileman +"PKG",219,20,0) +^9.402P^^ +"PKG",219,22,0) +^9.49I^1^1 +"PKG",219,22,1,0) +1.0^3120926 +"PKG",219,22,1,1,0) +^^1^1^3120926 +"PKG",219,22,1,1,1,0) +Version 1.0 +"PKG",219,"DEV") +GPL/WV +"PKG",219,"VERSION") +1.0 "QUES","XPF1",0) Y "QUES","XPF1","??") @@ -489,7 +521,7 @@ D XPZ2^XPDIQ "RTN","C0XF2N",1,0) C0XF2N ; GPL - Fileman Triples entry point routine ;10/13/11 17:05 "RTN","C0XF2N",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 10 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11 "RTN","C0XF2N",3,0) ;Copyright 2011 George Lilly. Licensed under the terms of the GNU "RTN","C0XF2N",4,0) @@ -1885,11 +1917,11 @@ UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS "RTN","C0XF2N",699,0) ; "RTN","C0XGET1") -0^8^B4808799 +0^8^B237497267 "RTN","C0XGET1",1,0) C0XGET1 ; GPL - Fileman Triples entry point routine ;1/12/12 17:05 "RTN","C0XGET1",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 10 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11 "RTN","C0XGET1",3,0) ;Copyright 2011 George Lilly. Licensed under the terms of the GNU "RTN","C0XGET1",4,0) @@ -2015,7 +2047,7 @@ STR(ZIN,C0XFARY) ; EXTRINSIC RETURNS A STRING "RTN","C0XGET1",64,0) ; "RTN","C0XGET1",65,0) -SPO(ZRTN,ZNODE,C0XFARY) +SPO(ZRTN,ZNODE,C0XFARY) "RTN","C0XGET1",66,0) I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY") "RTN","C0XGET1",67,0) @@ -2627,7 +2659,7 @@ trip(triprtn,nsub,npred,nobj,ngraph,fary) ; returns triples iens "RTN","C0XGET1",370,0) ; "RTN","C0XGET1",371,0) -do0(dortn,zt,zi,z1,z2,z3) +do0(dortn,zt,zi,z1,z2,z3) "RTN","C0XGET1",372,0) ; looking for only one triple "RTN","C0XGET1",373,0) @@ -2865,7 +2897,7 @@ tagRoot(ztag) ; extrinsic which returns the root for graphs and subjects "RTN","C0XINIT",1,0) C0XINIT ; GPL - Fileman Triples initialization routine ;10/13/11 17:05 "RTN","C0XINIT",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 10 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11 "RTN","C0XINIT",3,0) ;Copyright 2011 George Lilly. Licensed under the terms of the GNU "RTN","C0XINIT",4,0) @@ -3101,7 +3133,7 @@ INIT ; INITIALIZE THE TRIPLE STORE - THIS DELETES THE GLOBALS AND "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 10 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11 "RTN","C0XMAIN",3,0) ;Copyright 2011 George Lilly. Licensed under the terms of the GNU "RTN","C0XMAIN",4,0) @@ -3853,11 +3885,11 @@ UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS "RTN","C0XMAIN",377,0) ; "RTN","C0XRDF") -0^7^B4392 +0^7^B9306574 "RTN","C0XRDF",1,0) C0XRDF ; GPL - Fileman Triples RDF out ;11/07/11 17:05 "RTN","C0XRDF",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 10 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11 "RTN","C0XRDF",3,0) ;Copyright 2012 George Lilly. Licensed under the terms of the GNU "RTN","C0XRDF",4,0) @@ -3897,7 +3929,7 @@ C0XRDF ; GPL - Fileman Triples RDF out ;11/07/11 17:05 "RTN","C0XRDF",21,0) ; "RTN","C0XRDF",22,0) -REPLYSTART(ZARY); +REPLYSTART(ZARY); "RTN","C0XRDF",23,0) D ADD(ZARY,"") "RTN","C0XRDF",24,0) @@ -3907,13 +3939,13 @@ REPLYSTART(ZARY); "RTN","C0XRDF",26,0) ; "RTN","C0XRDF",27,0) -LISTSTART(ZARY,ZNAM) +LISTSTART(ZARY,ZNAM) "RTN","C0XRDF",28,0) Q "RTN","C0XRDF",29,0) ; "RTN","C0XRDF",30,0) -DICTSTART(ZARY,ZSUB) +DICTSTART(ZARY,ZSUB) "RTN","C0XRDF",31,0) I ZSUB["http" D Q ; "RTN","C0XRDF",32,0) @@ -3929,7 +3961,7 @@ DICTSTART(ZARY,ZSUB) "RTN","C0XRDF",37,0) ; "RTN","C0XRDF",38,0) -DASSERT(ZARY,ZPRED,ZOBJ) +DASSERT(ZARY,ZPRED,ZOBJ) "RTN","C0XRDF",39,0) I ZPRED[":" D Q ; "RTN","C0XRDF",40,0) @@ -3969,7 +4001,7 @@ DASSERT(ZARY,ZPRED,ZOBJ) "RTN","C0XRDF",57,0) ; "RTN","C0XRDF",58,0) -DICTEND(ZARY) +DICTEND(ZARY) "RTN","C0XRDF",59,0) D ADD(ZARY,"") "RTN","C0XRDF",60,0) @@ -3977,13 +4009,13 @@ DICTEND(ZARY) "RTN","C0XRDF",61,0) ; "RTN","C0XRDF",62,0) -LISTEND(ZARY) +LISTEND(ZARY) "RTN","C0XRDF",63,0) Q "RTN","C0XRDF",64,0) ; "RTN","C0XRDF",65,0) -REPLYEND(ZARY) +REPLYEND(ZARY) "RTN","C0XRDF",66,0) D ADD(ZARY,"") "RTN","C0XRDF",67,0) @@ -3991,7 +4023,7 @@ REPLYEND(ZARY) "RTN","C0XRDF",68,0) ; "RTN","C0XRDF",69,0) -ADD(ZARY,ZELE) +ADD(ZARY,ZELE) "RTN","C0XRDF",70,0) N ZI "RTN","C0XRDF",71,0) @@ -4037,7 +4069,7 @@ rdfout(rdfout,zary) ; "RTN","C0XTEST",1,0) C0XTEST ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05 "RTN","C0XTEST",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 10 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11 "RTN","C0XTEST",3,0) ;Copyright 2011 George Lilly. Licensed under the terms of the GNU "RTN","C0XTEST",4,0) @@ -4285,275 +4317,277 @@ BLKERR ; "RTN","C0XTEST",125,0) ; "RTN","C0XTKSB") -0^6^B17580555 +0^6^B17753558 "RTN","C0XTKSB",1,0) C0XTESTKSB ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05 "RTN","C0XTKSB",2,0) - ; KSB - modified to fix a minor bug and to use;;;;;Build 10 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11 "RTN","C0XTKSB",3,0) - ; high resolution time if routines available ; 11/19/11 1410 EST + ; KSB - modified to fix a minor bug and to use;;;;;Build 10 "RTN","C0XTKSB",4,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 1 + ; high resolution time if routines available ; 11/19/11 1410 EST "RTN","C0XTKSB",5,0) - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU + ;;0.1;C0X;nopatch;noreleasedate;Build 1 "RTN","C0XTKSB",6,0) - ;General Public License See attached copy of the License. + ;Copyright 2011 George Lilly. Licensed under the terms of the GNU "RTN","C0XTKSB",7,0) - ; + ;General Public License See attached copy of the License. "RTN","C0XTKSB",8,0) - ;This program is free software; you can redistribute it and/or modify + ; "RTN","C0XTKSB",9,0) - ;it under the terms of the GNU General Public License as published by + ;This program is free software; you can redistribute it and/or modify "RTN","C0XTKSB",10,0) - ;the Free Software Foundation; either version 2 of the License, or + ;it under the terms of the GNU General Public License as published by "RTN","C0XTKSB",11,0) - ;(at your option) any later version. + ;the Free Software Foundation; either version 2 of the License, or "RTN","C0XTKSB",12,0) - ; + ;(at your option) any later version. "RTN","C0XTKSB",13,0) - ;This program is distributed in the hope that it will be useful, + ; "RTN","C0XTKSB",14,0) - ;but WITHOUT ANY WARRANTY; without even the implied warranty of + ;This program is distributed in the hope that it will be useful, "RTN","C0XTKSB",15,0) - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ;but WITHOUT ANY WARRANTY; without even the implied warranty of "RTN","C0XTKSB",16,0) - ;GNU General Public License for more details. + ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "RTN","C0XTKSB",17,0) - ; + ;GNU General Public License for more details. "RTN","C0XTKSB",18,0) - ;You should have received a copy of the GNU General Public License along + ; "RTN","C0XTKSB",19,0) - ;with this program; if not, write to the Free Software Foundation, Inc., + ;You should have received a copy of the GNU General Public License along "RTN","C0XTKSB",20,0) - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ;with this program; if not, write to the Free Software Foundation, Inc., "RTN","C0XTKSB",21,0) - ; + ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. "RTN","C0XTKSB",22,0) - Q + ; "RTN","C0XTKSB",23,0) - ; + Q "RTN","C0XTKSB",24,0) -EN ; run the test + ; "RTN","C0XTKSB",25,0) - ; +EN ; run the test "RTN","C0XTKSB",26,0) - k C0XFDA ; clear the node variable + ; "RTN","C0XTKSB",27,0) - s U="^" ; initialization - Bhaskar 20111119 + k C0XFDA ; clear the node variable "RTN","C0XTKSB",28,0) - i '$d(^C0X(101,0)) d ; global doesn't exist + s U="^" ; initialization - Bhaskar 20111119 "RTN","C0XTKSB",29,0) - . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1" + i '$d(^C0X(101,0)) d ; global doesn't exist "RTN","C0XTKSB",30,0) - n zg + . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1" "RTN","C0XTKSB",31,0) - S zg="_:G"_$$LKY9 ; all nodes are in the same graph + n zg "RTN","C0XTKSB",32,0) - n zi + S zg="_:G"_$$LKY9 ; all nodes are in the same graph "RTN","C0XTKSB",33,0) - f zi=1:1:10000 d ; try a test of 10000 nodes + n zi "RTN","C0XTKSB",34,0) - . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name + f zi=1:1:10000 d ; try a test of 10000 nodes "RTN","C0XTKSB",35,0) - . s C0XFDA(172.101,zi,.02)=zg + . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name "RTN","C0XTKSB",36,0) - . s C0XFDA(172.101,zi,.03)=$R(100000) + . s C0XFDA(172.101,zi,.02)=zg "RTN","C0XTKSB",37,0) - . s C0XFDA(172.101,zi,.04)=$R(100000) + . s C0XFDA(172.101,zi,.03)=$R(100000) "RTN","C0XTKSB",38,0) - . s C0XFDA(172.101,zi,.05)=$R(100000) + . s C0XFDA(172.101,zi,.04)=$R(100000) "RTN","C0XTKSB",39,0) - S C0XST=$$H ; start of the insertion test + . s C0XFDA(172.101,zi,.05)=$R(100000) "RTN","C0XTKSB",40,0) - W !,"INSERTION STARTS AT ",$ZDATE(C0XST,"YEAR-MM-DD:24:60:SS"),! + S C0XST=$$H ; start of the insertion test "RTN","C0XTKSB",41,0) - d BULKLOAD(.C0XFDA) + W !,"INSERTION STARTS AT ",$ZDATE(C0XST,"YEAR-MM-DD:24:60:SS"),! "RTN","C0XTKSB",42,0) - s C0XEND=$$H ; end of the insertion test + d BULKLOAD(.C0XFDA) "RTN","C0XTKSB",43,0) - W !,"INSERTION ENDS AT ",$ZDATE(C0XEND,"YEAR-MM-DD:24:60:SS") + s C0XEND=$$H ; end of the insertion test "RTN","C0XTKSB",44,0) - S C0XDIFF=(86400*($P(C0XEND,",",1)-$P(C0XST,",",1)))+$P(C0XEND,",",2)-$P(C0XST,",",2) + W !,"INSERTION ENDS AT ",$ZDATE(C0XEND,"YEAR-MM-DD:24:60:SS") "RTN","C0XTKSB",45,0) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" + S C0XDIFF=(86400*($P(C0XEND,",",1)-$P(C0XST,",",1)))+$P(C0XEND,",",2)-$P(C0XST,",",2) "RTN","C0XTKSB",46,0) - W ! + W !," ELAPSED TIME: ",C0XDIFF," SECONDS" "RTN","C0XTKSB",47,0) - W:C0XDIFF>0 " APPROXIMATELY ",$FN(10000/C0XDIFF,",",0)," NODES PER SECOND",! + W ! "RTN","C0XTKSB",48,0) - q + W:C0XDIFF>0 " APPROXIMATELY ",$FN(10000/C0XDIFF,",",0)," NODES PER SECOND",! "RTN","C0XTKSB",49,0) - ; + q "RTN","C0XTKSB",50,0) -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING + ; "RTN","C0XTKSB",51,0) - ; UNIQUE NODE AND GRAPH NAMES +LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING "RTN","C0XTKSB",52,0) - N ZN,ZI -"RTN","C0XTKSB",53,0) - S ZN="" -"RTN","C0XTKSB",54,0) - F ZI=1:1:9 D ; -"RTN","C0XTKSB",55,0) - . S ZN=ZN_$R(10) -"RTN","C0XTKSB",56,0) - Q ZN -"RTN","C0XTKSB",57,0) - ; -"RTN","C0XTKSB",58,0) -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING -"RTN","C0XTKSB",59,0) ; UNIQUE NODE AND GRAPH NAMES -"RTN","C0XTKSB",60,0) +"RTN","C0XTKSB",53,0) N ZN,ZI -"RTN","C0XTKSB",61,0) +"RTN","C0XTKSB",54,0) S ZN="" -"RTN","C0XTKSB",62,0) - F ZI=1:1:17 D ; -"RTN","C0XTKSB",63,0) +"RTN","C0XTKSB",55,0) + F ZI=1:1:9 D ; +"RTN","C0XTKSB",56,0) . S ZN=ZN_$R(10) -"RTN","C0XTKSB",64,0) +"RTN","C0XTKSB",57,0) Q ZN +"RTN","C0XTKSB",58,0) + ; +"RTN","C0XTKSB",59,0) +LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING +"RTN","C0XTKSB",60,0) + ; UNIQUE NODE AND GRAPH NAMES +"RTN","C0XTKSB",61,0) + N ZN,ZI +"RTN","C0XTKSB",62,0) + S ZN="" +"RTN","C0XTKSB",63,0) + F ZI=1:1:17 D ; +"RTN","C0XTKSB",64,0) + . S ZN=ZN_$R(10) "RTN","C0XTKSB",65,0) - ; + Q ZN "RTN","C0XTKSB",66,0) -BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 + ; "RTN","C0XTKSB",67,0) - ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE +BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 "RTN","C0XTKSB",68,0) - ; QUITS IF FILE IS NOT 172.101 + ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE "RTN","C0XTKSB",69,0) - ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 + ; QUITS IF FILE IS NOT 172.101 "RTN","C0XTKSB",70,0) - ; QUITS IF FIRST ENTRY IS NOT IENS 1 + ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 "RTN","C0XTKSB",71,0) - ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES + ; QUITS IF FIRST ENTRY IS NOT IENS 1 "RTN","C0XTKSB",72,0) - ; ZBFDA IS PASSED BY REFERENCE + ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES "RTN","C0XTKSB",73,0) - ; + ; ZBFDA IS PASSED BY REFERENCE "RTN","C0XTKSB",74,0) - ; -- reserves a block of iens from file 172.101 by locking the zero node + ; "RTN","C0XTKSB",75,0) - ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 + ; -- reserves a block of iens from file 172.101 by locking the zero node "RTN","C0XTKSB",76,0) - ; -- then unlocking to minimize the duration of the lock + ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 "RTN","C0XTKSB",77,0) - ; + ; -- then unlocking to minimize the duration of the lock "RTN","C0XTKSB",78,0) - W !,"USING BULKLOAD" + ; "RTN","C0XTKSB",79,0) - I '$D(ZBFDA) Q ; EMPTY FDA + W !,"USING BULKLOAD" "RTN","C0XTKSB",80,0) - I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE + I '$D(ZBFDA) Q ; EMPTY FDA "RTN","C0XTKSB",81,0) - N ZCNT,ZP3,ZP4 + I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE "RTN","C0XTKSB",82,0) - ; -- find the number of nodes to insert + N ZCNT,ZP3,ZP4 "RTN","C0XTKSB",83,0) - S ZCNT=$O(ZBFDA(172.101,""),-1) + ; -- find the number of nodes to insert "RTN","C0XTKSB",84,0) - I ZCNT="" D Q ; + S ZCNT=$O(ZBFDA(172.101,""),-1) "RTN","C0XTKSB",85,0) - . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" + I ZCNT="" D Q ; "RTN","C0XTKSB",86,0) - . B + . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" "RTN","C0XTKSB",87,0) - ; -- lock the zero node and reserve a block of iens to insert + . B "RTN","C0XTKSB",88,0) - W !,"LOCKING ZERO NODE" + ; -- lock the zero node and reserve a block of iens to insert "RTN","C0XTKSB",89,0) - LOCK +^C0X(101,0) + W !,"LOCKING ZERO NODE" "RTN","C0XTKSB",90,0) - S ZP3=$P(^C0X(101,0),U,3) + LOCK +^C0X(101,0) "RTN","C0XTKSB",91,0) - S ZP4=$P(^C0X(101,0),U,4) + S ZP3=$P(^C0X(101,0),U,3) "RTN","C0XTKSB",92,0) - S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 + S ZP4=$P(^C0X(101,0),U,4) "RTN","C0XTKSB",93,0) - S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 + S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 "RTN","C0XTKSB",94,0) - LOCK -^C0X(101,0) + S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 "RTN","C0XTKSB",95,0) - N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE + LOCK -^C0X(101,0) "RTN","C0XTKSB",96,0) - S ZBASE=ZP3 ; the last ien in the file + N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE "RTN","C0XTKSB",97,0) - W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT + S ZBASE=ZP3 ; the last ien in the file "RTN","C0XTKSB",98,0) - W !,$ZDATE($$H,"YEAR-MM-DD:24:60:SS") + W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT "RTN","C0XTKSB",99,0) - S ZI="" + W !,$ZDATE($$H,"YEAR-MM-DD:24:60:SS") "RTN","C0XTKSB",100,0) - F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; + S ZI="" "RTN","C0XTKSB",101,0) - . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name + F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; "RTN","C0XTKSB",102,0) - . I ZN="" D BLKERR Q ; + . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name "RTN","C0XTKSB",103,0) - . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer + . I ZN="" D BLKERR Q ; "RTN","C0XTKSB",104,0) - . I ZG="" D BLKERR Q ; + . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer "RTN","C0XTKSB",105,0) - . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer + . I ZG="" D BLKERR Q ; "RTN","C0XTKSB",106,0) - . I ZS="" D BLKERR Q ; + . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer "RTN","C0XTKSB",107,0) - . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer + . I ZS="" D BLKERR Q ; "RTN","C0XTKSB",108,0) - . I ZP="" D BLKERR Q ; + . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer "RTN","C0XTKSB",109,0) - . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer + . I ZP="" D BLKERR Q ; "RTN","C0XTKSB",110,0) - . I ZO="" D BLKERR Q ; + . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer "RTN","C0XTKSB",111,0) - . S ZIEN=ZI+ZBASE ; the new ien + . I ZO="" D BLKERR Q ; "RTN","C0XTKSB",112,0) - . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node + . S ZIEN=ZI+ZBASE ; the new ien "RTN","C0XTKSB",113,0) - . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index + . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node "RTN","C0XTKSB",114,0) - . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index + . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index "RTN","C0XTKSB",115,0) - . S ^C0X(101,"SPO",ZS,ZP,ZO)="" + . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index "RTN","C0XTKSB",116,0) - . S ^C0X(101,"SOP",ZS,ZO,ZP)="" + . S ^C0X(101,"SPO",ZS,ZP,ZO)="" "RTN","C0XTKSB",117,0) - . S ^C0X(101,"OPS",ZO,ZP,ZS)="" + . S ^C0X(101,"SOP",ZS,ZO,ZP)="" "RTN","C0XTKSB",118,0) - . S ^C0X(101,"OSP",ZO,ZS,ZP)="" + . S ^C0X(101,"OPS",ZO,ZP,ZS)="" "RTN","C0XTKSB",119,0) - . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" + . S ^C0X(101,"OSP",ZO,ZS,ZP)="" "RTN","C0XTKSB",120,0) - . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" + . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" "RTN","C0XTKSB",121,0) - . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" + . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" "RTN","C0XTKSB",122,0) - . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" + . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" "RTN","C0XTKSB",123,0) - Q + . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" "RTN","C0XTKSB",124,0) - ; -"RTN","C0XTKSB",125,0) -BLKERR ; -"RTN","C0XTKSB",126,0) - W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) -"RTN","C0XTKSB",127,0) - B -"RTN","C0XTKSB",128,0) Q -"RTN","C0XTKSB",129,0) +"RTN","C0XTKSB",125,0) ; +"RTN","C0XTKSB",126,0) +BLKERR ; +"RTN","C0XTKSB",127,0) + W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) +"RTN","C0XTKSB",128,0) + B +"RTN","C0XTKSB",129,0) + Q "RTN","C0XTKSB",130,0) -H() + ; "RTN","C0XTKSB",131,0) +H() +"RTN","C0XTKSB",132,0) quit:$length($ztrnlnm("GTMXC_posix"))&$length($text(zhorolog^%POSIX)) $$zhorolog^%POSIX quit $horolog "RTN","C0XUTIL") 0^5^B11676522 "RTN","C0XUTIL",1,0) C0XUTIL ; GPL - Fileman Triples utilities ;11/07/11 17:05 "RTN","C0XUTIL",2,0) - ;;0.1;C0X;nopatch;noreleasedate;Build 10 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 11 "RTN","C0XUTIL",3,0) ;Copyright 2011 George Lilly. Licensed under the terms of the GNU "RTN","C0XUTIL",4,0) diff --git a/p/C0XF2N.m b/p/C0XF2N.m index 539ffe5..47ab858 100644 --- a/p/C0XF2N.m +++ b/p/C0XF2N.m @@ -1,699 +1,699 @@ -C0XF2N ; GPL - Fileman Triples entry point routine ;10/13/11 17:05 - ;;0.1;C0X;nopatch;noreleasedate;Build 7 - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. - ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. - ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. - ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - ; - Q - ; - ; This is based on C0XMAIN but experiments with a fast load for triples - ; that will write directly to the fileman global - ; The file 172.101 is a F2N design style for triples, which means - ; that it is a Flat file with no subfiles, all fields at the root - ; ... it is a "2" file solution which means all strings are stored in - ; ... strings file and pointed to by the triples file - ; ... it is an N file because it has generated Node IDs instead of - ; ... DINUM which would use the IEN for the Node ID. - ; gpl 11/04/2011 - ; -INITFARY(ZFARY) ; INITIALIZE FILE NUMBERS AND OTHER USEFUL THINGS - ; FOR THE DEFAULT TRIPLE STORE. USE OTHER VALUES FOR SUPPORTING ADDITIONAL - ; TRIPLE STORES - I $D(@ZFARY) Q ; ALREADY INITIALIZED - S @ZFARY@("C0XTFN")=172.101 ; TRIPLES FILE NUMBER - S @ZFARY@("C0XSFN")=172.201 ; TRIPLES STRINGS FILE NUMBER - S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME - S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME - S @ZFARY@("C0XDIR")="/home/glilly/fmts/trunk/samples/smart-new/" - S @ZFARY@("BLKLOAD")=1 ; this file supports block load - S @ZFARY@("FMTSSTYLE")="F2N" ; fileman style - S @ZFARY@("REPLYFMT")="JSON" - D USEFARY(ZFARY) - Q - ; -USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY - N ZI S ZI="" - F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D - . ;N ZX - . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_"""" - . ;W !,ZX - . X ZX - Q - ; -FILEIN ; INTERACTIVE ENTRY POINT FOR OPTION TO READ IN A FILE - I '$D(C0XFARY) D INITFARY("C0XFARY") - D USEFARY("C0XFARY") - S DIR(0)="F^3:240" - S DIR("A")="File Directory" - S DIR("B")=C0XDIR - D ^DIR - I Y="^" Q ; - S C0XDIR=Y - S C0XFARY("C0XDIR")=Y - S DIR(0)="F^3:240" - S DIR("A")="File Name" - I '$D(C0XFN) S DIR("B")="qds.rdf" - E S DIR("B")=C0XFN - D ^DIR - I Y="" Q ; - I Y="^" Q ; - S C0XFN=Y - D IMPORT(C0XFN,C0XDIR,,"C0XFARY") - K C0XFDA - Q - ; -IMPORT(FNAME,INDIR,INURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD - ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE - ; NODE NAME OF THE TEXT TRIPLE - ; INDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR) - ; INURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE - ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - N ZD,ZTMP - I '$D(INDIR) S INDIR=C0XDIR ; DIRECTORY OF THE RDF FILE - I $G(INURL)="" D ; - . ;N ZN2 S ZN2=$P(FNAME,".",1)_"_"_$P(FNAME,".",2) ; REMOVE THE DOT - . ;S INURL=FDIR_ZN2 - . S INURL=INDIR_FNAME - N ZTMP - S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE - K @ZTMP ; MAKE SURE IT'S CLEAR - S C0XSTART=$$NOW^XLFDT - W !,"STARTED: ",C0XSTART - W !,"READING IN: ",FNAME - I '$$FILEREAD(ZTMP,INDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS - . W !,"ERROR READING FILE: ",INDIR,FNAME - S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT - W !,$O(@ZRDF@(""),-1)," LINES READ" - D INSRDF(ZRDF,INURL,FARY) ; IMPORT AND PROCESS THE RDF - K INURL - K C0XFDA - ;K ^TMP("MXMLDOM",$J) - Q - ; -WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT - ; - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - ;N ZLOC,ZTMP - K ZTMP - S ZLOC=$NA(^TMP("C0X","WGET",$J)) - K @ZLOC - S C0XSTART=$$NOW^XLFDT - W !,"STARTED: ",C0XSTART - W !,"DOWNLOADING: ",ZURL - S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP) - M @ZLOC=ZTMP - S C0XLINES=$O(@ZLOC@(""),-1) - W !,C0XLINES," LINES READ" - S C0XDLC=$$NOW^XLFDT ; DOWNLOAD COMPLETE - W !,"DOWNLOAD COMPLETE AT ",C0XDLC - S C0XDIFF=$$FMDIFF^XLFDT(C0XDLC,C0XSTART,2) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" - I C0XDIFF'=0 W !," APPROXIMATELY ",$P(C0XLINES/C0XDIFF,".")," LINES PER SEC" - D INSRDF(ZLOC,ZURL,FARY) - Q - ; -INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS - ; ZRDF IS PASSED BY NAME - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - S BATCNT=0 ; BATCH COUNTER - S BATMAX=10000 ; TRY BATCHES OF THIS SIZE - N ZGRAPH,ZSUBJECT - S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME - S ZSUBJECT=$$ANONS() ; RANDOM ANOYMOUS SUBJECT - D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY) - N ZTXTNM - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE - D ADD(ZGRAPH,ZSUBJECT,"fmts:fileSource",ZTXTNM,FARY) - D ADD(ZGRAPH,ZSUBJECT,"fmts:fileTag",$$name2tag(ZNAME),FARY) - D SWUPDIE(.C0XFDA) ; TRY IT OUT - K C0XCNT ;RESET FOR NEXT TIME - D STORETXT(ZRDF,ZTXTNM,FARY) - W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:fileSource ",ZTXTNM - D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF - Q - ; -name2tag(zname) ; extrinsic which returns a tag derived from a name - ; /home/vista/project.xml ==> project - q $p($re($p($re(zname),"/")),".") - ; -STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME - ; - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - N ZIEN - S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN - D CLEAN^DILF - K ZERR - D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") - I $D(ZERR) D Q ; - . W !,"ERROR CREATING WORD PROCESSING FIELD" - . S C0XERR="ERROR CREATING WORD PROCESSING FIELD" - . D ^%ZTER ; error trap - Q - ; -GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT - ; ZRTN IS PASSED BY REFERENCE - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - N ZIEN - S ZIEN=$$IENOF(ZNAME) - S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") - Q - ; -WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL - ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - N ZIEN - S ZIEN=$$IENOF(ZNAME) - Q $NA(@C0XSN@(ZIEN,1)) - ; -FILEREAD(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH - ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT - ; IE ^TMP("C0X","FILEIN",1) - ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 - ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH - S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) - Q OK - ; -TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE - S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) - S ZGRAPH="/test/rdfFile" - S ZM="/test/rdfFile/meta" - D PROCESS(.G,ZIN,ZGRAPH,ZM) - Q - ; -VISTAOWL ; - S ZRDF=$NA(^TMP("C0X",542,"FILEIN")) - S ZNAME="/home/glilly/vistaowl/VistAOWL.owl" - S ZGRAPH="_:G431590209" - S FARY="C0XFARY" - D INITFARY(FARY) - S C0XDOCID=1 - S BATCNT=0 - S BATMAX=10000 - D PROCESS(.G,ZRDF,ZGRAPH,ZNAME,FARY) - Q - ; -PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA - ; - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - ;N BATCNT - ;N BATMAX - ; -- first parse the rdf file with the MXML parser - ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML - S C0XDLC2=$$NOW^XLFDT ; START OF PARSE - I @ZRDF@(1)'[" project + q $p($re($p($re(zname),"/")),".") + ; +STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME + ; + I '$D(FARY) D ; + . D INITFARY("C0XFARY") + . S FARY="C0XFARY" + D USEFARY(FARY) + N ZIEN + S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN + D CLEAN^DILF + K ZERR + D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") + I $D(ZERR) D Q ; + . W !,"ERROR CREATING WORD PROCESSING FIELD" + . S C0XERR="ERROR CREATING WORD PROCESSING FIELD" + . D ^%ZTER ; error trap + Q + ; +GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT + ; ZRTN IS PASSED BY REFERENCE + I '$D(FARY) D ; + . D INITFARY("C0XFARY") + . S FARY="C0XFARY" + D USEFARY(FARY) + N ZIEN + S ZIEN=$$IENOF(ZNAME) + S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") + Q + ; +WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL + ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING + I '$D(FARY) D ; + . D INITFARY("C0XFARY") + . S FARY="C0XFARY" + D USEFARY(FARY) + N ZIEN + S ZIEN=$$IENOF(ZNAME) + Q $NA(@C0XSN@(ZIEN,1)) + ; +FILEREAD(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH + ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT + ; IE ^TMP("C0X","FILEIN",1) + ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 + ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH + S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) + Q OK + ; +TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE + S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) + S ZGRAPH="/test/rdfFile" + S ZM="/test/rdfFile/meta" + D PROCESS(.G,ZIN,ZGRAPH,ZM) + Q + ; +VISTAOWL ; + S ZRDF=$NA(^TMP("C0X",542,"FILEIN")) + S ZNAME="/home/glilly/vistaowl/VistAOWL.owl" + S ZGRAPH="_:G431590209" + S FARY="C0XFARY" + D INITFARY(FARY) + S C0XDOCID=1 + S BATCNT=0 + S BATMAX=10000 + D PROCESS(.G,ZRDF,ZGRAPH,ZNAME,FARY) + Q + ; +PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE + ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING + ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE + ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS + ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA + ; + I '$D(FARY) D ; + . D INITFARY("C0XFARY") + . S FARY="C0XFARY" + D USEFARY(FARY) + ;N BATCNT + ;N BATMAX + ; -- first parse the rdf file with the MXML parser + ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML + S C0XDLC2=$$NOW^XLFDT ; START OF PARSE + I @ZRDF@(1)'[" "nodeID:1234" - n zin,zrtn - d subjects(.zin,$g(pred),$g(obj),$g(form),$g(fary)) - s zrtn=$o(zin("")) - i $o(zin(zrtn))'="" s zrtn="" - q zrtn - ; -preds(listrtn,sub,obj,graph,form,fary) ; return list of subjects - d onelist("P",$g(sub),,$g(obj),$g(fary)) ;subjects - q - ; -objects(listrtn,sub,pred,graph,form,fary) ; return list of subjects - d onelist("O",$g(sub),$g(pred),"",$g(fary)) ;subjects - q - ; -object(sub,pred,graph,form,fary) ; extrinsic which returns the first - ; multiple of return from objects - returns null if more than one - ; objects(.G,sub,pred) - ; G("location") ==> "location" - n zin,zrtn - d objects(.zin,$g(sub),$g(pred),$g(form),$g(fary)) - s zrtn=$o(zin("")) - i $o(zin(zrtn))'="" s zrtn="" - q zrtn - ; -onelist(zw,sub,pred,obj,fary) ; returns list - ; zw is S P or O depending on what should be returned - I $g(fary)="" D ; - . D INITFARY^C0XF2N("C0XFARY") - . S fary="C0XFARY" - D USEFARY^C0XF2N(fary) - I '$D(form) S form="json" - k listrtn ; start with a clean return - n zsub,zpred,zobj,zgraph,tmprtn - s zsub=$$IENOF($$EXT^C0XUTIL($g(sub)),fary) ; ien of sub - s zpred=$$IENOF($$EXT^C0XUTIL($g(pred)),fary) ; ien of pred - s zobj=$$IENOF($$EXT^C0XUTIL($g(obj)),fary) ; ien of obj - s zgraph=$$IENOF($g(graph),fary) ; ien of graph - I $G(DEBUG) W !,"s:",zsub," p:",zpred," o:",zobj - n c0xflag,zi,zx,zt - s zt=$na(^C0X(101)) ; - s c0xflag=$$mask(zsub,zpred,zobj) ; get mask flags - k tmprtn - n itbl,ii,ix - s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"OSP") ; no constraint - s itbl("I000",ii)="d zip(.tmprtn,zt,zi)" - s ii=$s(zw="S":"OSP",zw="P":"OPS",zw="O":"OSP") ; obj constraint - s ix=$s(zw="O":"d just(zobj)",1:"d zip1(.tmprtn,zt,zi,zobj)") - s itbl("I001",ii)=ix - s ii=$s(zw="S":"PSO",zw="P":"POS",zw="O":"POS") ; pred constraint - s ix=$s(zw="P":"d just(zpred)",1:"d zip1(.tmprtn,zt,zi,zpred)") - s itbl("I010",ii)=ix - s ii=$s(zw="S":"POS",zw="P":"OPS",zw="O":"OSP") ; pred + obj constraint - s ix=$s(zw="S":"d zip2(.tmprtn,zt,zi,zpred,zobj)",zw="P":"d just(zpred)",zw="O":"d just(zobj)",1:"d just(zobj)") - s itbl("I011",ii)=ix - s ii=$s(zw="S":"SPO",zw="P":"SPO",zw="O":"SOP") ; sub constraint - s ix=$s(zw="S":"d just(zsub)",1:"d zip1(.tmprtn,zt,zi,zsub)") - s itbl("I100",ii)=ix - s ii=$s(zw="S":"SPO",zw="P":"SOP",zw="O":"OSP") ; sub + obj constraint - s ix=$s(zw="P":"d zip2(.tmprtn,zt,zi,zsub,zobj)",zw="S":"d just(zsub)",zw="O":"d just(zobj)",1:"d just(zobj)") - s itbl("I101",ii)=ix - s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"SPO") ; sub + pred constraint - s ix=$s(zw="O":"d zip2(.tmprtn,zt,zi,zsub,zpred)",zw="S":"d just(zsub)",zw="P":"d just(zpred)",1:"d just(zsub)") - s itbl("I110",ii)=ix - s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"OSP") ; sub + pred + obj constraint - s ix=$s(zw="O":"d just(zobj)",zw="S":"d just(zsub)",zw="P":"d just(zpred)",1:"d just(zsub)") - s itbl("I111",ii)=ix - ; end itbl definition - ; - s zi=$o(itbl(c0xflag,"")) ; find index to use - s zx=itbl(c0xflag,zi) ; executable instruction to run - ;i $g(ngraph)'="" s zi="G"_zi ; this is wrong.. don't do graphs yet - i $g(DEBUG) w !,c0xflag," ",zw," ",zt," ",zi," ",zx,! - ;zwr itbl - x zx - k listrtn - d strings(.listrtn,"tmprtn") ; convert pointer to strings - q - ; -just(zin) ; add one element to tmprtn - s tmprtn(zin)="" - q - ; -zip(zrtn,zt,zi) ; pull out just the first element of the index - ; - n zii s zii="" - f s zii=$o(@zt@(zi,zii)) q:zii="" d ; - . s zrtn(zii)="" - q - ; -zip1(zrtn,zt,zi,zn) ; pull out just the first element of the index - ; - n zii s zii="" - f s zii=$o(@zt@(zi,zn,zii)) q:zii="" d ; - . s zrtn(zii)="" - q - ; -zip2(zrtn,zt,zi,zn,zn1) ; pull out just the first element of the index - ; - n zii s zii="" - f s zii=$o(@zt@(zi,zn,zn1,zii)) q:zii="" d ; - . s zrtn(zii)="" - q - ; -arrayout(rtn,zary) ; output an array of triples - ; - s zrsub="" - s zcnt=1 - f s zrsub=$o(zary(zrsub)) q:zrsub="" d ; organized by subject - . s zzz="" - . f s zzz=$o(zary(zrsub,zzz)) q:zzz="" d ; pred and obj - . . s rtn(zcnt)=zrsub_"^"_zzz - . . s zcnt=zcnt+1 - q - ; -rawout(rtn,zary) ; output a mumps array of triples - ; - s zrsub="" - ;s zcnt=1 - f s zrsub=$o(zary(zrsub)) q:zrsub="" d ; organized by subject - . s zzz="" - . f s zzz=$o(zary(zrsub,zzz)) q:zzz="" d ; pred and obj - . . s rtn(zrsub,$p(zzz,"^",1))=$p(zzz,"^",2) - . . ;s zcnt=zcnt+1 - q - ; -strings(zrary,zinary) ; convert pointers to strings - ; - k zrary - n zzz s zzz="" - f s zzz=$o(@zinary@(zzz)) q:zzz="" d ; - . n zs - . ;s zs=$$GET1^DIQ(C0XSFN,zzz_",",.01) - . s zs=$$NSP^C0XUTIL(zzz) ; get namespaced string - . q:zs="" - . s zrary(zs)="" ; - q - ; -ien2tary(zrary,zinary) ; zinary is an array of iens passed by name - ; zrary is passed by reference and is return array of triples - ; format zrary(zsub,"zpred^zobj")="" - ; - k zrary ; start out clean - n zzz,zrsub,zrpred,zrobj,zgraph,zcnt - s zzz="" - f s zzz=$o(@zinary@(zzz)) q:zzz="" d ; - . s zrsub=$$GET1^DIQ(C0XTFN,zzz_",",.03,"E") - . s zrpred=$$GET1^DIQ(C0XTFN,zzz_",",.04,"E") - . s zrobj=$$GET1^DIQ(C0XTFN,zzz_",",.05,"E") - . s zrgraph=$$GET1^DIQ(C0XTFN,zzz_",",.02,"E") - . s zrary(zrsub,zrpred_"^"_zrobj)="" - q - ; -jsonout(jout,zary) ; - d REPLYSTART^FMQLJSON("jout") - d LISTSTART^FMQLJSON("jout","results") - n zi s zi="" - f s zi=$o(zary(zi)) q:zi="" d ; for each subject - . n zii s zii="" - . D DICTSTART^FMQLJSON("jout",zi) - . f s zii=$o(zary(zi,zii)) q:zii="" d ; for each pred^obj pair - . . d DASSERT^FMQLJSON("jout",$p(zii,"^",1),$p(zii,"^",2)) - . D DICTEND^FMQLJSON("jout") - d LISTEND^FMQLJSON("jout") - d REPLYEND^FMQLJSON("jout") - q - ; -mask(zsub,zpred,zobj) ; function to return mask information - ; about the inputs ie I100 for just a subject and no pred or obj - n zf1,zf2,zf3,zflag - s zf1=$s($g(zsub)="":0,1:1) - s zf2=$s($g(zpred)="":0,1:1) - s zf3=$s($g(zobj)="":0,1:1) - s zflag="I"_zf1_zf2_zf3 - q zflag - ; -trip(triprtn,nsub,npred,nobj,ngraph,fary) ; returns triples iens - ; nsub,npred,nobj are all optional - ; graf is also optional, and will limit the search to a particular ngraph - ; fary is which triple store (not implemented yet) - n c0xflag,zi,zx,zt - s zt=$na(^C0X(101)) ; - s c0xflag=$$mask(nsub,npred,nobj) ; get mask flags - n itbl - s itbl("I000","SPO")="d do3(.triprtn,zt,zi)" - s itbl("I001","OSP")="d do2(.triprtn,zt,zi,nobj)" - s itbl("I010","PSO")="d do2(.triprtn,zt,zi,npred)" - s itbl("I011","POS")="d do1(.triprtn,zt,zi,npred,nobj)" - s itbl("I100","SPO")="d do2(.triprtn,zt,zi,nsub)" - s itbl("I101","SOP")="d do1(.triprtn,zt,zi,nsub,nobj)" - s itbl("I110","SPO")="d do1(.triprtn,zt,zi,nsub,npred)" - s itbl("I111","SPO")="d do0(.triprtn,zt,zi,nsub,npred,nobj)" - s zi=$o(itbl(c0xflag,"")) - s zx=itbl(c0xflag,zi) ; executable instruction to run - i $g(ngraph)'="" s zi="G"_zi - i $g(DEBUG) w !,zx - x zx - q - ; -do0(dortn,zt,zi,z1,z2,z3) - ; looking for only one triple - n zz - s zz=$o(@zt@(zi,z1,z2,z3,"")) - i zz'="" s dortn(zz)="" - q - ; -do1(dortn,zt,zi,z1,z2) ; have 2, looking for one - n zr,zx1 - s zx1="" - f s zx1=$o(@zt@(zi,z1,z2,zx1)) q:zx1="" d ; - . s zr=$o(@zt@(zi,z1,z2,zx1,"")) - . s dortn(zr)="" - q - ; -do2(dortn,zt,zi,z1) ; have one, looking for 2 - n zr,zx1,zx2 - s (zx1,zx2)="" - f s zx1=$o(@zt@(zi,z1,zx1)) q:zx1="" d ; - . f s zx2=$o(@zt@(zi,z1,zx1,zx2)) q:zx2="" d ; - . . s zr=$o(@zt@(zi,z1,zx1,zx2,"")) - . . s dortn(zr)="" - q - ; -do3(dortn,zt,zi) ; have none, looking for three - n zr,zx1,zx2,zx3 - s (zx1,zx2,zx3)="" - f s zx1=$o(@zt@(zi,zx1)) q:zx1="" d ; - . f s zx2=$o(@zt@(zi,zx1,zx2)) q:zx2="" d ; - . . f s zx3=$o(@zt@(zi,zx1,zx2,zx3)) q:zx3="" d ; - . . . s zr=$o(@zt@(zi,zx1,zx2,zx3,"")) - . . . s dortn(zr)="" - q - ; -IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE - I '$D(FARY) D ; - . D INITFARY^C0XF2N("C0XFARY") - . S FARY="C0XFARY" - N ZIEN - I $G(ZSTRING)="" Q "" ; NO STRING - S ZIEN=$O(@C0XSN@("B",$$EXT^C0XUTIL(ZSTRING),"")) - I ZIEN="" S ZIEN=-1 - Q ZIEN - ; -IENOFA(ZOUTARY,INARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE - ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" - I '$D(FARY) D ; - . D INITFARY^C0XF2N("C0XFARY") - . S FARY="C0XFARY" - K ZOUTARY ; START WITH CLEAN RESULTS - K C0XFDA2 ; USE A SEPARATE FDA FOR THIS - I '$D(C0XVOC) D VOCINIT^C0XUTIL - N ZINARY - N ZI S ZI="" - F S ZI=$O(INARY(ZI)) Q:ZI="" D ; - . N ZK - . S ZK=$O(INARY(ZI,"")) - . S ZINARY($$EXT^C0XUTIL(ZI),$$EXT^C0XUTIL(ZK))="" - N ZV,ZIEN - N ZCNT S ZCNT=0 - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS - . S ZV=$O(ZINARY(ZI,"")) - . I ZV["^" S ZV=$TR(ZV,"^","|") - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOW GET ALL IENS - . S ZV=$O(ZINARY(ZI,"")) - . I ZV["^" S ZV=$TR(ZV,"^","|") - . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW - . I ZIEN="" S ZOUTARY("IEN",ZI)="" - . E S ZOUTARY("IEN",ZI,ZIEN)="" - Q - ; -output(zwhat,zfname,zdir) ; function to write an array to a host file - ; if zdir is ommitted, will output to the CCR directory - ; ^TMP("C0CCCR","ODIR") - ; if fname is ommitted, will output yyyy-mm-dd-hh-mm-ss-C0XOUT.out - ; zwhat is passed by name - ; - i '$d(zdir) s zdir=$G(^TMP("C0CCCR","ODIR")) - i '$d(zfname) d ; - . s zfname=$$FMTE^XLFDT($$NOW^XLFDT,7) - . s zfname=$tr(zfname,"/","-") - . s zfname=$tr(zfname,"@","-") - . s zfname=$tr(zfname,":","-") - . s zfname=zfname_".out" - i $e(zwhat,1,1)'="^" d ; not a global - . k ^TMP("C0XOUT",$J) - . m ^TMP("C0XOUT",$J)=@zwhat - . s zwhat=$na(^TMP("C0XOUT",$J,1)) - n zout s zout="" - s zout=$$OUTPUT^C0CXPATH(zwhat,zfname,zdir) - K ^TMP("C0XOUT",$J) - Q zout - ; -tagText(ztag) ; extrinsic which returns the location of the text - ; associated with ztag - n zs,zo - s zs=$$subject("fmts:fileTag",ztag) - i zs="" d q "" ; - . w !,"error, tag is either missing or there are more than one ",ztag - s zo=$$object(zs,"fmts:fileSource") - i zo="" d q "" ; - . w !,"error, tag source not found ",zs - w !,zo - q $$WHERETXT^C0XF2N(zo) - ; -tagRoot(ztag) ; extrinsic which returns the root for graphs and subjects - ; associated with ztag - n zs,zo - s zs=$$subject("fmts:fileTag",ztag) - i zs="" d q "" ; - . w !,"error, tag is either missing or there are more than one ",ztag - s zo=$$object(zs,"fmts:root") - i zo="" d q "" ; - . w !,"error, root not found ",zs - ;w !,zo - q zo - ; \ No newline at end of file +C0XGET1 ; GPL - Fileman Triples entry point routine ;1/12/12 17:05 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 10 + ;Copyright 2011 George Lilly. Licensed under the terms of the GNU + ;General Public License See attached copy of the License. + ; + ;This program is free software; you can redistribute it and/or modify + ;it under the terms of the GNU General Public License as published by + ;the Free Software Foundation; either version 2 of the License, or + ;(at your option) any later version. + ; + ;This program is distributed in the hope that it will be useful, + ;but WITHOUT ANY WARRANTY; without even the implied warranty of + ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ;GNU General Public License for more details. + ; + ;You should have received a copy of the GNU General Public License along + ;with this program; if not, write to the Free Software Foundation, Inc., + ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; + Q + ; +LSSUBJ(RTN,ZSUBJ,C0XFARY) ; LIST NODES WITH SUBJECT ZSUBJ + ; + I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY") + D USEFARY^C0XF2N("C0XFARY") + Q + ; +graph(sub,pred,obj,form,fary) ; extrinsic which returns a graph name + I '$D(fary) D ; + . S fary="C0XFARY" + . D INITFARY^C0XF2N(fary) + D USEFARY^C0XF2N(fary) + k triplertn ; start with a clean return + n zsub,zpred,zobj,zgraph,tmprtn + s zsub=$$IENOF($$EXT^C0XUTIL($g(sub)),fary) ; ien of subject + s zpred=$$IENOF($$EXT^C0XUTIL($g(pred)),fary) ; ien of predicate + s zobj=$$IENOF($$EXT^C0XUTIL($g(obj)),fary) ; ien of object + s zgraph=$$IENOF($g(graph),fary) ; ien of graph + I $G(DEBUG) W !,"s:",zsub," p:",zpred," o:",zobj + d trip(.tmprtn,zsub,zpred,zobj,zgraph,fary) + n ztmp + d trip(.ztmp,$g(sub),$g(pred),$g(obj),"",$g(fary)) + n zi,zg,zrtn + s zi=$o(tmprtn("")) + s zg=$$GET1^DIQ(C0XTFN,zi,.02,"E") ; + i zg="" q "" + s zrtn=zg + i $o(tmprtn(zi))'="" d + . s zrtn="" + q zrtn + ; +GRAPHS(RTN,C0XFARY) ; LIST ALL GRAPHS + ; + I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY") + D USEFARY^C0XF2N("C0XFARY") + N ZI S ZI="" + F S ZI=$O(@C0XTN@("G",ZI)) Q:ZI="" D ; + . S RTN(ZI,$$STR(ZI))="" + Q + ; +STR(ZIN,C0XFARY) ; EXTRINSIC RETURNS A STRING + I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY") + Q $$GET1^DIQ(C0XSFN,ZIN,.01,"E") + ; +SPO(ZRTN,ZNODE,C0XFARY) + I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY") + N ZI S ZI=$$NXT(.ZRTN) + S ZRTN(ZI,"S")=$$S(ZNODE) + S ZRTN(ZI,"P")=$$P(ZNODE) + S ZRTN(ZI,"O")=$$O(ZNODE) + Q + ; +S(ZNODE,C0XFARY) ; EXTRINSIC RETURNING THE SUBJECT + Q $$STR($$GET1^DIQ(C0XTFN,ZNODE,.03,"I")) ; + ; +P(ZNODE,C0XFARY) ; EXTRINSIC RETURNING THE PREDICATE + Q $$STR($$GET1^DIQ(C0XTFN,ZNODE,.04,"I")) ; + ; +O(ZNODE,C0XFARY) ; EXTRINSIC RETURNING THE OBJECT + Q $$STR($$GET1^DIQ(C0XTFN,ZNODE,.05,"I")) ; + ; +NXT(ZRTN) ;EXTRINSIC FOR THE NEXT NODE IN ARRAY ZRTN, PASSED BY REF + I '$D(ZRTN) S ZRTN="" + Q $O(ZRTN(""),-1)+1 + ; +SING(ZRTN,ZG) ; SUBJECTS IN GRAPH + ; + I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY") + I '$D(ZRTN) S ZRTN="" + N ZI,ZN S ZI="" + F S ZI=$O(@C0XTN@("GSPO",ZG,ZI)) Q:ZI="" D ; + . S ZRTN($$NXT(.ZRTN),"S")=$$STR(ZI) + Q + ; +qparse(qrtn,zquery) ; parses the query + ; want this to be able to handle the WHERE clause of SPARQL eventually + ; + n q1,q2,q3,qq + ;s qq=$tr(zquery," ","^") + s qq=query ; really want to remove whitespace here + s q1=$p(qq," ",1) + i q1["?" s q1="" + s q2=$p(qq," ",2) + i q2["?" s q2="" + s q3=$p(qq," ",3) + i q3["?" s q3="" + s qrtn(1)=q1_"^"_q2_"^"_q3 ; more lines to come later + q + ; +getGraph(zrtn,zgrf,form) ; get all triples in graph zgrf + ; forms planned: "rdf" "json" "array" "turtle" "triples" "raw" + ; forms supported: "rdf" "json" "array" "raw" + I '$D(form) S form="rdf" + N ZIENS,ZTRIP + D TING^C0XF2N(.ZIENS,zgrf) + I '$D(ZIENS) Q ; + D ien2tary(.ZTRIP,"ZIENS") + I form="json" d jsonout(.zrtn,.ZTRIP) q ; what follows is else + i form="rdf" d rdfout^C0XRDF(.zrtn,.ZTRIP) q ; + i form="array" d arrayout^C0XGET1(.zrtn,.ZTRIP) q ; + i form="raw" d rawout^C0XGET1(.zrtn,.ZTRIP) q ; + W !,"Form not supported: ",form + Q + ; +rpctrip(rtn,query,limit,offset) ; rpc to access triples with a query + ; + n zoff,zlim,zcount,zq + k rtn + i '$d(limit) s limit=250 + i '$d(offset) s offset=0 + d qparse(.zq,query) ; parse the query + n qsub,qpred,qobj,qtmp + W !,zq(1) + s qsub=$p(zq(1),"^",1) + s qpred=$p(zq(1),"^",2) + s qobj=$p(zq(1),"^",3) + d triples(.qtmp,qsub,qpred,qobj) + f zcount=offset+1:1:offset+limit q:'$d(qtmp(zcount)) d ; + . s rtn(zcount)=qtmp(zcount) + q + ; +triples(triplertn,sub,pred,obj,graph,form,fary) ; returns triples + I '$D(fary) D ; + . D INITFARY^C0XF2N("C0XFARY") + . S fary="C0XFARY" + D USEFARY^C0XF2N(fary) + I '$D(form) S form="json" + k triplertn ; start with a clean return + n zsub,zpred,zobj,zgraph,tmprtn + s zsub=$$IENOF($$EXT^C0XUTIL($g(sub)),fary) ; ien of subject + s zpred=$$IENOF($$EXT^C0XUTIL($g(pred)),fary) ; ien of predicate + s zobj=$$IENOF($$EXT^C0XUTIL($g(obj)),fary) ; ien of object + s zgraph=$$IENOF($g(graph),fary) ; ien of graph + I $G(DEBUG) W !,"s:",zsub," p:",zpred," o:",zobj + d trip(.tmprtn,zsub,zpred,zobj,zgraph,fary) + d ien2tary(.zrary,"tmprtn") ; convert to triples + ; + i form="json" d jsonout(.triplertn,.zrary) q ; what follows is 'else' + i form="rdf" d rdfout^C0XRDF(.triplertn,.zrary) q ; + i form="array" d arrayout(.triplertn,.zrary) q ; + i form="raw" d rawout(.triplertn,.zrary) q ; + w !,"form not supported: ",form + q + ; +subjects(listrtn,pred,obj,graph,form,fary) ; return list of subjects + d onelist("S",,$g(pred),$g(obj),$g(fary)) ;subjects + q + ; +subject(pred,obj,graph,form,fary) ; extrinsic which returns the first + ; multiple of return from subjects - returns null if more than one + ; subjects(.G,sub,pred) + ; G("nodeID:1234") ==> "nodeID:1234" + n zin,zrtn + d subjects(.zin,$g(pred),$g(obj),$g(form),$g(fary)) + s zrtn=$o(zin("")) + i $o(zin(zrtn))'="" s zrtn="" + q zrtn + ; +preds(listrtn,sub,obj,graph,form,fary) ; return list of subjects + d onelist("P",$g(sub),,$g(obj),$g(fary)) ;subjects + q + ; +objects(listrtn,sub,pred,graph,form,fary) ; return list of subjects + d onelist("O",$g(sub),$g(pred),"",$g(fary)) ;subjects + q + ; +object(sub,pred,graph,form,fary) ; extrinsic which returns the first + ; multiple of return from objects - returns null if more than one + ; objects(.G,sub,pred) + ; G("location") ==> "location" + n zin,zrtn + d objects(.zin,$g(sub),$g(pred),$g(form),$g(fary)) + s zrtn=$o(zin("")) + i $o(zin(zrtn))'="" s zrtn="" + q zrtn + ; +onelist(zw,sub,pred,obj,fary) ; returns list + ; zw is S P or O depending on what should be returned + I $g(fary)="" D ; + . D INITFARY^C0XF2N("C0XFARY") + . S fary="C0XFARY" + D USEFARY^C0XF2N(fary) + I '$D(form) S form="json" + k listrtn ; start with a clean return + n zsub,zpred,zobj,zgraph,tmprtn + s zsub=$$IENOF($$EXT^C0XUTIL($g(sub)),fary) ; ien of sub + s zpred=$$IENOF($$EXT^C0XUTIL($g(pred)),fary) ; ien of pred + s zobj=$$IENOF($$EXT^C0XUTIL($g(obj)),fary) ; ien of obj + s zgraph=$$IENOF($g(graph),fary) ; ien of graph + I $G(DEBUG) W !,"s:",zsub," p:",zpred," o:",zobj + n c0xflag,zi,zx,zt + s zt=$na(^C0X(101)) ; + s c0xflag=$$mask(zsub,zpred,zobj) ; get mask flags + k tmprtn + n itbl,ii,ix + s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"OSP") ; no constraint + s itbl("I000",ii)="d zip(.tmprtn,zt,zi)" + s ii=$s(zw="S":"OSP",zw="P":"OPS",zw="O":"OSP") ; obj constraint + s ix=$s(zw="O":"d just(zobj)",1:"d zip1(.tmprtn,zt,zi,zobj)") + s itbl("I001",ii)=ix + s ii=$s(zw="S":"PSO",zw="P":"POS",zw="O":"POS") ; pred constraint + s ix=$s(zw="P":"d just(zpred)",1:"d zip1(.tmprtn,zt,zi,zpred)") + s itbl("I010",ii)=ix + s ii=$s(zw="S":"POS",zw="P":"OPS",zw="O":"OSP") ; pred + obj constraint + s ix=$s(zw="S":"d zip2(.tmprtn,zt,zi,zpred,zobj)",zw="P":"d just(zpred)",zw="O":"d just(zobj)",1:"d just(zobj)") + s itbl("I011",ii)=ix + s ii=$s(zw="S":"SPO",zw="P":"SPO",zw="O":"SOP") ; sub constraint + s ix=$s(zw="S":"d just(zsub)",1:"d zip1(.tmprtn,zt,zi,zsub)") + s itbl("I100",ii)=ix + s ii=$s(zw="S":"SPO",zw="P":"SOP",zw="O":"OSP") ; sub + obj constraint + s ix=$s(zw="P":"d zip2(.tmprtn,zt,zi,zsub,zobj)",zw="S":"d just(zsub)",zw="O":"d just(zobj)",1:"d just(zobj)") + s itbl("I101",ii)=ix + s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"SPO") ; sub + pred constraint + s ix=$s(zw="O":"d zip2(.tmprtn,zt,zi,zsub,zpred)",zw="S":"d just(zsub)",zw="P":"d just(zpred)",1:"d just(zsub)") + s itbl("I110",ii)=ix + s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"OSP") ; sub + pred + obj constraint + s ix=$s(zw="O":"d just(zobj)",zw="S":"d just(zsub)",zw="P":"d just(zpred)",1:"d just(zsub)") + s itbl("I111",ii)=ix + ; end itbl definition + ; + s zi=$o(itbl(c0xflag,"")) ; find index to use + s zx=itbl(c0xflag,zi) ; executable instruction to run + ;i $g(ngraph)'="" s zi="G"_zi ; this is wrong.. don't do graphs yet + i $g(DEBUG) w !,c0xflag," ",zw," ",zt," ",zi," ",zx,! + ;zwr itbl + x zx + k listrtn + d strings(.listrtn,"tmprtn") ; convert pointer to strings + q + ; +just(zin) ; add one element to tmprtn + s tmprtn(zin)="" + q + ; +zip(zrtn,zt,zi) ; pull out just the first element of the index + ; + n zii s zii="" + f s zii=$o(@zt@(zi,zii)) q:zii="" d ; + . s zrtn(zii)="" + q + ; +zip1(zrtn,zt,zi,zn) ; pull out just the first element of the index + ; + n zii s zii="" + f s zii=$o(@zt@(zi,zn,zii)) q:zii="" d ; + . s zrtn(zii)="" + q + ; +zip2(zrtn,zt,zi,zn,zn1) ; pull out just the first element of the index + ; + n zii s zii="" + f s zii=$o(@zt@(zi,zn,zn1,zii)) q:zii="" d ; + . s zrtn(zii)="" + q + ; +arrayout(rtn,zary) ; output an array of triples + ; + s zrsub="" + s zcnt=1 + f s zrsub=$o(zary(zrsub)) q:zrsub="" d ; organized by subject + . s zzz="" + . f s zzz=$o(zary(zrsub,zzz)) q:zzz="" d ; pred and obj + . . s rtn(zcnt)=zrsub_"^"_zzz + . . s zcnt=zcnt+1 + q + ; +rawout(rtn,zary) ; output a mumps array of triples + ; + s zrsub="" + ;s zcnt=1 + f s zrsub=$o(zary(zrsub)) q:zrsub="" d ; organized by subject + . s zzz="" + . f s zzz=$o(zary(zrsub,zzz)) q:zzz="" d ; pred and obj + . . s rtn(zrsub,$p(zzz,"^",1))=$p(zzz,"^",2) + . . ;s zcnt=zcnt+1 + q + ; +strings(zrary,zinary) ; convert pointers to strings + ; + k zrary + n zzz s zzz="" + f s zzz=$o(@zinary@(zzz)) q:zzz="" d ; + . n zs + . ;s zs=$$GET1^DIQ(C0XSFN,zzz_",",.01) + . s zs=$$NSP^C0XUTIL(zzz) ; get namespaced string + . q:zs="" + . s zrary(zs)="" ; + q + ; +ien2tary(zrary,zinary) ; zinary is an array of iens passed by name + ; zrary is passed by reference and is return array of triples + ; format zrary(zsub,"zpred^zobj")="" + ; + k zrary ; start out clean + n zzz,zrsub,zrpred,zrobj,zgraph,zcnt + s zzz="" + f s zzz=$o(@zinary@(zzz)) q:zzz="" d ; + . s zrsub=$$GET1^DIQ(C0XTFN,zzz_",",.03,"E") + . s zrpred=$$GET1^DIQ(C0XTFN,zzz_",",.04,"E") + . s zrobj=$$GET1^DIQ(C0XTFN,zzz_",",.05,"E") + . s zrgraph=$$GET1^DIQ(C0XTFN,zzz_",",.02,"E") + . s zrary(zrsub,zrpred_"^"_zrobj)="" + q + ; +jsonout(jout,zary) ; + d REPLYSTART^FMQLJSON("jout") + d LISTSTART^FMQLJSON("jout","results") + n zi s zi="" + f s zi=$o(zary(zi)) q:zi="" d ; for each subject + . n zii s zii="" + . D DICTSTART^FMQLJSON("jout",zi) + . f s zii=$o(zary(zi,zii)) q:zii="" d ; for each pred^obj pair + . . d DASSERT^FMQLJSON("jout",$p(zii,"^",1),$p(zii,"^",2)) + . D DICTEND^FMQLJSON("jout") + d LISTEND^FMQLJSON("jout") + d REPLYEND^FMQLJSON("jout") + q + ; +mask(zsub,zpred,zobj) ; function to return mask information + ; about the inputs ie I100 for just a subject and no pred or obj + n zf1,zf2,zf3,zflag + s zf1=$s($g(zsub)="":0,1:1) + s zf2=$s($g(zpred)="":0,1:1) + s zf3=$s($g(zobj)="":0,1:1) + s zflag="I"_zf1_zf2_zf3 + q zflag + ; +trip(triprtn,nsub,npred,nobj,ngraph,fary) ; returns triples iens + ; nsub,npred,nobj are all optional + ; graf is also optional, and will limit the search to a particular ngraph + ; fary is which triple store (not implemented yet) + n c0xflag,zi,zx,zt + s zt=$na(^C0X(101)) ; + s c0xflag=$$mask(nsub,npred,nobj) ; get mask flags + n itbl + s itbl("I000","SPO")="d do3(.triprtn,zt,zi)" + s itbl("I001","OSP")="d do2(.triprtn,zt,zi,nobj)" + s itbl("I010","PSO")="d do2(.triprtn,zt,zi,npred)" + s itbl("I011","POS")="d do1(.triprtn,zt,zi,npred,nobj)" + s itbl("I100","SPO")="d do2(.triprtn,zt,zi,nsub)" + s itbl("I101","SOP")="d do1(.triprtn,zt,zi,nsub,nobj)" + s itbl("I110","SPO")="d do1(.triprtn,zt,zi,nsub,npred)" + s itbl("I111","SPO")="d do0(.triprtn,zt,zi,nsub,npred,nobj)" + s zi=$o(itbl(c0xflag,"")) + s zx=itbl(c0xflag,zi) ; executable instruction to run + i $g(ngraph)'="" s zi="G"_zi + i $g(DEBUG) w !,zx + x zx + q + ; +do0(dortn,zt,zi,z1,z2,z3) + ; looking for only one triple + n zz + s zz=$o(@zt@(zi,z1,z2,z3,"")) + i zz'="" s dortn(zz)="" + q + ; +do1(dortn,zt,zi,z1,z2) ; have 2, looking for one + n zr,zx1 + s zx1="" + f s zx1=$o(@zt@(zi,z1,z2,zx1)) q:zx1="" d ; + . s zr=$o(@zt@(zi,z1,z2,zx1,"")) + . s dortn(zr)="" + q + ; +do2(dortn,zt,zi,z1) ; have one, looking for 2 + n zr,zx1,zx2 + s (zx1,zx2)="" + f s zx1=$o(@zt@(zi,z1,zx1)) q:zx1="" d ; + . f s zx2=$o(@zt@(zi,z1,zx1,zx2)) q:zx2="" d ; + . . s zr=$o(@zt@(zi,z1,zx1,zx2,"")) + . . s dortn(zr)="" + q + ; +do3(dortn,zt,zi) ; have none, looking for three + n zr,zx1,zx2,zx3 + s (zx1,zx2,zx3)="" + f s zx1=$o(@zt@(zi,zx1)) q:zx1="" d ; + . f s zx2=$o(@zt@(zi,zx1,zx2)) q:zx2="" d ; + . . f s zx3=$o(@zt@(zi,zx1,zx2,zx3)) q:zx3="" d ; + . . . s zr=$o(@zt@(zi,zx1,zx2,zx3,"")) + . . . s dortn(zr)="" + q + ; +IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE + I '$D(FARY) D ; + . D INITFARY^C0XF2N("C0XFARY") + . S FARY="C0XFARY" + N ZIEN + I $G(ZSTRING)="" Q "" ; NO STRING + S ZIEN=$O(@C0XSN@("B",$$EXT^C0XUTIL(ZSTRING),"")) + I ZIEN="" S ZIEN=-1 + Q ZIEN + ; +IENOFA(ZOUTARY,INARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE + ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" + I '$D(FARY) D ; + . D INITFARY^C0XF2N("C0XFARY") + . S FARY="C0XFARY" + K ZOUTARY ; START WITH CLEAN RESULTS + K C0XFDA2 ; USE A SEPARATE FDA FOR THIS + I '$D(C0XVOC) D VOCINIT^C0XUTIL + N ZINARY + N ZI S ZI="" + F S ZI=$O(INARY(ZI)) Q:ZI="" D ; + . N ZK + . S ZK=$O(INARY(ZI,"")) + . S ZINARY($$EXT^C0XUTIL(ZI),$$EXT^C0XUTIL(ZK))="" + N ZV,ZIEN + N ZCNT S ZCNT=0 + F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS + . S ZV=$O(ZINARY(ZI,"")) + . I ZV["^" S ZV=$TR(ZV,"^","|") + F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOW GET ALL IENS + . S ZV=$O(ZINARY(ZI,"")) + . I ZV["^" S ZV=$TR(ZV,"^","|") + . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW + . I ZIEN="" S ZOUTARY("IEN",ZI)="" + . E S ZOUTARY("IEN",ZI,ZIEN)="" + Q + ; +output(zwhat,zfname,zdir) ; function to write an array to a host file + ; if zdir is ommitted, will output to the CCR directory + ; ^TMP("C0CCCR","ODIR") + ; if fname is ommitted, will output yyyy-mm-dd-hh-mm-ss-C0XOUT.out + ; zwhat is passed by name + ; + i '$d(zdir) s zdir=$G(^TMP("C0CCCR","ODIR")) + i '$d(zfname) d ; + . s zfname=$$FMTE^XLFDT($$NOW^XLFDT,7) + . s zfname=$tr(zfname,"/","-") + . s zfname=$tr(zfname,"@","-") + . s zfname=$tr(zfname,":","-") + . s zfname=zfname_".out" + i $e(zwhat,1,1)'="^" d ; not a global + . k ^TMP("C0XOUT",$J) + . m ^TMP("C0XOUT",$J)=@zwhat + . s zwhat=$na(^TMP("C0XOUT",$J,1)) + n zout s zout="" + s zout=$$OUTPUT^C0CXPATH(zwhat,zfname,zdir) + K ^TMP("C0XOUT",$J) + Q zout + ; +tagText(ztag) ; extrinsic which returns the location of the text + ; associated with ztag + n zs,zo + s zs=$$subject("fmts:fileTag",ztag) + i zs="" d q "" ; + . w !,"error, tag is either missing or there are more than one ",ztag + s zo=$$object(zs,"fmts:fileSource") + i zo="" d q "" ; + . w !,"error, tag source not found ",zs + w !,zo + q $$WHERETXT^C0XF2N(zo) + ; +tagRoot(ztag) ; extrinsic which returns the root for graphs and subjects + ; associated with ztag + n zs,zo + s zs=$$subject("fmts:fileTag",ztag) + i zs="" d q "" ; + . w !,"error, tag is either missing or there are more than one ",ztag + s zo=$$object(zs,"fmts:root") + i zo="" d q "" ; + . w !,"error, root not found ",zs + ;w !,zo + q zo + ; diff --git a/p/C0XINIT.m b/p/C0XINIT.m index 0761cea..81d7828 100644 --- a/p/C0XINIT.m +++ b/p/C0XINIT.m @@ -1,117 +1,117 @@ -C0XINIT ; GPL - Fileman Triples initialization routine ;10/13/11 17:05 - ;;0.1;C0X;nopatch;noreleasedate;Build 7 - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. - ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. - ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. - ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - ; - Q - ; -CLEAR ; DELETE THE FILESTORE - K ^C0X(101) - K ^C0X(201) - S ^C0X(101,0)="C0X TRIPLE^172.101I^^" - S ^C0X(201,0)="C0X STRING^172.201I^^" - Q - ; -INIT ; INITIALIZE THE TRIPLE STORE - THIS DELETES THE GLOBALS AND - ; START ALL OVER... USE WITH CAUTION - ; - ; -- we should be more sophisticated here.. at least warn the user - ; -- and give them a chance to cancel - ; - D CLEAR ; DELETE THE TRIPLESTORE - ; - ; -- we are assuming that FARY is set up properly in C0XF2N - ; -- with repect to the default directory and the defaut fileman files - ; -- here's what it is now: "/home/vista/gpl/fmts/trunk/samples/" - ; -- that means that all the sample files will look like: - ; --- qds/QDS_0001.rdf - ; --- smart-rdf-in/small.rdf - ; - S FARY="C0XFARY" - D INITFARY^C0XF2N(FARY) - D USEFARY^C0XF2N(FARY) - S C0XFARY("C0XDIR")="/home/vista/gpl/fmts/trunk/samples/smart-rdf-in/" ; - D USEFARY^C0XF2N(FARY) - S SMART(1)="cole-susan.rdf" - S SMART(2)="jones-cynthia.rdf" - S SMART(3)="small.rdf" - S SMART(4)="collins-frank.rdf" - S SMART(5)="kelly-david.rdf" - S SMART(6)="smith-maria.rdf" - S SMART(7)="ford-shirley.rdf" - S SMART(8)="morgan-jason.rdf" - S SMART(9)="west-lisa.rdf" - S SMART(10)="gracia-paul.rdf" - S SMART(11)="reed-richard.rdf" - S SMART(12)="west-sandra.rdf" - S SMART(13)="jackson-jessica.rdf" - S SMART(14)="small-allergies.rdf" - S SMART(15)="white-patricia.rdf" - N ZI S ZI="" - F S ZI=$O(SMART(ZI)) Q:ZI="" D ; for each smart file - . D IMPORT^C0XF2N(SMART(ZI),C0XDIR,,FARY) ; import to the triplestore - S FARY="C0XFARY" - S C0XFARY("C0XDIR")="/home/vista/gpl/fmts/trunk/samples/qds/" - D USEFARY^C0XF2N(FARY) - D IMPORT^C0XF2N("QDS_0001.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0028b.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0052.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0073.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0385.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0002.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0031.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0055.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0074.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0387.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0004.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0032.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0056.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0075.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0389.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0012.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0033.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0059.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0081.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0421.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0013.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0034.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0061.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0083.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0575.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0014.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0036.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0062.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0084.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0018.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0038.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0064.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0086.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0024.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0041.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0067.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0088.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0027.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0043.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0068.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0089.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0028a.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0047.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0070.rdf",C0XDIR,,FARY) - D IMPORT^C0XF2N("QDS_0105.rdf",C0XDIR,,FARY) - ;D IMPORT^C0XF2N("qds.rdf",C0XDIR,,FARY) - Q - ; +C0XINIT ; GPL - Fileman Triples initialization routine ;10/13/11 17:05 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 10 + ;Copyright 2011 George Lilly. Licensed under the terms of the GNU + ;General Public License See attached copy of the License. + ; + ;This program is free software; you can redistribute it and/or modify + ;it under the terms of the GNU General Public License as published by + ;the Free Software Foundation; either version 2 of the License, or + ;(at your option) any later version. + ; + ;This program is distributed in the hope that it will be useful, + ;but WITHOUT ANY WARRANTY; without even the implied warranty of + ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ;GNU General Public License for more details. + ; + ;You should have received a copy of the GNU General Public License along + ;with this program; if not, write to the Free Software Foundation, Inc., + ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; + Q + ; +CLEAR ; DELETE THE FILESTORE + K ^C0X(101) + K ^C0X(201) + S ^C0X(101,0)="C0X TRIPLE^172.101I^^" + S ^C0X(201,0)="C0X STRING^172.201I^^" + Q + ; +INIT ; INITIALIZE THE TRIPLE STORE - THIS DELETES THE GLOBALS AND + ; START ALL OVER... USE WITH CAUTION + ; + ; -- we should be more sophisticated here.. at least warn the user + ; -- and give them a chance to cancel + ; + D CLEAR ; DELETE THE TRIPLESTORE + ; + ; -- we are assuming that FARY is set up properly in C0XF2N + ; -- with repect to the default directory and the defaut fileman files + ; -- here's what it is now: "/home/vista/gpl/fmts/trunk/samples/" + ; -- that means that all the sample files will look like: + ; --- qds/QDS_0001.rdf + ; --- smart-rdf-in/small.rdf + ; + S FARY="C0XFARY" + D INITFARY^C0XF2N(FARY) + D USEFARY^C0XF2N(FARY) + S C0XFARY("C0XDIR")="/home/vista/gpl/fmts/trunk/samples/smart-rdf-in/" ; + D USEFARY^C0XF2N(FARY) + S SMART(1)="cole-susan.rdf" + S SMART(2)="jones-cynthia.rdf" + S SMART(3)="small.rdf" + S SMART(4)="collins-frank.rdf" + S SMART(5)="kelly-david.rdf" + S SMART(6)="smith-maria.rdf" + S SMART(7)="ford-shirley.rdf" + S SMART(8)="morgan-jason.rdf" + S SMART(9)="west-lisa.rdf" + S SMART(10)="gracia-paul.rdf" + S SMART(11)="reed-richard.rdf" + S SMART(12)="west-sandra.rdf" + S SMART(13)="jackson-jessica.rdf" + S SMART(14)="small-allergies.rdf" + S SMART(15)="white-patricia.rdf" + N ZI S ZI="" + F S ZI=$O(SMART(ZI)) Q:ZI="" D ; for each smart file + . D IMPORT^C0XF2N(SMART(ZI),C0XDIR,,FARY) ; import to the triplestore + S FARY="C0XFARY" + S C0XFARY("C0XDIR")="/home/vista/gpl/fmts/trunk/samples/qds/" + D USEFARY^C0XF2N(FARY) + D IMPORT^C0XF2N("QDS_0001.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0028b.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0052.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0073.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0385.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0002.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0031.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0055.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0074.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0387.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0004.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0032.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0056.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0075.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0389.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0012.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0033.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0059.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0081.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0421.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0013.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0034.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0061.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0083.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0575.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0014.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0036.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0062.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0084.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0018.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0038.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0064.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0086.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0024.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0041.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0067.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0088.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0027.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0043.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0068.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0089.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0028a.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0047.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0070.rdf",C0XDIR,,FARY) + D IMPORT^C0XF2N("QDS_0105.rdf",C0XDIR,,FARY) + ;D IMPORT^C0XF2N("qds.rdf",C0XDIR,,FARY) + Q + ; diff --git a/p/C0XMAIN.m b/p/C0XMAIN.m index b2b07d6..e6787e7 100644 --- a/p/C0XMAIN.m +++ b/p/C0XMAIN.m @@ -1,377 +1,377 @@ -C0XMAIN ; GPL - Fileman Triples entry point routine ;10/13/11 17:05 - ;;0.1;C0X;nopatch;noreleasedate;Build 7 - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. - ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. - ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. - ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - ; - Q - ; -INITFARY(ZFARY) ; INITIALIZE FILE NUMBERS AND OTHER USEFUL THINGS - ; FOR THE DEFAULT TRIPLE STORE. USE OTHER VALUES FOR SUPPORTING ADDITIONAL - ; TRIPLE STORES - S @ZFARY@("C0XTFN")=172.101 ; TRIPLES FILE NUMBER - S @ZFARY@("C0XSFN")=172.201 ; TRIPLES STRINGS FILE NUMBER - S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME - S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME - ;S @ZFARY@("C0XDIR")="/home/glilly/all_smart_patient_data/smart-rdf/" - S @ZFARY@("C0XDIR")="/home/george/fmts/trunk/samples/" - D USEFARY(ZFARY) - Q - ; -USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY - N ZI S ZI="" - F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D - . ;N ZX - . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_"""" - . ;W !,ZX - . X ZX - Q - ; -IMPORT(FNAME,FDIR,FURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD - ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE - ; NODE NAME OF THE TEXT TRIPLE - ; FDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR) - ; FURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE - ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - N ZD,ZTMP - I '$D(FDIR) S FDIR=C0XDIR ; DIRECTORY OF THE RDF FILE - I '$D(FURL) D ; - . N ZN2 S ZN2=$TR(FNAME,".","_") ; REMOVE THE DOT FROM THE NAME - . S FURL=FDIR_ZN2 - N ZTMP - S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE - K @ZTMP ; MAKE SURE IT'S CLEAR - S C0XSTART=$$NOW^XLFDT - W !,"STARTED: ",C0XSTART - W !,"READING IN: ",FNAME - I '$$FILEIN(ZTMP,FDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS - . W !,"ERROR READING FILE: ",FDIR,FNAME - S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT - W !,$O(@ZRDF@(""),-1)," LINES READ" - D INSRDF(ZRDF,FURL,FARY) ; IMPORT AND PROCESS THE RDF - Q - ; -WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT - ; - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - ;N ZLOC,ZTMP - K ZTMP - S ZLOC=$NA(^TMP("C0X","WGET",$J)) - S C0XSTART=$$NOW^XLFDT - W !,"STARTED: ",C0XSTART - W !,"DOWNLOADING: ",ZURL - S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP) - M @ZLOC=ZTMP - W !,$O(@ZLOC@(""),-1)," LINES READ" - D INSRDF(ZLOC,ZURL,FARY) - Q - ; -INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS - ; ZRDF IS PASSED BY NAME - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - N ZGRAPH,ZSUBJECT - S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME - S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT - D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY) - N ZTXTNM - S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE - D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY) - D UPDIE(.C0XFDA) ; TRY IT OUT - K C0XCNT ;RESET FOR NEXT TIME - D STORETXT(ZRDF,ZTXTNM,FARY) - W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM - D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF - Q - ; -STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME - ; - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - N ZIEN - S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN - D CLEAN^DILF - K ZERR - D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") - I $D(ZERR) D ; - . ZWR ZERR - Q - ; -GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT - ; ZRTN IS PASSED BY REFERENCE - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - N ZIEN - S ZIEN=$$IENOF(ZNAME) - S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") - Q - ; -WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL - ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - N ZIEN - S ZIEN=$$IENOF(ZNAME) - Q $NA(@C0XSN@(ZIEN,1)) - ; -FILEIN(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH - ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT - ; IE ^TMP("C0X","FILEIN",1) - ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 - ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH - S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) - Q OK - ; -TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE - S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) - S ZGRAPH="/test/rdfFile" - S ZM="/test/rdfFile/meta" - D PROCESS(.G,ZIN,ZGRAPH,ZM) - Q - ; -PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE - ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING - ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE - ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS - ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA - ; - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - ; -- first parse the rdf file with the MXML parser - ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML - S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W") - ; -- assign the MXLM dom global name to ZDOM - S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID)) - W !,$O(@ZDOM@(""),-1)," XML NODES PARSED" - ; -- populate the metagraph to point to the graph with status unfinished - S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT - I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH - D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH - D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished - ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT") - S C0XDATE=$$NOW^XLFDT - D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY) - D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store - ; -- - ; -- pull out the vocabularies in the RDF statement. marked with xmlns: - ; -- put them in a local variable for quick reference - ; -- TODO: create a graph for vocabularies and validate incoming against it - ; - S C0XVOC="" - N ZI,ZJ,ZK S ZI="" - F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns - . S ZVOC=$P(ZI,"xmlns:",2) - . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI)) - ;W !,"VOCABS:" ZWR C0XVOC - ; - ; -- look for children called rdf:Description. quit if none. not an rdf file - ; - S ZI=$O(@ZDOM@(1,"C","")) - I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file - . W !,"Error. Not an RDF file. Cannot process." - ; - ; -- now process the rdf description children - ; - S ZI="" - S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate - F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ; - . ; -- we are skipping any child that is not rdf:Description - . ; -- TODO: check to see if this is right in general - . ; - . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; - . . W !,"SKIPPING NODE: ",ZI - . ; -- now looking for the subject for the triples - . S ZX=$G(@ZDOM@(ZI,"A","rdf:about")) - . I ZX'="" D ; we have the subject - . . ;W " about: ",ZX - . . S C0XSUB=ZX - . E D ; - . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject - . . I ZX'="" D ; - . . . S C0XSUB=ZX - . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT - . ; - . ; -- we now have the subject. the children of this node have the rest - . ; - . S ZJ="" ; for the children of the rdf:Description nodes - . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child - . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix - . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space - . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix - . . I C0XPRE[":" D ; expand using vocabulary - . . . N ZB,ZA - . . . S ZB=$P(C0XPRE,":",1) - . . . S ZA=$P(C0XPRE,":",2) - . . . I $G(C0XVOC(ZB))'="" D ; - . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded - . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object - . . I ZY'="" D Q ; - . . . S C0XOBJ=ZY ; object - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple - . . ; -- this is an else because of the quit above - . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object - . . I ZX'="" D Q ; got one - . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject - . . . ; without change... this could be foolish .. look at it again later - . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node - . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here - . . I C0XOBJ="" D Q ; not a happy situation - . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ - . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node - W !,"INSERTING ",C0XCNT," TRIPLES" - D UPDIE(.C0XFDA) ; commit the updates to the file - ; next, mark the graph as finished - S C0XEND=$$NOW^XLFDT - W !," ENDED AT: ",C0XEND - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" - W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" - Q - ; -SHOW(ZN) ; - ZWR ^TMP("MXMLDOM",$J,1,ZN,*) - Q - ; -ANONS() ; RETURNS AN ANONOMOUS SUBJECT - Q "_S:"_$$LKY9 - ; -NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED - ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT - ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN - S NGRAPH="G"_$$LKY9 - S NMETA=NGRAPH_"A" - Q - ; -ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT - ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - D USEFARY(FARY) - I '$D(C0XCNT) S C0XCNT=0 - N ZNODE - S ZNODE="N"_$$LKY17 - N ZNARY ; GET READY TO CALL IENOFA - S ZNARY("ZG",ZG)="" - S ZNARY("ZS",ZS)="" - S ZNARY("ZP",ZP)="" - S ZNARY("ZO",ZO)="" - D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS - ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN - ;S ZSIEN=$$IENOF(ZS) - ;S ZPIEN=$$IENOF(ZP) - ;S ZOIEN=$$IENOF(ZO) - ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED - S C0XCNT=C0XCNT+1 - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG","")) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS","")) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP","")) - S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO","")) - ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE - Q - ; -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING - ; UNIQUE NODE AND GRAPH NAMES - N ZN,ZI - S ZN="" - F ZI=1:1:9 D ; - . S ZN=ZN_$R(10) - Q ZN - ; -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING - ; UNIQUE NODE AND GRAPH NAMES - N ZN,ZI - S ZN="" - F ZI=1:1:17 D ; - . S ZN=ZN_$R(10) - Q ZN - ; -IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - N ZIEN - S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) - I ZIEN="" D ; - . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING - . D UPDIE(.C0XFDA2) - . S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) - . K C0XFDA2 - Q ZIEN - ; -IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE - ; OR ADD THEM IF - ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE - ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")="" - ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" - I '$D(FARY) D ; - . D INITFARY("C0XFARY") - . S FARY="C0XFARY" - K ZOUTARY ; START WITH CLEAN RESULTS - K C0XFDA2 ; USE A SEPARATE FDA FOR THIS - N ZI S ZI="" - N ZV,ZIEN - N ZCNT S ZCNT=0 - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS - . S ZV=$O(ZINARY(ZI,"")) - . I $O(@C0XSN@("B",ZV,""))="" D ; - . . S ZCNT=ZCNT+1 - . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV - I $D(C0XFDA2) D ; - . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS - . K C0XFDA2 ; CLEAN UP - F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS - . S ZV=$O(ZINARY(ZI,"")) - . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW - . I ZIEN="" D ; - . . W !,"ERROR ADDING STRING: ",ZV - . . B - . S ZOUTARY("IEN",ZI,ZIEN)="" - Q - ; -UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS - ; ZFDA IS PASSED BY REFERENCE - ;ZWR ZFDA - ;B - K ZERR - D CLEAN^DILF - D UPDATE^DIE("","ZFDA","","ZERR") - I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, - ; INVOKE THE ERROR TRAP IF TASKED - ;. W "ERROR",! - ;. ZWR ZERR - ;. B - K ZFDA - Q - ; +C0XMAIN ; GPL - Fileman Triples entry point routine ;10/13/11 17:05 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 10 + ;Copyright 2011 George Lilly. Licensed under the terms of the GNU + ;General Public License See attached copy of the License. + ; + ;This program is free software; you can redistribute it and/or modify + ;it under the terms of the GNU General Public License as published by + ;the Free Software Foundation; either version 2 of the License, or + ;(at your option) any later version. + ; + ;This program is distributed in the hope that it will be useful, + ;but WITHOUT ANY WARRANTY; without even the implied warranty of + ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ;GNU General Public License for more details. + ; + ;You should have received a copy of the GNU General Public License along + ;with this program; if not, write to the Free Software Foundation, Inc., + ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; + Q + ; +INITFARY(ZFARY) ; INITIALIZE FILE NUMBERS AND OTHER USEFUL THINGS + ; FOR THE DEFAULT TRIPLE STORE. USE OTHER VALUES FOR SUPPORTING ADDITIONAL + ; TRIPLE STORES + S @ZFARY@("C0XTFN")=172.101 ; TRIPLES FILE NUMBER + S @ZFARY@("C0XSFN")=172.201 ; TRIPLES STRINGS FILE NUMBER + S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME + S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME + ;S @ZFARY@("C0XDIR")="/home/glilly/all_smart_patient_data/smart-rdf/" + S @ZFARY@("C0XDIR")="/home/george/fmts/trunk/samples/" + D USEFARY(ZFARY) + Q + ; +USEFARY(ZFARY) ; INITIALIZES VARIABLES SAVED IN ARRAY ZFARY + N ZI S ZI="" + F S ZI=$O(@ZFARY@(ZI)) Q:ZI="" D + . ;N ZX + . S ZX="S "_ZI_"="""_@ZFARY@(ZI)_"""" + . ;W !,ZX + . X ZX + Q + ; +IMPORT(FNAME,FDIR,FURL,FARY) ; EXTRINSIC THAT READS A FILE FROM THE STANDARD + ; DIRECTORY, LOADS IT INTO THE TRIPLESTORE AS TEXT, AND RETURNS THE + ; NODE NAME OF THE TEXT TRIPLE + ; FDIR IS THE OPTIONAL DIRECTORY (DEFAUTS TO STANDARD DIR) + ; FURL IS THE OPTIONAL URI FOR ACCESSING THE FILE FROM THE TRIPLE STORE + ; FARY IS THE OPTIONAL FILE ARRAY OF THE TRIPLE STORE TO USE + I '$D(FARY) D ; + . D INITFARY("C0XFARY") + . S FARY="C0XFARY" + D USEFARY(FARY) + N ZD,ZTMP + I '$D(FDIR) S FDIR=C0XDIR ; DIRECTORY OF THE RDF FILE + I '$D(FURL) D ; + . N ZN2 S ZN2=$TR(FNAME,".","_") ; REMOVE THE DOT FROM THE NAME + . S FURL=FDIR_ZN2 + N ZTMP + S ZTMP=$NA(^TMP("C0X",$J,"FILEIN",1)) ; WHERE TO PUT THE INCOMING FILE + K @ZTMP ; MAKE SURE IT'S CLEAR + S C0XSTART=$$NOW^XLFDT + W !,"STARTED: ",C0XSTART + W !,"READING IN: ",FNAME + I '$$FILEIN(ZTMP,FDIR,FNAME,4) D Q ; QUIT IF NO SUCCESS + . W !,"ERROR READING FILE: ",FDIR,FNAME + S ZRDF=$NA(^TMP("C0X",$J,"FILEIN")) ; WITHOUT THE SUBSCRIPT + W !,$O(@ZRDF@(""),-1)," LINES READ" + D INSRDF(ZRDF,FURL,FARY) ; IMPORT AND PROCESS THE RDF + Q + ; +WGET(ZURL,FARY) ; GET FROM THE INTERNET AN RDF FILE AND INSERT IT + ; + I '$D(FARY) D ; + . D INITFARY("C0XFARY") + . S FARY="C0XFARY" + D USEFARY(FARY) + ;N ZLOC,ZTMP + K ZTMP + S ZLOC=$NA(^TMP("C0X","WGET",$J)) + S C0XSTART=$$NOW^XLFDT + W !,"STARTED: ",C0XSTART + W !,"DOWNLOADING: ",ZURL + S OK=$$httpGET^%zewdGTM(ZURL,.ZTMP) + M @ZLOC=ZTMP + W !,$O(@ZLOC@(""),-1)," LINES READ" + D INSRDF(ZLOC,ZURL,FARY) + Q + ; +INSRDF(ZRDF,ZNAME,FARY) ; INSERT AN RDF FILE INTO THE STORE AND PROCESS + ; ZRDF IS PASSED BY NAME + I '$D(FARY) D ; + . D INITFARY("C0XFARY") + . S FARY="C0XFARY" + D USEFARY(FARY) + N ZGRAPH,ZSUBJECT + S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME + S ZSUBJECT=$$ANONS ; RANDOM ANOYMOUS SUBJECT + D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY) + N ZTXTNM + S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE + D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY) + D UPDIE(.C0XFDA) ; TRY IT OUT + K C0XCNT ;RESET FOR NEXT TIME + D STORETXT(ZRDF,ZTXTNM,FARY) + W !,"ADDED: ",ZGRAPH," ",ZSUBJECT," fmts:rdfSource ",ZTXTNM + D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF + Q + ; +STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME + ; + I '$D(FARY) D ; + . D INITFARY("C0XFARY") + . S FARY="C0XFARY" + D USEFARY(FARY) + N ZIEN + S ZIEN=$$IENOF(ZNAME,FARY) ; GET THE IEN + D CLEAN^DILF + K ZERR + D WP^DIE(C0XSFN,ZIEN_",",1,,ZTXT,"ZERR") + I $D(ZERR) D ; + . ZWR ZERR + Q + ; +GETTXT(ZRTN,ZNAME,FARY) ; RETURNS RDF SOURCE OR OTHER TEXT + ; ZRTN IS PASSED BY REFERENCE + I '$D(FARY) D ; + . D INITFARY("C0XFARY") + . S FARY="C0XFARY" + D USEFARY(FARY) + N ZIEN + S ZIEN=$$IENOF(ZNAME) + S OK=$$GET1^DIQ(C0XSFN,ZIEN_",",1,,"ZRTN") + Q + ; +WHERETXT(ZNAME,FARY) ; EXTRINSIC WHICH RETURNS THE NAME OF THE GLOBAL + ; WHERE THE TEXT IS LOCATED. NAME IS THE NAME OF THE STRING + I '$D(FARY) D ; + . D INITFARY("C0XFARY") + . S FARY="C0XFARY" + D USEFARY(FARY) + N ZIEN + S ZIEN=$$IENOF(ZNAME) + Q $NA(@C0XSN@(ZIEN,1)) + ; +FILEIN(ZINTMP,ZDIR,ZFNAME,ZLVL) ; READS A FILE INTO ZINTMP USING FTG^%ZISH + ; ZINTMP IS PASSED BY NAME AND INCLUDES THE NEW SUBSCRIPT + ; IE ^TMP("C0X","FILEIN",1) + ; ZLVL IN THIS CASE WOULD BE 3 INCREMENTING THE 1 + ; EXTRINSIC WHICH RETURNS THE RESULT OF FTG^%ZISH + S OK=$$FTG^%ZISH(ZDIR,FNAME,ZINTMP,ZLVL) + Q OK + ; +TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE + S ZIN=$NA(^TMP("C0X",12226,"FILEIN")) + S ZGRAPH="/test/rdfFile" + S ZM="/test/rdfFile/meta" + D PROCESS(.G,ZIN,ZGRAPH,ZM) + Q + ; +PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE + ; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING + ; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE + ; ZGRF IS THE NAME OF THE GRAPH TO USE IN THE TRIPLE STORE FOR RESULTS + ; ZMETA IS OPTIONAL AND IS THE NAME OF THE GRAPH TO STORE METADATA + ; + I '$D(FARY) D ; + . D INITFARY("C0XFARY") + . S FARY="C0XFARY" + D USEFARY(FARY) + ; -- first parse the rdf file with the MXML parser + ;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML + S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W") + ; -- assign the MXLM dom global name to ZDOM + S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID)) + W !,$O(@ZDOM@(""),-1)," XML NODES PARSED" + ; -- populate the metagraph to point to the graph with status unfinished + S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT + I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH + D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH + D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished + ;S C0XDATE=$$FMDTOUTC^C0CUTIL($$NOW^XLFDT,"DT") + S C0XDATE=$$NOW^XLFDT + D ADD(ZMETA,METAS,"fmts:dateTime",C0XDATE,FARY) + D UPDIE(.C0XFDA) ; commit the metagraph changes to the triple store + ; -- + ; -- pull out the vocabularies in the RDF statement. marked with xmlns: + ; -- put them in a local variable for quick reference + ; -- TODO: create a graph for vocabularies and validate incoming against it + ; + S C0XVOC="" + N ZI,ZJ,ZK S ZI="" + F S ZI=$O(@ZDOM@(1,"A",ZI)) Q:ZI="" D ; FOR EACH xmlns + . S ZVOC=$P(ZI,"xmlns:",2) + . I ZVOC'="" S C0XVOC(ZVOC)=$G(@ZDOM@(1,"A",ZI)) + ;W !,"VOCABS:" ZWR C0XVOC + ; + ; -- look for children called rdf:Description. quit if none. not an rdf file + ; + S ZI=$O(@ZDOM@(1,"C","")) + I $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; not an rdf file + . W !,"Error. Not an RDF file. Cannot process." + ; + ; -- now process the rdf description children + ; + S ZI="" + S (C0XSUB,C0XPRE,C0XOBJ)="" ; INITIALIZE subject, object and predicate + F S ZI=$O(@ZDOM@(1,"C",ZI)) Q:ZI="" D ; + . ; -- we are skipping any child that is not rdf:Description + . ; -- TODO: check to see if this is right in general + . ; + . IF $G(@ZDOM@(1,"C",ZI))'="rdf:Description" D Q ; + . . W !,"SKIPPING NODE: ",ZI + . ; -- now looking for the subject for the triples + . S ZX=$G(@ZDOM@(ZI,"A","rdf:about")) + . I ZX'="" D ; we have the subject + . . ;W " about: ",ZX + . . S C0XSUB=ZX + . E D ; + . . S ZX=$G(@ZDOM@(ZI,"A","rdf:nodeID")) ; node id is another style of subject + . . I ZX'="" D ; + . . . S C0XSUB=ZX + . I C0XSUB="" S C0XSUB=$$ANONS ; DEFAULT TO BLANK SUBJECT + . ; + . ; -- we now have the subject. the children of this node have the rest + . ; + . S ZJ="" ; for the children of the rdf:Description nodes + . F S ZJ=$O(@ZDOM@(ZI,"C",ZJ)) Q:ZJ="" D ; for each child + . . S C0XPRE=@ZDOM@(ZJ) ; the predicate without a prefix + . . S ZX=$G(@ZDOM@(ZJ,"A","xmlns")) ; name space + . . I ZX'="" S C0XPRE=ZX_C0XPRE ; add the namespace prefix + . . I C0XPRE[":" D ; expand using vocabulary + . . . N ZB,ZA + . . . S ZB=$P(C0XPRE,":",1) + . . . S ZA=$P(C0XPRE,":",2) + . . . I $G(C0XVOC(ZB))'="" D ; + . . . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded + . . S ZY=$G(@ZDOM@(ZJ,"A","rdf:resource")) ; potential object + . . I ZY'="" D Q ; + . . . S C0XOBJ=ZY ; object + . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; finally. our first real triple + . . ; -- this is an else because of the quit above + . . S ZX=$G(@ZDOM@(ZJ,"A","rdf:nodeID")) ; fishing for nodeId object + . . I ZX'="" D Q ; got one + . . . S C0XOBJ=ZX ; we are using the incoming nodeIDs as object/subject + . . . ; without change... this could be foolish .. look at it again later + . . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node + . . S C0XOBJ=$G(@ZDOM@(ZJ,"T",1)) ; hopefully an object is here + . . I C0XOBJ="" D Q ; not a happy situation + . . . W !,"ERROR, NO OBJECT FOUND FOR NODE: ",ZJ + . . D ADD(ZGRF,C0XSUB,C0XPRE,C0XOBJ) ; go for it and add a node + W !,"INSERTING ",C0XCNT," TRIPLES" + D UPDIE(.C0XFDA) ; commit the updates to the file + ; next, mark the graph as finished + S C0XEND=$$NOW^XLFDT + W !," ENDED AT: ",C0XEND + S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XSTART,2) + W !," ELAPSED TIME: ",C0XDIFF," SECONDS" + W !," APPROXIMATELY ",$P(C0XCNT/C0XDIFF,".")," TRIPLES PER SECOND" + Q + ; +SHOW(ZN) ; + ZWR ^TMP("MXMLDOM",$J,1,ZN,*) + Q + ; +ANONS() ; RETURNS AN ANONOMOUS SUBJECT + Q "_S:"_$$LKY9 + ; +NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED + ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT + ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN + S NGRAPH="G"_$$LKY9 + S NMETA=NGRAPH_"A" + Q + ; +ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT + ; THE FDA IS SET UP BUT THE FILES ARE NOT UPDATED. CALL UPDIE TO COMPLETE + I '$D(FARY) D ; + . D INITFARY("C0XFARY") + . S FARY="C0XFARY" + D USEFARY(FARY) + I '$D(C0XCNT) S C0XCNT=0 + N ZNODE + S ZNODE="N"_$$LKY17 + N ZNARY ; GET READY TO CALL IENOFA + S ZNARY("ZG",ZG)="" + S ZNARY("ZS",ZS)="" + S ZNARY("ZP",ZP)="" + S ZNARY("ZO",ZO)="" + D IENOFA(.ZIENS,.ZNARY,FARY) ; RESOLVE/ADD STRINGS + ;S ZGIEN=$$IENOF(ZG) ; LAYGO TO GET IEN + ;S ZSIEN=$$IENOF(ZS) + ;S ZPIEN=$$IENOF(ZP) + ;S ZOIEN=$$IENOF(ZO) + ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED + S C0XCNT=C0XCNT+1 + S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.01)=ZNODE + S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.02)=$O(ZIENS("IEN","ZG","")) + S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.03)=$O(ZIENS("IEN","ZS","")) + S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.04)=$O(ZIENS("IEN","ZP","")) + S C0XFDA(C0XTFN,"?+"_C0XCNT_",",.05)=$O(ZIENS("IEN","ZO","")) + ; REMEMBER TO CALL UPDIE WHEN YOU'RE DONE + Q + ; +LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING + ; UNIQUE NODE AND GRAPH NAMES + N ZN,ZI + S ZN="" + F ZI=1:1:9 D ; + . S ZN=ZN_$R(10) + Q ZN + ; +LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING + ; UNIQUE NODE AND GRAPH NAMES + N ZN,ZI + S ZN="" + F ZI=1:1:17 D ; + . S ZN=ZN_$R(10) + Q ZN + ; +IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE + I '$D(FARY) D ; + . D INITFARY("C0XFARY") + . S FARY="C0XFARY" + N ZIEN + S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) + I ZIEN="" D ; + . S C0XFDA2(C0XSFN,"+1,",.01)=ZSTRING + . D UPDIE(.C0XFDA2) + . S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) + . K C0XFDA2 + Q ZIEN + ; +IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE + ; OR ADD THEM IF + ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE + ; ZINARY LOOKS LIKE ZINARY("VAR","VAL")="" + ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" + I '$D(FARY) D ; + . D INITFARY("C0XFARY") + . S FARY="C0XFARY" + K ZOUTARY ; START WITH CLEAN RESULTS + K C0XFDA2 ; USE A SEPARATE FDA FOR THIS + N ZI S ZI="" + N ZV,ZIEN + N ZCNT S ZCNT=0 + F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS + . S ZV=$O(ZINARY(ZI,"")) + . I $O(@C0XSN@("B",ZV,""))="" D ; + . . S ZCNT=ZCNT+1 + . . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV + I $D(C0XFDA2) D ; + . D UPDIE(.C0XFDA2) ; ADD MISSING STRINGS + . K C0XFDA2 ; CLEAN UP + F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS + . S ZV=$O(ZINARY(ZI,"")) + . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW + . I ZIEN="" D ; + . . W !,"ERROR ADDING STRING: ",ZV + . . B + . S ZOUTARY("IEN",ZI,ZIEN)="" + Q + ; +UPDIE(ZFDA) ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS + ; ZFDA IS PASSED BY REFERENCE + ;ZWR ZFDA + ;B + K ZERR + D CLEAN^DILF + D UPDATE^DIE("","ZFDA","","ZERR") + I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, + ; INVOKE THE ERROR TRAP IF TASKED + ;. W "ERROR",! + ;. ZWR ZERR + ;. B + K ZFDA + Q + ; diff --git a/p/C0XRDF.m b/p/C0XRDF.m index 7e8062f..20d9360 100644 --- a/p/C0XRDF.m +++ b/p/C0XRDF.m @@ -1,89 +1,89 @@ -C0XRDF ; GPL - Fileman Triples RDF out ;11/07/11 17:05 - ;;0.1;C0X;nopatch;noreleasedate;Build 7 - ;Copyright 2012 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. - ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. - ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. - ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - ; - Q - ; -REPLYSTART(ZARY); - D ADD(ZARY,"") - D ADD(ZARY,"") - Q - ; -LISTSTART(ZARY,ZNAM) - Q - ; -DICTSTART(ZARY,ZSUB) - I ZSUB["http" D Q ; - . D ADD(ZARY,"") - I $E(ZSUB,1,1)="/" D Q ; - . D ADD(ZARY,"") - D ADD(ZARY,"") - Q - ; -DASSERT(ZARY,ZPRED,ZOBJ) - I ZPRED[":" D Q ; - . I ZPRED="rdf:type" D Q ; - . . D ADD(ZARY,"") - . N ZA,ZB,ZC - . S ZA=$P(ZPRED,":",1) - . S ZB=$P(ZPRED,":",2) - . I $E(ZB,1,1)="/" D ; - . . S ZB=$P(ZB,"/",2) ; handling gpltest:/note situations - . S ZC=C0XVOC(ZA) - . I ZOBJ["nodeID:" D Q ; - . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:nodeID="""_$$EXT^C0XUTIL(ZOBJ)_"""/>") - . S ZOBJ=$$EXT^C0XUTIL(ZOBJ) - . I ZOBJ["http" D Q ; - . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:resource="""_ZOBJ_"""/>") - . I $E(ZOBJ,1,1)="/" D Q ; - . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:resource="""_ZOBJ_"""/>") - . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""">"_$$EXT^C0XUTIL(ZOBJ)_"") - Q - ; -DICTEND(ZARY) - D ADD(ZARY,"") - Q - ; -LISTEND(ZARY) - Q - ; -REPLYEND(ZARY) - D ADD(ZARY,"") - Q - ; -ADD(ZARY,ZELE) - N ZI - I '$D(ZARY) S @ZARY@(1)=ZELE Q ; - S ZI=$O(@ZARY@(""),-1) - S @ZARY@(ZI+1)=ZELE - Q - ; -rdfout(rdfout,zary) ; - d REPLYSTART("rdfout") - d LISTSTART("rdfout","results") - n zi s zi="" - f s zi=$o(zary(zi)) q:zi="" d ; for each subject - . n zii s zii="" - . D DICTSTART("rdfout",$$EXT^C0XUTIL(zi)) - . f s zii=$o(zary(zi,zii)) q:zii="" d ; for each pred^obj pair - . . d DASSERT("rdfout",$p(zii,"^",1),$p(zii,"^",2)) - . D DICTEND("rdfout") - d LISTEND("rdfout") - d REPLYEND("rdfout") - q - ; +C0XRDF ; GPL - Fileman Triples RDF out ;11/07/11 17:05 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 10 + ;Copyright 2012 George Lilly. Licensed under the terms of the GNU + ;General Public License See attached copy of the License. + ; + ;This program is free software; you can redistribute it and/or modify + ;it under the terms of the GNU General Public License as published by + ;the Free Software Foundation; either version 2 of the License, or + ;(at your option) any later version. + ; + ;This program is distributed in the hope that it will be useful, + ;but WITHOUT ANY WARRANTY; without even the implied warranty of + ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ;GNU General Public License for more details. + ; + ;You should have received a copy of the GNU General Public License along + ;with this program; if not, write to the Free Software Foundation, Inc., + ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; + Q + ; +REPLYSTART(ZARY); + D ADD(ZARY,"") + D ADD(ZARY,"") + Q + ; +LISTSTART(ZARY,ZNAM) + Q + ; +DICTSTART(ZARY,ZSUB) + I ZSUB["http" D Q ; + . D ADD(ZARY,"") + I $E(ZSUB,1,1)="/" D Q ; + . D ADD(ZARY,"") + D ADD(ZARY,"") + Q + ; +DASSERT(ZARY,ZPRED,ZOBJ) + I ZPRED[":" D Q ; + . I ZPRED="rdf:type" D Q ; + . . D ADD(ZARY,"") + . N ZA,ZB,ZC + . S ZA=$P(ZPRED,":",1) + . S ZB=$P(ZPRED,":",2) + . I $E(ZB,1,1)="/" D ; + . . S ZB=$P(ZB,"/",2) ; handling gpltest:/note situations + . S ZC=C0XVOC(ZA) + . I ZOBJ["nodeID:" D Q ; + . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:nodeID="""_$$EXT^C0XUTIL(ZOBJ)_"""/>") + . S ZOBJ=$$EXT^C0XUTIL(ZOBJ) + . I ZOBJ["http" D Q ; + . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:resource="""_ZOBJ_"""/>") + . I $E(ZOBJ,1,1)="/" D Q ; + . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:resource="""_ZOBJ_"""/>") + . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""">"_$$EXT^C0XUTIL(ZOBJ)_"") + Q + ; +DICTEND(ZARY) + D ADD(ZARY,"") + Q + ; +LISTEND(ZARY) + Q + ; +REPLYEND(ZARY) + D ADD(ZARY,"") + Q + ; +ADD(ZARY,ZELE) + N ZI + I '$D(ZARY) S @ZARY@(1)=ZELE Q ; + S ZI=$O(@ZARY@(""),-1) + S @ZARY@(ZI+1)=ZELE + Q + ; +rdfout(rdfout,zary) ; + d REPLYSTART("rdfout") + d LISTSTART("rdfout","results") + n zi s zi="" + f s zi=$o(zary(zi)) q:zi="" d ; for each subject + . n zii s zii="" + . D DICTSTART("rdfout",$$EXT^C0XUTIL(zi)) + . f s zii=$o(zary(zi,zii)) q:zii="" d ; for each pred^obj pair + . . d DASSERT("rdfout",$p(zii,"^",1),$p(zii,"^",2)) + . D DICTEND("rdfout") + d LISTEND("rdfout") + d REPLYEND("rdfout") + q + ; diff --git a/p/C0XTEST.m b/p/C0XTEST.m index 2ea3013..122b1aa 100644 --- a/p/C0XTEST.m +++ b/p/C0XTEST.m @@ -1,125 +1,125 @@ -C0XTEST ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05 - ;;0.1;C0X;nopatch;noreleasedate;Build 7 - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. - ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. - ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. - ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - ; - Q - ; -EN ; run the test - ; - k C0XFDA ; clear the node variable - i '$d(^C0X(101,0)) d ; global doesn't exist - . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1" - n zg - S zg="_:G"_$$LKY9 ; all nodes are in the same graph - n zi - f zi=1:1:100000 d ; try a test of 10000 nodes - . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name - . s C0XFDA(172.101,zi,.02)=zg - . s C0XFDA(172.101,zi,.03)=$R(100000) - . s C0XFDA(172.101,zi,.04)=$R(100000) - . s C0XFDA(172.101,zi,.05)=$R(100000) - S C0XST=$$NOW^XLFDT ; start of the insertion test - W !,"INSERTION STARTS AT ",C0XST,! - d BULKLOAD(.C0XFDA) - s C0XEND=$$NOW^XLFDT ; end of the insertion test - W !,"INSERTION ENDS AT ",C0XEND - S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XST,2) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" - I C0XDIFF>0 W !," APPROXIMATELY ",$P(100000/C0XDIFF,".")," NODES PER SECOND" - q - ; -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING - ; UNIQUE NODE AND GRAPH NAMES - N ZN,ZI - S ZN="" - F ZI=1:1:9 D ; - . S ZN=ZN_$R(10) - Q ZN - ; -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING - ; UNIQUE NODE AND GRAPH NAMES - N ZN,ZI - S ZN="" - F ZI=1:1:17 D ; - . S ZN=ZN_$R(10) - Q ZN - ; -BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 - ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE - ; QUITS IF FILE IS NOT 172.101 - ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 - ; QUITS IF FIRST ENTRY IS NOT IENS 1 - ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES - ; ZBFDA IS PASSED BY REFERENCE - ; - ; -- reserves a block of iens from file 172.101 by locking the zero node - ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 - ; -- then unlocking to minimize the duration of the lock - ; - W !,"USING BULKLOAD" - I '$D(ZBFDA) Q ; EMPTY FDA - I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE - N ZCNT,ZP3,ZP4 - ; -- find the number of nodes to insert - S ZCNT=$O(ZBFDA(172.101,""),-1) - I ZCNT="" D Q ; - . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" - . B - ; -- lock the zero node and reserve a block of iens to insert - W !,"LOCKING ZERO NODE" - LOCK +^C0X(101,0) - S ZP3=$P(^C0X(101,0),U,3) - S ZP4=$P(^C0X(101,0),U,4) - S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 - S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 - LOCK -^C0X(101,0) - N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE - S ZBASE=ZP3 ; the last ien in the file - W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT - W !,$$NOW^XLFDT - S ZI="" - F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; - . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name - . I ZN="" D BLKERR Q ; - . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer - . I ZG="" D BLKERR Q ; - . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer - . I ZS="" D BLKERR Q ; - . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer - . I ZP="" D BLKERR Q ; - . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer - . I ZO="" D BLKERR Q ; - . S ZIEN=ZI+ZBASE ; the new ien - . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node - . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index - . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index - . S ^C0X(101,"SPO",ZS,ZP,ZO)="" - . S ^C0X(101,"SOP",ZS,ZO,ZP)="" - . S ^C0X(101,"OPS",ZO,ZP,ZS)="" - . S ^C0X(101,"OSP",ZO,ZS,ZP)="" - . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" - . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" - . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" - . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" - Q - ; -BLKERR ; - W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) - B - Q - ; +C0XTEST ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 10 + ;Copyright 2011 George Lilly. Licensed under the terms of the GNU + ;General Public License See attached copy of the License. + ; + ;This program is free software; you can redistribute it and/or modify + ;it under the terms of the GNU General Public License as published by + ;the Free Software Foundation; either version 2 of the License, or + ;(at your option) any later version. + ; + ;This program is distributed in the hope that it will be useful, + ;but WITHOUT ANY WARRANTY; without even the implied warranty of + ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ;GNU General Public License for more details. + ; + ;You should have received a copy of the GNU General Public License along + ;with this program; if not, write to the Free Software Foundation, Inc., + ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; + Q + ; +EN ; run the test + ; + k C0XFDA ; clear the node variable + i '$d(^C0X(101,0)) d ; global doesn't exist + . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1" + n zg + S zg="_:G"_$$LKY9 ; all nodes are in the same graph + n zi + f zi=1:1:100000 d ; try a test of 10000 nodes + . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name + . s C0XFDA(172.101,zi,.02)=zg + . s C0XFDA(172.101,zi,.03)=$R(100000) + . s C0XFDA(172.101,zi,.04)=$R(100000) + . s C0XFDA(172.101,zi,.05)=$R(100000) + S C0XST=$$NOW^XLFDT ; start of the insertion test + W !,"INSERTION STARTS AT ",C0XST,! + d BULKLOAD(.C0XFDA) + s C0XEND=$$NOW^XLFDT ; end of the insertion test + W !,"INSERTION ENDS AT ",C0XEND + S C0XDIFF=$$FMDIFF^XLFDT(C0XEND,C0XST,2) + W !," ELAPSED TIME: ",C0XDIFF," SECONDS" + I C0XDIFF>0 W !," APPROXIMATELY ",$P(100000/C0XDIFF,".")," NODES PER SECOND" + q + ; +LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING + ; UNIQUE NODE AND GRAPH NAMES + N ZN,ZI + S ZN="" + F ZI=1:1:9 D ; + . S ZN=ZN_$R(10) + Q ZN + ; +LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING + ; UNIQUE NODE AND GRAPH NAMES + N ZN,ZI + S ZN="" + F ZI=1:1:17 D ; + . S ZN=ZN_$R(10) + Q ZN + ; +BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 + ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE + ; QUITS IF FILE IS NOT 172.101 + ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 + ; QUITS IF FIRST ENTRY IS NOT IENS 1 + ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES + ; ZBFDA IS PASSED BY REFERENCE + ; + ; -- reserves a block of iens from file 172.101 by locking the zero node + ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 + ; -- then unlocking to minimize the duration of the lock + ; + W !,"USING BULKLOAD" + I '$D(ZBFDA) Q ; EMPTY FDA + I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE + N ZCNT,ZP3,ZP4 + ; -- find the number of nodes to insert + S ZCNT=$O(ZBFDA(172.101,""),-1) + I ZCNT="" D Q ; + . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" + . B + ; -- lock the zero node and reserve a block of iens to insert + W !,"LOCKING ZERO NODE" + LOCK +^C0X(101,0) + S ZP3=$P(^C0X(101,0),U,3) + S ZP4=$P(^C0X(101,0),U,4) + S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 + S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 + LOCK -^C0X(101,0) + N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE + S ZBASE=ZP3 ; the last ien in the file + W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT + W !,$$NOW^XLFDT + S ZI="" + F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; + . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name + . I ZN="" D BLKERR Q ; + . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer + . I ZG="" D BLKERR Q ; + . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer + . I ZS="" D BLKERR Q ; + . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer + . I ZP="" D BLKERR Q ; + . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer + . I ZO="" D BLKERR Q ; + . S ZIEN=ZI+ZBASE ; the new ien + . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node + . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index + . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index + . S ^C0X(101,"SPO",ZS,ZP,ZO)="" + . S ^C0X(101,"SOP",ZS,ZO,ZP)="" + . S ^C0X(101,"OPS",ZO,ZP,ZS)="" + . S ^C0X(101,"OSP",ZO,ZS,ZP)="" + . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" + . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" + . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" + . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" + Q + ; +BLKERR ; + W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) + B + Q + ; diff --git a/p/C0XTKSB.m b/p/C0XTKSB.m index ca15258..d0c044d 100644 --- a/p/C0XTKSB.m +++ b/p/C0XTKSB.m @@ -1,131 +1,132 @@ -C0XTESTKSB ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05 - ; KSB - modified to fix a minor bug and to use;;;;;Build 7 - ; high resolution time if routines available ; 11/19/11 1410 EST - ;;0.1;C0X;nopatch;noreleasedate;Build 1 - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. - ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. - ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. - ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - ; - Q - ; -EN ; run the test - ; - k C0XFDA ; clear the node variable - s U="^" ; initialization - Bhaskar 20111119 - i '$d(^C0X(101,0)) d ; global doesn't exist - . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1" - n zg - S zg="_:G"_$$LKY9 ; all nodes are in the same graph - n zi - f zi=1:1:10000 d ; try a test of 10000 nodes - . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name - . s C0XFDA(172.101,zi,.02)=zg - . s C0XFDA(172.101,zi,.03)=$R(100000) - . s C0XFDA(172.101,zi,.04)=$R(100000) - . s C0XFDA(172.101,zi,.05)=$R(100000) - S C0XST=$$H ; start of the insertion test - W !,"INSERTION STARTS AT ",$ZDATE(C0XST,"YEAR-MM-DD:24:60:SS"),! - d BULKLOAD(.C0XFDA) - s C0XEND=$$H ; end of the insertion test - W !,"INSERTION ENDS AT ",$ZDATE(C0XEND,"YEAR-MM-DD:24:60:SS") - S C0XDIFF=(86400*($P(C0XEND,",",1)-$P(C0XST,",",1)))+$P(C0XEND,",",2)-$P(C0XST,",",2) - W !," ELAPSED TIME: ",C0XDIFF," SECONDS" - W ! - W:C0XDIFF>0 " APPROXIMATELY ",$FN(10000/C0XDIFF,",",0)," NODES PER SECOND",! - q - ; -LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING - ; UNIQUE NODE AND GRAPH NAMES - N ZN,ZI - S ZN="" - F ZI=1:1:9 D ; - . S ZN=ZN_$R(10) - Q ZN - ; -LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING - ; UNIQUE NODE AND GRAPH NAMES - N ZN,ZI - S ZN="" - F ZI=1:1:17 D ; - . S ZN=ZN_$R(10) - Q ZN - ; -BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 - ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE - ; QUITS IF FILE IS NOT 172.101 - ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 - ; QUITS IF FIRST ENTRY IS NOT IENS 1 - ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES - ; ZBFDA IS PASSED BY REFERENCE - ; - ; -- reserves a block of iens from file 172.101 by locking the zero node - ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 - ; -- then unlocking to minimize the duration of the lock - ; - W !,"USING BULKLOAD" - I '$D(ZBFDA) Q ; EMPTY FDA - I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE - N ZCNT,ZP3,ZP4 - ; -- find the number of nodes to insert - S ZCNT=$O(ZBFDA(172.101,""),-1) - I ZCNT="" D Q ; - . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" - . B - ; -- lock the zero node and reserve a block of iens to insert - W !,"LOCKING ZERO NODE" - LOCK +^C0X(101,0) - S ZP3=$P(^C0X(101,0),U,3) - S ZP4=$P(^C0X(101,0),U,4) - S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 - S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 - LOCK -^C0X(101,0) - N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE - S ZBASE=ZP3 ; the last ien in the file - W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT - W !,$ZDATE($$H,"YEAR-MM-DD:24:60:SS") - S ZI="" - F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; - . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name - . I ZN="" D BLKERR Q ; - . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer - . I ZG="" D BLKERR Q ; - . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer - . I ZS="" D BLKERR Q ; - . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer - . I ZP="" D BLKERR Q ; - . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer - . I ZO="" D BLKERR Q ; - . S ZIEN=ZI+ZBASE ; the new ien - . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node - . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index - . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index - . S ^C0X(101,"SPO",ZS,ZP,ZO)="" - . S ^C0X(101,"SOP",ZS,ZO,ZP)="" - . S ^C0X(101,"OPS",ZO,ZP,ZS)="" - . S ^C0X(101,"OSP",ZO,ZS,ZP)="" - . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" - . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" - . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" - . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" - Q - ; -BLKERR ; - W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) - B - Q - ; -H() - quit:$length($ztrnlnm("GTMXC_posix"))&$length($text(zhorolog^%POSIX)) $$zhorolog^%POSIX quit $horolog +C0XTESTKSB ; GPL - Fileman Triples bulk load tester ;11/6/11 17:05 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012 + ; KSB - modified to fix a minor bug and to use;;;;;Build 10 + ; high resolution time if routines available ; 11/19/11 1410 EST + ;;0.1;C0X;nopatch;noreleasedate;Build 1 + ;Copyright 2011 George Lilly. Licensed under the terms of the GNU + ;General Public License See attached copy of the License. + ; + ;This program is free software; you can redistribute it and/or modify + ;it under the terms of the GNU General Public License as published by + ;the Free Software Foundation; either version 2 of the License, or + ;(at your option) any later version. + ; + ;This program is distributed in the hope that it will be useful, + ;but WITHOUT ANY WARRANTY; without even the implied warranty of + ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ;GNU General Public License for more details. + ; + ;You should have received a copy of the GNU General Public License along + ;with this program; if not, write to the Free Software Foundation, Inc., + ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; + Q + ; +EN ; run the test + ; + k C0XFDA ; clear the node variable + s U="^" ; initialization - Bhaskar 20111119 + i '$d(^C0X(101,0)) d ; global doesn't exist + . s ^C0X(101,0)="C0X TRIPLE^172.101^1^1" + n zg + S zg="_:G"_$$LKY9 ; all nodes are in the same graph + n zi + f zi=1:1:10000 d ; try a test of 10000 nodes + . s C0XFDA(172.101,zi,.01)="N"_$$LKY17 ; node name + . s C0XFDA(172.101,zi,.02)=zg + . s C0XFDA(172.101,zi,.03)=$R(100000) + . s C0XFDA(172.101,zi,.04)=$R(100000) + . s C0XFDA(172.101,zi,.05)=$R(100000) + S C0XST=$$H ; start of the insertion test + W !,"INSERTION STARTS AT ",$ZDATE(C0XST,"YEAR-MM-DD:24:60:SS"),! + d BULKLOAD(.C0XFDA) + s C0XEND=$$H ; end of the insertion test + W !,"INSERTION ENDS AT ",$ZDATE(C0XEND,"YEAR-MM-DD:24:60:SS") + S C0XDIFF=(86400*($P(C0XEND,",",1)-$P(C0XST,",",1)))+$P(C0XEND,",",2)-$P(C0XST,",",2) + W !," ELAPSED TIME: ",C0XDIFF," SECONDS" + W ! + W:C0XDIFF>0 " APPROXIMATELY ",$FN(10000/C0XDIFF,",",0)," NODES PER SECOND",! + q + ; +LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING + ; UNIQUE NODE AND GRAPH NAMES + N ZN,ZI + S ZN="" + F ZI=1:1:9 D ; + . S ZN=ZN_$R(10) + Q ZN + ; +LKY17() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING + ; UNIQUE NODE AND GRAPH NAMES + N ZN,ZI + S ZN="" + F ZI=1:1:17 D ; + . S ZN=ZN_$R(10) + Q ZN + ; +BULKLOAD(ZBFDA) ; BULK LOADER FOR LOADING TRIPLES INTO FILE 172.101 + ; USING GLOBAL SETS INSTEAD OF UPDATE^DIE + ; QUITS IF FILE IS NOT 172.101 + ; EXPECTS AN FDA WITHOUT STRINGS FOR THE IENS, STARTING AT 1 + ; QUITS IF FIRST ENTRY IS NOT IENS 1 + ; ASSUMES THAT THE LAST IENS IS THE COUNT OF ENTRIES + ; ZBFDA IS PASSED BY REFERENCE + ; + ; -- reserves a block of iens from file 172.101 by locking the zero node + ; -- ^C0X(101,0) and adding the count of entries to piece 2 and 3 + ; -- then unlocking to minimize the duration of the lock + ; + W !,"USING BULKLOAD" + I '$D(ZBFDA) Q ; EMPTY FDA + I $O(ZBFDA(""))'=172.101 Q ; WRONG FILE + N ZCNT,ZP3,ZP4 + ; -- find the number of nodes to insert + S ZCNT=$O(ZBFDA(172.101,""),-1) + I ZCNT="" D Q ; + . W !,"ERROR IN BULK LOAD - INVALID NODE COUNT" + . B + ; -- lock the zero node and reserve a block of iens to insert + W !,"LOCKING ZERO NODE" + LOCK +^C0X(101,0) + S ZP3=$P(^C0X(101,0),U,3) + S ZP4=$P(^C0X(101,0),U,4) + S $P(^C0X(101,0),U,3)=ZP3+ZCNT+1 + S $P(^C0X(101,0),U,4)=ZP4+ZCNT+1 + LOCK -^C0X(101,0) + N ZI,ZN,ZG,ZS,ZP,ZO,ZIEN,ZBASE + S ZBASE=ZP3 ; the last ien in the file + W !,"ZERO NODE UNLOCKED, IENS RESERVED=",ZCNT + W !,$ZDATE($$H,"YEAR-MM-DD:24:60:SS") + S ZI="" + F S ZI=$O(ZBFDA(172.101,ZI)) Q:ZI="" D ; + . S ZN=$G(ZBFDA(172.101,ZI,.01)) ; node name + . I ZN="" D BLKERR Q ; + . S ZG=$G(ZBFDA(172.101,ZI,.02)) ; graph pointer + . I ZG="" D BLKERR Q ; + . S ZS=$G(ZBFDA(172.101,ZI,.03)) ; subject pointer + . I ZS="" D BLKERR Q ; + . S ZP=$G(ZBFDA(172.101,ZI,.04)) ; predicate pointer + . I ZP="" D BLKERR Q ; + . S ZO=$G(ZBFDA(172.101,ZI,.05)) ; object pointer + . I ZO="" D BLKERR Q ; + . S ZIEN=ZI+ZBASE ; the new ien + . S ^C0X(101,ZIEN,0)=ZN_U_ZG_U_ZS_U_ZP_U_ZO ; set the zero node + . S ^C0X(101,"B",ZN,ZIEN)="" ; the B index + . S ^C0X(101,"G",ZG,ZIEN)="" ; the G for Graph index + . S ^C0X(101,"SPO",ZS,ZP,ZO)="" + . S ^C0X(101,"SOP",ZS,ZO,ZP)="" + . S ^C0X(101,"OPS",ZO,ZP,ZS)="" + . S ^C0X(101,"OSP",ZO,ZS,ZP)="" + . S ^C0X(101,"GOPS",ZG,ZO,ZP,ZS)="" + . S ^C0X(101,"GOSP",ZG,ZO,ZS,ZP)="" + . S ^C0X(101,"GPSO",ZG,ZP,ZS,ZO)="" + . S ^C0X(101,"GSPO",ZG,ZS,ZP,ZO)="" + Q + ; +BLKERR ; + W !,"ERROR IN BULK LOAD",! ZWR ZBFDA(ZI) + B + Q + ; +H() + quit:$length($ztrnlnm("GTMXC_posix"))&$length($text(zhorolog^%POSIX)) $$zhorolog^%POSIX quit $horolog diff --git a/p/C0XUTIL.m b/p/C0XUTIL.m index a6183b4..e807e95 100644 --- a/p/C0XUTIL.m +++ b/p/C0XUTIL.m @@ -1,82 +1,82 @@ -C0XUTIL ; GPL - Fileman Triples utilities ;11/07/11 17:05 - ;;0.1;C0X;nopatch;noreleasedate;Build 7 - ;Copyright 2011 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. - ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. - ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. - ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - ; - Q - ; -NSP(ZX) ; OUTPUT TRANSFORM EXTRINSIC - ; - N ZR - ; I WOULD REALLY LIKE TO NOT HAVE THE FILE NUMBER HARD CODED HERE - ; ANYONE KNOW HOW I COULD DO THAT? :) GPL - S ZR=$$GET1^DIQ(172.201,ZX_",",.01) - I '$D(C0XNSP) S C0XNSP=1 ; DEFAULT ON - I C0XNSP=0 Q ZR ; SWITCHED OFF - I '$D(C0XVOC) D VOCINIT ; INITIALIZE THE VOCABULARIES - N ZI,ZJ,ZK S ZI="" - N DONE S DONE=0 - F S ZI=$O(C0XVOC(ZI)) Q:(DONE=1)!(ZI="") D ; - . ;W !,ZI - . S ZJ=C0XVOC(ZI) - . S ZK=$P(ZR,ZJ,2) - . ;W !,"ZK=",ZK - . I ZK'="" D ; BINGO - . . S ZR=ZI_":"_ZK - . . S DONE=1 - Q ZR - ; -VOCINIT ; INITIALIZE VOCABULARIES - S C0XVOC("dcterms")="http://purl.org/dc/terms/" - S C0XVOC("rdf")="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - S C0XVOC("sp")="http://smartplatforms.org/terms#" - S C0XVOC("qds")="http://cms.gov/pqri/qds/" - S C0XVOC("smart")="http://sandbox-api.smartplatforms.org/records/" - S C0XVOC("snomed")="http://purl.bioontology.org/ontology/SNOMEDCT/" - S C0XVOC("icd9")="http://purl.bioontology.org/ontology/ICD9/" - S C0XVOC("rxnorm")="http://purl.bioontology.org/ontology/RXNORM/" - S C0XVOC("loinc")="http://purl.bioontology.org/ontology/LNC/" - S C0XVOC("file")="/home/glilly/fmts/trunk/samples/" - S C0XVOC("foaf")="http://xmlns.com/foaf/0.1/" - S C0XVOC("skos")="http://www.w3.org/2004/02/skos/core#" - S C0XVOC("gpl")="http://georgetriples.org/" - S C0XVOC("cg")="http://datasets.caregraf.org/" - S C0XVOC("mv")="http://metavista.name/foundation#" - S C0XVOC("rdfs")="http://www.w3.org/2000/01/rdf-schema#" - S C0XVOC("vistaSmart")="https://smart2.vistaewd.net/vista/smart/records/" - S C0XVOC("vmu")="http://vista.org/mu/" - S C0XVOC("vq")="http://vista.org/quality/" - S C0XVOC("nodeID")="iDPsDPss" - S C0XVOC("fmts")="http://glilly.net/fmts#" - S C0XVOC("oro")="http://oro.com/vista/sage" ;change to get URL from system - S C0XVOC("sage")="http://oro.com/sage/schema#" - S C0XVOC("v")="http://www.w3.org/2006/vcard/ns#" - Q - ; -EXT(C0XIN) ; EXTRINSIC WHICH EXPANDS NAMESPACES - ; SO skos:xxx would return http://www.w3.org/2004/02/skos/core#xxx - N C0XPRE - S C0XPRE=C0XIN - I '$D(C0XVOC) D VOCINIT ; INITIALIZE NAME SPACE TABLE - I C0XPRE[":" D ; expand using vocabulary - . N ZB,ZA - . S ZB=$P(C0XPRE,":",1) - . S ZA=$P(C0XPRE,":",2) - . I $G(C0XVOC(ZB))'="" D ; - . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded - Q C0XPRE - ; +C0XUTIL ; GPL - Fileman Triples utilities ;11/07/11 17:05 + ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 10 + ;Copyright 2011 George Lilly. Licensed under the terms of the GNU + ;General Public License See attached copy of the License. + ; + ;This program is free software; you can redistribute it and/or modify + ;it under the terms of the GNU General Public License as published by + ;the Free Software Foundation; either version 2 of the License, or + ;(at your option) any later version. + ; + ;This program is distributed in the hope that it will be useful, + ;but WITHOUT ANY WARRANTY; without even the implied warranty of + ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ;GNU General Public License for more details. + ; + ;You should have received a copy of the GNU General Public License along + ;with this program; if not, write to the Free Software Foundation, Inc., + ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; + Q + ; +NSP(ZX) ; OUTPUT TRANSFORM EXTRINSIC + ; + N ZR + ; I WOULD REALLY LIKE TO NOT HAVE THE FILE NUMBER HARD CODED HERE + ; ANYONE KNOW HOW I COULD DO THAT? :) GPL + S ZR=$$GET1^DIQ(172.201,ZX_",",.01) + I '$D(C0XNSP) S C0XNSP=1 ; DEFAULT ON + I C0XNSP=0 Q ZR ; SWITCHED OFF + I '$D(C0XVOC) D VOCINIT ; INITIALIZE THE VOCABULARIES + N ZI,ZJ,ZK S ZI="" + N DONE S DONE=0 + F S ZI=$O(C0XVOC(ZI)) Q:(DONE=1)!(ZI="") D ; + . ;W !,ZI + . S ZJ=C0XVOC(ZI) + . S ZK=$P(ZR,ZJ,2) + . ;W !,"ZK=",ZK + . I ZK'="" D ; BINGO + . . S ZR=ZI_":"_ZK + . . S DONE=1 + Q ZR + ; +VOCINIT ; INITIALIZE VOCABULARIES + S C0XVOC("dcterms")="http://purl.org/dc/terms/" + S C0XVOC("rdf")="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + S C0XVOC("sp")="http://smartplatforms.org/terms#" + S C0XVOC("qds")="http://cms.gov/pqri/qds/" + S C0XVOC("smart")="http://sandbox-api.smartplatforms.org/records/" + S C0XVOC("snomed")="http://purl.bioontology.org/ontology/SNOMEDCT/" + S C0XVOC("icd9")="http://purl.bioontology.org/ontology/ICD9/" + S C0XVOC("rxnorm")="http://purl.bioontology.org/ontology/RXNORM/" + S C0XVOC("loinc")="http://purl.bioontology.org/ontology/LNC/" + S C0XVOC("file")="/home/glilly/fmts/trunk/samples/" + S C0XVOC("foaf")="http://xmlns.com/foaf/0.1/" + S C0XVOC("skos")="http://www.w3.org/2004/02/skos/core#" + S C0XVOC("gpl")="http://georgetriples.org/" + S C0XVOC("cg")="http://datasets.caregraf.org/" + S C0XVOC("mv")="http://metavista.name/foundation#" + S C0XVOC("rdfs")="http://www.w3.org/2000/01/rdf-schema#" + S C0XVOC("vistaSmart")="https://smart2.vistaewd.net/vista/smart/records/" + S C0XVOC("vmu")="http://vista.org/mu/" + S C0XVOC("vq")="http://vista.org/quality/" + S C0XVOC("nodeID")="iDPsDPss" + S C0XVOC("fmts")="http://glilly.net/fmts#" + S C0XVOC("oro")="http://oro.com/vista/sage" ;change to get URL from system + S C0XVOC("sage")="http://oro.com/sage/schema#" + S C0XVOC("v")="http://www.w3.org/2006/vcard/ns#" + Q + ; +EXT(C0XIN) ; EXTRINSIC WHICH EXPANDS NAMESPACES + ; SO skos:xxx would return http://www.w3.org/2004/02/skos/core#xxx + N C0XPRE + S C0XPRE=C0XIN + I '$D(C0XVOC) D VOCINIT ; INITIALIZE NAME SPACE TABLE + I C0XPRE[":" D ; expand using vocabulary + . N ZB,ZA + . S ZB=$P(C0XPRE,":",1) + . S ZA=$P(C0XPRE,":",2) + . I $G(C0XVOC(ZB))'="" D ; + . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded + Q C0XPRE + ;