changes to support VistAOWL

This commit is contained in:
george 2012-02-14 23:42:07 +00:00
parent 9a55697ac0
commit bcabb57ad9
2 changed files with 25 additions and 5 deletions

View File

@ -205,6 +205,18 @@ TESTPROC ; TEST PROCESS WITH EXISTING SMALL RDF FILE
D PROCESS(.G,ZIN,ZGRAPH,ZM)
Q
;
VISTAOWL ;
S ZRDF=$NA(^TMP("C0X",542,"FILEIN"))
S ZNAME="/home/glilly/vistaowl/VistAOWL.owl"
S ZGRAPH="_:G431590209"
S FARY="C0XFARY"
D INITFARY(FARY)
S C0XDOCID=1
S BATCNT=0
S BATMAX=10000
D PROCESS(.G,ZRDF,ZGRAPH,ZNAME,FARY)
Q
;
PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE
; ZRTN IS PASS BY REFERENCE AND RETURNS MESSAGES ABOUT THE PROCESSING
; ZRDF IS PASSED BY NAME AND IS THE GLOBAL CONTAINING THE RDF FILE
@ -220,11 +232,12 @@ PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE
; -- first parse the rdf file with the MXML parser
;S C0XDOCID=$$PARSE^C0CNHIN(ZRDF,"C0XARRAY") ; PARSE WITH MXML
S C0XDLC2=$$NOW^XLFDT ; START OF PARSE
S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W")
;S C0XDOCID=$$EN^MXMLDOM(ZRDF,"W") ; DON'T PARSE JUST NOW
;B
K @ZRDF ; DON'T NEED INPUT BUFFER ANYMORE
; -- assign the MXLM dom global name to ZDOM
S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID))
;S ZDOM=$NA(^TMP("MXMLDOM",$J,C0XDOCID))
S ZDOM=$NA(^TMP("MXMLDOM",16850,C0XDOCID)) ;VISTAOWL DOM
S C0XNODE=$O(@ZDOM@(""),-1)
W !,C0XNODE," XML NODES PARSED"
S C0XPRS=$$NOW^XLFDT ; PARSE COMPLETE
@ -259,10 +272,11 @@ PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE
;
S C0XTYPE("rdf:Description")=1
S C0XTYPE("owl:ObjectProperty")=1
S C0XTYPE("owl:Ontology")=1
S ZI=$O(@ZDOM@(1,"C",""))
I '$G(C0XTYPE(@ZDOM@(1,"C",ZI))) D Q ; not an rdf file
. W !,"Error. Not an RDF file. Cannot process."
. zwr ^TMP("MXMLDOM",$J,*)
. ;zwr ^TMP("MXMLDOM",$J,*)
;
; -- now process the rdf description children
;
@ -338,7 +352,8 @@ PROCESS(ZRTN,ZRDF,ZGRF,ZMETA,FARY) ; PROCESS AN INCOMING RDF FILE
Q
;
SHOW(ZN) ;
ZWR ^TMP("MXMLDOM",$J,1,ZN,*)
;ZWR ^TMP("MXMLDOM",$J,1,ZN,*)
ZWR ^TMP("MXMLDOM",16850,1,ZN,*)
Q
;
ANONS() ; RETURNS AN ANONOMOUS SUBJECT
@ -383,7 +398,7 @@ ADD(ZG,ZS,ZP,ZO,FARY) ; ADD A TRIPLE TO THE TRIPLESTORE. ALL VALUES ARE TEXT
. S C0XFDA(C0XTFN,"?+"_BATCNT_",",.01)=ZNODE
. S C0XFDA(C0XTFN,"?+"_BATCNT_",",.02)=$O(ZIENS("IEN","ZG",""))
. S C0XFDA(C0XTFN,"?+"_BATCNT_",",.03)=$O(ZIENS("IEN","ZS",""))
. S C0XFDA(C0XTFN,"?+"_BATCNT_",",.04)=$O(ZIENS("IEN","ZP",""))
. S C0XFDA(C0XTFN,"?+"_ATCNT_",",.04)=$O(ZIENS("IEN","ZP",""))
. S C0XFDA(C0XTFN,"?+"_BATCNT_",",.05)=$O(ZIENS("IEN","ZO",""))
I BATCNT=BATMAX D ; BATCH IS DONE
. I $G(BLKLOAD) D ; bulk load
@ -440,6 +455,7 @@ IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE
N ZCNT S ZCNT=0
F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; LOOK FOR MISSING STRINGS
. S ZV=$O(ZINARY(ZI,""))
. I ZV["^" S ZV=$TR(ZV,"^","|")
. I $O(@C0XSN@("B",ZV,""))="" D ;
. . S ZCNT=ZCNT+1
. . S C0XFDA2(C0XSFN,"+"_ZCNT_",",.01)=ZV
@ -448,6 +464,7 @@ IENOFA(ZOUTARY,ZINARY,FARY) ; RESOLVE STRINGS TO IEN IN STRINGS FILE
. K C0XFDA2 ; CLEAN UP
F S ZI=$O(ZINARY(ZI)) Q:ZI="" D ; NOT GET ALL IENS
. S ZV=$O(ZINARY(ZI,""))
. I ZV["^" S ZV=$TR(ZV,"^","|")
. S ZIEN=$O(@C0XSN@("B",ZV,"")) ; THEY SHOULD BE THERE NOW
. I ZIEN="" D ;
. . W !,"ERROR ADDING STRING: ",ZV

View File

@ -54,6 +54,9 @@ VOCINIT ; INITIALIZE VOCABULARIES
S C0XVOC("skos")="http://www.w3.org/2004/02/skos/core#"
S C0XVOC("gpl")="http://georgetriples.org/"
S C0XVOC("cg")="http://datasets.caregraf.org/"
S C0XVOC("mv")="http://metavista.name/foundation#"
S C0XVOC("rdfs")="http://www.w3.org/2000/01/rdf-schema#"
S C0XVOC("os")="http://osehra.org/ns#"
Q
;
EXT(C0XIN) ; EXTRINSIC WHICH EXPANDS NAMESPACES