- Timestamp:
- Mar 10, 2012, 12:16:58 AM (13 years ago)
- Location:
- fmts/trunk/p
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fmts/trunk/p/C0XF2N.m
r1372 r1376 440 440 Q ZN 441 441 ; 442 ; these routines add the string if it is not found 443 ; 442 444 IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE 443 445 I '$D(FARY) D ; -
fmts/trunk/p/C0XGET1.m
r1374 r1376 123 123 k triplertn ; start with a clean return 124 124 n zsub,zpred,zobj,zgraph,tmprtn 125 s zsub=$$IENOF ^C0XF2N($$EXT^C0XUTIL($g(sub)),fary) ; ien of subject126 s zpred=$$IENOF ^C0XF2N($$EXT^C0XUTIL($g(pred)),fary) ; ien of predicate127 s zobj=$$IENOF ^C0XF2N($$EXT^C0XUTIL($g(obj)),fary) ; ien of object128 s zgraph=$$IENOF ^C0XF2N($g(graph),fary) ; ien of graph125 s zsub=$$IENOF($$EXT^C0XUTIL($g(sub)),fary) ; ien of subject 126 s zpred=$$IENOF($$EXT^C0XUTIL($g(pred)),fary) ; ien of predicate 127 s zobj=$$IENOF($$EXT^C0XUTIL($g(obj)),fary) ; ien of object 128 s zgraph=$$IENOF($g(graph),fary) ; ien of graph 129 129 W !,"s:",zsub," p:",zpred," o:",zobj 130 130 d trip(.tmprtn,zsub,zpred,zobj,zgraph,fary) … … 146 146 ; 147 147 objects(listrtn,sub,pred,obj,graph,form,fary) ; return list of subjects 148 d onelist("O" ) ;subjects149 q 150 ; 151 onelist(zw ) ; returns list148 d onelist("O",$g(sub),$g(pred),"",$g(fary)) ;subjects 149 q 150 ; 151 onelist(zw,sub,pred,obj,fary) ; returns list 152 152 ; zw is S P or O depending on what should be returned 153 I '$D(fary)D ;153 I $g(fary)="" D ; 154 154 . D INITFARY^C0XF2N("C0XFARY") 155 155 . S fary="C0XFARY" … … 158 158 k listrtn ; start with a clean return 159 159 n zsub,zpred,zobj,zgraph,tmprtn 160 s zsub=$$IENOF ^C0XF2N($$EXT^C0XUTIL($g(sub)),fary) ; ien of subject161 s zpred=$$IENOF ^C0XF2N($$EXT^C0XUTIL($g(pred)),fary) ; ien of predicate162 s zobj=$$IENOF ^C0XF2N($$EXT^C0XUTIL($g(obj)),fary) ; ien of object163 s zgraph=$$IENOF ^C0XF2N($g(graph),fary) ; ien of graph160 s zsub=$$IENOF($$EXT^C0XUTIL($g(sub)),fary) ; ien of sub 161 s zpred=$$IENOF($$EXT^C0XUTIL($g(pred)),fary) ; ien of pred 162 s zobj=$$IENOF($$EXT^C0XUTIL($g(obj)),fary) ; ien of obj 163 s zgraph=$$IENOF($g(graph),fary) ; ien of graph 164 164 W !,"s:",zsub," p:",zpred," o:",zobj 165 165 n c0xflag,zi,zx,zt 166 166 s zt=$na(^C0X(101)) ; 167 s c0xflag=$$m eta(zsub,zpred,zobj) ; get metaflags167 s c0xflag=$$mask(zsub,zpred,zobj) ; get mask flags 168 168 k tmprtn 169 169 n itbl,ii,ix … … 173 173 s ix=$s(zw="O":"d just(zobj)",1:"d zip1(.tmprtn,zt,zi,zobj)") 174 174 s itbl("I001",ii)=ix 175 s ii=$s(zw="S":"PSO",zw="P":"POS",zw="O":" OPS") ; pred constraint176 s ix=$s(zw=" O":"d just(zpred)",1:"d zip1(.tmprtn,zt,zi,zpred)")177 s itbl("I010", "PSO")=ix175 s ii=$s(zw="S":"PSO",zw="P":"POS",zw="O":"POS") ; pred constraint 176 s ix=$s(zw="P":"d just(zpred)",1:"d zip1(.tmprtn,zt,zi,zpred)") 177 s itbl("I010",ii)=ix 178 178 s ii=$s(zw="S":"POS",zw="P":"OPS",zw="O":"OSP") ; pred + obj constraint 179 179 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)") 180 s itbl("I011","POS")=ix 181 s itbl("I100","SPO")="d zip(.tmprtn,zt,zi)" 182 s itbl("I101","OSP")="d zip1(.tmprtn,zt,zi,zobj)" 183 s itbl("I110","PSO")="d zip1(.tmprtn,zt,zi,zpred)" 184 s itbl("I111","POS")="d zip2(.tmprtn,zt,zi,zpred,zobj)" 185 s zi=$o(itbl(c0xflag,"")) 180 s itbl("I011",ii)=ix 181 s ii=$s(zw="S":"SPO",zw="P":"SPO",zw="O":"SOP") ; sub constraint 182 s ix=$s(zw="S":"d just(zsub)",1:"d zip1(.tmprtn,zt,zi,zsub)") 183 s itbl("I100",ii)=ix 184 s ii=$s(zw="S":"SPO",zw="P":"SOP",zw="O":"OSP") ; sub + obj constraint 185 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)") 186 s itbl("I101",ii)=ix 187 s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"SPO") ; sub + pred constraint 188 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)") 189 s itbl("I110",ii)=ix 190 s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"OSP") ; sub + pred + obj constraint 191 s ix=$s(zw="O":"d just(zobj)",zw="S":"d just(zsub)",zw="P":"d just(zpred)",1:"d just(zsub)") 192 s itbl("I111",ii)=ix 193 ; end itbl definition 194 ; 195 s zi=$o(itbl(c0xflag,"")) ; find index to use 186 196 s zx=itbl(c0xflag,zi) ; executable instruction to run 187 i $g(ngraph)'="" s zi="G"_zi 188 w !,zx 197 ;i $g(ngraph)'="" s zi="G"_zi ; this is wrong.. don't do graphs yet 198 w !,c0xflag," ",zw," ",zt," ",zi," ",zx,! 199 ;zwr itbl 189 200 x zx 190 201 k listrtn … … 268 279 q 269 280 ; 270 m eta(zsub,zpred,zobj) ; function to return metainformation281 mask(zsub,zpred,zobj) ; function to return mask information 271 282 ; about the inputs ie I100 for just a subject and no pred or obj 272 283 n zf1,zf2,zf3,zflag … … 283 294 n c0xflag,zi,zx,zt 284 295 s zt=$na(^C0X(101)) ; 285 s c0xflag=$$m eta(nsub,npred,nobj) ; get metaflags296 s c0xflag=$$mask(nsub,npred,nobj) ; get mask flags 286 297 n itbl 287 298 s itbl("I000","SPO")="d do3(.triprtn,zt,zi)" … … 333 344 . . . s dortn(zr)="" 334 345 q 346 ; 347 IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE 348 I '$D(FARY) D ; 349 . D INITFARY^C0XF2N("C0XFARY") 350 . S FARY="C0XFARY" 351 N ZIEN 352 I $G(ZSTRING)="" Q "" ; NO STRING 353 S ZIEN=$O(@C0XSN@("B",ZSTRING,"")) 354 Q ZIEN 355 ; 356 IENOFA(ZOUTARY,INARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE 357 ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)="" 358 I '$D(FARY) D ; 359 . D INITFARY^C0XF2N("C0XFARY") 360 . S FARY="C0XFARY" 361 K ZOUTARY ; START WITH CLEAN RESULTS 362 K C0XFDA2 ; USE A SEPARATE FDA FOR THIS 363 I '$D(C0XVOC) D VOCINIT^C0XUTIL 364 N ZINARY 365 N ZI S ZI="" 366 F S ZI=$O(INARY(ZI)) Q:ZI="" D ; 367 . N ZK 368 . S ZK=$O(INARY(ZI,"")) 369 . S ZINARY($$EXT^C0XUTIL(ZI),$$EXT^C0XUTIL(ZK))="" 370 N ZV,ZIEN 371 N ZCNT S ZCNT=0 372 F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS 373 . S ZV=$O(ZINARY(ZI,"")) 374 . I ZV["^" S ZV=$TR(ZV,"^","|") 375 F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOW GET ALL IENS 376 . S ZV=$O(ZINARY(ZI,"")) 377 . I ZV["^" S ZV=$TR(ZV,"^","|") 378 . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW 379 . I ZIEN="" S ZOUTARY("IEN",ZI)="" 380 . E S ZOUTARY("IEN",ZI,ZIEN)="" 381 Q 335 382 ; 336 383 output(zwhat,zfname,zdir) ; function to write an array to a host file
Note:
See TracChangeset
for help on using the changeset viewer.