From 4ae60f52c9a24a49c5ac9d99774de90252c53abc Mon Sep 17 00:00:00 2001 From: Kaiwen He Date: Tue, 5 Nov 2024 11:55:22 -0600 Subject: [PATCH] updated RTX-KG2 to version 2.10.1pre --- .../import-rtx-kg2.rkt | 2 +- .../transform-edge-jsonl.rkt | 15 +++++++++++---- .../transform-rtx-kg2.rkt | 6 +++--- .../neo/neo-low-level/query-low-level-rtx-kg2.rkt | 2 +- medikanren2/neo/neo-server/neo-server.rkt | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/medikanren2/neo/neo-data-import/build-mediKanren2-kg-from-4tsv/import-rtx-kg2.rkt b/medikanren2/neo/neo-data-import/build-mediKanren2-kg-from-4tsv/import-rtx-kg2.rkt index c58adfc2..41d2c1b3 100644 --- a/medikanren2/neo/neo-data-import/build-mediKanren2-kg-from-4tsv/import-rtx-kg2.rkt +++ b/medikanren2/neo/neo-data-import/build-mediKanren2-kg-from-4tsv/import-rtx-kg2.rkt @@ -2,7 +2,7 @@ (require "../../dbKanren/dbk/database.rkt" racket/list racket/pretty racket/runtime-path) -(define BASE "../../neo-data/raw_downloads_from_kge_archive_transformed_to_4tsv/rtx-kg2-2.10.0pre/") +(define BASE "../../neo-data/raw_downloads_from_kge_archive_transformed_to_4tsv/rtx-kg2-2.10.1pre/") (define EDGEPROP_PATH (string-append BASE "rtx_kg2.edgeprop.tsv")) (define EDGE_PATH (string-append BASE "rtx_kg2.edge.tsv")) diff --git a/medikanren2/neo/neo-data-import/transform-2tsv-to-4tsv-kgs/transform-edge-jsonl.rkt b/medikanren2/neo/neo-data-import/transform-2tsv-to-4tsv-kgs/transform-edge-jsonl.rkt index 7f92579a..7a78e40e 100644 --- a/medikanren2/neo/neo-data-import/transform-2tsv-to-4tsv-kgs/transform-edge-jsonl.rkt +++ b/medikanren2/neo/neo-data-import/transform-2tsv-to-4tsv-kgs/transform-edge-jsonl.rkt @@ -84,10 +84,14 @@ ex-rows: (printf "finished processing edges\n") (printf "the current counters ~s\n\n" counters)] [else - (let ((subject (hash-ref line 'subject #f)) - (object (hash-ref line 'object #f)) - (predicate (hash-ref line 'predicate #f)) - (robokop-primary_knowledge_source (hash-ref line 'primary_knowledge_source #f))) + (let* ((subject (hash-ref line 'subject #f)) + (object (hash-ref line 'object #f)) + (predicate (hash-ref line 'predicate #f)) + ; the following line is for a fix for rtx-kg2 2.10.1pre + (predicate (if (and (string? predicate) (string-contains? predicate "biolink:biolink_")) + (string-replace predicate "biolink:biolink_" "biolink:") + predicate)) + (robokop-primary_knowledge_source (hash-ref line 'primary_knowledge_source #f))) (if (equal? robokop-primary_knowledge_source "infores:text-mining-provider-targeted") (loop id (read-json edges-in)) (begin @@ -117,6 +121,9 @@ ex-rows: value))) (unless (or (equal? "" value) (equal? 'null value)) (cond + ; the following line is for a fix for rtx-kg2 2.10.1pre + ((and (equal? propname 'predicate) (string-contains? value "biolink:biolink_")) + (fprintf edge-props-out "~a\t~a\t~a\n" id propname (string-replace value "biolink:biolink_" "biolink:"))) ((equal? propname 'qualified_object_aspect) (fprintf edge-props-out "~a\tobject_aspect_qualifier\t~a\n" id value)) ((equal? propname 'qualified_object_direction) diff --git a/medikanren2/neo/neo-data-import/transform-2tsv-to-4tsv-kgs/transform-rtx-kg2.rkt b/medikanren2/neo/neo-data-import/transform-2tsv-to-4tsv-kgs/transform-rtx-kg2.rkt index ae05d8bd..dc075c11 100644 --- a/medikanren2/neo/neo-data-import/transform-2tsv-to-4tsv-kgs/transform-rtx-kg2.rkt +++ b/medikanren2/neo/neo-data-import/transform-2tsv-to-4tsv-kgs/transform-rtx-kg2.rkt @@ -4,12 +4,12 @@ "transform-edge-jsonl.rkt" "transform-node-jsonl.rkt") -(define BASE "rtx-kg2-2.10.0pre/") +(define BASE "rtx-kg2-2.10.1pre/") (transform-generic (string-append "../../neo-data/raw_downloads_from_kge_archive/" BASE) (string-append "../../neo-data/raw_downloads_from_kge_archive_transformed_to_4tsv/" BASE) - "kg2.10.0pre-nodes.jsonl" - "kg2.10.0pre-edges.jsonl" + "kg2-simplified-2.10.1-nodes.jsonl" + "kg2-simplified-2.10.1-edges.jsonl" "rtx_kg2" 'rtx-kg2 (cons transform-node-jsonl transform-edge-jsonl)) diff --git a/medikanren2/neo/neo-low-level/query-low-level-rtx-kg2.rkt b/medikanren2/neo/neo-low-level/query-low-level-rtx-kg2.rkt index 05b1f462..267ff72d 100644 --- a/medikanren2/neo/neo-low-level/query-low-level-rtx-kg2.rkt +++ b/medikanren2/neo/neo-low-level/query-low-level-rtx-kg2.rkt @@ -24,7 +24,7 @@ racket/match) #;(define db-path-under-parent "rtx-kg2-may-9-2024/rtx-kg2-2.9.0pre/rtx-kg2.db") -(define db-path-under-parent "rtx-kg2-Aug-6-2024/rtx-kg2-2.10.0pre/rtx-kg2.db") +(define db-path-under-parent "rtx-kg2-oct-30-2024/rtx-kg2-2.10.1pre/rtx-kg2.db") (match-define (list diff --git a/medikanren2/neo/neo-server/neo-server.rkt b/medikanren2/neo/neo-server/neo-server.rkt index fb98d6a1..46c388ed 100644 --- a/medikanren2/neo/neo-server/neo-server.rkt +++ b/medikanren2/neo/neo-server/neo-server.rkt @@ -29,7 +29,7 @@ (define DEFAULT_PORT 8384) -(define NEO_SERVER_VERSION "1.53") +(define NEO_SERVER_VERSION "1.54") ;; Maximum number of results to be returned from *each individual* KP, ;; or from mediKanren itself.