aboutsummaryrefslogtreecommitdiffstats
path: root/src/Data/JLD/Expansion
diff options
context:
space:
mode:
authorVolpeon <github@volpeon.ink>2023-05-27 20:36:26 +0200
committerVolpeon <github@volpeon.ink>2023-05-27 20:36:26 +0200
commit838ed8229ed13959d9235b5eafae959e8b8421c4 (patch)
tree1026b8039b841c4ee39b155c0bb8d00c7e39b391 /src/Data/JLD/Expansion
parentStructural improvements (diff)
downloadhs-jsonld-838ed8229ed13959d9235b5eafae959e8b8421c4.tar.gz
hs-jsonld-838ed8229ed13959d9235b5eafae959e8b8421c4.tar.bz2
hs-jsonld-838ed8229ed13959d9235b5eafae959e8b8421c4.zip
Added Node Map Generation algorithm
Diffstat (limited to 'src/Data/JLD/Expansion')
-rw-r--r--src/Data/JLD/Expansion/Context.hs27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/Data/JLD/Expansion/Context.hs b/src/Data/JLD/Expansion/Context.hs
index ce61644..99daba0 100644
--- a/src/Data/JLD/Expansion/Context.hs
+++ b/src/Data/JLD/Expansion/Context.hs
@@ -13,7 +13,7 @@ import Data.JLD.Model.Language (Language (..))
13import Data.JLD.Model.TermDefinition (TermDefinition (..), newTermDefinition) 13import Data.JLD.Model.TermDefinition (TermDefinition (..), newTermDefinition)
14import Data.JLD.Model.URI (parseUri, uriToIri) 14import Data.JLD.Model.URI (parseUri, uriToIri)
15import Data.JLD.Options (ContextCache, Document (..), DocumentCache, DocumentLoader (..), JLDVersion (..)) 15import Data.JLD.Options (ContextCache, Document (..), DocumentCache, DocumentLoader (..), JLDVersion (..))
16import Data.JLD.Util (flattenSingletonArray, valueContains, valueContainsAny, valueIsTrue, valueToArray) 16import Data.JLD.Util (flattenSingletonArray, valueContains, valueContainsAny, valueToArray)
17 17
18import Control.Monad.Except (MonadError (..)) 18import Control.Monad.Except (MonadError (..))
19import Data.Aeson (Object, Value (..)) 19import Data.Aeson (Object, Value (..))
@@ -73,7 +73,7 @@ bacBuildTermDefinition contextDefinition baseUrl term = do
73 p 73 p
74 { btdParamsBaseUrl = baseUrl 74 { btdParamsBaseUrl = baseUrl
75 , btdParamsOverrideProtectedFlag = bacEnvOverrideProtected 75 , btdParamsOverrideProtectedFlag = bacEnvOverrideProtected
76 , btdParamsProtectedFlag = contextDefinition |> KM.lookup (show KeywordProtected) .> maybe False valueIsTrue 76 , btdParamsProtectedFlag = contextDefinition |> KM.lookup (show KeywordProtected) .> maybe False (== Bool True)
77 , btdParamsRemoteContexts = remoteContexts 77 , btdParamsRemoteContexts = remoteContexts
78 } 78 }
79 (activeContext', _) <- 79 (activeContext', _) <-
@@ -246,20 +246,19 @@ bacProcessItem baseUrl item = do
246 Nothing -> pure () 246 Nothing -> pure ()
247 247
248 -- 5.13. 248 -- 5.13.
249 let filteredKeywords =
250 [ KeywordBase
251 , KeywordDirection
252 , KeywordImport
253 , KeywordLanguage
254 , KeywordPropagate
255 , KeywordProtected
256 , KeywordVersion
257 , KeywordVocab
258 ]
249 KM.keys contextDefinition' 259 KM.keys contextDefinition'
250 |> fmap K.toText 260 |> fmap K.toText
251 .> filter 261 .> filter (`isNotKeyword` filteredKeywords)
252 ( `isNotKeyword`
253 [ KeywordBase
254 , KeywordDirection
255 , KeywordImport
256 , KeywordLanguage
257 , KeywordPropagate
258 , KeywordProtected
259 , KeywordVersion
260 , KeywordVocab
261 ]
262 )
263 .> mapM_ (bacBuildTermDefinition contextDefinition' baseUrl) 262 .> mapM_ (bacBuildTermDefinition contextDefinition' baseUrl)
264 -- 5.3. 263 -- 5.3.
265 _ -> throwError <| Left InvalidLocalContext 264 _ -> throwError <| Left InvalidLocalContext