Skip to content

Commit

Permalink
Support to save manually and automaticlly.
Browse files Browse the repository at this point in the history
  • Loading branch information
yjcyxky committed Mar 9, 2024
1 parent 9c52218 commit 1d2cb7e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
11 changes: 5 additions & 6 deletions src/model/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ use crate::model::kge::{
get_embedding_metadata, get_entity_emb_table_name, get_relation_emb_table_name,
EmbeddingMetadata, DEFAULT_MODEL_NAME,
};
use crate::model::util::match_color;
use crate::model::util::ValidationError;
use crate::model::util::{match_color, title_case, ValidationError};
use crate::query_builder::sql_builder::ComposeQuery;
use lazy_static::lazy_static;
use log::{debug, error};
Expand Down Expand Up @@ -131,8 +130,8 @@ pub struct Label {

impl Label {
pub fn format_name(name: &str) -> String {
if name.len() > 20 {
format!("{}...", &name[0..20])
if name.len() > 15 {
format!("{}...", title_case(&name[0..15]))
} else {
name.to_string()
}
Expand Down Expand Up @@ -205,11 +204,11 @@ pub struct NodeData {
#[serde(deserialize_with = "convert_null_to_empty_string")]
#[oai(skip_serializing_if_is_none)]
pub pmids: Option<String>,

#[serde(deserialize_with = "convert_null_to_empty_string")]
#[oai(skip_serializing_if_is_none)]
pub taxid: Option<String>,

#[serde(deserialize_with = "convert_null_to_empty_string")]
#[oai(skip_serializing_if_is_none)]
pub synonyms: Option<String>,
Expand Down
17 changes: 17 additions & 0 deletions src/model/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,23 @@ pub fn match_color(entity_type: &str) -> String {
DEFAULT_COLOR.to_string()
}

pub fn title_case(s: &str) -> String {
s.split_whitespace()
.map(|word| {
word.char_indices()
.map(|(i, c)| {
if i == 0 {
c.to_uppercase().collect::<String>()
} else {
c.to_lowercase().collect::<String>()
}
})
.collect::<String>()
})
.collect::<Vec<String>>() // 将单词收集成Vec<String>
.join(" ")
}

pub fn read_annotation_file(filepath: &PathBuf) -> Result<HashMap<String, String>, Box<dyn Error>> {
let delimiter = get_delimiter(filepath).unwrap();

Expand Down
2 changes: 1 addition & 1 deletion studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"antd": "5.7.0",
"antd-schema-form": "^4.5.1",
"axios": "^1.1.2",
"biominer-components": "0.3.1",
"biominer-components": "0.3.6",
"classnames": "^2.3.0",
"handlebars": "^4.7.7",
"handsontable": "^12.1.3",
Expand Down
8 changes: 4 additions & 4 deletions studio/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5375,10 +5375,10 @@ bindings@^1.5.0:
dependencies:
file-uri-to-path "1.0.0"

biominer-components@0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/biominer-components/-/biominer-components-0.3.1.tgz#2e77420859c90c0a55cb7ebd2e2b278779521b43"
integrity sha512-mPj2tDf1cLuKy1NugoUuEfEnWyGgprDCWaV6+/mQKAKrFRT/8nZ3WxM8G/hU8A6k8IEogohMdCa77SeAz1X6Xw==
biominer-components@0.3.6:
version "0.3.6"
resolved "https://registry.yarnpkg.com/biominer-components/-/biominer-components-0.3.6.tgz#84743106ff8c6a9182394b6d6cef457cf9121232"
integrity sha512-ORvQ4QPzA70psw7+7m83LEFVzuMNMOQSP6/lMyLTn8Bdpyy0D03EVQQPXHroG830SFJudQfW6MAa9+2SWQYHwQ==
dependencies:
"@fingerprintjs/fingerprintjs" "^4.2.2"
ag-grid-community "^31.0.1"
Expand Down

0 comments on commit 1d2cb7e

Please sign in to comment.