diff --git a/prefix_map/src/prefix_map.rs b/prefix_map/src/prefix_map.rs
index 81c5c2e3..9c6b383c 100644
--- a/prefix_map/src/prefix_map.rs
+++ b/prefix_map/src/prefix_map.rs
@@ -100,5 +100,15 @@ mod tests {
assert_eq!(pm.to_string(),
"ex \nrdf \n");
}
+
+ #[test]
+ fn prefix_map_resolve() {
+ let mut pm = PrefixMap::new();
+ let ex_iri = IriS::from_str("http://example.org/").unwrap();
+ pm.insert("ex", &ex_iri);
+ assert_eq!(pm.resolve(&"ex:pepe").unwrap(),
+ Some(IriS::from_str("http://example.org/pepe").unwrap()));
+ }
+
}
diff --git a/shex_ast/src/schema.rs b/shex_ast/src/schema.rs
index 2390094f..a0fcfd1d 100644
--- a/shex_ast/src/schema.rs
+++ b/shex_ast/src/schema.rs
@@ -1,15 +1,27 @@
+use iri_s::IriError;
use prefix_map::PrefixMap;
use srdf::iri::IriS;
#[derive(Debug)]
pub struct Schema<'a> {
- pub id: Option>,
- pub base: Option>,
- pub prefixes: Option>
+ pub(crate) id: Option,
+ pub(crate) base: Option,
+ pub(crate) prefixes: Option>
}
impl <'a> Schema<'a> {
- pub fn base(&self) -> &Option> { &self.base }
+
+ pub fn id(&self) -> Option { self.id.clone() }
+
+ pub fn base(&self) -> Option { self.base.clone() }
+
+ pub fn resolve(&self, alias: &str) -> Result