slowly figuring out how to populate the herbrand
This commit is contained in:
parent
ab610a6c78
commit
a70cf1f6bf
@ -19,6 +19,8 @@ import Data.Map qualified as Map
|
||||
import Datalog.DatalogDB
|
||||
import Datalog.DatalogParser
|
||||
import Control.Exception
|
||||
import Data.Maybe
|
||||
import Data.Functor ((<&>))
|
||||
|
||||
data (DatalogDB db) => NaiveQE db = NaiveQE
|
||||
{
|
||||
@ -41,8 +43,16 @@ instance QueryEngine NaiveQE where
|
||||
|
||||
computeHerbrand :: (DatalogDB db) => db -> Map Text Relation
|
||||
computeHerbrand db =
|
||||
computeHerbrandSub Map.empty where
|
||||
computeHerbrandSub :: Map Text Relation -> Map Text Relation
|
||||
computeHerbrandSub facts = facts
|
||||
-- for_ (Map.toList myMap) $ \(k,v) ->
|
||||
computeHerbrandSub initialFacts where
|
||||
initialFacts :: Map Text Relation =
|
||||
Map.fromList $ catMaybes $ relationNames db <&> (\relationName -> do
|
||||
relation <- lookupRelation db relationName
|
||||
pure (relationName, relation))
|
||||
updateFacts :: Map Text Relation -> Maybe (Map Text Relation)
|
||||
updateFacts facts = Nothing -- Just facts
|
||||
computeHerbrandSub :: Map Text Relation -> Map Text Relation
|
||||
computeHerbrandSub facts =
|
||||
case updateFacts facts of
|
||||
Just moreFacts -> computeHerbrandSub moreFacts
|
||||
Nothing -> facts
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user