aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-08-23 18:02:40 +0300
committerMunyoki Kilyungi2023-08-23 18:02:40 +0300
commit136139333d34179b3677b950e6c213cb61f535d3 (patch)
tree7214a9cb9601150c5d041ddcb7fb5e595ef391e6
parent7998f8f2341e0acc1667b75ef899e84894e93720 (diff)
downloadgn-transform-databases-136139333d34179b3677b950e6c213cb61f535d3.tar.gz
Update how NCBI genewiki entries are transformed
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rwxr-xr-xexamples/generif.scm78
1 files changed, 45 insertions, 33 deletions
diff --git a/examples/generif.scm b/examples/generif.scm
index d6b8b25..cdb692a 100755
--- a/examples/generif.scm
+++ b/examples/generif.scm
@@ -77,39 +77,6 @@
(gnt:belongsToSpecies rdfs:domain gnc:GNWikiEntry)
(gnt:symbol rdfs:domain gnc:GNWikiEntry))
(triples
-(define-transformer ncbi-genewiki-entries
- (tables (GeneRIF_BASIC)
- "GROUP BY GeneId, comment, createtime")
- (schema-triples
- (gnt:geneWikiEntryofNCBI rdfs:domain gn:geneWikiEntry))
- (triples (ontology 'generif:
- (field GeneRIF_BASIC GeneId))
- (set gnt:geneWikiEntryOfNCBI
- (blank-node
- (set gnt:geneWikiEntry
- (annotate-field (field GeneRIF_BASIC comment)
- '^^xsd:string))
- (multiset dct:source (map (lambda (el) (if (string-null? el)
- ""
- (ontology 'pubmed: el)))
- (string-split (field ("GROUP_CONCAT(PubMed_ID)" pmids))
- #\,)))
- (set dct:created (annotate-field (time-unix->string
- (field GeneRIF_BASIC createtime) "~5")
- '^^xsd:datetime))))))
- (string->identifier
- "generif"
- (make-version-3-uuid
- (u8-list->bytevector
- ;; URL namespace UUID is 6ba7b811-9dad-11d1-80b4-00c04fd430c8
- '(107 167 184 17 157 173 17 209 128 180
- 0 192 79 212 48 200))
- (format #f "~a~a~a~a"
- (field Species FullName)
- (field GeneRIF comment)
- (field GeneRIF symbol)
- (field GeneRIF createtime))
- ""))
(string->identifier
"generif"
(make-version-3-uuid
@@ -168,6 +135,51 @@
""))
(set foaf:homepage (field GeneRIF weburl))))
+(define-transformer ncbi-genewiki-entries
+ (tables (GeneRIF_BASIC)
+ "GROUP BY GeneId, comment, createtime")
+ (schema-triples
+ (gnc:NCBIWikiEntry rdfs:subClassOf gnc:GeneWikiEntry)
+ (gnc:NCBIWikiEntry rdfs:comment "Represents GeneRIF Entries obtained from NCBI"))
+ (triples
+ (string->identifier
+ "generif"
+ (make-version-3-uuid
+ (u8-list->bytevector
+ ;; URL namespace UUID is 6ba7b811-9dad-11d1-80b4-00c04fd430c8
+ '(107 167 184 17 157 173 17 209 128 180
+ 0 192 79 212 48 200))
+ (format #f "~a~a~a~a~a"
+ (field GeneRIF_BASIC GeneId)
+ (field GeneRIF_BASIC VersionId)
+ (field GeneRIF_BASIC comment)
+ (field GeneRIF_BASIC symbol)
+ (field GeneRIF_BASIC createtime))
+ ""))
+ (set rdf:type 'gnc:NCBIWikiEntry)
+ (set rdfs:label
+ (annotate-field (field GeneRIF_BASIC comment)
+ '^^xsd:string))
+ (set gnt:symbol (field GeneRIF_BASIC symbol))
+ (multiset dct:references
+ (map
+ (lambda (el)
+ (if (string-null? el)
+ ""
+ (ontology 'pubmed: el)))
+ (string-split (field ("GROUP_CONCAT(PubMed_ID)" pmids))
+ #\,)))
+ (set gnt:hasVersion
+ (format #f "~a" (field GeneRIF_BASIC VersionId)))
+ (set dct:created
+ (let ((createtime (field GeneRIF_BASIC createtime)))
+ (if (string? createtime)
+ ""
+ (annotate-field
+ (time-unix->string
+ createtime "~5")
+ '^^xsd:datetime))))))
+
(let* ((option-spec