source: fmts/trunk/p/C0XXFRM.m@ 1421

Last change on this file since 1421 was 1421, checked in by George Lilly, 12 years ago

new handy utilities for transforming triples to mumps and back again

File size: 2.0 KB
Line 
1C0XXFRM ; 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 ;
22TEST1 ; test GRAPHY
23 ;
24 S G("positiveMatch",18262)=""
25 S G("positiveMatch",18262,"DOB")="19520606^19520606"
26 S G("positiveMatch",18262,"FNAME")="GEORGE^GEORGE PHILLIP"
27 S G("positiveMatch",18262,"LNAME")="LILLY^LILLY"
28 S G("positiveMatch",18262,"SSN")=310449999
29 S GRAPH="/test/gpl/graph"
30 S SUBJECT="/test/gpl/match"
31 D GRAPHY("G2","G",GRAPH,SUBJECT) ; CONVERT TO GRAPH
32 ZWR G2
33 ;
34 Q
35 ;
36TEST2 ; test ARRAYIFY
37 ;
38 Q
39 ;
40GRAPHY(ZOUT,ZIN,ZGRF,ZSUB,ZWHICH) ; turn a mumps array into triples
41 W !,"GRAPHY: ZOUT=",ZOUT," ZIN=",ZIN," ZSUB=",ZSUB," ZWHICH=",$G(ZWHICH),!
42 N ZI S ZI=$G(ZWHICH)
43 N ZP
44 S ZP=$O(@ZIN@(ZI))
45 W !,"ZP=",ZP
46 I ZP="" Q ; THE WAY OUT
47 N ZJ S ZJ=""
48 F S ZJ=$O(@ZIN@(ZP,ZJ)) Q:ZJ="" D ; for each object
49 . N ZO
50 . S ZO=$$ANONS^C0XF2N ; anonomous subject
51 . S @ZOUT@(ZSUB,ZP)=ZO
52 . S @ZOUT@(ZO,"rdf:id")=ZJ
53 . N ZK S ZK=""
54 . F S ZK=$O(@ZIN@(ZP,ZJ,ZK)) Q:ZK="" D ;
55 . . S @ZOUT@(ZO,ZK)=$G(@ZIN@(ZP,ZJ,ZK))
56 . . D GRAPHY(ZOUT,$NA(@ZIN@(ZP,ZJ,ZK)),ZGRF,ZO)
57 ;
58 Q
59 ;
60ARRAYIFY(ZOUT,ZIN,ZWHICH) ; turn triples into a mumps array (opposite of GRAPHY)
61 ;
62 Q
63 ;
Note: See TracBrowser for help on using the repository browser.