diff options
author | Volpeon <github@volpeon.ink> | 2023-05-28 10:48:57 +0200 |
---|---|---|
committer | Volpeon <github@volpeon.ink> | 2023-05-28 10:48:57 +0200 |
commit | 402b62d399133e635f79369aebc1746349bc74fd (patch) | |
tree | ea055527a6bc910fd34b1643e23524b182762968 /src/Data/JLD | |
parent | Fixed flattening errors (diff) | |
download | hs-jsonld-402b62d399133e635f79369aebc1746349bc74fd.tar.gz hs-jsonld-402b62d399133e635f79369aebc1746349bc74fd.tar.bz2 hs-jsonld-402b62d399133e635f79369aebc1746349bc74fd.zip |
Fix reverse property handling in flattening
Diffstat (limited to 'src/Data/JLD')
-rw-r--r-- | src/Data/JLD/Flattening/NodeMap.hs | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/Data/JLD/Flattening/NodeMap.hs b/src/Data/JLD/Flattening/NodeMap.hs index 6c35302..2e6b8e3 100644 --- a/src/Data/JLD/Flattening/NodeMap.hs +++ b/src/Data/JLD/Flattening/NodeMap.hs | |||
@@ -185,9 +185,9 @@ buildNodeMap' element = case element of | |||
185 | if | 185 | if |
186 | -- 6.5. | 186 | -- 6.5. |
187 | | Just referenceNode <- bnmEnvReferenceNode -> bnmModifyNodeMap \nodeMap -> | 187 | | Just referenceNode <- bnmEnvReferenceNode -> bnmModifyNodeMap \nodeMap -> |
188 | if N.memberArray bnmEnvActiveGraph bnmEnvActiveSubject bnmEnvActiveProperty (Object referenceNode) nodeMap | 188 | if N.memberArray bnmEnvActiveGraph (Just id') bnmEnvActiveProperty (Object referenceNode) nodeMap |
189 | then nodeMap | 189 | then nodeMap |
190 | else N.modifyArray bnmEnvActiveGraph bnmEnvActiveSubject bnmEnvActiveProperty (`V.snoc` Object referenceNode) nodeMap | 190 | else N.modifyArray bnmEnvActiveGraph (Just id') bnmEnvActiveProperty (`V.snoc` Object referenceNode) nodeMap |
191 | -- 6.6. | 191 | -- 6.6. |
192 | | isJust bnmEnvActiveProperty -> do | 192 | | isJust bnmEnvActiveProperty -> do |
193 | -- 6.6.1. | 193 | -- 6.6.1. |
@@ -223,25 +223,19 @@ buildNodeMap' element = case element of | |||
223 | case KM.lookup (show KeywordIndex) elementObject' of | 223 | case KM.lookup (show KeywordIndex) elementObject' of |
224 | Just indexValue | 224 | Just indexValue |
225 | | N.hasKey3 bnmEnvActiveGraph (Just id') (Just <| show KeywordIndex) nodeMap' -> throwError <| Left ConflictingIndexes | 225 | | N.hasKey3 bnmEnvActiveGraph (Just id') (Just <| show KeywordIndex) nodeMap' -> throwError <| Left ConflictingIndexes |
226 | | otherwise -> bnmModifyNodeMap <| N.insert bnmEnvActiveGraph (Just id') (Just <| show KeywordType) indexValue | 226 | | otherwise -> bnmModifyNodeMap <| N.insert bnmEnvActiveGraph (Just id') (Just <| show KeywordIndex) indexValue |
227 | -- | 227 | -- |
228 | Nothing -> pure () | 228 | Nothing -> pure () |
229 | 229 | ||
230 | -- 6.9. | 230 | -- 6.9. |
231 | case KM.lookup (show KeywordReverse) elementObject' of | 231 | case KM.lookup (show KeywordReverse) elementObject' of |
232 | Just (Object reverseMap) -> do | 232 | Just (Object reverseMap) -> iforM_ reverseMap \key -> |
233 | -- 6.9.1. | 233 | valueToArray .> mapM_ \value -> |
234 | let referenced = KM.singleton (show KeywordId) (String id') | 234 | void <| bnmBuildNodeMap value \params -> |
235 | 235 | params | |
236 | -- 6.9.3. | 236 | { bnmParamsReferenceNode = Just <| KM.singleton (show KeywordId) (String id') |
237 | iforM_ reverseMap \key -> | 237 | , bnmParamsActiveProperty = Just <| K.toText key |
238 | valueToArray .> mapM_ \value -> do | 238 | } |
239 | void <| bnmBuildNodeMap value \params -> | ||
240 | params | ||
241 | { bnmParamsReferenceNode = Just referenced | ||
242 | , bnmParamsActiveProperty = Just <| K.toText key | ||
243 | } | ||
244 | pure () | ||
245 | -- | 239 | -- |
246 | _ -> pure () | 240 | _ -> pure () |
247 | 241 | ||