Changeset 1539 for fmts/trunk/p/C0XRDF.m
- Timestamp:
- Sep 26, 2012, 12:58:34 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fmts/trunk/p/C0XRDF.m
r1499 r1539 1 C0XRDF 2 ;;0.1;C0X;nopatch;noreleasedate;Build 7 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 REPLYSTART(ZARY); 23 24 25 26 27 LISTSTART(ZARY,ZNAM) 28 29 30 DICTSTART(ZARY,ZSUB) 31 32 33 34 35 36 37 38 DASSERT(ZARY,ZPRED,ZOBJ) 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 DICTEND(ZARY) 59 60 61 62 LISTEND(ZARY) 63 64 65 REPLYEND(ZARY) 66 67 68 69 ADD(ZARY,ZELE) 70 71 72 73 74 75 76 rdfout(rdfout,zary) 77 78 79 80 81 82 83 84 85 86 87 88 89 1 C0XRDF ; GPL - Fileman Triples RDF out ;11/07/11 17:05 2 ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 10 3 ;Copyright 2012 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 ; 22 REPLYSTART(ZARY); 23 D ADD(ZARY,"<?xml version=""1.0"" encoding=""UTF-8""?>") 24 D ADD(ZARY,"<rdf:RDF xmlns:rdf=""http://www.w3.org/1999/02/22-rdf-syntax-ns#"">") 25 Q 26 ; 27 LISTSTART(ZARY,ZNAM) 28 Q 29 ; 30 DICTSTART(ZARY,ZSUB) 31 I ZSUB["http" D Q ; 32 . D ADD(ZARY,"<rdf:Description rdf:about="""_ZSUB_""">") 33 I $E(ZSUB,1,1)="/" D Q ; 34 . D ADD(ZARY,"<rdf:Description rdf:about="""_ZSUB_""">") 35 D ADD(ZARY,"<rdf:Description rdf:nodeID="""_ZSUB_""">") 36 Q 37 ; 38 DASSERT(ZARY,ZPRED,ZOBJ) 39 I ZPRED[":" D Q ; 40 . I ZPRED="rdf:type" D Q ; 41 . . D ADD(ZARY,"<rdf:type rdf:resource="""_$$EXT^C0XUTIL(ZOBJ)_"""/>") 42 . N ZA,ZB,ZC 43 . S ZA=$P(ZPRED,":",1) 44 . S ZB=$P(ZPRED,":",2) 45 . I $E(ZB,1,1)="/" D ; 46 . . S ZB=$P(ZB,"/",2) ; handling gpltest:/note situations 47 . S ZC=C0XVOC(ZA) 48 . I ZOBJ["nodeID:" D Q ; 49 . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:nodeID="""_$$EXT^C0XUTIL(ZOBJ)_"""/>") 50 . S ZOBJ=$$EXT^C0XUTIL(ZOBJ) 51 . I ZOBJ["http" D Q ; 52 . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:resource="""_ZOBJ_"""/>") 53 . I $E(ZOBJ,1,1)="/" D Q ; 54 . . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""" rdf:resource="""_ZOBJ_"""/>") 55 . D ADD(ZARY,"<"_ZB_" xmlns="""_ZC_""">"_$$EXT^C0XUTIL(ZOBJ)_"</"_ZB_">") 56 Q 57 ; 58 DICTEND(ZARY) 59 D ADD(ZARY,"</rdf:Description>") 60 Q 61 ; 62 LISTEND(ZARY) 63 Q 64 ; 65 REPLYEND(ZARY) 66 D ADD(ZARY,"</rdf:RDF>") 67 Q 68 ; 69 ADD(ZARY,ZELE) 70 N ZI 71 I '$D(ZARY) S @ZARY@(1)=ZELE Q ; 72 S ZI=$O(@ZARY@(""),-1) 73 S @ZARY@(ZI+1)=ZELE 74 Q 75 ; 76 rdfout(rdfout,zary) ; 77 d REPLYSTART("rdfout") 78 d LISTSTART("rdfout","results") 79 n zi s zi="" 80 f s zi=$o(zary(zi)) q:zi="" d ; for each subject 81 . n zii s zii="" 82 . D DICTSTART("rdfout",$$EXT^C0XUTIL(zi)) 83 . f s zii=$o(zary(zi,zii)) q:zii="" d ; for each pred^obj pair 84 . . d DASSERT("rdfout",$p(zii,"^",1),$p(zii,"^",2)) 85 . D DICTEND("rdfout") 86 d LISTEND("rdfout") 87 d REPLYEND("rdfout") 88 q 89 ;
Note:
See TracChangeset
for help on using the changeset viewer.