LogicGraph.hs revision a389e88e0acb83d8489bdc5e55bc5522b152bbec
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mack{-# LANGUAGE GADTs #-}
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mack{-# LANGUAGE MultiParamTypeClasses #-}
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mack{-# LANGUAGE OverloadedStrings #-}
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mack{-# LANGUAGE TypeFamilies #-}
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mackmodule Persistence.LogicGraph ( migrateLogicGraphKey
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mack , exportLogicGraph
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mack , findOrCreateLogic
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mack , findOrCreateLanguageMappingAndLogicMapping
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mackimport Persistence.Schema as SchemaClass
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mackimport qualified Comorphisms.LogicGraph as LogicGraph (logicGraph)
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mackimport Logic.Logic as Logic
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mackimport Logic.Comorphism as Comorphism
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mackimport Control.Monad (unless)
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mackimport Control.Monad.IO.Class (MonadIO (..))
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel MackmigrateLogicGraphKey :: String
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel MackmigrateLogicGraphKey = "migrateLogicGraph"
1433efd219a6df414a1821b3d3d70d86201ed3e4Lennart PoetteringexportLogicGraph :: HetcatsOpts -> IO ()
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel MackexportLogicGraph opts =
f3c4724635951c5b8a2b3f3c3f25798ce4d290cdDaniel Mack onDatabase (databaseConfig opts) $
5e2de0eb1dff7bb86b40c16a0a9c9c4de33e77d1Daniel Mack advisoryLocked opts migrateLogicGraphKey $ migrateLogicGraph opts
exportLanguagesAndLogics opts LogicGraph.logicGraph
exportLanguageMappingsAndLogicMappings opts LogicGraph.logicGraph
mapM_ (\ (Logic.Logic lid) -> do
, Logic.Logic lid sublogics basic_spec sentence
, Logic.Logic lid sublogics basic_spec sentence
Nothing -> insert SchemaClass.Logic
findOrCreateLanguageMappingAndLogicMapping opts (Comorphism.Comorphism cid) =
findOrCreateLogicMapping sourceLogicKey targetLogicKey languageMappingKey $ Comorphism.Comorphism cid
findOrCreateLogicMapping sourceLogicKey targetLogicKey languageMappingKey (Comorphism.Comorphism cid) = do
sublogicNameForDB :: Logic.Logic lid sublogics basic_spec sentence symb_items