Changeset 1350
- Timestamp:
- Jan 28, 2012, 12:28:51 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fmts/trunk/p/C0XGET1.m
r1349 r1350 69 69 Q 70 70 ; 71 qparse(qrtn,zquery) ; parses the query 72 ; want this to be able to handle the WHERE clause of SPARQL eventually 73 ; 74 n q1,q2,q3,qq 75 ;s qq=$tr(zquery," ","^") 76 s qq=query ; really want to remove whitespace here 77 s q1=$p(qq," ",1) 78 i q1["?" s q1="" 79 s q2=$p(qq," ",2) 80 i q2["?" s q2="" 81 s q3=$p(qq," ",3) 82 i q3["?" s q3="" 83 s qrtn(1)=q1_"^"_q2_"^"_q3 ; more lines to come later 84 q 85 ; 86 rpctrip(rtn,query,limit,offset) ; rpc to access triples with a query 87 ; 88 n zoff,zlim,zcount,zq 89 i '$d(limit) s limit=250 90 i '$d(offset) s offset=0 91 d qparse(.zq,query) ; parse the query 92 n qsub,qpred,qobj,qtmp 93 W !,zq(1) 94 s qsub=$p(zq(1),"^",1) 95 s qpred=$p(zq(1),"^",2) 96 s qobj=$p(zq(1),"^",3) 97 d triples(.qtmp,qsub,qpred,qobj) 98 f zcount=offset+1:1:offset+limit q:'$d(qtmp(zcount)) d ; 99 . s rtn(zcount)=qtmp(zcount) 100 q 101 ; 71 102 triples(triplertn,sub,pred,obj,graph,fary) ; returns triples 72 103 I '$D(fary) D ; … … 82 113 W !,"s:",zsub," p:",zpred," o:",zobj 83 114 d trip(.tmprtn,zsub,zpred,zobj,zgraph,fary) 84 n zzz,zrsub,zrpred,zrobj,zgraph 115 n zzz,zrsub,zrpred,zrobj,zgraph,zcnt 116 s zcnt=1 85 117 s zzz="" 86 118 f s zzz=$o(tmprtn(zzz)) q:zzz="" d ; … … 89 121 . s zrobj=$$GET1^DIQ(C0XTFN,zzz_",",.05,"E") 90 122 . s zrgraph=$$GET1^DIQ(C0XTFN,zzz_",",.02,"E") 91 . s triplertn(zzz)=zrsub_"^"_zrpred_"^"_zrobj ; _"^"_zrgraph 123 . s triplertn(zcnt)=zrsub_"^"_zrpred_"^"_zrobj ; _"^"_zrgraph 124 . s zcnt=zcnt+1 92 125 q 93 126 ;
Note:
See TracChangeset
for help on using the changeset viewer.