Morphism.hs revision 38733ccc23cd5e522a1ed721eed36139e402d49c
66267bcb678a9c341272c323b299337bcfdb7cc5Christian Maeder{- |
5c933f3c61d2cfa7e76e4eb610a4b0bac988be47Christian MaederModule : $Header$
66267bcb678a9c341272c323b299337bcfdb7cc5Christian MaederDescription : OWL Morphisms
66267bcb678a9c341272c323b299337bcfdb7cc5Christian MaederCopyright : (c) Dominik Luecke, 2008
e7ce154edb906685b3fa7f6c0a764e18a4658068Christian MaederLicense : GPLv2 or higher, see LICENSE.txt
66267bcb678a9c341272c323b299337bcfdb7cc5Christian Maeder
ffd01020a4f35f434b912844ad6e0d6918fadffdChristian MaederMaintainer : luecke@informatik.uni-bremen.de
66267bcb678a9c341272c323b299337bcfdb7cc5Christian MaederStability : provisional
66267bcb678a9c341272c323b299337bcfdb7cc5Christian MaederPortability : portable
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder
fb69cd512eab767747f109e40322df7cae2f7bdfChristian MaederMorphisms for OWL
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder-}
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maedermodule OWL2.Morphism
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder ( OWLMorphism (..)
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder , isOWLInclusion
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , inclOWLMorphism
05e2a3161e4589a717c6fe5c7306820273a473c5Christian Maeder , legalMor
05e2a3161e4589a717c6fe5c7306820273a473c5Christian Maeder , composeMor
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , cogeneratedSign
5d7e4bf173534e7eb3fc84dce7bb0151079d3f8aChristian Maeder , generatedSign
ad270004874ce1d0697fb30d7309f180553bb315Christian Maeder , matchesSym
ad270004874ce1d0697fb30d7309f180553bb315Christian Maeder , statSymbItems
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder , statSymbMapItems
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , inducedFromMor
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , symMapOf
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , mapSen
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder ) where
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maederimport OWL2.AS
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maederimport OWL2.FunctionalPrint ()
e7ce154edb906685b3fa7f6c0a764e18a4658068Christian Maederimport OWL2.Sign
e7ce154edb906685b3fa7f6c0a764e18a4658068Christian Maederimport OWL2.StaticAnalysis
e7ce154edb906685b3fa7f6c0a764e18a4658068Christian Maederimport OWL2.FS
05e2a3161e4589a717c6fe5c7306820273a473c5Christian Maederimport OWL2.Symbols
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maederimport Common.DocUtils
024621f43239cfe9629e35d35a8669fad7acbba2Christian Maederimport Common.Doc
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maederimport Common.Result
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maederimport Common.Lib.State (execState)
36c6cc568751e4235502cfee00ba7b597dae78dcChristian Maederimport Common.Lib.Rel (setToMap)
36c6cc568751e4235502cfee00ba7b597dae78dcChristian Maeder
27912d626bf179b82fcb337077e5cd9653bb71cfChristian Maederimport Control.Monad
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maederimport Data.Maybe
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maederimport qualified Data.Map as Map
5c933f3c61d2cfa7e76e4eb610a4b0bac988be47Christian Maederimport qualified Data.Set as Set
5c933f3c61d2cfa7e76e4eb610a4b0bac988be47Christian Maeder
5c933f3c61d2cfa7e76e4eb610a4b0bac988be47Christian Maederdata OWLMorphism = OWLMorphism
8c81b727b788d90ff3b8cbda7b0900c9009243bbChristian Maeder { osource :: Sign
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , otarget :: Sign
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , mmaps :: Map.Map Entity IRI
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder } deriving (Show, Eq, Ord)
76647324ed70f33b95a881b536d883daccf9568dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederinclOWLMorphism :: Sign -> Sign -> OWLMorphism
07b1bf56f3a486f26d69514d05b73100abb25a0eChristian MaederinclOWLMorphism s t = OWLMorphism
05e2a3161e4589a717c6fe5c7306820273a473c5Christian Maeder { osource = s
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , otarget = t
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , mmaps = Map.empty }
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederisOWLInclusion :: OWLMorphism -> Bool
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederisOWLInclusion m = Map.null (mmaps m) && isSubSign (osource m) (otarget m)
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaedersymMap :: Map.Map Entity IRI -> Map.Map Entity Entity
c438c79d00fc438f99627e612498744bdc0d0c89Christian MaedersymMap = Map.mapWithKey (\ (Entity ty _) -> Entity ty)
c438c79d00fc438f99627e612498744bdc0d0c89Christian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederinducedElems :: Map.Map Entity IRI -> [Entity]
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederinducedElems = Map.elems . symMap
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederinducedSign :: Map.Map Entity IRI -> Sign -> Sign
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederinducedSign m = execState $ do
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder mapM_ (modEntity Set.delete) $ Map.keys m
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder mapM_ (modEntity Set.insert) $ inducedElems m
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederinducedFromMor :: Map.Map RawSymb RawSymb -> Sign -> Result OWLMorphism
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederinducedFromMor rm sig = do
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder let syms = symOf sig
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder mm <- foldM (\ m p -> case p of
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder (ASymbol s@(Entity _ v), ASymbol (Entity _ u)) ->
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder if Set.member s syms
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder then return $ if u == v then m else Map.insert s u m
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder else fail $ "unknown symbol: " ++ showDoc s "\n" ++ shows sig ""
36c6cc568751e4235502cfee00ba7b597dae78dcChristian Maeder (AnUri v, AnUri u) -> case filter (`Set.member` syms)
36c6cc568751e4235502cfee00ba7b597dae78dcChristian Maeder $ map (`Entity` v) entityTypes of
36c6cc568751e4235502cfee00ba7b597dae78dcChristian Maeder [] -> fail $ "unknown symbol: " ++ showDoc v "\n" ++ shows sig ""
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder l -> return $ if u == v then m else foldr (`Map.insert` u) m l
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder _ -> error "OWL2.Morphism.inducedFromMor") Map.empty $ Map.toList rm
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder return OWLMorphism
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder { osource = sig
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , otarget = inducedSign mm sig
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , mmaps = mm }
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaedersymMapOf :: OWLMorphism -> Map.Map Entity Entity
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaedersymMapOf mor = Map.union (symMap $ mmaps mor) $ setToMap $ symOf $ osource mor
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maederinstance Pretty OWLMorphism where
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder pretty m = let
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder s = osource m
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder srcD = specBraces $ space <> pretty s
5c933f3c61d2cfa7e76e4eb610a4b0bac988be47Christian Maeder t = otarget m
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder in if isOWLInclusion m then
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder if isSubSign t s then
5c933f3c61d2cfa7e76e4eb610a4b0bac988be47Christian Maeder fsep [text "identity morphism over", srcD]
5c933f3c61d2cfa7e76e4eb610a4b0bac988be47Christian Maeder else fsep
c438c79d00fc438f99627e612498744bdc0d0c89Christian Maeder [ text "inclusion morphism of"
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , srcD
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , text "extended with"
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , pretty $ Set.difference (symOf t) $ symOf s ]
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder else fsep
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder [ pretty $ mmaps m
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , colon <+> srcD, mapsto <+> specBraces (space <> pretty t) ]
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederlegalMor :: OWLMorphism -> Bool
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederlegalMor m = let mm = mmaps m in
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder Set.isSubsetOf (Map.keysSet mm) (symOf $ osource m)
76647324ed70f33b95a881b536d883daccf9568dChristian Maeder && Set.isSubsetOf (Set.fromList $ inducedElems mm) (symOf $ otarget m)
76647324ed70f33b95a881b536d883daccf9568dChristian Maeder
8aea46773664711e0910accc5cf80ef9ee1bcfbfChristian MaedergetIri :: EntityType -> IRI -> Map.Map Entity IRI -> IRI
8aea46773664711e0910accc5cf80ef9ee1bcfbfChristian MaedergetIri ty u = fromMaybe u . Map.lookup (Entity ty u)
8aea46773664711e0910accc5cf80ef9ee1bcfbfChristian Maeder
c438c79d00fc438f99627e612498744bdc0d0c89Christian MaedercomposeMor :: OWLMorphism -> OWLMorphism -> Result OWLMorphism
8aea46773664711e0910accc5cf80ef9ee1bcfbfChristian MaedercomposeMor m1 m2 =
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder let nm = Set.fold (\ s@(Entity ty u) -> let
8aea46773664711e0910accc5cf80ef9ee1bcfbfChristian Maeder t = getIri ty u $ mmaps m1
8aea46773664711e0910accc5cf80ef9ee1bcfbfChristian Maeder r = getIri ty t $ mmaps m2
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder in if r == u then id else Map.insert s r) Map.empty
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder . symOf $ osource m1
8aea46773664711e0910accc5cf80ef9ee1bcfbfChristian Maeder in return m1
8aea46773664711e0910accc5cf80ef9ee1bcfbfChristian Maeder { otarget = otarget m2
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder , mmaps = nm }
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaedercogeneratedSign :: Set.Set Entity -> Sign -> Result OWLMorphism
61091743da1a9ed6dfd5e077fdcc972553358962Christian MaedercogeneratedSign s sign =
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder let sig2 = execState (mapM_ (modEntity Set.delete) $ Set.toList s) sign
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder in if isSubSign sig2 sign then return $ inclOWLMorphism sig2 sign else
08b724e8dcbba5820d80f0974b9a5385140815baChristian Maeder fail "non OWL2 subsignatures for (co)generatedSign"
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5d7e4bf173534e7eb3fc84dce7bb0151079d3f8aChristian MaedergeneratedSign :: Set.Set Entity -> Sign -> Result OWLMorphism
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaedergeneratedSign s sign = cogeneratedSign (Set.difference (symOf sign) s) sign
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5d7e4bf173534e7eb3fc84dce7bb0151079d3f8aChristian MaedermatchesSym :: Entity -> RawSymb -> Bool
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaedermatchesSym e@(Entity _ u) r = case r of
5d7e4bf173534e7eb3fc84dce7bb0151079d3f8aChristian Maeder ASymbol s -> s == e
5d7e4bf173534e7eb3fc84dce7bb0151079d3f8aChristian Maeder AnUri s -> s == u
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederstatSymbItems :: [SymbItems] -> [RawSymb]
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederstatSymbItems = concatMap
76647324ed70f33b95a881b536d883daccf9568dChristian Maeder $ \ (SymbItems m us) -> case m of
717686b54b9650402e2ebfbaadf433eab8ba5171Christian Maeder Nothing -> map AnUri us
76647324ed70f33b95a881b536d883daccf9568dChristian Maeder Just ty -> map (ASymbol . Entity ty) us
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederstatSymbMapItems :: [SymbMapItems] -> Result (Map.Map RawSymb RawSymb)
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaederstatSymbMapItems =
76647324ed70f33b95a881b536d883daccf9568dChristian Maeder foldM (\ m (s, t) -> case Map.lookup s m of
717686b54b9650402e2ebfbaadf433eab8ba5171Christian Maeder Nothing -> return $ Map.insert s t m
405b95208385572f491e1e0207d8d14e31022fa6Christian Maeder Just u -> case (u, t) of
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder (AnUri su, ASymbol (Entity _ tu)) | su == tu ->
8c81b727b788d90ff3b8cbda7b0900c9009243bbChristian Maeder return $ Map.insert s t m
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder (ASymbol (Entity _ su), AnUri tu) | su == tu ->
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder return m
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder _ -> if u == t then return m else
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder fail $ "differently mapped symbol: " ++ showDoc s "\nmapped to "
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder ++ showDoc u " and " ++ showDoc t "")
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder Map.empty
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder . concatMap (\ (SymbMapItems m us) ->
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder let ps = map (\ (u, v) -> (u, fromMaybe u v)) us in
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder case m of
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder Nothing -> map (\ (s, t) -> (AnUri s, AnUri t)) ps
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder Just ty -> let mS = ASymbol . Entity ty in
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder map (\ (s, t) -> (mS s, mS t)) ps)
05e2a3161e4589a717c6fe5c7306820273a473c5Christian Maeder
05e2a3161e4589a717c6fe5c7306820273a473c5Christian MaedermapAnno :: Map.Map Entity IRI -> Annotation -> Annotation
76647324ed70f33b95a881b536d883daccf9568dChristian MaedermapAnno m ann = case ann of
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder Annotation l a e -> Annotation l (getIri AnnotationProperty a m) e
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaedermapSen :: OWLMorphism -> Axiom -> Result Axiom
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaedermapSen m = return . mapAxiom (mmaps m)
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaedermapAxiom :: Map.Map Entity IRI -> Axiom -> Axiom
341d00318de2d0ea9b6f0ab43f7e4d10ee4fb454Christian MaedermapAxiom m axm = case axm of
341d00318de2d0ea9b6f0ab43f7e4d10ee4fb454Christian Maeder PlainAxiom as a -> PlainAxiom (map (mapAnno m) as) $ mapPlainAxiom m a
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian Maeder
5a13581acc5a76d392c1dec01657bb3efd4dcf2dChristian MaedermapObjExpr :: Map.Map Entity IRI -> ObjectPropertyExpression
-> ObjectPropertyExpression
mapObjExpr m ope = case ope of
ObjectProp u -> ObjectProp $ getIri ObjectProperty u m
ObjectInverseOf o -> ObjectInverseOf $ mapObjExpr m o
mapDRange :: Map.Map Entity IRI -> DataRange -> DataRange
mapDRange m dr = case dr of
DataType u l -> DataType (getIri Datatype u m) l
DataJunction j l -> DataJunction j (map (mapDRange m) l)
DataComplementOf d -> DataComplementOf $ mapDRange m d
DataOneOf _ -> dr
mapDataExpr :: Map.Map Entity IRI -> DataPropertyExpression
-> DataPropertyExpression
mapDataExpr m dpe = getIri DataProperty dpe m
getClassIri :: IRI -> Map.Map Entity IRI -> IRI
getClassIri = getIri Class
getIndIri :: IRI -> Map.Map Entity IRI -> IRI
getIndIri = getIri NamedIndividual
mapCard :: (a -> b) -> (c -> d) -> Cardinality a c -> Cardinality b d
mapCard f g (Cardinality ty i a mb) =
Cardinality ty i (f a) $ fmap g mb
mapDescr :: Map.Map Entity IRI -> ClassExpression -> ClassExpression
mapDescr m desc = case desc of
Expression u -> Expression $ getClassIri u m
ObjectJunction ty ds -> ObjectJunction ty $ map (mapDescr m) ds
ObjectComplementOf d -> ObjectComplementOf $ mapDescr m d
ObjectOneOf is -> ObjectOneOf $ map (`getIndIri` m) is
ObjectValuesFrom ty o d -> ObjectValuesFrom ty (mapObjExpr m o)
$ mapDescr m d
ObjectHasSelf o -> ObjectHasSelf $ mapObjExpr m o
ObjectHasValue o i -> ObjectHasValue (mapObjExpr m o) $ getIndIri i m
ObjectCardinality c -> ObjectCardinality
$ mapCard (mapObjExpr m) (mapDescr m) c
DataValuesFrom ty d ds dr -> DataValuesFrom ty (mapDataExpr m d)
(map (mapDataExpr m) ds) $ mapDRange m dr
DataHasValue d c -> DataHasValue (mapDataExpr m d) c
DataCardinality c -> DataCardinality
$ mapCard (mapDataExpr m) (mapDRange m) c
mapSubObjExpr :: Map.Map Entity IRI -> SubObjectPropertyExpression
-> SubObjectPropertyExpression
mapSubObjExpr m ope = case ope of
OPExpression o -> OPExpression $ mapObjExpr m o
SubObjectPropertyChain os -> SubObjectPropertyChain
$ map (mapObjExpr m) os
mapDataDomOrRange :: Map.Map Entity IRI -> DataDomainOrRange
-> DataDomainOrRange
mapDataDomOrRange m ddr = case ddr of
DataDomain d -> DataDomain $ mapDescr m d
DataRange d -> DataRange $ mapDRange m d
mapAssertion :: Map.Map Entity IRI -> (a -> b) -> (c -> d)
-> Assertion a c -> Assertion b d
mapAssertion m f g (Assertion a ty i b) =
Assertion (f a) ty (getIndIri i m) $ g b
mapPlainAxiom :: Map.Map Entity IRI -> PlainAxiom -> PlainAxiom
mapPlainAxiom m pax = case pax of
AnnotationAssertion ir -> AnnotationAssertion ir
AnnotationAxiom rel p ir -> AnnotationAxiom rel (getIri AnnotationProperty p m) ir
SubClassOf s t -> SubClassOf (mapDescr m s) $ mapDescr m t
EquivOrDisjointClasses ty ds -> EquivOrDisjointClasses ty
$ map (mapDescr m) ds
DisjointUnion u ds -> DisjointUnion (getClassIri u m)
$ map (mapDescr m) ds
SubObjectPropertyOf so o -> SubObjectPropertyOf (mapSubObjExpr m so)
$ mapObjExpr m o
EquivOrDisjointObjectProperties ty os -> EquivOrDisjointObjectProperties ty
$ map (mapObjExpr m) os
ObjectPropertyDomainOrRange odr o d -> ObjectPropertyDomainOrRange odr
(mapObjExpr m o) $ mapDescr m d
InverseObjectProperties o p -> InverseObjectProperties (mapObjExpr m o)
$ mapObjExpr m p
ObjectPropertyCharacter c o -> ObjectPropertyCharacter c $ mapObjExpr m o
SubDataPropertyOf d e -> SubDataPropertyOf (mapDataExpr m d)
$ mapDataExpr m e
EquivOrDisjointDataProperties ty ds -> EquivOrDisjointDataProperties ty
$ map (mapDataExpr m) ds
DataPropertyDomainOrRange dd d -> DataPropertyDomainOrRange
(mapDataDomOrRange m dd) $ mapDataExpr m d
FunctionalDataProperty d -> FunctionalDataProperty $ mapDataExpr m d
SameOrDifferentIndividual ty is -> SameOrDifferentIndividual ty $ map (`getIndIri` m) is
ClassAssertion d i -> ClassAssertion (mapDescr m d) $ getIndIri i m
ObjectPropertyAssertion a -> ObjectPropertyAssertion
$ mapAssertion m (mapObjExpr m) (`getIndIri` m) a
DataPropertyAssertion a -> DataPropertyAssertion
$ mapAssertion m (mapDataExpr m) id a
Declaration (Entity ty u) -> Declaration $ Entity ty $ getIri ty u m
DatatypeDefinition ty d-> DatatypeDefinition (getIri Datatype ty m) (mapDRange m d)
HasKey c ob da-> HasKey (mapDescr m c) (map (mapObjExpr m) ob) (map (mapDataExpr m) da)