Skip to content

Commit

Permalink
feat(http): allow multiple ontologies per collection
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdoret committed Oct 2, 2024
1 parent eecc061 commit 3754bbf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 3 additions & 3 deletions fuzon-http/config/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"host": "::",
"port": 8080,
"collections": {
"cell_type": "https://purl.obolibrary.org/obo/cl.owl",
"source_material": "https://purl.obolibrary.org/obo/uberon.owl",
"taxon_id": "https://purl.obolibrary.org/obo/ncbitaxon/subsets/taxslim.owl"
"cell_type": ["https://purl.obolibrary.org/obo/cl.owl"],
"source_material": ["https://purl.obolibrary.org/obo/uberon.owl"],
"taxon_id": ["https://purl.obolibrary.org/obo/ncbitaxon/subsets/taxslim.owl"]
}
}
13 changes: 10 additions & 3 deletions fuzon-http/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,19 @@ struct AppState {

impl AppState {
fn from_config(data: Config) -> Self {
let collections = data
let collections = data.clone()
.collections
.into_iter()
.inspect(|(k, _)| println!("Loading collection {}...", k))
.map(|(k, v)| (k, TermMatcher::from_paths(vec![&v]).unwrap()))
.inspect(|(k, _)| println!("Loading collection: {}...", k))
.map(|(k, v)| (
k,
TermMatcher::from_paths(
v.iter().map(|s| &**s).collect()).unwrap()
)
)
.collect();

println!("Initialized with: {:?}", &data);
AppState { collections: Arc::new(collections) }
}
}
Expand Down

0 comments on commit 3754bbf

Please sign in to comment.