{- |
Module      :  ./Logic/KnownIris.hs
Description :  map of the known logics and serializations
Copyright   :  (c) Soeren Schulze, Uni Bremen 2012
License     :  GPLv2 or higher, see LICENSE.txt

Maintainer  :  Christian.Maeder@dfki.de
Stability   :  provisional
Portability :  portable

-}

module Logic.KnownIris where

import qualified Data.Map as Map

logPrefix, serPrefix :: String

logPrefix :: String
logPrefix = "http://purl.net/dol/logics/"
serPrefix :: String
serPrefix = "http://purl.net/dol/serializations/"

logicNames :: Map.Map String String
logicNames :: Map String String
logicNames = -- IRI -> local name
  [(String, String)] -> Map String String
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
  [ (String
logPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ "CommonLogic", "CommonLogic"),
    (String
logPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ "Propositional", "Propositional"),
    (String
logPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ "OWL2", "OWL") ]

lookupLogicName :: String -> Maybe String
lookupLogicName :: String -> Maybe String
lookupLogicName = (String -> Map String String -> Maybe String
forall k a. Ord k => k -> Map k a -> Maybe a
`Map.lookup` Map String String
logicNames)

serializations :: String -> Map.Map String String
serializations :: String -> Map String String
serializations l :: String
l
  | String
l String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "CommonLogic" =
    [(String, String)] -> Map String String
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [ (String
serPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ "CommonLogic/CLIF", "CLIF"),
                   (String
serPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ "CommonLogic/KIF", "KIF") ]
  | String
l String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "Propositional" =
    [(String, String)] -> Map String String
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [ (String
serPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ "Propositional/Hets", "Hets") ]
  | String
l String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "OWL" =
    [(String, String)] -> Map String String
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [ (String
serPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ "OWL2/Manchester", "Manchester") ]
  | Bool
otherwise = Map String String
forall k a. Map k a
Map.empty

lookupSerialization :: String -> String -> Maybe String
lookupSerialization :: String -> String -> Maybe String
lookupSerialization l :: String
l = (String -> Map String String -> Maybe String
forall k a. Ord k => k -> Map k a -> Maybe a
`Map.lookup` String -> Map String String
serializations String
l)