diff options
Diffstat (limited to 'examples/generif.scm')
-rwxr-xr-x | examples/generif.scm | 69 |
1 files changed, 38 insertions, 31 deletions
diff --git a/examples/generif.scm b/examples/generif.scm index 909ec13..a0db6de 100755 --- a/examples/generif.scm +++ b/examples/generif.scm @@ -39,7 +39,8 @@ GROUP BY GeneRIF.Id, GeneRIF.versionId, GeneRIF.symbol") #f "gn:wiki-~a-~a" (field GeneRIF Id) (field GeneRIF versionId)) - (set rdfs:label (string->symbol (format #f "'''~a'''@en" (field GeneRIF comment)))) + (set rdfs:label (string->symbol + (sanitize-rdf-string (format #f "'''~a'''@en" (field GeneRIF comment))))) (set rdf:type 'gnc:GNWikiEntry) (set gnt:symbol (field GeneRIF symbol)) (set gnt:belongsToSpecies (string->identifier @@ -96,36 +97,42 @@ GROUP BY GeneRIF.Id, GeneRIF.versionId, GeneRIF.symbol") (field ("DATE_FORMAT(createtime, '%Y-%m-%dT%T')" CreateTime)) (field GeneRIF_BASIC VersionId)) - (set rdf:type 'gnc:NCBIWikiEntry) - (set gnt:symbol (field GeneRIF_BASIC symbol)) - (set rdfs:label - (let* ((comment - (format #f "'~a'@en" - (replace-substrings - (field GeneRIF_BASIC comment) - '(("\\" . "\\\\") - ("\n" . "\\n") - ("\r" . "\\r") - ("'" . "\\'")))))) - (string->symbol comment))) - (set dct:created - (string->symbol - (format #f "~s^^xsd:datetime " - (field - ("CAST(createtime AS CHAR)" EntryCreateTime))))) - (set gnt:belongsToSpecies (string->identifier - "" - (remap-species-identifiers (field Species Fullname)) - #:separator "" - #:proc string-capitalize-first)) - (set gnt:hasGeneId (string->symbol (format #f "generif:~a" (field GeneRIF_BASIC GeneId)))) - (set skos:notation (match (field GeneRIF_BASIC TaxID TaxonomicId) - ((? number? x) - (string->symbol (format #f "taxon:~a" x))) - (else ""))) - (set dct:hasVersion (annotate-field (format #f "~s" (field GeneRIF_BASIC versionId)) - '^^xsd:integer)) - (set dct:references (string->symbol (format #f "pubmed:~a" (field GeneRIF_BASIC PubMed_ID)))))) + (set rdf:type + (let* ((comment (format #f "'~a'@en" + (replace-substrings + (sanitize-rdf-string + (field GeneRIF_BASIC comment)) + '(("\\" . "\\\\") + ("\n" . "\\n") + ("\r" . "\\r") + ("'" . "\\'"))))) + (create-time (format #f "~s^^xsd:datetime" + (field + ("CAST(createtime AS CHAR)" EntryCreateTime)))) + (symbol (field GeneRIF_BASIC symbol)) + (species (string->identifier + "" + (remap-species-identifiers (field Species Fullname)) + #:separator "" + #:proc string-capitalize-first)) + (gene-id (field GeneRIF_BASIC GeneId)) + (taxon-id (field GeneRIF_BASIC TaxID TaxonomicId)) + (pmid (field GeneRIF_BASIC PubMed_ID)) + (version-id (field GeneRIF_BASIC versionId))) + (string->symbol + (string-append + (format #f "gnc:NCBIWikiEntry ;\n") + (format #f "\trdfs:label ~a ;\n" comment) + (format #f "\tgnt:belongsToSpecies ~a ;\n" species) + (format #f "\tgnt:symbol ~s ;\n" symbol) + (format #f "\tgnt:hasGeneId generif:~a ;\n" gene-id) + (match taxon-id + ((? number? x) + (format #f "\tskos:notation taxon:~a ;\n" taxon-id)) + (else "")) + (format #f "\tdct:hasVersion \"~a\"^^xsd:integer ;\n" version-id) + (format #f "\tdct:references pubmed:~a ;\n" pmid) + (format #f "\tdct:created ~a" create-time))))))) |