in
let tokens = (Str.split (Str.regexp "/") str) in
(* ty = "cic:" *)
- let (ty, sp) = (List.hd tokens, List.tl tokens) in
+ let (ty, sp) =
+ (try (List.hd tokens, List.tl tokens)
+ with Failure "hd" | Failure "tl" ->
+ raise (IllFormedUri str))
+ in
aux ty sp
;;
let uri_is_annuri uri =
Str.string_match (Str.regexp ".*\.ann$") (string_of_uri uri) 0
;;
+
+let bodyuri_of_uri uri =
+ let struri = string_of_uri uri in
+ if Str.string_match (Str.regexp ".*\.con$") (string_of_uri uri) 0 then
+ let newuri = Array.copy uri in
+ newuri.(Array.length uri - 2) <- struri ^ ".body" ;
+ Some newuri
+ else
+ None
+;;