Skip to content

Commit

Permalink
Start cleaning up documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
daemontus committed May 15, 2024
1 parent f3ddfc1 commit 9e14d07
Show file tree
Hide file tree
Showing 10 changed files with 452 additions and 91 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ strum_macros = "0.26"
regex = "1.10.3"
biodivine-xml-doc = "0.3.0"
sbml-macros = { path = "sbml-macros" }
embed-doc-image = "0.1.4"

[dev-dependencies]
sbml-test-suite = { path = "sbml-test-suite" }
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn main() {
let compartment_id = compartments.get(0).id().get();
let s = Species::new(model.document(), &species_id, &compartment_id);
let species_name = "MySpecies".to_string();
s.name().set(Some(&species_name));
s.name().set_some(&species_name);

// Then, add it to the current list of species.
species.push(s);
Expand Down
Binary file added docs-images/uml-model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs-images/uml-sbml-container.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 41 additions & 34 deletions src/constants/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ pub const ALLOWED_CHILDREN: Map<&str, &[&str]> = phf_map! {
"listOfUnitDefinitions" => extended_sbase_children!("unitDefinition"),
"unitDefinition" => extended_sbase_children!("listOfUnits"),
"listOfUnits" => extended_sbase_children!("unit"),
"unit" => extended_sbase_children!(),
"unit" => ALLOWED_SBASE_CHILDREN,
"listOfCompartments" => extended_sbase_children!("compartment"),
"compartment" => extended_sbase_children!(),
"compartment" => ALLOWED_SBASE_CHILDREN,
"listOfSpecies" => extended_sbase_children!("species"),
"species" => extended_sbase_children!(),
"species" => ALLOWED_SBASE_CHILDREN,
"listOfParameters" => extended_sbase_children!("parameter"),
"parameter" => extended_sbase_children!(),
"parameter" => ALLOWED_SBASE_CHILDREN,
"listOfInitialAssignments" => extended_sbase_children!("initialAssignment"),
"initialAssignment" => extended_sbase_children!("math"),
"listOfRules" => extended_sbase_children!("algebraicRule", "assignmentRule", "rateRule"),
Expand All @@ -139,12 +139,12 @@ pub const ALLOWED_CHILDREN: Map<&str, &[&str]> = phf_map! {
"reaction" => extended_sbase_children!("listOfReactants", "listOfProducts", "listOfModifiers", "kineticLaw"),
"listOfReactants" => extended_sbase_children!("speciesReference"),
"listOfProducts" => extended_sbase_children!("speciesReference"),
"speciesReference" => extended_sbase_children!(),
"speciesReference" => ALLOWED_SBASE_CHILDREN,
"listOfModifiers" => extended_sbase_children!("modifierSpeciesReference"),
"modifierSpeciesReference" => extended_sbase_children!(),
"modifierSpeciesReference" => ALLOWED_SBASE_CHILDREN,
"kineticLaw" => extended_sbase_children!("math", "listOfLocalParameters"),
"listOfLocalParameters" => extended_sbase_children!("localParameter"),
"localParameter" => extended_sbase_children!(),
"localParameter" => ALLOWED_SBASE_CHILDREN,
"listOfEvents" => extended_sbase_children!("event"),
"event" => extended_sbase_children!("trigger", "priority", "delay", "listOfEventAssignments"),
"trigger" => extended_sbase_children!("math"),
Expand Down Expand Up @@ -299,30 +299,37 @@ pub const MATHML_BINARY_OPERATORS: &[&str] = &[
"outerproduct",
];

// source: https://www.w3.org/TR/MathML2/chapter4.html#contm.funopqual
pub const MATHML_NARY_OPERATORS: &[&str] = &[
"plus",
"times",
"max",
"min",
"gcd",
"lcm",
"mean",
"sdev",
"variance",
"median",
"mode",
"union",
"intersect",
"cartesianproduct",
"selector",
"and",
"or",
"xor",
"eq",
"neq",
"leq",
"lt",
"geq",
"gt",
];
/*
This is currently unused, but will become relevant once we start implementing
the MathML abstraction.
// source: https://www.w3.org/TR/MathML2/chapter4.html#contm.funopqual
pub const MATHML_NARY_OPERATORS: &[&str] = &[
"plus",
"times",
"max",
"min",
"gcd",
"lcm",
"mean",
"sdev",
"variance",
"median",
"mode",
"union",
"intersect",
"cartesianproduct",
"selector",
"and",
"or",
"xor",
"eq",
"neq",
"leq",
"lt",
"geq",
"gt",
];
*/
6 changes: 3 additions & 3 deletions src/constants/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub mod document;
pub mod element;
pub mod namespaces;
pub(crate) mod document;
pub(crate) mod element;
pub(crate) mod namespaces;
3 changes: 3 additions & 0 deletions src/constants/namespaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ pub const URL_HTML: &str = "http://www.w3.org/1999/xhtml";
pub const URL_MATHML: &str = "http://www.w3.org/1998/Math/MathML";

/// The URL of the "default" empty namespace.
#[cfg(test)]
pub const URL_EMPTY: &str = "";

/// The "core" SBML namespace. Default prefix for this namespace is empty.
pub const NS_SBML_CORE: Namespace = ("", URL_SBML_CORE);

/// The "core" HTML namespace. Default prefix for this namespace is empty.
#[cfg(test)]
pub const NS_HTML: Namespace = ("", URL_HTML);

/// The MathML namespace. Default prefix for this namespace is empty.
pub const NS_MATHML: (&str, &str) = ("", URL_MATHML);

/// The "default" empty namespace. Default prefix for this namespace is empty.
#[cfg(test)]
pub const NS_EMPTY: (&str, &str) = ("", URL_EMPTY);
Loading

0 comments on commit 9e14d07

Please sign in to comment.