b99a562391dd — Chris Cannam 5 years ago
Merge from branch trie-twig; this is the reality now
4 files changed, 33 insertions(+), 28 deletions(-)

M repoint-lock.json
M repoint-project.json
M src/parse-serialise/prefix-table.sml
M src/store/index.sml
M repoint-lock.json +4 -4
@@ 1,19 1,19 @@ 
 {
   "libraries": {
     "sml-smlnj-containers": {
-      "pin": "a3020aba4db0"
+      "pin": "2c094258f541"
     },
     "sml-utf8": {
-      "pin": "715b45585896"
+      "pin": "cc9c7ce6eeec"
     },
     "sml-trie": {
-      "pin": "c911f50b0ba0"
+      "pin": "f9cacb07c1a8"
     },
     "sml-log": {
       "pin": "eb568f7d3c13"
     },
     "sml-buildscripts": {
-      "pin": "7f6d3489f8af"
+      "pin": "c0ab93f4abde"
     }
   }
 }

          
M repoint-project.json +1 -2
@@ 11,8 11,7 @@ 
         "sml-utf8": {
             "vcs": "hg",
             "service": "bitbucket",
-	    "owner": "cannam",
-            "branch": "stream"
+	    "owner": "cannam"
         },
         "sml-trie": {
             "vcs": "hg",

          
M src/parse-serialise/prefix-table.sml +27 -21
@@ 1,45 1,49 @@ 
-
+                               
 structure IriTrie :> TRIE where type entry = Iri.t = struct
 
-    structure WordListTrie = ListMTrieFn(struct
-				          type t = word
-				          val compare = Word.compare
-				          end)
+    structure WordVectorTrie
+        = TrieFn (VectorMTrieMapFn(struct
+                                    type t = word
+                                    val compare = Word.compare
+                                    end))
 
-    type t = WordListTrie.t
+    type t = WordVectorTrie.trie
+
+    (*!!! should be wrapper fn in trie for this *)
+
     type trie = t
     type entry = Iri.t
 
-    val empty = WordListTrie.empty
-    val isEmpty = WordListTrie.isEmpty
+    val empty = WordVectorTrie.empty
+    val isEmpty = WordVectorTrie.isEmpty
 
-    fun explode iri = WdString.explode (Iri.toWideString iri)
-    fun implode ws = Iri.fromWideString (WdString.implode ws)
-                    
+    fun explode iri = WdString.toVector (Iri.toWideString iri)
+    fun implode ws = Iri.fromWideString (WdString.fromVector ws)
+                      
     fun add (trie, s) =
-        WordListTrie.add (trie, explode s)
+        WordVectorTrie.add (trie, explode s)
 
     fun contains (trie, s) =
-        WordListTrie.contains (trie, explode s)
+        WordVectorTrie.contains (trie, explode s)
                          
     fun remove (trie, s) =
-        WordListTrie.remove (trie, explode s)
+        WordVectorTrie.remove (trie, explode s)
 
     fun foldl f acc trie =
-        WordListTrie.foldl (fn (e, acc) => f (implode e, acc)) acc trie
+        WordVectorTrie.foldl (fn (e, acc) => f (implode e, acc)) acc trie
 
     fun enumerate trie =
-        List.map implode (WordListTrie.enumerate trie)
+        List.map implode (WordVectorTrie.enumerate trie)
 
     fun foldlPrefixMatch f acc (trie, s) =
-        WordListTrie.foldlPrefixMatch (fn (e, acc) => f (implode e, acc))
+        WordVectorTrie.foldlPrefixMatch (fn (e, acc) => f (implode e, acc))
                                         acc (trie, explode s)
                  
     fun prefixMatch (trie, s) =
-        List.map implode (WordListTrie.prefixMatch (trie, explode s))
+        List.map implode (WordVectorTrie.prefixMatch (trie, explode s))
 
     fun prefixOf (trie, s) =
-        implode (WordListTrie.prefixOf (trie, explode s))
+        implode (WordVectorTrie.prefixOf (trie, explode s))
 
 end
 

          
@@ 60,7 64,7 @@ structure PrefixTable :> PREFIX_TABLE = 
                                        val compare = Iri.compare
                                        end)
 
-    type t = iri AbbrMap.map * abbreviation IriMap.map * IriTrie.t
+    type t = iri AbbrMap.map * abbreviation IriMap.map * IriTrie.trie
                         
     val empty : t = (AbbrMap.empty, IriMap.empty, IriTrie.empty)
 

          
@@ 116,7 120,9 @@ structure PrefixTable :> PREFIX_TABLE = 
 	  then NONE
 	  else
 	      case IriMap.find (reverse, prefix) of
-		  NONE => raise Fail ("internal error: prefix found in trie " ^
+		  NONE => raise Fail ("internal error: prefix <" ^
+                                      Iri.toString prefix ^
+                                      "> found in trie " ^
                                       "but not in reverse map")
 		| SOME abbr =>
 	          SOME (abbr, toUtf8 (dropPrefix (iri, Iri.size prefix)))

          
M src/store/index.sml +1 -1
@@ 14,7 14,7 @@ structure Index :> INDEX = struct
                                       val compare = RdfNode.compare
                                       end)
 
-    type t = indexOrder * NodeTrie.t
+    type t = indexOrder * NodeTrie.trie
 
     fun nameOfOrder SPO = "spo" 
       | nameOfOrder POS = "pos"