Changeset 1381 for fmts/trunk/p


Ignore:
Timestamp:
Mar 22, 2012, 9:38:37 AM (13 years ago)
Author:
George Lilly
Message:

added $$subject and $$object and LKY5 for randoms

Location:
fmts/trunk/p
Files:
2 edited

Legend:

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

    r1380 r1381  
    142142 S BATMAX=10000 ; TRY BATCHES OF THIS SIZE
    143143 N ZGRAPH,ZSUBJECT
    144  S ZGRAPH="_:G"_$$LKY9 ; RANDOM GRAPH NAME
     144 S ZGRAPH="_:G"_$$LKY5 ; RANDOM GRAPH NAME
    145145 S ZSUBJECT=$$ANONS() ; RANDOM ANOYMOUS SUBJECT
    146146 D ADD(ZGRAPH,ZSUBJECT,"fmts:url",ZNAME,FARY)
    147147 N ZTXTNM
    148  S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY9 ; NAME FOR TEXT NODE
     148 S ZTXTNM="_TXT_INCOMING_RDF_FILE_"_ZNAME_"_"_$$LKY5 ; NAME FOR TEXT NODE
    149149 D ADD(ZGRAPH,ZSUBJECT,"fmts:rdfSource",ZTXTNM,FARY)
     150 D ADD(ZGRAPH,ZSUBJECT,"fmts:tag",$$name2tag(ZNAME),FARY)
    150151 D SWUPDIE(.C0XFDA) ; TRY IT OUT
    151152 K C0XCNT ;RESET FOR NEXT TIME
     
    154155 D PROCESS(.G,ZRDF,ZNAME,ZGRAPH,FARY) ; PARSE AND INSERT THE RDF
    155156 Q
     157 ;
     158name2tag(zname) ; extrinsic which returns a tag derived from a name
     159 ; /home/vista/project.xml ==> project
     160 q $p($re($p($re(zname),"/")),".")
    156161 ;
    157162STORETXT(ZTXT,ZNAME,FARY) ; STORE TEXT IN THE TRIPLESTORE AT ZNAME
     
    253258 ; -- populate the metagraph to point to the graph with status unfinished
    254259 S METAS=$$ANONS ; GET AN ANONOMOUS RANDOM SUBJECT
    255  I '$D(ZMETA) S ZMETA="_:G"_$$LKY9 ; RANDOM GRAPH NAME FOR METAGRAPH
     260 I '$D(ZMETA) S ZMETA="_:G"_$$LKY5 ; RANDOM GRAPH NAME FOR METAGRAPH
    256261 D ADD(ZMETA,METAS,"fmts:about",ZGRF,FARY) ; POINT THE META TO THE GRAPH
    257262 D ADD(ZMETA,METAS,"fmts:status","unfinished",FARY) ; mark as unfinished
     
    371376 ;
    372377ANONS() ; RETURNS AN ANONOMOUS SUBJECT
    373  Q "iDPsDPss"_$$LKY9
     378 Q "iDPsDPss"_$$LKY5
    374379 ;
    375380NEWG(NGRAPH,NMETA) ; CREATES A NEW META GRAPH, MARKS IT AS UNFINISHED
    376381 ; THEN CREATES A NEW GRAPH AND POINTS THE METAGRAPH TO IT
    377382 ; NGRAPH AND NMETA ARE PASSED BY REFERENCE AND ARE THE RETURN
    378  S NGRAPH="G"_$$LKY9
     383 S NGRAPH="G"_$$LKY5
    379384 S NMETA=NGRAPH_"A"
    380385 Q
     
    426431 Q
    427432 ;
     433LKY5() ;EXTRINIC THAT RETURNS A RANDOM 5 DIGIT NUMBER. USED FOR GENERATING
     434 ; UNIQUE NODE AND GRAPH NAMES
     435 N ZN,ZI
     436 S ZN=""
     437 F ZI=1:1:5 D  ;
     438 . S ZN=ZN_$R(10)
     439 Q ZN
     440 ;
    428441LKY9() ;EXTRINIC THAT RETURNS A RANDOM 9 DIGIT NUMBER. USED FOR GENERATING
    429442 ; UNIQUE NODE AND GRAPH NAMES
  • fmts/trunk/p/C0XGET1.m

    r1377 r1381  
    141141 q
    142142 ;
     143subject(pred,obj,graph,form,fary) ; extrinsic which returns the first
     144 ; multiple of return from subjects - returns null if more than one
     145 ; subjects(.G,sub,pred)
     146 ; G("nodeID:1234") ==> "nodeID:1234"
     147 n zin,zrtn
     148 d subjects(.zin,$g(pred),$g(obj),$g(form),$g(fary))
     149 s zrtn=$o(zin(""))
     150 i $o(zin(zrtn))'="" s zrtn=""
     151 q zrtn
     152 ;
    143153preds(listrtn,sub,obj,graph,form,fary) ; return list of subjects
    144154 d onelist("P",$g(sub),,$g(obj),$g(fary)) ;subjects
     
    148158 d onelist("O",$g(sub),$g(pred),"",$g(fary)) ;subjects
    149159 q
     160 ;
     161object(sub,pred,graph,form,fary) ; extrinsic which returns the first
     162 ; multiple of return from objects - returns null if more than one
     163 ; objects(.G,sub,pred)
     164 ; G("location") ==> "location"
     165 n zin,zrtn
     166 d objects(.zin,$g(sub),$g(pred),$g(form),$g(fary))
     167 s zrtn=$o(zin(""))
     168 i $o(zin(zrtn))'="" s zrtn=""
     169 q zrtn
    150170 ;
    151171onelist(zw,sub,pred,obj,fary) ; returns list
Note: See TracChangeset for help on using the changeset viewer.