Skip to main content

swls_core/feature/
parse.rs

1use bevy_ecs::{prelude::*, schedule::ScheduleLabel};
2
3pub use crate::systems::{
4    derive_ontologies, derive_prefix_links, extract_type_hierarchy, fetch_lov_properties,
5    infer_types,
6};
7use crate::{
8    client::Client,
9    store::Store,
10    systems::{
11        check_added_ontology_extract, derive_owl_imports_links, open_imports, validate_shapes,
12    },
13};
14
15/// Parse schedule barrier, after this system, triples should be derived
16pub fn triples() {}
17/// Parse schedule barrier, after this system, prefixes should be derived
18pub fn prefixes() {}
19
20/// [`ScheduleLabel`] related to the Parse schedule
21#[derive(ScheduleLabel, Clone, Eq, PartialEq, Debug, Hash)]
22pub struct Label;
23
24pub fn setup_schedule<C: Client + Resource>(world: &mut World) {
25    let mut parse_schedule = bevy_ecs::schedule::Schedule::new(Label);
26    parse_schedule.add_systems((
27        prefixes,
28        triples,
29        derive_prefix_links.after(prefixes),
30        derive_owl_imports_links.after(triples),
31        fetch_lov_properties::<C>.after(prefixes),
32        extract_type_hierarchy.after(triples),
33        infer_types.after(triples),
34        check_added_ontology_extract.after(triples),
35        open_imports::<C>.after(triples),
36        validate_shapes.after(triples),
37        // store things
38        crate::store::load_store.after(triples),
39        derive_ontologies.after(crate::store::load_store),
40    ));
41
42    // #[cfg(feature = "shapes")]
43    parse_schedule.add_systems((crate::systems::derive_shapes.after(triples),));
44    world.add_schedule(parse_schedule);
45    world.insert_resource(Store(oxigraph::store::Store::new().unwrap()));
46}