source: fmts/trunk/p/C0XGET1.m@ 1384

Last change on this file since 1384 was 1383, checked in by George Lilly, 13 years ago

fixed bug in non-xml inport

File size: 14.4 KB
RevLine 
[1343]1C0XGET1 ; GPL - Fileman Triples entry point routine ;1/12/12 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 ;
22LSSUBJ(RTN,ZSUBJ,C0XFARY) ; LIST NODES WITH SUBJECT ZSUBJ
23 ;
24 I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY")
25 D USEFARY^C0XF2N("C0XFARY")
26 Q
27 ;
[1382]28graph(sub,pred,obj,form,fary) ; extrinsic which returns a graph name
29 I '$D(fary) D ;
30 . S fary="C0XFARY"
31 . D INITFARY^C0XF2N(fary)
32 D USEFARY^C0XF2N(fary)
33 k triplertn ; start with a clean return
34 n zsub,zpred,zobj,zgraph,tmprtn
35 s zsub=$$IENOF($$EXT^C0XUTIL($g(sub)),fary) ; ien of subject
36 s zpred=$$IENOF($$EXT^C0XUTIL($g(pred)),fary) ; ien of predicate
37 s zobj=$$IENOF($$EXT^C0XUTIL($g(obj)),fary) ; ien of object
38 s zgraph=$$IENOF($g(graph),fary) ; ien of graph
39 W !,"s:",zsub," p:",zpred," o:",zobj
40 d trip(.tmprtn,zsub,zpred,zobj,zgraph,fary)
41 n ztmp
42 d trip(.ztmp,$g(sub),$g(pred),$g(obj),"",$g(fary))
43 n zi,zg,zrtn
44 s zi=$o(tmprtn(""))
45 s zg=$$GET1^DIQ(C0XTFN,zi,.02,"E") ;
46 i zg="" q ""
47 s zrtn=zg
48 i $o(tmprtn(zi))'="" d
49 . s zrtn=""
50 q zrtn
51 ;
[1349]52GRAPHS(RTN,C0XFARY) ; LIST ALL GRAPHS
[1343]53 ;
54 I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY")
55 D USEFARY^C0XF2N("C0XFARY")
56 N ZI S ZI=""
57 F S ZI=$O(@C0XTN@("G",ZI)) Q:ZI="" D ;
58 . S RTN(ZI,$$STR(ZI))=""
59 Q
60 ;
61STR(ZIN,C0XFARY) ; EXTRINSIC RETURNS A STRING
62 I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY")
63 Q $$GET1^DIQ(C0XSFN,ZIN,.01,"E")
64 ;
65SPO(ZRTN,ZNODE,C0XFARY)
66 I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY")
67 N ZI S ZI=$$NXT(.ZRTN)
68 S ZRTN(ZI,"S")=$$S(ZNODE)
69 S ZRTN(ZI,"P")=$$P(ZNODE)
70 S ZRTN(ZI,"O")=$$O(ZNODE)
71 Q
72 ;
73S(ZNODE,C0XFARY) ; EXTRINSIC RETURNING THE SUBJECT
74 Q $$STR($$GET1^DIQ(C0XTFN,ZNODE,.03,"I")) ;
75 ;
76P(ZNODE,C0XFARY) ; EXTRINSIC RETURNING THE PREDICATE
77 Q $$STR($$GET1^DIQ(C0XTFN,ZNODE,.04,"I")) ;
78 ;
79O(ZNODE,C0XFARY) ; EXTRINSIC RETURNING THE OBJECT
80 Q $$STR($$GET1^DIQ(C0XTFN,ZNODE,.05,"I")) ;
81 ;
82NXT(ZRTN) ;EXTRINSIC FOR THE NEXT NODE IN ARRAY ZRTN, PASSED BY REF
[1349]83 I '$D(ZRTN) S ZRTN=""
[1343]84 Q $O(ZRTN(""),-1)+1
85 ;
86SING(ZRTN,ZG) ; SUBJECTS IN GRAPH
87 ;
88 I '$D(C0XFARY) D INITFARY^C0XF2N("C0XFARY")
[1349]89 I '$D(ZRTN) S ZRTN=""
[1343]90 N ZI,ZN S ZI=""
[1349]91 F S ZI=$O(@C0XTN@("GSPO",ZG,ZI)) Q:ZI="" D ;
92 . S ZRTN($$NXT(.ZRTN),"S")=$$STR(ZI)
[1343]93 Q
[1349]94 ;
[1350]95qparse(qrtn,zquery) ; parses the query
96 ; want this to be able to handle the WHERE clause of SPARQL eventually
97 ;
98 n q1,q2,q3,qq
99 ;s qq=$tr(zquery," ","^")
100 s qq=query ; really want to remove whitespace here
101 s q1=$p(qq," ",1)
102 i q1["?" s q1=""
103 s q2=$p(qq," ",2)
104 i q2["?" s q2=""
105 s q3=$p(qq," ",3)
106 i q3["?" s q3=""
107 s qrtn(1)=q1_"^"_q2_"^"_q3 ; more lines to come later
108 q
109 ;
[1368]110getGraph(zrtn,zgrf,form) ; get all triples in graph zgrf
111 ; forms planned: "rdf" "json" "array" "turtle" "triples"
112 ; forms supported: "rdf" "json" "array"
113 I '$D(form) S form="rdf"
114 N ZIENS,ZTRIP
115 D TING^C0XF2N(.ZIENS,zgrf)
116 I '$D(ZIENS) Q ;
117 D ien2tary(.ZTRIP,"ZIENS")
118 I form="json" d jsonout(.zrtn,.ZTRIP) q ; what follows is else
119 i form="rdf" d rdfout^C0XRDF(.zrtn,.ZTRIP) q ;
120 i form="array" d arrayout^C0XGET1(.zrtn,.ZTRIP) q ;
121 W !,"Form not supported: ",form
122 Q
123 ;
[1350]124rpctrip(rtn,query,limit,offset) ; rpc to access triples with a query
125 ;
126 n zoff,zlim,zcount,zq
[1351]127 k rtn
[1350]128 i '$d(limit) s limit=250
129 i '$d(offset) s offset=0
130 d qparse(.zq,query) ; parse the query
131 n qsub,qpred,qobj,qtmp
132 W !,zq(1)
133 s qsub=$p(zq(1),"^",1)
134 s qpred=$p(zq(1),"^",2)
135 s qobj=$p(zq(1),"^",3)
136 d triples(.qtmp,qsub,qpred,qobj)
137 f zcount=offset+1:1:offset+limit q:'$d(qtmp(zcount)) d ;
138 . s rtn(zcount)=qtmp(zcount)
139 q
140 ;
[1368]141triples(triplertn,sub,pred,obj,graph,form,fary) ; returns triples
[1349]142 I '$D(fary) D ;
143 . D INITFARY^C0XF2N("C0XFARY")
144 . S fary="C0XFARY"
145 D USEFARY^C0XF2N(fary)
[1368]146 I '$D(form) S form="json"
[1349]147 k triplertn ; start with a clean return
148 n zsub,zpred,zobj,zgraph,tmprtn
[1376]149 s zsub=$$IENOF($$EXT^C0XUTIL($g(sub)),fary) ; ien of subject
150 s zpred=$$IENOF($$EXT^C0XUTIL($g(pred)),fary) ; ien of predicate
151 s zobj=$$IENOF($$EXT^C0XUTIL($g(obj)),fary) ; ien of object
152 s zgraph=$$IENOF($g(graph),fary) ; ien of graph
[1349]153 W !,"s:",zsub," p:",zpred," o:",zobj
154 d trip(.tmprtn,zsub,zpred,zobj,zgraph,fary)
[1367]155 d ien2tary(.zrary,"tmprtn") ; convert to triples
[1354]156 ;
[1368]157 i form="json" d jsonout(.triplertn,.zrary) q ; what follows is 'else'
158 i form="rdf" d rdfout^C0XRDF(.triplertn,.zrary) q ;
159 i form="array" d arrayout(.triplertn,.zrary) q ;
160 w !,"form not supported: ",form
161 q
[1354]162 ;
[1377]163subjects(listrtn,pred,obj,graph,form,fary) ; return list of subjects
164 d onelist("S",,$g(pred),$g(obj),$g(fary)) ;subjects
[1373]165 q
166 ;
[1381]167subject(pred,obj,graph,form,fary) ; extrinsic which returns the first
168 ; multiple of return from subjects - returns null if more than one
169 ; subjects(.G,sub,pred)
170 ; G("nodeID:1234") ==> "nodeID:1234"
171 n zin,zrtn
172 d subjects(.zin,$g(pred),$g(obj),$g(form),$g(fary))
173 s zrtn=$o(zin(""))
174 i $o(zin(zrtn))'="" s zrtn=""
175 q zrtn
176 ;
[1377]177preds(listrtn,sub,obj,graph,form,fary) ; return list of subjects
178 d onelist("P",$g(sub),,$g(obj),$g(fary)) ;subjects
[1373]179 q
180 ;
[1377]181objects(listrtn,sub,pred,graph,form,fary) ; return list of subjects
[1376]182 d onelist("O",$g(sub),$g(pred),"",$g(fary)) ;subjects
[1373]183 q
184 ;
[1381]185object(sub,pred,graph,form,fary) ; extrinsic which returns the first
186 ; multiple of return from objects - returns null if more than one
187 ; objects(.G,sub,pred)
188 ; G("location") ==> "location"
189 n zin,zrtn
190 d objects(.zin,$g(sub),$g(pred),$g(form),$g(fary))
191 s zrtn=$o(zin(""))
192 i $o(zin(zrtn))'="" s zrtn=""
193 q zrtn
194 ;
[1376]195onelist(zw,sub,pred,obj,fary) ; returns list
[1373]196 ; zw is S P or O depending on what should be returned
[1376]197 I $g(fary)="" D ;
[1373]198 . D INITFARY^C0XF2N("C0XFARY")
199 . S fary="C0XFARY"
200 D USEFARY^C0XF2N(fary)
201 I '$D(form) S form="json"
202 k listrtn ; start with a clean return
203 n zsub,zpred,zobj,zgraph,tmprtn
[1376]204 s zsub=$$IENOF($$EXT^C0XUTIL($g(sub)),fary) ; ien of sub
205 s zpred=$$IENOF($$EXT^C0XUTIL($g(pred)),fary) ; ien of pred
206 s zobj=$$IENOF($$EXT^C0XUTIL($g(obj)),fary) ; ien of obj
207 s zgraph=$$IENOF($g(graph),fary) ; ien of graph
[1373]208 W !,"s:",zsub," p:",zpred," o:",zobj
209 n c0xflag,zi,zx,zt
210 s zt=$na(^C0X(101)) ;
[1376]211 s c0xflag=$$mask(zsub,zpred,zobj) ; get mask flags
[1373]212 k tmprtn
213 n itbl,ii,ix
214 s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"OSP") ; no constraint
215 s itbl("I000",ii)="d zip(.tmprtn,zt,zi)"
216 s ii=$s(zw="S":"OSP",zw="P":"OPS",zw="O":"OSP") ; obj constraint
[1374]217 s ix=$s(zw="O":"d just(zobj)",1:"d zip1(.tmprtn,zt,zi,zobj)")
[1373]218 s itbl("I001",ii)=ix
[1376]219 s ii=$s(zw="S":"PSO",zw="P":"POS",zw="O":"POS") ; pred constraint
220 s ix=$s(zw="P":"d just(zpred)",1:"d zip1(.tmprtn,zt,zi,zpred)")
221 s itbl("I010",ii)=ix
[1374]222 s ii=$s(zw="S":"POS",zw="P":"OPS",zw="O":"OSP") ; pred + obj constraint
223 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)")
[1376]224 s itbl("I011",ii)=ix
225 s ii=$s(zw="S":"SPO",zw="P":"SPO",zw="O":"SOP") ; sub constraint
226 s ix=$s(zw="S":"d just(zsub)",1:"d zip1(.tmprtn,zt,zi,zsub)")
227 s itbl("I100",ii)=ix
228 s ii=$s(zw="S":"SPO",zw="P":"SOP",zw="O":"OSP") ; sub + obj constraint
229 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)")
230 s itbl("I101",ii)=ix
231 s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"SPO") ; sub + pred constraint
232 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)")
233 s itbl("I110",ii)=ix
234 s ii=$s(zw="S":"SPO",zw="P":"POS",zw="O":"OSP") ; sub + pred + obj constraint
235 s ix=$s(zw="O":"d just(zobj)",zw="S":"d just(zsub)",zw="P":"d just(zpred)",1:"d just(zsub)")
236 s itbl("I111",ii)=ix
237 ; end itbl definition
238 ;
239 s zi=$o(itbl(c0xflag,"")) ; find index to use
[1373]240 s zx=itbl(c0xflag,zi) ; executable instruction to run
[1376]241 ;i $g(ngraph)'="" s zi="G"_zi ; this is wrong.. don't do graphs yet
242 w !,c0xflag," ",zw," ",zt," ",zi," ",zx,!
243 ;zwr itbl
[1373]244 x zx
245 k listrtn
246 d strings(.listrtn,"tmprtn") ; convert pointer to strings
247 q
248 ;
[1374]249just(zin) ; add one element to tmprtn
250 s tmprtn(zin)=""
251 q
252 ;
[1373]253zip(zrtn,zt,zi) ; pull out just the first element of the index
254 ;
255 n zii s zii=""
256 f s zii=$o(@zt@(zi,zii)) q:zii="" d ;
257 . s zrtn(zii)=""
258 q
259 ;
260zip1(zrtn,zt,zi,zn) ; pull out just the first element of the index
261 ;
262 n zii s zii=""
263 f s zii=$o(@zt@(zi,zn,zii)) q:zii="" d ;
264 . s zrtn(zii)=""
265 q
266 ;
267zip2(zrtn,zt,zi,zn,zn1) ; pull out just the first element of the index
268 ;
269 n zii s zii=""
270 f s zii=$o(@zt@(zi,zn,zn1,zii)) q:zii="" d ;
271 . s zrtn(zii)=""
272 q
273 ;
[1368]274arrayout(rtn,zary) ; output an array of triples
[1354]275 ;
276 s zrsub=""
277 s zcnt=1
[1368]278 f s zrsub=$o(zary(zrsub)) q:zrsub="" d ; organized by subject
[1354]279 . s zzz=""
[1368]280 . f s zzz=$o(zary(zrsub,zzz)) q:zzz="" d ; pred and obj
281 . . s rtn(zcnt)=zrsub_"^"_zzz
[1354]282 . . s zcnt=zcnt+1
[1349]283 q
284 ;
[1373]285strings(zrary,zinary) ; convert pointers to strings
286 ;
287 k zrary
288 n zzz s zzz=""
289 f s zzz=$o(@zinary@(zzz)) q:zzz="" d ;
290 . n zs
[1382]291 . ;s zs=$$GET1^DIQ(C0XSFN,zzz_",",.01)
292 . s zs=$$NSP^C0XUTIL(zzz) ; get namespaced string
[1373]293 . q:zs=""
[1382]294 . s zrary(zs)="" ;
[1373]295 q
296 ;
[1367]297ien2tary(zrary,zinary) ; zinary is an array of iens passed by name
298 ; zrary is passed by reference and is return array of triples
299 ; format zrary(zsub,"zpred^zobj")=""
300 ;
[1372]301 k zrary ; start out clean
[1367]302 n zzz,zrsub,zrpred,zrobj,zgraph,zcnt
303 s zzz=""
304 f s zzz=$o(@zinary@(zzz)) q:zzz="" d ;
305 . s zrsub=$$GET1^DIQ(C0XTFN,zzz_",",.03,"E")
306 . s zrpred=$$GET1^DIQ(C0XTFN,zzz_",",.04,"E")
307 . s zrobj=$$GET1^DIQ(C0XTFN,zzz_",",.05,"E")
308 . s zrgraph=$$GET1^DIQ(C0XTFN,zzz_",",.02,"E")
309 . s zrary(zrsub,zrpred_"^"_zrobj)=""
310 q
311 ;
[1354]312jsonout(jout,zary) ;
313 d REPLYSTART^FMQLJSON("jout")
314 d LISTSTART^FMQLJSON("jout","results")
315 n zi s zi=""
316 f s zi=$o(zary(zi)) q:zi="" d ; for each subject
317 . n zii s zii=""
318 . D DICTSTART^FMQLJSON("jout",zi)
319 . f s zii=$o(zary(zi,zii)) q:zii="" d ; for each pred^obj pair
320 . . d DASSERT^FMQLJSON("jout",$p(zii,"^",1),$p(zii,"^",2))
321 . D DICTEND^FMQLJSON("jout")
322 d LISTEND^FMQLJSON("jout")
323 d REPLYEND^FMQLJSON("jout")
324 q
325 ;
[1376]326mask(zsub,zpred,zobj) ; function to return mask information
[1373]327 ; about the inputs ie I100 for just a subject and no pred or obj
328 n zf1,zf2,zf3,zflag
329 s zf1=$s($g(zsub)="":0,1:1)
330 s zf2=$s($g(zpred)="":0,1:1)
331 s zf3=$s($g(zobj)="":0,1:1)
332 s zflag="I"_zf1_zf2_zf3
333 q zflag
334 ;
[1349]335trip(triprtn,nsub,npred,nobj,ngraph,fary) ; returns triples iens
336 ; nsub,npred,nobj are all optional
337 ; graf is also optional, and will limit the search to a particular ngraph
338 ; fary is which triple store (not implemented yet)
339 n c0xflag,zi,zx,zt
340 s zt=$na(^C0X(101)) ;
[1376]341 s c0xflag=$$mask(nsub,npred,nobj) ; get mask flags
[1349]342 n itbl
343 s itbl("I000","SPO")="d do3(.triprtn,zt,zi)"
344 s itbl("I001","OSP")="d do2(.triprtn,zt,zi,nobj)"
345 s itbl("I010","PSO")="d do2(.triprtn,zt,zi,npred)"
346 s itbl("I011","POS")="d do1(.triprtn,zt,zi,npred,nobj)"
347 s itbl("I100","SPO")="d do2(.triprtn,zt,zi,nsub)"
348 s itbl("I101","SOP")="d do1(.triprtn,zt,zi,nsub,nobj)"
349 s itbl("I110","SPO")="d do1(.triprtn,zt,zi,nsub,npred)"
350 s itbl("I111","SPO")="d do0(.triprtn,zt,zi,nsub,npred,nobj)"
351 s zi=$o(itbl(c0xflag,""))
352 s zx=itbl(c0xflag,zi) ; executable instruction to run
353 i $g(ngraph)'="" s zi="G"_zi
354 w !,zx
355 x zx
356 q
357 ;
358do0(dortn,zt,zi,z1,z2,z3)
359 ; looking for only one triple
360 n zz
361 s zz=$o(@zt@(zi,z1,z2,z3,""))
362 i zz'="" s dortn(zz)=""
363 q
364 ;
365do1(dortn,zt,zi,z1,z2) ; have 2, looking for one
366 n zr,zx1
367 s zx1=""
368 f s zx1=$o(@zt@(zi,z1,z2,zx1)) q:zx1="" d ;
369 . s zr=$o(@zt@(zi,z1,z2,zx1,""))
370 . s dortn(zr)=""
371 q
372 ;
373do2(dortn,zt,zi,z1) ; have one, looking for 2
374 n zr,zx1,zx2
375 s (zx1,zx2)=""
376 f s zx1=$o(@zt@(zi,z1,zx1)) q:zx1="" d ;
377 . f s zx2=$o(@zt@(zi,z1,zx1,zx2)) q:zx2="" d ;
378 . . s zr=$o(@zt@(zi,z1,zx1,zx2,""))
379 . . s dortn(zr)=""
380 q
381 ;
382do3(dortn,zt,zi) ; have none, looking for three
383 n zr,zx1,zx2,zx3
384 s (zx1,zx2,zx3)=""
385 f s zx1=$o(@zt@(zi,zx1)) q:zx1="" d ;
386 . f s zx2=$o(@zt@(zi,zx1,zx2)) q:zx2="" d ;
387 . . f s zx3=$o(@zt@(zi,zx1,zx2,zx3)) q:zx3="" d ;
388 . . . s zr=$o(@zt@(zi,zx1,zx2,zx3,""))
389 . . . s dortn(zr)=""
390 q
391 ;
[1376]392IENOF(ZSTRING,FARY) ; EXTRINSIC WHICH RETURNS THE IEN OF ZS IN THE STRINGS FILE
393 I '$D(FARY) D ;
394 . D INITFARY^C0XF2N("C0XFARY")
395 . S FARY="C0XFARY"
396 N ZIEN
397 I $G(ZSTRING)="" Q "" ; NO STRING
398 S ZIEN=$O(@C0XSN@("B",ZSTRING,""))
399 Q ZIEN
400 ;
401IENOFA(ZOUTARY,INARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE
402 ; RETURNS IN ZOUTARY OF THE FORM ZOUTARY("IEN","VAR",IEN)=""
403 I '$D(FARY) D ;
404 . D INITFARY^C0XF2N("C0XFARY")
405 . S FARY="C0XFARY"
406 K ZOUTARY ; START WITH CLEAN RESULTS
407 K C0XFDA2 ; USE A SEPARATE FDA FOR THIS
408 I '$D(C0XVOC) D VOCINIT^C0XUTIL
409 N ZINARY
410 N ZI S ZI=""
411 F S ZI=$O(INARY(ZI)) Q:ZI="" D ;
412 . N ZK
413 . S ZK=$O(INARY(ZI,""))
414 . S ZINARY($$EXT^C0XUTIL(ZI),$$EXT^C0XUTIL(ZK))=""
415 N ZV,ZIEN
416 N ZCNT S ZCNT=0
417 F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS
418 . S ZV=$O(ZINARY(ZI,""))
419 . I ZV["^" S ZV=$TR(ZV,"^","|")
420 F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOW GET ALL IENS
421 . S ZV=$O(ZINARY(ZI,""))
422 . I ZV["^" S ZV=$TR(ZV,"^","|")
423 . S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW
424 . I ZIEN="" S ZOUTARY("IEN",ZI)=""
425 . E S ZOUTARY("IEN",ZI,ZIEN)=""
426 Q
427 ;
[1371]428output(zwhat,zfname,zdir) ; function to write an array to a host file
429 ; if zdir is ommitted, will output to the CCR directory
430 ; ^TMP("C0CCCR","ODIR")
431 ; if fname is ommitted, will output yyyy-mm-dd-hh-mm-ss-C0XOUT.out
432 ; zwhat is passed by name
433 ;
434 i '$d(zdir) s zdir=$G(^TMP("C0CCCR","ODIR"))
435 i '$d(zfname) d ;
436 . s zfname=$$FMTE^XLFDT($$NOW^XLFDT,7)
437 . s zfname=$tr(zfname,"/","-")
438 . s zfname=$tr(zfname,"@","-")
439 . s zfname=$tr(zfname,":","-")
440 . s zfname=zfname_".out"
441 i $e(zwhat,1,1)'="^" d ; not a global
442 . k ^TMP("C0XOUT",$J)
443 . m ^TMP("C0XOUT",$J)=@zwhat
444 . s zwhat=$na(^TMP("C0XOUT",$J,1))
445 n zout s zout=""
446 s zout=$$OUTPUT^C0CXPATH(zwhat,zfname,zdir)
447 K ^TMP("C0XOUT",$J)
448 Q zout
[1382]449 ;
450tagText(ztag) ; extrinsic which returns the location of the text
451 ; associated with ztag
452 n zs,zo
[1383]453 s zs=$$subject("fmts:fileTag",ztag)
[1382]454 i zs="" d q ;
455 . w !,"error, tag is either missing or there are more than one ",ztag
[1383]456 s zo=$$object(zs,"fmts:fileSource")
[1382]457 i zo="" d q ;
458 . w !,"error, tag source not found ",zs
459 w !,zo
460 q $$WHERETXT^C0XF2N(zo)
[1371]461 ;
Note: See TracBrowser for help on using the repository browser.