| 1 | C0XXFRM ; GPL - Fileman Triples utilities ;11/07/11  17:05 | 
|---|
| 2 | ;;0.1;C0X;nopatch;noreleasedate;Build 7 | 
|---|
| 3 | ;Copyright 2011 George Lilly.  Licensed under the terms of the GNU | 
|---|
| 4 | ;General Public License See attached copy of the License. | 
|---|
| 5 | ; | 
|---|
| 6 | ;This program is free software; you can redistribute it and/or modify | 
|---|
| 7 | ;it under the terms of the GNU General Public License as published by | 
|---|
| 8 | ;the Free Software Foundation; either version 2 of the License, or | 
|---|
| 9 | ;(at your option) any later version. | 
|---|
| 10 | ; | 
|---|
| 11 | ;This program is distributed in the hope that it will be useful, | 
|---|
| 12 | ;but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 13 | ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 14 | ;GNU General Public License for more details. | 
|---|
| 15 | ; | 
|---|
| 16 | ;You should have received a copy of the GNU General Public License along | 
|---|
| 17 | ;with this program; if not, write to the Free Software Foundation, Inc., | 
|---|
| 18 | ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 
|---|
| 19 | ; | 
|---|
| 20 | Q | 
|---|
| 21 | ; | 
|---|
| 22 | TEST1 ; test GRAPHY | 
|---|
| 23 | ; | 
|---|
| 24 | S G("possibleMatch",18262)="" | 
|---|
| 25 | S G("possibleMatch",18262,"DOB")="19520606^19520606" | 
|---|
| 26 | S G("possibleMatch",18262,"FNAME")="GEORGE^GEORGE PHILLIP" | 
|---|
| 27 | S G("possibleMatch",18262,"LNAME")="LILLY^LILLY" | 
|---|
| 28 | S G("possibleMatch",18262,"SSN")=310449999 | 
|---|
| 29 | S G("possibleMatch",18263)="" | 
|---|
| 30 | S G("possibleMatch",18263,"DOB")="19520606^19531031" | 
|---|
| 31 | S G("possibleMatch",18263,"FNAME")="GEORGE^FRANCIS JAMES" | 
|---|
| 32 | S G("possibleMatch",18263,"LNAME")="LILLY^LILLY" | 
|---|
| 33 | S G("possibleMatch",18263,"SSN")=3232221111 | 
|---|
| 34 | S GRAPH="/test/gpl/graph" | 
|---|
| 35 | S SUBJECT="/test/gpl/match" | 
|---|
| 36 | D GRAPHY("G2","G",GRAPH,SUBJECT) ; CONVERT TO GRAPH | 
|---|
| 37 | W ! | 
|---|
| 38 | ZWR G2 | 
|---|
| 39 | ; | 
|---|
| 40 | Q | 
|---|
| 41 | ; | 
|---|
| 42 | TEST2 ; test ARRAYIFY | 
|---|
| 43 | ; | 
|---|
| 44 | Q | 
|---|
| 45 | ; | 
|---|
| 46 | GRAPHY(ZOUT,ZIN,ZGRF,ZSUB,ZWHICH) ; turn a mumps array into triples | 
|---|
| 47 | W !,"GRAPHY: ZOUT=",ZOUT," ZIN=",ZIN," ZSUB=",ZSUB," ZWHICH=",$G(ZWHICH),! | 
|---|
| 48 | N ZI S ZI=$G(ZWHICH) | 
|---|
| 49 | N ZP | 
|---|
| 50 | S ZP=$O(@ZIN@(ZI)) | 
|---|
| 51 | W !,"ZP=",ZP | 
|---|
| 52 | I ZP="" Q  ; THE WAY OUT | 
|---|
| 53 | N ZJ S ZJ="" | 
|---|
| 54 | F  S ZJ=$O(@ZIN@(ZP,ZJ)) Q:ZJ=""  D  ; for each object | 
|---|
| 55 | . N ZO | 
|---|
| 56 | . S ZO=$$ANONS^C0XF2N ; anonomous subject | 
|---|
| 57 | . S @ZOUT@(ZSUB,ZP,ZO)="" | 
|---|
| 58 | . S @ZOUT@(ZO,"rdf:id",ZJ)="" | 
|---|
| 59 | . N ZK S ZK="" | 
|---|
| 60 | . F  S ZK=$O(@ZIN@(ZP,ZJ,ZK)) Q:ZK=""  D  ; | 
|---|
| 61 | . . S @ZOUT@(ZO,ZK,$G(@ZIN@(ZP,ZJ,ZK)))="" | 
|---|
| 62 | . . D GRAPHY(ZOUT,$NA(@ZIN@(ZP,ZJ,ZK)),ZGRF,ZO) | 
|---|
| 63 | ; | 
|---|
| 64 | Q | 
|---|
| 65 | ; | 
|---|
| 66 | ARRAYIFY(ZOUT,ZIN,ZWHICH) ; turn triples into a mumps array (opposite of GRAPHY) | 
|---|
| 67 | ; | 
|---|
| 68 | Q | 
|---|
| 69 | ; | 
|---|