#[must_use]
pub fn looks_like_iri(s: &str) -> bool {
let mut chars = s.chars();
match chars.next() {
Some(c) if c.is_ascii_alphabetic() => {}
_ => return false,
}
for c in chars {
if c == ':' {
return true;
}
if !c.is_ascii_alphanumeric() && c != '+' && c != '-' && c != '.' {
return false;
}
}
false
}
#[must_use]
pub fn expand_curie(s: &str, prefixes: &[(String, String)]) -> String {
if let Some((prefix, suffix)) = s.split_once(':') {
for (name, base) in prefixes {
if name == prefix {
return format!("{base}{suffix}");
}
}
}
s.to_owned()
}