Changeset 1367 for fmts/trunk


Ignore:
Timestamp:
Feb 26, 2012, 11:37:05 PM (13 years ago)
Author:
George Lilly
Message:

RDF output from triples

Location:
fmts/trunk/p
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • fmts/trunk/p/C0XF2N.m

    r1366 r1367  
    3838 S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME
    3939 S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME
    40  S @ZFARY@("C0XDIR")="/home/vista/gpl/C0Q/trunk/rdf/"
     40 S @ZFARY@("C0XDIR")="/home/glilly/fmts/trunk/samples/smart-rdf-in/"
    4141 S @ZFARY@("BLKLOAD")=1 ; this file supports block load
    4242 S @ZFARY@("FMTSSTYLE")="F2N" ; fileman style
     
    271271 W !,"VOCABS:"
    272272 N ZZ S ZZ=""
    273  F  S ZZ=$O(C0XVOC(ZZ)) Q:ZZ=""  W !,ZZ,":",C0CVOC(ZZ)
     273 F  S ZZ=$O(C0XVOC(ZZ)) Q:ZZ=""  W !,ZZ,":",C0XVOC(ZZ)
    274274 ;
    275275 ; -- look for children called rdf:Description. quit if none. not an rdf file
     
    398398 ;S ZOIEN=$$IENOF(ZO)
    399399 ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED
     400 I '$D(BATCNT) S BATCNT=0
    400401 S BATCNT=BATCNT+1
    401402 S C0XCNT=C0XCNT+1
     
    412413 . S C0XFDA(C0XTFN,"?+"_ATCNT_",",.04)=$O(ZIENS("IEN","ZP",""))
    413414 . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.05)=$O(ZIENS("IEN","ZO",""))
     415 I '$D(BATMAX) S BATMAX=10000
    414416 I BATCNT=BATMAX D  ; BATCH IS DONE
    415417 . I $G(BLKLOAD) D  ; bulk load
     
    452454 Q ZIEN
    453455 ;
    454 IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE
     456IENOFA(ZOUTARY,INARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE
    455457 ; OR ADD THEM IF
    456458 ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE
     
    462464 K ZOUTARY ; START WITH CLEAN RESULTS
    463465 K C0XFDA2 ; USE A SEPARATE FDA FOR THIS
     466 I '$D(C0XVOC) D INITVOC^C0XUTIL
     467 N ZINARY
    464468 N ZI S ZI=""
     469 F  S ZI=$O(INARY(ZI)) Q:ZI=""  D  ;
     470 . N ZK
     471 . S ZK=$O(INARY(ZI,""))
     472 . S ZINARY($$EXT^C0XUTIL(ZI),$$EXT^C0XUTIL(ZK))=""
    465473 N ZV,ZIEN
    466474 N ZCNT S ZCNT=0
  • fmts/trunk/p/C0XGET1.m

    r1354 r1367  
    114114 W !,"s:",zsub," p:",zpred," o:",zobj
    115115 d trip(.tmprtn,zsub,zpred,zobj,zgraph,fary)
    116  n zzz,zrsub,zrpred,zrobj,zgraph,zcnt,zrary
    117  s zzz=""
    118  f  s zzz=$o(tmprtn(zzz)) q:zzz=""  d  ;
    119  . s zrsub=$$GET1^DIQ(C0XTFN,zzz_",",.03,"E")
    120  . s zrpred=$$GET1^DIQ(C0XTFN,zzz_",",.04,"E")
    121  . s zrobj=$$GET1^DIQ(C0XTFN,zzz_",",.05,"E")
    122  . s zrgraph=$$GET1^DIQ(C0XTFN,zzz_",",.02,"E")
    123  . s zrary(zrsub,zrpred_"^"_zrobj)=""
    124  ;b
    125  ;
     116 d ien2tary(.zrary,"tmprtn") ; convert to triples
     117 ;
     118 d rdfout^C0XRDF(.triplertn,.zrary) q  ;
    126119 i REPLYFMT="JSON" d jsonout(.triplertn,.zrary) q  ; what follows is 'else'
    127120 ;
     
    135128 . . s triplertn(zcnt)=zrsub_"^"_zzz
    136129 . . s zcnt=zcnt+1
     130 q
     131 ;
     132ien2tary(zrary,zinary) ; zinary is an array of iens passed by name
     133 ; zrary is passed by reference and is return array of triples
     134 ; format zrary(zsub,"zpred^zobj")=""
     135 ;
     136 n zzz,zrsub,zrpred,zrobj,zgraph,zcnt
     137 s zzz=""
     138 f  s zzz=$o(@zinary@(zzz)) q:zzz=""  d  ;
     139 . s zrsub=$$GET1^DIQ(C0XTFN,zzz_",",.03,"E")
     140 . s zrpred=$$GET1^DIQ(C0XTFN,zzz_",",.04,"E")
     141 . s zrobj=$$GET1^DIQ(C0XTFN,zzz_",",.05,"E")
     142 . s zrgraph=$$GET1^DIQ(C0XTFN,zzz_",",.02,"E")
     143 . s zrary(zrsub,zrpred_"^"_zrobj)=""
    137144 q
    138145 ;
Note: See TracChangeset for help on using the changeset viewer.