Morphism.hs revision 5efb71382fdcce83a76a6d40e5f8def0462bf8a8
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder{- |
e83ed59502a681713982f25c559aae77a4145734Christian MaederModule : $Header$
eb483f2216949400bfef8f6deb5320f071445626Christian MaederDescription : RDF Morphism
e6d40133bc9f858308654afb1262b8b483ec5922Till MossakowskiCopyright : (c) Francisc-Nicolae Bungiu, 2011
eb483f2216949400bfef8f6deb5320f071445626Christian MaederLicense : GPLv2 or higher, see LICENSE.txt
97018cf5fa25b494adffd7e9b4e87320dae6bf47Christian Maeder
eb483f2216949400bfef8f6deb5320f071445626Christian MaederMaintainer : f.bungiu@jacobs-university.de
3f69b6948966979163bdfe8331c38833d5d90ecdChristian MaederStability : provisional
eb483f2216949400bfef8f6deb5320f071445626Christian MaederPortability : portable
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder
f3a94a197960e548ecd6520bb768cb0d547457bbChristian MaederMorphisms for RDF
e6d40133bc9f858308654afb1262b8b483ec5922Till Mossakowski-}
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder
eb483f2216949400bfef8f6deb5320f071445626Christian Maedermodule RDF.Morphism
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder ( RDFMorphism (..)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder , isRDFInclusion
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder , inclRDFMorphism
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- , legalMor
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- , composeMor
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- , cogeneratedSign
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- , generatedSign
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- , matchesSym
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- , statSymbItems
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- , statSymbMapItems
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- , inducedFromMor
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- , symMapOf
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- , mapSen
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder ) where
e83ed59502a681713982f25c559aae77a4145734Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederimport RDF.AS
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederimport RDF.Sign
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederimport Common.DocUtils
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederimport Common.Doc
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederimport Common.Result
e83ed59502a681713982f25c559aae77a4145734Christian Maederimport Common.Utils (composeMap)
e83ed59502a681713982f25c559aae77a4145734Christian Maederimport Common.Lib.State (execState)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederimport Common.Lib.MapSet (setToMap)
e83ed59502a681713982f25c559aae77a4145734Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederimport Control.Monad
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederimport Data.Maybe
e83ed59502a681713982f25c559aae77a4145734Christian Maederimport qualified Data.Map as Map
e83ed59502a681713982f25c559aae77a4145734Christian Maederimport qualified Data.Set as Set
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederdata RDFMorphism = RDFMorphism
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder { osource :: Sign
e83ed59502a681713982f25c559aae77a4145734Christian Maeder , otarget :: Sign
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder , mmaps :: MorphMap
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder , pmap :: StringMap
e83ed59502a681713982f25c559aae77a4145734Christian Maeder } deriving (Show, Eq, Ord)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
e83ed59502a681713982f25c559aae77a4145734Christian MaederinclRDFMorphism :: Sign -> Sign -> RDFMorphism
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederinclRDFMorphism s t = RDFMorphism
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder { osource = s
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder , otarget = t
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder , pmap = Map.empty
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder , mmaps = Map.empty }
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederisRDFInclusion :: RDFMorphism -> Bool
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederisRDFInclusion m = Map.null (pmap m)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder && Map.null (mmaps m) && isSubSign (osource m) (otarget m)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder