diff options
Diffstat (limited to 'examples/schema.scm')
| -rwxr-xr-x | examples/schema.scm | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/examples/schema.scm b/examples/schema.scm index 50cfd6a..c4ff082 100755 --- a/examples/schema.scm +++ b/examples/schema.scm @@ -8,18 +8,7 @@ (transform sql) (transform table)) -(define (call-with-genenetwork-database connection-settings proc) - (call-with-database "mysql" (string-join - (list (assq-ref connection-settings 'sql-username) - (assq-ref connection-settings 'sql-password) - (assq-ref connection-settings 'sql-database) - "tcp" - (assq-ref connection-settings 'sql-host) - (number->string - (assq-ref connection-settings 'sql-port))) - ":") - proc)) - + (define (transform-table-schema connection-settings db) (let ((tables (tables connection-settings db))) (for-each (lambda (table) @@ -33,18 +22,18 @@ (table-name table))))) (triple table-id 'rdf:type 'gn:sqlTable) (triple table-id 'gn:name (table-name table)) - (triple table-id 'gn:hasSize (string->symbol (format #f "~a" (table-size table)))) + (triple table-id 'gn:has_size (string->symbol (format #f "~a" (table-size table)))) (for-each (lambda (column) (let ((column-id (column-id (table-name table) (column-name column)))) - (triple column-id 'rdf:type 'gn:sqlTableField) + (triple column-id 'rdf:type 'gn:sql_table_field) (triple column-id 'gn:name (column-name column)) - (triple column-id 'gn:sqlFieldType (column-type column)) - (triple table-id 'gn:hasField column-id))) + (triple column-id 'gn:sql_field_type (column-type column)) + (triple table-id 'gn:has_field column-id))) (table-columns table)))) tables))) - + (let* ((option-spec '((settings (single-char #\s) (value #t)) (output (single-char #\o) (value #t)) @@ -54,16 +43,16 @@ (output (option-ref options 'output #f)) (documentation (option-ref options 'documentation #f)) (%connection-settings (call-with-input-file settings read))) - (call-with-genenetwork-database + (call-with-target-database %connection-settings (lambda (db) (with-output-to-file output (lambda () (prefix "rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>") (prefix "rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>") - (prefix "gn:" "<http://genenetwork.org/id/>") - (prefix "gnc:" "<http://genenetwork.org/category/>") - (prefix "gnt:" "<http://genenetwork.org/term/>") + (prefix "gn:" "<http://rdf.genenetwork.org/v1/id/>") + (prefix "gnc:" "<http://rdf.genenetwork.org/v1/category/>") + (prefix "gnt:" "<http://rdf.genenetwork.org/v1/term/>") (prefix "xsd:" "<http://www.w3.org/2001/XMLSchema#>") (prefix "owl:" "<http://www.w3.org/2002/07/owl#>") (newline) |
