@@ -144,6 +144,23 @@ impl<'r> Resolver<'r> {
144144 continue ;
145145 }
146146 let prefix = prefix. to_ascii_lowercase ( ) ;
147+
148+ // TODO: no fast way to see if a prefix is present, currently
149+ let test_c = Curie :: new ( Some ( & prefix) , "" ) ;
150+ if iri_mappings. expand_curie ( & test_c) . is_ok ( )
151+ || self
152+ . constant_data
153+ . host_prefix_mappings
154+ . expand_curie ( & test_c)
155+ . is_ok ( )
156+ {
157+ processor_graph. emit_message (
158+ PGClass :: PrefixRedefinition ,
159+ & format ! ( "prefix '{prefix}' redefined via @xmlns" ) ,
160+ None , // TODO: context
161+ ) ;
162+ }
163+
147164 if let Err ( curie:: InvalidPrefixError :: ReservedPrefix ) =
148165 iri_mappings. add_prefix ( & prefix, iri)
149166 {
@@ -161,6 +178,23 @@ impl<'r> Resolver<'r> {
161178 continue ;
162179 }
163180 let prefix = prefix. to_ascii_lowercase ( ) ;
181+
182+ // TODO: no fast way to see if a prefix is present, currently
183+ let test_c = Curie :: new ( Some ( & prefix) , "" ) ;
184+ if iri_mappings. expand_curie ( & test_c) . is_ok ( )
185+ || self
186+ . constant_data
187+ . host_prefix_mappings
188+ . expand_curie ( & test_c)
189+ . is_ok ( )
190+ {
191+ processor_graph. emit_message (
192+ PGClass :: PrefixRedefinition ,
193+ & format ! ( "prefix '{prefix}' redefined via @prefix" ) ,
194+ None , // TODO: context
195+ ) ;
196+ }
197+
164198 if let Err ( curie:: InvalidPrefixError :: ReservedPrefix ) =
165199 iri_mappings. add_prefix ( & prefix, iri)
166200 {
@@ -266,7 +300,9 @@ impl Resolver<'_> {
266300 Ok ( Some ( term) )
267301 } else {
268302 // > Otherwise, the term has no associated IRI and MUST be ignored.
269- Err ( InvalidTerm )
303+ Err ( InvalidTerm {
304+ term : term. to_string ( ) ,
305+ } )
270306 }
271307 } else {
272308 // not a term
0 commit comments