Changeset 1539 for fmts/trunk/p/C0XUTIL.m
- Timestamp:
- Sep 26, 2012, 12:58:34 PM (13 years ago)
- File:
-
- 1 edited
-
fmts/trunk/p/C0XUTIL.m (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
fmts/trunk/p/C0XUTIL.m
r1532 r1539 1 C0XUTIL ; GPL - Fileman Triples utilities ;11/07/11 17:052 ;;0.1;C0X;nopatch;noreleasedate;Build 7 3 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU4 ;General Public License See attached copy of the License.5 ;6 ;This program is free software; you can redistribute it and/or modify7 ;it under the terms of the GNU General Public License as published by8 ;the Free Software Foundation; either version 2 of the License, or9 ;(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 of13 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14 ;GNU General Public License for more details.15 ;16 ;You should have received a copy of the GNU General Public License along17 ;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 Q21 ;22 NSP(ZX) ; OUTPUT TRANSFORM EXTRINSIC23 ;24 N ZR25 ; I WOULD REALLY LIKE TO NOT HAVE THE FILE NUMBER HARD CODED HERE26 ; ANYONE KNOW HOW I COULD DO THAT? :) GPL27 S ZR=$$GET1^DIQ(172.201,ZX_",",.01)28 I '$D(C0XNSP) S C0XNSP=1 ; DEFAULT ON29 I C0XNSP=0 Q ZR ; SWITCHED OFF30 I '$D(C0XVOC) D VOCINIT ; INITIALIZE THE VOCABULARIES31 N ZI,ZJ,ZK S ZI=""32 N DONE S DONE=033 F S ZI=$O(C0XVOC(ZI)) Q:(DONE=1)!(ZI="") D ;34 . ;W !,ZI35 . S ZJ=C0XVOC(ZI)36 . S ZK=$P(ZR,ZJ,2)37 . ;W !,"ZK=",ZK38 . I ZK'="" D ; BINGO39 . . S ZR=ZI_":"_ZK40 . . S DONE=141 Q ZR42 ;43 VOCINIT ; INITIALIZE VOCABULARIES44 S C0XVOC("dcterms")="http://purl.org/dc/terms/"45 S C0XVOC("rdf")="http://www.w3.org/1999/02/22-rdf-syntax-ns#"46 S C0XVOC("sp")="http://smartplatforms.org/terms#"47 S C0XVOC("qds")="http://cms.gov/pqri/qds/"48 S C0XVOC("smart")="http://sandbox-api.smartplatforms.org/records/"49 S C0XVOC("snomed")="http://purl.bioontology.org/ontology/SNOMEDCT/"50 S C0XVOC("icd9")="http://purl.bioontology.org/ontology/ICD9/"51 S C0XVOC("rxnorm")="http://purl.bioontology.org/ontology/RXNORM/"52 S C0XVOC("loinc")="http://purl.bioontology.org/ontology/LNC/"53 S C0XVOC("file")="/home/glilly/fmts/trunk/samples/"54 S C0XVOC("foaf")="http://xmlns.com/foaf/0.1/"55 S C0XVOC("skos")="http://www.w3.org/2004/02/skos/core#"56 S C0XVOC("gpl")="http://georgetriples.org/"57 S C0XVOC("cg")="http://datasets.caregraf.org/"58 S C0XVOC("mv")="http://metavista.name/foundation#"59 S C0XVOC("rdfs")="http://www.w3.org/2000/01/rdf-schema#"60 S C0XVOC("vistaSmart")="https://smart2.vistaewd.net/vista/smart/records/"61 S C0XVOC("vmu")="http://vista.org/mu/"62 S C0XVOC("vq")="http://vista.org/quality/"63 S C0XVOC("nodeID")="iDPsDPss"64 S C0XVOC("fmts")="http://glilly.net/fmts#"65 S C0XVOC("oro")="http://oro.com/vista/sage" ;change to get URL from system66 S C0XVOC("sage")="http://oro.com/sage/schema#"67 S C0XVOC("v")="http://www.w3.org/2006/vcard/ns#"68 Q69 ;70 EXT(C0XIN) ; EXTRINSIC WHICH EXPANDS NAMESPACES71 ; SO skos:xxx would return http://www.w3.org/2004/02/skos/core#xxx72 N C0XPRE73 S C0XPRE=C0XIN74 I '$D(C0XVOC) D VOCINIT ; INITIALIZE NAME SPACE TABLE75 I C0XPRE[":" D ; expand using vocabulary76 . N ZB,ZA77 . S ZB=$P(C0XPRE,":",1)78 . S ZA=$P(C0XPRE,":",2)79 . I $G(C0XVOC(ZB))'="" D ;80 . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded81 Q C0XPRE82 ;1 C0XUTIL ; GPL - Fileman Triples utilities ;11/07/11 17:05 2 ;;1.0;FILEMAN TRIPLE STORE;;Sep 26, 2012;Build 10 3 ;Copyright 2011 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 NSP(ZX) ; OUTPUT TRANSFORM EXTRINSIC 23 ; 24 N ZR 25 ; I WOULD REALLY LIKE TO NOT HAVE THE FILE NUMBER HARD CODED HERE 26 ; ANYONE KNOW HOW I COULD DO THAT? :) GPL 27 S ZR=$$GET1^DIQ(172.201,ZX_",",.01) 28 I '$D(C0XNSP) S C0XNSP=1 ; DEFAULT ON 29 I C0XNSP=0 Q ZR ; SWITCHED OFF 30 I '$D(C0XVOC) D VOCINIT ; INITIALIZE THE VOCABULARIES 31 N ZI,ZJ,ZK S ZI="" 32 N DONE S DONE=0 33 F S ZI=$O(C0XVOC(ZI)) Q:(DONE=1)!(ZI="") D ; 34 . ;W !,ZI 35 . S ZJ=C0XVOC(ZI) 36 . S ZK=$P(ZR,ZJ,2) 37 . ;W !,"ZK=",ZK 38 . I ZK'="" D ; BINGO 39 . . S ZR=ZI_":"_ZK 40 . . S DONE=1 41 Q ZR 42 ; 43 VOCINIT ; INITIALIZE VOCABULARIES 44 S C0XVOC("dcterms")="http://purl.org/dc/terms/" 45 S C0XVOC("rdf")="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 46 S C0XVOC("sp")="http://smartplatforms.org/terms#" 47 S C0XVOC("qds")="http://cms.gov/pqri/qds/" 48 S C0XVOC("smart")="http://sandbox-api.smartplatforms.org/records/" 49 S C0XVOC("snomed")="http://purl.bioontology.org/ontology/SNOMEDCT/" 50 S C0XVOC("icd9")="http://purl.bioontology.org/ontology/ICD9/" 51 S C0XVOC("rxnorm")="http://purl.bioontology.org/ontology/RXNORM/" 52 S C0XVOC("loinc")="http://purl.bioontology.org/ontology/LNC/" 53 S C0XVOC("file")="/home/glilly/fmts/trunk/samples/" 54 S C0XVOC("foaf")="http://xmlns.com/foaf/0.1/" 55 S C0XVOC("skos")="http://www.w3.org/2004/02/skos/core#" 56 S C0XVOC("gpl")="http://georgetriples.org/" 57 S C0XVOC("cg")="http://datasets.caregraf.org/" 58 S C0XVOC("mv")="http://metavista.name/foundation#" 59 S C0XVOC("rdfs")="http://www.w3.org/2000/01/rdf-schema#" 60 S C0XVOC("vistaSmart")="https://smart2.vistaewd.net/vista/smart/records/" 61 S C0XVOC("vmu")="http://vista.org/mu/" 62 S C0XVOC("vq")="http://vista.org/quality/" 63 S C0XVOC("nodeID")="iDPsDPss" 64 S C0XVOC("fmts")="http://glilly.net/fmts#" 65 S C0XVOC("oro")="http://oro.com/vista/sage" ;change to get URL from system 66 S C0XVOC("sage")="http://oro.com/sage/schema#" 67 S C0XVOC("v")="http://www.w3.org/2006/vcard/ns#" 68 Q 69 ; 70 EXT(C0XIN) ; EXTRINSIC WHICH EXPANDS NAMESPACES 71 ; SO skos:xxx would return http://www.w3.org/2004/02/skos/core#xxx 72 N C0XPRE 73 S C0XPRE=C0XIN 74 I '$D(C0XVOC) D VOCINIT ; INITIALIZE NAME SPACE TABLE 75 I C0XPRE[":" D ; expand using vocabulary 76 . N ZB,ZA 77 . S ZB=$P(C0XPRE,":",1) 78 . S ZA=$P(C0XPRE,":",2) 79 . I $G(C0XVOC(ZB))'="" D ; 80 . . S C0XPRE=C0XVOC(ZB)_ZA ; expanded 81 Q C0XPRE 82 ;
Note:
See TracChangeset
for help on using the changeset viewer.
