@@ -4,19 +4,6 @@ open System.Collections.Generic
44open ARCtrl.Helper
55open Fable.Core
66
7- module Dictionary =
8-
9- let ofSeq ( s : seq < 'Key * 'T >) =
10- let dict = Dictionary()
11- s
12- |> Seq.iter dict.Add
13- dict
14-
15- let tryFind ( key : 'Key ) ( dict : Dictionary < 'Key , 'T >) =
16- let b , v = dict.TryGetValue key
17- if b then Some v
18- else None
19-
207module IRIHelper =
218
229 open ARCtrl.Helper .Regex
@@ -67,28 +54,28 @@ type LDContext(?mappings : Dictionary<string,string>, ?baseContexts : ResizeArra
6754 let compactReverseMappings : Dictionary < string , string * string > = Dictionary()
6855
6956 let addReverseMapping ( key : string ) ( value : string ) =
70- Dictionary .addOrUpdate value key reverseMappings
57+ StringDictionary .addOrUpdate value key reverseMappings
7158 match value with
7259 | IRIHelper.CompactIri ( prefix, suffix) ->
73- Dictionary .addOrUpdate prefix ( suffix, key) compactReverseMappings
74- match Dictionary .tryFind prefix mappings with
60+ StringDictionary .addOrUpdate prefix ( suffix, key) compactReverseMappings
61+ match StringDictionary .tryFind prefix mappings with
7562 | Some prefix ->
7663 let iri = IRIHelper.combine prefix suffix
77- Dictionary .addOrUpdate iri key reverseMappings
64+ StringDictionary .addOrUpdate iri key reverseMappings
7865 | None -> ()
7966 | _ ->
80- match Dictionary .tryFind key compactReverseMappings with
67+ match StringDictionary .tryFind key compactReverseMappings with
8168 | Some ( suffix, term) ->
8269 let iri = IRIHelper.combine value suffix
83- Dictionary .addOrUpdate iri term reverseMappings
70+ StringDictionary .addOrUpdate iri term reverseMappings
8471 | None -> ()
8572
8673 do for kvp in mappings do
8774 addReverseMapping kvp.Key kvp.Value
8875
8976 let rec tryFindTerm ( term : string ) : string option =
9077 let definition =
91- match Dictionary .tryFind term mappings with
78+ match StringDictionary .tryFind term mappings with
9279 | Some v -> Some v
9380 | None ->
9481 baseContexts
@@ -103,7 +90,7 @@ type LDContext(?mappings : Dictionary<string,string>, ?baseContexts : ResizeArra
10390 | None -> None
10491
10592 let tryFindIri ( iri : string ) =
106- match Dictionary .tryFind iri reverseMappings with
93+ match StringDictionary .tryFind iri reverseMappings with
10794 | Some v -> Some v
10895 | None ->
10996 baseContexts
@@ -124,7 +111,7 @@ type LDContext(?mappings : Dictionary<string,string>, ?baseContexts : ResizeArra
124111 and set ( value ) = name <- value
125112
126113 member this.AddMapping ( term , definition ) =
127- Dictionary .addOrUpdate term definition mappings
114+ StringDictionary .addOrUpdate term definition mappings
128115 addReverseMapping term definition
129116
130117 member this.TryResolveTerm ( term : string ) =
@@ -151,7 +138,7 @@ type LDContext(?mappings : Dictionary<string,string>, ?baseContexts : ResizeArra
151138 | _ -> false
152139
153140 static member fromMappingSeq ( mappings : seq < string * string >) =
154- LDContext( Dictionary .ofSeq mappings)
141+ LDContext( StringDictionary .ofSeq mappings)
155142
156143 /// Append first context as base context to the second one inplace
157144 static member combine_InPlace ( baseContext : LDContext ) ( specificContext : LDContext ) : LDContext =
0 commit comments