pub struct SammAspectParser { /* private fields */ }Expand description
Parses SAMM TTL format and bridges it to physics simulation types.
Internally uses an in-memory RdfStore to enable SPARQL-based extraction
of structured data from the SAMM TTL.
Implementations§
Source§impl SammAspectParser
impl SammAspectParser
Sourcepub fn new() -> PhysicsResult<Self>
pub fn new() -> PhysicsResult<Self>
Create a new parser with default configuration.
Sourcepub fn with_physics_namespace(self, ns: impl Into<String>) -> Self
pub fn with_physics_namespace(self, ns: impl Into<String>) -> Self
Override the physics namespace prefix.
Sourcepub async fn parse_samm_file(
&self,
path: &Path,
) -> PhysicsResult<SammAspectModel>
pub async fn parse_samm_file( &self, path: &Path, ) -> PhysicsResult<SammAspectModel>
Sourcepub async fn parse_samm_string(
&self,
content: &str,
) -> PhysicsResult<SammAspectModel>
pub async fn parse_samm_string( &self, content: &str, ) -> PhysicsResult<SammAspectModel>
Parse a SAMM TTL string in memory.
§Errors
Returns PhysicsError::SammParsing if the Turtle syntax is invalid.
Sourcepub fn extract_prefix_map(&self, content: &str) -> HashMap<String, String>
pub fn extract_prefix_map(&self, content: &str) -> HashMap<String, String>
Extract @prefix / PREFIX declarations from a raw Turtle string.
Returns a map of prefix_name → namespace_iri.
Sourcepub fn bridge_to_simulation_params(
&self,
model: &SammAspectModel,
entity_iri: &str,
simulation_type: &str,
) -> PhysicsResult<SimulationParameters>
pub fn bridge_to_simulation_params( &self, model: &SammAspectModel, entity_iri: &str, simulation_type: &str, ) -> PhysicsResult<SimulationParameters>
Bridge a SammAspectModel to SimulationParameters for the named entity.
Numeric properties with known units are mapped to initial conditions. Range constraints become boundary conditions.
§Arguments
model– Parsed SAMM model.entity_iri– IRI of the physical entity to simulate.simulation_type– Simulation type string (e.g."thermal").
§Errors
Returns PhysicsError::SammParsing if the model is empty or inconsistent.
Sourcepub fn extract_physical_value(
&self,
model: &SammAspectModel,
property_name: &str,
) -> Option<PhysicalValue>
pub fn extract_physical_value( &self, model: &SammAspectModel, property_name: &str, ) -> Option<PhysicalValue>
Extract a PhysicalValue for a specific property name from the model.
Uses the range midpoint as the representative value when only bounds are
available. Returns None if the property is not found or is non-numeric.
Sourcepub fn validate_model_for_simulation(
&self,
model: &SammAspectModel,
) -> PhysicsResult<()>
pub fn validate_model_for_simulation( &self, model: &SammAspectModel, ) -> PhysicsResult<()>
Validate that all required (numeric) properties have value ranges or defaults.
Returns Ok(()) if validation passes, or a descriptive error listing
missing data.
Sourcepub fn parse_property_literal(
&self,
prop: &SammPhysicsProperty,
literal: &str,
) -> PhysicsResult<PhysicalValue>
pub fn parse_property_literal( &self, prop: &SammPhysicsProperty, literal: &str, ) -> PhysicsResult<PhysicalValue>
Parse a raw RDF literal string for a given SAMM property.
Delegates to parse_rdf_literal with the property’s data type as hint.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SammAspectParser
impl RefUnwindSafe for SammAspectParser
impl Send for SammAspectParser
impl Sync for SammAspectParser
impl Unpin for SammAspectParser
impl UnsafeUnpin for SammAspectParser
impl UnwindSafe for SammAspectParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more