API Reference
biokb_taxtree.import_data
Import all data in database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
engine
|
Optional[Engine]
|
SQLAlchemy engine. Defaults to None. |
None
|
force_download
|
bool
|
If True, will force download the data, even if files already exist. If False, it will skip the downloading part if files already exist locally. Defaults to False. |
False
|
delete_files
|
bool
|
If True, downloaded files are deleted after import. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
dict[str, int]
|
Dict[str, int]: table=key and number of inserted=value |
Source code in src/biokb_taxtree/db/manager.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
biokb_taxtree.create_ttls
Create all turtle files.
If engine=None tries to get the settings from config ini file
If export_to_folder=None takes the default path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
engine
|
Engine | None
|
SQLAlchemy class. Defaults to None. |
None
|
export_to_folder
|
str | None
|
Folder to export ttl files. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
path zipped file with ttls. |
Source code in src/biokb_taxtree/rdf/turtle.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
biokb_taxtree.import_ttls
Import data into Neo4J from zipped turtle files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
neo4j_uri
|
str | None
|
URI of the Neo4j database. |
None
|
neo4j_user
|
str | None
|
Username for Neo4j. |
None
|
neo4j_pwd
|
str | None
|
Password for Neo4j. |
None
|
delete_existing_graph
|
bool
|
delete existing graph before import. |
True
|
Returns: bool: True if import is successful.
Source code in src/biokb_taxtree/rdf/neo4j_importer.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
Command Line Interface (CLI)
import_data
Import data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force_download
|
bool
|
Force re-download of the source file (default: False) |
required |
connection_string
|
str
|
SQLAlchemy engine URL (default: sqlite:///taxtree.db) |
required |
delete_files
|
bool
|
Delete downloaded source files after import (default: False) |
required |
env
|
Optional[str]
|
Environment file to load for configuration (default: None) |
None
|
Source code in src/biokb_taxtree/cli.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
create_ttls
Create TTL files from local database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
connection_string
|
str
|
SQLAlchemy engine URL (default: sqlite:///taxtree.db) |
required |
Source code in src/biokb_taxtree/cli.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
import_neo4j
Import TTL files into Neo4j database.
Source code in src/biokb_taxtree/cli.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
run_server
Run the API server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host
|
str
|
API server host |
'0.0.0.0'
|
port
|
int
|
API server port |
8000
|
user
|
str
|
API username |
'admin'
|
password
|
str
|
API password |
'admin'
|
env
|
Optional[str]
|
Environment file to load for configuration (default: None) |
None
|
Source code in src/biokb_taxtree/cli.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |