Index: fmts/trunk/p/C0XF2N.m
===================================================================
--- fmts/trunk/p/C0XF2N.m	(revision 1366)
+++ fmts/trunk/p/C0XF2N.m	(revision 1367)
@@ -38,5 +38,5 @@
  S @ZFARY@("C0XTN")=$NA(^C0X(101)) ; TRIPLES GLOBAL NAME
  S @ZFARY@("C0XSN")=$NA(^C0X(201)) ; STRING FILE GLOBAL NAME
- S @ZFARY@("C0XDIR")="/home/vista/gpl/C0Q/trunk/rdf/"
+ S @ZFARY@("C0XDIR")="/home/glilly/fmts/trunk/samples/smart-rdf-in/"
  S @ZFARY@("BLKLOAD")=1 ; this file supports block load
  S @ZFARY@("FMTSSTYLE")="F2N" ; fileman style
@@ -271,5 +271,5 @@
  W !,"VOCABS:"
  N ZZ S ZZ=""
- F  S ZZ=$O(C0XVOC(ZZ)) Q:ZZ=""  W !,ZZ,":",C0CVOC(ZZ)
+ F  S ZZ=$O(C0XVOC(ZZ)) Q:ZZ=""  W !,ZZ,":",C0XVOC(ZZ)
  ;
  ; -- look for children called rdf:Description. quit if none. not an rdf file
@@ -398,4 +398,5 @@
  ;S ZOIEN=$$IENOF(ZO)
  ;I $D(C0XFDA) D UPDIE ; ADD THE STRINGS IF NEEDED
+ I '$D(BATCNT) S BATCNT=0
  S BATCNT=BATCNT+1
  S C0XCNT=C0XCNT+1
@@ -412,4 +413,5 @@
  . S C0XFDA(C0XTFN,"?+"_ATCNT_",",.04)=$O(ZIENS("IEN","ZP",""))
  . S C0XFDA(C0XTFN,"?+"_BATCNT_",",.05)=$O(ZIENS("IEN","ZO",""))
+ I '$D(BATMAX) S BATMAX=10000
  I BATCNT=BATMAX D  ; BATCH IS DONE
  . I $G(BLKLOAD) D  ; bulk load
@@ -452,5 +454,5 @@
  Q ZIEN
  ;
-IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE 
+IENOFA(ZOUTARY,INARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE 
  ; OR ADD THEM IF
  ; MISSING. ZINARY AND ZOUTARY ARE PASSED BY REFERENCE 
@@ -462,5 +464,11 @@
  K ZOUTARY ; START WITH CLEAN RESULTS
  K C0XFDA2 ; USE A SEPARATE FDA FOR THIS
+ I '$D(C0XVOC) D INITVOC^C0XUTIL
+ N ZINARY 
  N ZI S ZI=""
+ F  S ZI=$O(INARY(ZI)) Q:ZI=""  D  ;
+ . N ZK
+ . S ZK=$O(INARY(ZI,""))
+ . S ZINARY($$EXT^C0XUTIL(ZI),$$EXT^C0XUTIL(ZK))=""
  N ZV,ZIEN
  N ZCNT S ZCNT=0
Index: fmts/trunk/p/C0XGET1.m
===================================================================
--- fmts/trunk/p/C0XGET1.m	(revision 1366)
+++ fmts/trunk/p/C0XGET1.m	(revision 1367)
@@ -114,14 +114,7 @@
  W !,"s:",zsub," p:",zpred," o:",zobj
  d trip(.tmprtn,zsub,zpred,zobj,zgraph,fary)
- n zzz,zrsub,zrpred,zrobj,zgraph,zcnt,zrary
- s zzz=""
- f  s zzz=$o(tmprtn(zzz)) q:zzz=""  d  ;
- . s zrsub=$$GET1^DIQ(C0XTFN,zzz_",",.03,"E")
- . s zrpred=$$GET1^DIQ(C0XTFN,zzz_",",.04,"E")
- . s zrobj=$$GET1^DIQ(C0XTFN,zzz_",",.05,"E")
- . s zrgraph=$$GET1^DIQ(C0XTFN,zzz_",",.02,"E")
- . s zrary(zrsub,zrpred_"^"_zrobj)=""
- ;b
- ;
+ d ien2tary(.zrary,"tmprtn") ; convert to triples
+ ;
+ d rdfout^C0XRDF(.triplertn,.zrary) q  ;
  i REPLYFMT="JSON" d jsonout(.triplertn,.zrary) q  ; what follows is 'else'
  ;
@@ -135,4 +128,18 @@
  . . s triplertn(zcnt)=zrsub_"^"_zzz
  . . s zcnt=zcnt+1
+ q
+ ;
+ien2tary(zrary,zinary) ; zinary is an array of iens passed by name
+ ; zrary is passed by reference and is return array of triples
+ ; format zrary(zsub,"zpred^zobj")=""
+ ;
+ n zzz,zrsub,zrpred,zrobj,zgraph,zcnt
+ s zzz=""
+ f  s zzz=$o(@zinary@(zzz)) q:zzz=""  d  ;
+ . s zrsub=$$GET1^DIQ(C0XTFN,zzz_",",.03,"E")
+ . s zrpred=$$GET1^DIQ(C0XTFN,zzz_",",.04,"E")
+ . s zrobj=$$GET1^DIQ(C0XTFN,zzz_",",.05,"E")
+ . s zrgraph=$$GET1^DIQ(C0XTFN,zzz_",",.02,"E")
+ . s zrary(zrsub,zrpred_"^"_zrobj)=""
  q
  ;
Index: fmts/trunk/p/C0XRDF.m
===================================================================
--- fmts/trunk/p/C0XRDF.m	(revision 1367)
+++ fmts/trunk/p/C0XRDF.m	(revision 1367)
@@ -0,0 +1,79 @@
+C0XRDF ; GPL - Fileman Triples RDF out  ;11/07/11  17:05
+ ;;0.1;C0X;nopatch;noreleasedate;Build 7
+ ;Copyright 2012 George Lilly.  Licensed under the terms of the GNU
+ ;General Public License See attached copy of the License.
+ ;
+ ;This program is free software; you can redistribute it and/or modify
+ ;it under the terms of the GNU General Public License as published by
+ ;the Free Software Foundation; either version 2 of the License, or
+ ;(at your option) any later version.
+ ;
+ ;This program is distributed in the hope that it will be useful,
+ ;but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ ;GNU General Public License for more details.
+ ;
+ ;You should have received a copy of the GNU General Public License along
+ ;with this program; if not, write to the Free Software Foundation, Inc.,
+ ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ ;
+ Q
+ ;
+REPLYSTART(ZARY);
+ D ADD(ZARY,"<?xml version=""1.0"" encoding=""UTF-8""?>")
+ D ADD(ZARY,"<rdf:RDF xmlns:rdf=""http://www.w3.org/1999/02/22-rdf-syntax-ns#"">")
+ Q
+ ;
+LISTSTART(ZARY,ZNAM)
+ Q
+ ;
+DICTSTART(ZARY,ZSUB)
+ I ZSUB["http" D  Q  ;
+ . D ADD(ZARY,"<rdf:Description rdf:about="""_ZSUB_""">")
+ I $E(ZSUB,1,1)="/" D  Q  ;
+ . D ADD(ZARY,"<rdf:Description rdf:about="""_ZSUB_""">")
+ D ADD(ZARY,"<rdf:Description rdf:nodeID="""_ZSUB_""">")
+ Q
+ ;
+DASSERT(ZARY,ZPRED,ZOBJ)
+ I ZPRED[":" D  Q  ;
+ . I ZPRED="rdf:type" D  Q  ;
+ . . D ADD(ZARY,"rdf:type rdf:Resource="""_ZOBJ_"""/>")
+ . N ZA,ZB
+ . S ZA=$P(ZPRED,":",1)
+ . S ZB=$P(ZPRED,":",2)
+ . D ADD(ZARY,"<"_ZA_" xmlns="""_ZB_""">"_ZOBJ_"</"_ZA_">")
+ Q
+ ;
+DICTEND(ZARY)
+ D ADD(ZARY,"</rdf:Description")
+ Q
+ ;
+LISTEND(ZARY)
+ Q
+ ;
+REPLYEND(ZARY)
+ D ADD(ZARY,"</rdf:RDF>")
+ Q
+ ;
+ADD(ZARY,ZELE)
+ N ZI
+ I '$D(ZARY) S @ZARY@(1)=ZELE Q  ;
+ S ZI=$O(@ZARY@(""),-1)
+ S @ZARY@(ZI+1)=ZELE
+ Q
+ ;
+rdfout(rdfout,zary) ; 
+ d REPLYSTART("rdfout")
+ d LISTSTART("rdfout","results")
+ n zi s zi=""
+ f  s zi=$o(zary(zi)) q:zi=""  d  ; for each subject
+ . n zii s zii=""
+ . D DICTSTART("rdfout",zi)
+ . f  s zii=$o(zary(zi,zii)) q:zii=""  d  ; for each pred^obj pair
+ . . d DASSERT("rdfout",$p(zii,"^",1),$p(zii,"^",2))
+ . D DICTEND("rdfout")
+ d LISTEND("rdfout")
+ d REPLYEND("rdfout")
+ q
+ ;
