module OWL2.ColimSign where
import OWL2.Sign
import OWL2.Morphism
import OWL2.AS
import Common.IRI
import Common.SetColimit
import Common.Lib.Graph
import Data.Graph.Inductive.Graph as Graph
import qualified Data.Map as Map
signColimit :: Gr Sign (Int, OWLMorphism) ->
(Sign, Map.Map Int OWLMorphism)
signColimit :: Gr Sign (Int, OWLMorphism) -> (Sign, Map Int OWLMorphism)
signColimit graph :: Gr Sign (Int, OWLMorphism)
graph = let
conGraph :: Gr (Set Class) (Int, Map Class Class)
conGraph = ((Int, OWLMorphism) -> (Int, Map Class Class))
-> Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class)
forall (gr :: * -> * -> *) b c a.
DynGraph gr =>
(b -> c) -> gr a b -> gr a c
emap (EntityType -> (Int, OWLMorphism) -> (Int, Map Class Class)
getEntityTypeMap EntityType
Class) (Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class))
-> Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class)
forall a b. (a -> b) -> a -> b
$ (Sign -> Set Class)
-> Gr Sign (Int, OWLMorphism) -> Gr (Set Class) (Int, OWLMorphism)
forall (gr :: * -> * -> *) a c b.
DynGraph gr =>
(a -> c) -> gr a b -> gr c b
nmap Sign -> Set Class
concepts Gr Sign (Int, OWLMorphism)
graph
dataGraph :: Gr (Set Class) (Int, Map Class Class)
dataGraph = ((Int, OWLMorphism) -> (Int, Map Class Class))
-> Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class)
forall (gr :: * -> * -> *) b c a.
DynGraph gr =>
(b -> c) -> gr a b -> gr a c
emap (EntityType -> (Int, OWLMorphism) -> (Int, Map Class Class)
getEntityTypeMap EntityType
Datatype) (Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class))
-> Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class)
forall a b. (a -> b) -> a -> b
$ (Sign -> Set Class)
-> Gr Sign (Int, OWLMorphism) -> Gr (Set Class) (Int, OWLMorphism)
forall (gr :: * -> * -> *) a c b.
DynGraph gr =>
(a -> c) -> gr a b -> gr c b
nmap Sign -> Set Class
datatypes Gr Sign (Int, OWLMorphism)
graph
indGraph :: Gr (Set Class) (Int, Map Class Class)
indGraph = ((Int, OWLMorphism) -> (Int, Map Class Class))
-> Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class)
forall (gr :: * -> * -> *) b c a.
DynGraph gr =>
(b -> c) -> gr a b -> gr a c
emap (EntityType -> (Int, OWLMorphism) -> (Int, Map Class Class)
getEntityTypeMap EntityType
NamedIndividual) (Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class))
-> Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class)
forall a b. (a -> b) -> a -> b
$ (Sign -> Set Class)
-> Gr Sign (Int, OWLMorphism) -> Gr (Set Class) (Int, OWLMorphism)
forall (gr :: * -> * -> *) a c b.
DynGraph gr =>
(a -> c) -> gr a b -> gr c b
nmap Sign -> Set Class
individuals Gr Sign (Int, OWLMorphism)
graph
objGraph :: Gr (Set Class) (Int, Map Class Class)
objGraph = ((Int, OWLMorphism) -> (Int, Map Class Class))
-> Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class)
forall (gr :: * -> * -> *) b c a.
DynGraph gr =>
(b -> c) -> gr a b -> gr a c
emap (EntityType -> (Int, OWLMorphism) -> (Int, Map Class Class)
getEntityTypeMap EntityType
ObjectProperty) (Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class))
-> Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class)
forall a b. (a -> b) -> a -> b
$
(Sign -> Set Class)
-> Gr Sign (Int, OWLMorphism) -> Gr (Set Class) (Int, OWLMorphism)
forall (gr :: * -> * -> *) a c b.
DynGraph gr =>
(a -> c) -> gr a b -> gr c b
nmap Sign -> Set Class
objectProperties Gr Sign (Int, OWLMorphism)
graph
dataPropGraph :: Gr (Set Class) (Int, Map Class Class)
dataPropGraph = ((Int, OWLMorphism) -> (Int, Map Class Class))
-> Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class)
forall (gr :: * -> * -> *) b c a.
DynGraph gr =>
(b -> c) -> gr a b -> gr a c
emap (EntityType -> (Int, OWLMorphism) -> (Int, Map Class Class)
getEntityTypeMap EntityType
DataProperty) (Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class))
-> Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class)
forall a b. (a -> b) -> a -> b
$
(Sign -> Set Class)
-> Gr Sign (Int, OWLMorphism) -> Gr (Set Class) (Int, OWLMorphism)
forall (gr :: * -> * -> *) a c b.
DynGraph gr =>
(a -> c) -> gr a b -> gr c b
nmap Sign -> Set Class
dataProperties Gr Sign (Int, OWLMorphism)
graph
annPropGraph :: Gr (Set Class) (Int, Map Class Class)
annPropGraph = ((Int, OWLMorphism) -> (Int, Map Class Class))
-> Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class)
forall (gr :: * -> * -> *) b c a.
DynGraph gr =>
(b -> c) -> gr a b -> gr a c
emap (EntityType -> (Int, OWLMorphism) -> (Int, Map Class Class)
getEntityTypeMap EntityType
AnnotationProperty) (Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class))
-> Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class)
forall a b. (a -> b) -> a -> b
$
(Sign -> Set Class)
-> Gr Sign (Int, OWLMorphism) -> Gr (Set Class) (Int, OWLMorphism)
forall (gr :: * -> * -> *) a c b.
DynGraph gr =>
(a -> c) -> gr a b -> gr c b
nmap Sign -> Set Class
annotationRoles Gr Sign (Int, OWLMorphism)
graph
_prefixGraph :: Gr (Set Class) (Int, Map Class Class)
_prefixGraph = ((Int, OWLMorphism) -> (Int, Map Class Class))
-> Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class)
forall (gr :: * -> * -> *) b c a.
DynGraph gr =>
(b -> c) -> gr a b -> gr a c
emap (Int, OWLMorphism) -> (Int, Map Class Class)
getPrefixMap
(Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class))
-> Gr (Set Class) (Int, OWLMorphism)
-> Gr (Set Class) (Int, Map Class Class)
forall a b. (a -> b) -> a -> b
$ (Sign -> Set Class)
-> Gr Sign (Int, OWLMorphism) -> Gr (Set Class) (Int, OWLMorphism)
forall (gr :: * -> * -> *) a c b.
DynGraph gr =>
(a -> c) -> gr a b -> gr c b
nmap (Map Class String -> Set Class
forall k a. Map k a -> Set k
Map.keysSet (Map Class String -> Set Class)
-> (Sign -> Map Class String) -> Sign -> Set Class
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PrefixMap -> Map Class String
toQName (PrefixMap -> Map Class String)
-> (Sign -> PrefixMap) -> Sign -> Map Class String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sign -> PrefixMap
prefixMap) Gr Sign (Int, OWLMorphism)
graph
(con :: Set Class
con, funC :: Map Int (Map Class Class)
funC) = (Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class))
forall a.
SymbolName a =>
(Set (a, Int), Map Int (Map a (a, Int)))
-> (Set a, Map Int (Map a a))
addIntToSymbols ((Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class)))
-> (Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class))
forall a b. (a -> b) -> a -> b
$ Gr (Set Class) (Int, Map Class Class)
-> (Set (Class, Int), Map Int (Map Class (Class, Int)))
forall a.
Ord a =>
Gr (Set a) (Int, Map a a)
-> (Set (a, Int), Map Int (Map a (a, Int)))
computeColimitSet Gr (Set Class) (Int, Map Class Class)
conGraph
(dat :: Set Class
dat, funD :: Map Int (Map Class Class)
funD) = (Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class))
forall a.
SymbolName a =>
(Set (a, Int), Map Int (Map a (a, Int)))
-> (Set a, Map Int (Map a a))
addIntToSymbols ((Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class)))
-> (Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class))
forall a b. (a -> b) -> a -> b
$ Gr (Set Class) (Int, Map Class Class)
-> (Set (Class, Int), Map Int (Map Class (Class, Int)))
forall a.
Ord a =>
Gr (Set a) (Int, Map a a)
-> (Set (a, Int), Map Int (Map a (a, Int)))
computeColimitSet Gr (Set Class) (Int, Map Class Class)
dataGraph
(ind :: Set Class
ind, funI :: Map Int (Map Class Class)
funI) = (Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class))
forall a.
SymbolName a =>
(Set (a, Int), Map Int (Map a (a, Int)))
-> (Set a, Map Int (Map a a))
addIntToSymbols ((Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class)))
-> (Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class))
forall a b. (a -> b) -> a -> b
$ Gr (Set Class) (Int, Map Class Class)
-> (Set (Class, Int), Map Int (Map Class (Class, Int)))
forall a.
Ord a =>
Gr (Set a) (Int, Map a a)
-> (Set (a, Int), Map Int (Map a (a, Int)))
computeColimitSet Gr (Set Class) (Int, Map Class Class)
indGraph
(obj :: Set Class
obj, funO :: Map Int (Map Class Class)
funO) = (Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class))
forall a.
SymbolName a =>
(Set (a, Int), Map Int (Map a (a, Int)))
-> (Set a, Map Int (Map a a))
addIntToSymbols ((Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class)))
-> (Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class))
forall a b. (a -> b) -> a -> b
$ Gr (Set Class) (Int, Map Class Class)
-> (Set (Class, Int), Map Int (Map Class (Class, Int)))
forall a.
Ord a =>
Gr (Set a) (Int, Map a a)
-> (Set (a, Int), Map Int (Map a (a, Int)))
computeColimitSet Gr (Set Class) (Int, Map Class Class)
objGraph
(dp :: Set Class
dp, funDP :: Map Int (Map Class Class)
funDP) = (Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class))
forall a.
SymbolName a =>
(Set (a, Int), Map Int (Map a (a, Int)))
-> (Set a, Map Int (Map a a))
addIntToSymbols ((Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class)))
-> (Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class))
forall a b. (a -> b) -> a -> b
$ Gr (Set Class) (Int, Map Class Class)
-> (Set (Class, Int), Map Int (Map Class (Class, Int)))
forall a.
Ord a =>
Gr (Set a) (Int, Map a a)
-> (Set (a, Int), Map Int (Map a (a, Int)))
computeColimitSet Gr (Set Class) (Int, Map Class Class)
dataPropGraph
(ap :: Set Class
ap, funAP :: Map Int (Map Class Class)
funAP) = (Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class))
forall a.
SymbolName a =>
(Set (a, Int), Map Int (Map a (a, Int)))
-> (Set a, Map Int (Map a a))
addIntToSymbols ((Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class)))
-> (Set (Class, Int), Map Int (Map Class (Class, Int)))
-> (Set Class, Map Int (Map Class Class))
forall a b. (a -> b) -> a -> b
$ Gr (Set Class) (Int, Map Class Class)
-> (Set (Class, Int), Map Int (Map Class (Class, Int)))
forall a.
Ord a =>
Gr (Set a) (Int, Map a a)
-> (Set (a, Int), Map Int (Map a (a, Int)))
computeColimitSet Gr (Set Class) (Int, Map Class Class)
annPropGraph
morFun :: Int -> Map Entity Class
morFun i :: Int
i = (Map Entity Class -> Map Entity Class -> Map Entity Class)
-> Map Entity Class -> [Map Entity Class] -> Map Entity Class
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl Map Entity Class -> Map Entity Class -> Map Entity Class
forall k a. Ord k => Map k a -> Map k a -> Map k a
Map.union Map Entity Class
forall k a. Map k a
Map.empty
[ EntityType -> Map Class Class -> Map Entity Class
setEntityTypeMap EntityType
Class (Map Class Class -> Map Entity Class)
-> Map Class Class -> Map Entity Class
forall a b. (a -> b) -> a -> b
$
Map Class Class
-> Int -> Map Int (Map Class Class) -> Map Class Class
forall k a. Ord k => a -> k -> Map k a -> a
Map.findWithDefault (String -> Map Class Class
forall a. HasCallStack => String -> a
error "maps") Int
i Map Int (Map Class Class)
funC,
EntityType -> Map Class Class -> Map Entity Class
setEntityTypeMap EntityType
Datatype (Map Class Class -> Map Entity Class)
-> Map Class Class -> Map Entity Class
forall a b. (a -> b) -> a -> b
$
Map Class Class
-> Int -> Map Int (Map Class Class) -> Map Class Class
forall k a. Ord k => a -> k -> Map k a -> a
Map.findWithDefault (String -> Map Class Class
forall a. HasCallStack => String -> a
error "maps") Int
i Map Int (Map Class Class)
funD,
EntityType -> Map Class Class -> Map Entity Class
setEntityTypeMap EntityType
NamedIndividual (Map Class Class -> Map Entity Class)
-> Map Class Class -> Map Entity Class
forall a b. (a -> b) -> a -> b
$
Map Class Class
-> Int -> Map Int (Map Class Class) -> Map Class Class
forall k a. Ord k => a -> k -> Map k a -> a
Map.findWithDefault (String -> Map Class Class
forall a. HasCallStack => String -> a
error "maps") Int
i Map Int (Map Class Class)
funI,
EntityType -> Map Class Class -> Map Entity Class
setEntityTypeMap EntityType
ObjectProperty (Map Class Class -> Map Entity Class)
-> Map Class Class -> Map Entity Class
forall a b. (a -> b) -> a -> b
$
Map Class Class
-> Int -> Map Int (Map Class Class) -> Map Class Class
forall k a. Ord k => a -> k -> Map k a -> a
Map.findWithDefault (String -> Map Class Class
forall a. HasCallStack => String -> a
error "maps") Int
i Map Int (Map Class Class)
funO,
EntityType -> Map Class Class -> Map Entity Class
setEntityTypeMap EntityType
DataProperty (Map Class Class -> Map Entity Class)
-> Map Class Class -> Map Entity Class
forall a b. (a -> b) -> a -> b
$
Map Class Class
-> Int -> Map Int (Map Class Class) -> Map Class Class
forall k a. Ord k => a -> k -> Map k a -> a
Map.findWithDefault (String -> Map Class Class
forall a. HasCallStack => String -> a
error "maps") Int
i Map Int (Map Class Class)
funDP,
EntityType -> Map Class Class -> Map Entity Class
setEntityTypeMap EntityType
AnnotationProperty (Map Class Class -> Map Entity Class)
-> Map Class Class -> Map Entity Class
forall a b. (a -> b) -> a -> b
$
Map Class Class
-> Int -> Map Int (Map Class Class) -> Map Class Class
forall k a. Ord k => a -> k -> Map k a -> a
Map.findWithDefault (String -> Map Class Class
forall a. HasCallStack => String -> a
error "maps") Int
i Map Int (Map Class Class)
funAP
]
morMaps :: Map Int (Map Entity Class)
morMaps = [(Int, Map Entity Class)] -> Map Int (Map Entity Class)
forall k a. Eq k => [(k, a)] -> Map k a
Map.fromAscList ([(Int, Map Entity Class)] -> Map Int (Map Entity Class))
-> [(Int, Map Entity Class)] -> Map Int (Map Entity Class)
forall a b. (a -> b) -> a -> b
$
(Int -> (Int, Map Entity Class))
-> [Int] -> [(Int, Map Entity Class)]
forall a b. (a -> b) -> [a] -> [b]
map (\ x :: Int
x -> (Int
x, Int -> Map Entity Class
morFun Int
x)) ([Int] -> [(Int, Map Entity Class)])
-> [Int] -> [(Int, Map Entity Class)]
forall a b. (a -> b) -> a -> b
$ Gr Sign (Int, OWLMorphism) -> [Int]
forall (gr :: * -> * -> *) a b. Graph gr => gr a b -> [Int]
nodes Gr Sign (Int, OWLMorphism)
graph
nameMap :: PrefixMap
nameMap = (PrefixMap -> PrefixMap -> PrefixMap)
-> PrefixMap -> [PrefixMap] -> PrefixMap
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl PrefixMap -> PrefixMap -> PrefixMap
forall k a. Ord k => Map k a -> Map k a -> Map k a
Map.union PrefixMap
forall k a. Map k a
Map.empty ([PrefixMap] -> PrefixMap) -> [PrefixMap] -> PrefixMap
forall a b. (a -> b) -> a -> b
$
((Int, Sign) -> PrefixMap) -> [(Int, Sign)] -> [PrefixMap]
forall a b. (a -> b) -> [a] -> [b]
map (\ (_, l :: Sign
l) -> Sign -> PrefixMap
prefixMap Sign
l) ([(Int, Sign)] -> [PrefixMap]) -> [(Int, Sign)] -> [PrefixMap]
forall a b. (a -> b) -> a -> b
$ Gr Sign (Int, OWLMorphism) -> [(Int, Sign)]
forall (gr :: * -> * -> *) a b. Graph gr => gr a b -> [LNode a]
labNodes Gr Sign (Int, OWLMorphism)
graph
colimSign :: Sign
colimSign = Sign
emptySign {
concepts :: Set Class
concepts = Set Class
con,
datatypes :: Set Class
datatypes = Set Class
dat,
objectProperties :: Set Class
objectProperties = Set Class
obj,
dataProperties :: Set Class
dataProperties = Set Class
dp,
individuals :: Set Class
individuals = Set Class
ind,
annotationRoles :: Set Class
annotationRoles = Set Class
ap,
prefixMap :: PrefixMap
prefixMap = PrefixMap
nameMap
}
colimMor :: Map Int OWLMorphism
colimMor = [(Int, OWLMorphism)] -> Map Int OWLMorphism
forall k a. Eq k => [(k, a)] -> Map k a
Map.fromAscList ([(Int, OWLMorphism)] -> Map Int OWLMorphism)
-> [(Int, OWLMorphism)] -> Map Int OWLMorphism
forall a b. (a -> b) -> a -> b
$
((Int, Sign) -> (Int, OWLMorphism))
-> [(Int, Sign)] -> [(Int, OWLMorphism)]
forall a b. (a -> b) -> [a] -> [b]
map (\ (i :: Int
i, ssig :: Sign
ssig) -> let
mm :: Map Entity Class
mm = Map Entity Class
-> Int -> Map Int (Map Entity Class) -> Map Entity Class
forall k a. Ord k => a -> k -> Map k a -> a
Map.findWithDefault (String -> Map Entity Class
forall a. HasCallStack => String -> a
error "mor") Int
i Map Int (Map Entity Class)
morMaps
om :: OWLMorphism
om = OWLMorphism :: Sign -> Sign -> Map Entity Class -> PrefixMap -> OWLMorphism
OWLMorphism {
osource :: Sign
osource = Sign
ssig,
otarget :: Sign
otarget = Sign
colimSign,
mmaps :: Map Entity Class
mmaps = Map Entity Class
mm,
pmap :: PrefixMap
pmap = PrefixMap
forall k a. Map k a
Map.empty
}
in (Int
i, OWLMorphism
om)
) ([(Int, Sign)] -> [(Int, OWLMorphism)])
-> [(Int, Sign)] -> [(Int, OWLMorphism)]
forall a b. (a -> b) -> a -> b
$ Gr Sign (Int, OWLMorphism) -> [(Int, Sign)]
forall (gr :: * -> * -> *) a b. Graph gr => gr a b -> [LNode a]
labNodes Gr Sign (Int, OWLMorphism)
graph
in (Sign
colimSign, Map Int OWLMorphism
colimMor)
getEntityTypeMap :: EntityType -> (Int, OWLMorphism)
-> (Int, Map.Map IRI IRI)
getEntityTypeMap :: EntityType -> (Int, OWLMorphism) -> (Int, Map Class Class)
getEntityTypeMap e :: EntityType
e (i :: Int
i, phi :: OWLMorphism
phi) = let
f :: Map Entity Class
f = (Entity -> Class -> Bool) -> Map Entity Class -> Map Entity Class
forall k a. (k -> a -> Bool) -> Map k a -> Map k a
Map.filterWithKey
(\ (Entity _ x :: EntityType
x _) _ -> EntityType
x EntityType -> EntityType -> Bool
forall a. Eq a => a -> a -> Bool
== EntityType
e) (Map Entity Class -> Map Entity Class)
-> Map Entity Class -> Map Entity Class
forall a b. (a -> b) -> a -> b
$ OWLMorphism -> Map Entity Class
mmaps OWLMorphism
phi
in (Int
i, [(Class, Class)] -> Map Class Class
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(Class, Class)] -> Map Class Class)
-> [(Class, Class)] -> Map Class Class
forall a b. (a -> b) -> a -> b
$
((Entity, Class) -> (Class, Class))
-> [(Entity, Class)] -> [(Class, Class)]
forall a b. (a -> b) -> [a] -> [b]
map (\ (Entity _ _ x :: Class
x, y :: Class
y) -> (Class
x, Class
y)) ([(Entity, Class)] -> [(Class, Class)])
-> [(Entity, Class)] -> [(Class, Class)]
forall a b. (a -> b) -> a -> b
$
Map Entity Class -> [(Entity, Class)]
forall k a. Map k a -> [(k, a)]
Map.toAscList Map Entity Class
f)
setEntityTypeMap :: EntityType -> Map.Map IRI IRI
-> Map.Map Entity IRI
setEntityTypeMap :: EntityType -> Map Class Class -> Map Entity Class
setEntityTypeMap = (Class -> Entity) -> Map Class Class -> Map Entity Class
forall k2 k1 a. Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a
Map.mapKeys ((Class -> Entity) -> Map Class Class -> Map Entity Class)
-> (EntityType -> Class -> Entity)
-> EntityType
-> Map Class Class
-> Map Entity Class
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EntityType -> Class -> Entity
mkEntity
getPrefixMap :: (Int, OWLMorphism) -> (Int, Map.Map IRI IRI)
getPrefixMap :: (Int, OWLMorphism) -> (Int, Map Class Class)
getPrefixMap (i :: Int
i, phi :: OWLMorphism
phi) = let
f :: PrefixMap
f = OWLMorphism -> PrefixMap
pmap OWLMorphism
phi
in (Int
i, [(Class, Class)] -> Map Class Class
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(Class, Class)] -> Map Class Class)
-> [(Class, Class)] -> Map Class Class
forall a b. (a -> b) -> a -> b
$
((String, String) -> (Class, Class))
-> [(String, String)] -> [(Class, Class)]
forall a b. (a -> b) -> [a] -> [b]
map (\ (x :: String
x, y :: String
y) -> (String -> Class
mkIRI String
x, String -> Class
mkIRI String
y)) ([(String, String)] -> [(Class, Class)])
-> [(String, String)] -> [(Class, Class)]
forall a b. (a -> b) -> a -> b
$
PrefixMap -> [(String, String)]
forall k a. Map k a -> [(k, a)]
Map.toAscList PrefixMap
f)
toQName :: PrefixMap -> Map.Map IRI String
toQName :: PrefixMap -> Map Class String
toQName pm :: PrefixMap
pm = [(Class, String)] -> Map Class String
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(Class, String)] -> Map Class String)
-> [(Class, String)] -> Map Class String
forall a b. (a -> b) -> a -> b
$ ((String, String) -> (Class, String))
-> [(String, String)] -> [(Class, String)]
forall a b. (a -> b) -> [a] -> [b]
map (\ (p :: String
p, s :: String
s) -> (String -> Class
mkIRI String
p, String
s)) ([(String, String)] -> [(Class, String)])
-> [(String, String)] -> [(Class, String)]
forall a b. (a -> b) -> a -> b
$ PrefixMap -> [(String, String)]
forall k a. Map k a -> [(k, a)]
Map.toList PrefixMap
pm