{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}

{- |
Module      :  ./OWL2/Function.hs
Copyright   :  (c) Felix Gabriel Mance
License     :  GPLv2 or higher, see LICENSE.txt

Maintainer  :  f.mance@jacobs-university.de
Stability   :  provisional
Portability :  portable

Instances for some of the functions used in OWL 2
-}

module OWL2.Function where

import OWL2.AS
import Common.IRI
import Common.Id (stringToId)
import qualified Common.GlobalAnnotations as GA (PrefixMap)
import OWL2.Sign
import OWL2.Symbols

import Data.List (stripPrefix)
import Data.Maybe
import qualified Data.Map as Map
import qualified Data.Set as Set

{- | this class contains general functions which operate on the ontology
    document, such as prefix renaming, IRI expansion or Morphism mapping -}
class Function a where
    function :: Action -> AMap -> a -> a

data Action = Rename | Expand
    deriving (Int -> Action -> ShowS
[Action] -> ShowS
Action -> String
(Int -> Action -> ShowS)
-> (Action -> String) -> ([Action] -> ShowS) -> Show Action
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Action] -> ShowS
$cshowList :: [Action] -> ShowS
show :: Action -> String
$cshow :: Action -> String
showsPrec :: Int -> Action -> ShowS
$cshowsPrec :: Int -> Action -> ShowS
Show, Action -> Action -> Bool
(Action -> Action -> Bool)
-> (Action -> Action -> Bool) -> Eq Action
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Action -> Action -> Bool
$c/= :: Action -> Action -> Bool
== :: Action -> Action -> Bool
$c== :: Action -> Action -> Bool
Eq, Eq Action
Eq Action =>
(Action -> Action -> Ordering)
-> (Action -> Action -> Bool)
-> (Action -> Action -> Bool)
-> (Action -> Action -> Bool)
-> (Action -> Action -> Bool)
-> (Action -> Action -> Action)
-> (Action -> Action -> Action)
-> Ord Action
Action -> Action -> Bool
Action -> Action -> Ordering
Action -> Action -> Action
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Action -> Action -> Action
$cmin :: Action -> Action -> Action
max :: Action -> Action -> Action
$cmax :: Action -> Action -> Action
>= :: Action -> Action -> Bool
$c>= :: Action -> Action -> Bool
> :: Action -> Action -> Bool
$c> :: Action -> Action -> Bool
<= :: Action -> Action -> Bool
$c<= :: Action -> Action -> Bool
< :: Action -> Action -> Bool
$c< :: Action -> Action -> Bool
compare :: Action -> Action -> Ordering
$ccompare :: Action -> Action -> Ordering
$cp1Ord :: Eq Action
Ord)

type StringMap = Map.Map String String
type MorphMap = Map.Map Entity IRI

data AMap =
      StringMap StringMap
    | MorphMap MorphMap
    deriving (Int -> AMap -> ShowS
[AMap] -> ShowS
AMap -> String
(Int -> AMap -> ShowS)
-> (AMap -> String) -> ([AMap] -> ShowS) -> Show AMap
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AMap] -> ShowS
$cshowList :: [AMap] -> ShowS
show :: AMap -> String
$cshow :: AMap -> String
showsPrec :: Int -> AMap -> ShowS
$cshowsPrec :: Int -> AMap -> ShowS
Show, AMap -> AMap -> Bool
(AMap -> AMap -> Bool) -> (AMap -> AMap -> Bool) -> Eq AMap
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AMap -> AMap -> Bool
$c/= :: AMap -> AMap -> Bool
== :: AMap -> AMap -> Bool
$c== :: AMap -> AMap -> Bool
Eq, Eq AMap
Eq AMap =>
(AMap -> AMap -> Ordering)
-> (AMap -> AMap -> Bool)
-> (AMap -> AMap -> Bool)
-> (AMap -> AMap -> Bool)
-> (AMap -> AMap -> Bool)
-> (AMap -> AMap -> AMap)
-> (AMap -> AMap -> AMap)
-> Ord AMap
AMap -> AMap -> Bool
AMap -> AMap -> Ordering
AMap -> AMap -> AMap
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: AMap -> AMap -> AMap
$cmin :: AMap -> AMap -> AMap
max :: AMap -> AMap -> AMap
$cmax :: AMap -> AMap -> AMap
>= :: AMap -> AMap -> Bool
$c>= :: AMap -> AMap -> Bool
> :: AMap -> AMap -> Bool
$c> :: AMap -> AMap -> Bool
<= :: AMap -> AMap -> Bool
$c<= :: AMap -> AMap -> Bool
< :: AMap -> AMap -> Bool
$c< :: AMap -> AMap -> Bool
compare :: AMap -> AMap -> Ordering
$ccompare :: AMap -> AMap -> Ordering
$cp1Ord :: Eq AMap
Ord)

maybeDo :: (Function a) => Action -> AMap -> Maybe a -> Maybe a
maybeDo :: Action -> AMap -> Maybe a -> Maybe a
maybeDo t :: Action
t mp :: AMap
mp = (a -> a) -> Maybe a -> Maybe a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> a) -> Maybe a -> Maybe a) -> (a -> a) -> Maybe a -> Maybe a
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> a -> a
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp

getIri :: EntityType -> IRI -> Map.Map Entity IRI -> IRI
getIri :: EntityType -> IRI -> Map Entity IRI -> IRI
getIri ty :: EntityType
ty u :: IRI
u = IRI -> Maybe IRI -> IRI
forall a. a -> Maybe a -> a
fromMaybe IRI
u (Maybe IRI -> IRI)
-> (Map Entity IRI -> Maybe IRI) -> Map Entity IRI -> IRI
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Entity -> Map Entity IRI -> Maybe IRI
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup (EntityType -> IRI -> Entity
mkEntity EntityType
ty IRI
u)

cutWith :: EntityType -> Action -> AMap -> IRI -> IRI
cutWith :: EntityType -> Action -> AMap -> IRI -> IRI
cutWith ty :: EntityType
ty t :: Action
t s :: AMap
s anIri :: IRI
anIri = Entity -> IRI
cutIRI (Entity -> IRI) -> Entity -> IRI
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> Entity -> Entity
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s (Entity -> Entity) -> Entity -> Entity
forall a b. (a -> b) -> a -> b
$ EntityType -> IRI -> Entity
mkEntity EntityType
ty IRI
anIri

err :: t
err :: t
err = String -> t
forall a. HasCallStack => String -> a
error "operation not allowed"

instance Function PrefixMap where
    function :: Action -> AMap -> PrefixMap -> PrefixMap
function a :: Action
a m :: AMap
m oldPs :: PrefixMap
oldPs = case AMap
m of
        StringMap mp :: PrefixMap
mp -> case Action
a of
            Rename ->
                (PrefixMap -> (String, String) -> PrefixMap)
-> PrefixMap -> [(String, String)] -> PrefixMap
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl (\ ns :: PrefixMap
ns (pre :: String
pre, ouri :: String
ouri) ->
                    String -> String -> PrefixMap -> PrefixMap
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert (String -> String -> PrefixMap -> String
forall k a. Ord k => a -> k -> Map k a -> a
Map.findWithDefault String
pre String
pre PrefixMap
mp) String
ouri PrefixMap
ns)
                    PrefixMap
forall k a. Map k a
Map.empty ([(String, String)] -> PrefixMap)
-> [(String, String)] -> PrefixMap
forall a b. (a -> b) -> a -> b
$ PrefixMap -> [(String, String)]
forall k a. Map k a -> [(k, a)]
Map.toList PrefixMap
oldPs
            Expand -> PrefixMap
oldPs
        _ -> PrefixMap
forall t. t
err

instance Function GA.PrefixMap where
    function :: Action -> AMap -> PrefixMap -> PrefixMap
function a :: Action
a m :: AMap
m oldPs :: PrefixMap
oldPs = case AMap
m of
        StringMap mp :: PrefixMap
mp -> case Action
a of
            Rename ->
                (PrefixMap -> (String, IRI) -> PrefixMap)
-> PrefixMap -> [(String, IRI)] -> PrefixMap
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl (\ ns :: PrefixMap
ns (pre :: String
pre, ouri :: IRI
ouri) ->
                    String -> IRI -> PrefixMap -> PrefixMap
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert (String -> String -> PrefixMap -> String
forall k a. Ord k => a -> k -> Map k a -> a
Map.findWithDefault String
pre String
pre PrefixMap
mp) IRI
ouri PrefixMap
ns)
                    PrefixMap
forall k a. Map k a
Map.empty ([(String, IRI)] -> PrefixMap) -> [(String, IRI)] -> PrefixMap
forall a b. (a -> b) -> a -> b
$ PrefixMap -> [(String, IRI)]
forall k a. Map k a -> [(k, a)]
Map.toList PrefixMap
oldPs
            Expand -> PrefixMap
oldPs
        _ -> PrefixMap
forall t. t
err

instance Function IRI where
  function :: Action -> AMap -> IRI -> IRI
function a :: Action
a m :: AMap
m iri :: IRI
iri = case AMap
m of
    StringMap pm :: PrefixMap
pm -> case Action
a of
     Rename -> let pre :: String
pre = IRI -> String
prefixName IRI
iri in
              IRI
iri { prefixName :: String
prefixName = String -> String -> PrefixMap -> String
forall k a. Ord k => a -> k -> Map k a -> a
Map.findWithDefault String
pre String
pre PrefixMap
pm}
     Expand ->
      let np :: String
np = IRI -> String
prefixName IRI
iri
          lp :: String
lp = Id -> String
forall a. Show a => a -> String
show (Id -> String) -> Id -> String
forall a b. (a -> b) -> a -> b
$ IRI -> Id
iriPath IRI
iri
          iRi :: IRI
iRi = if IRI -> Bool
hasFullIRI IRI
iri then let
                  ex :: String
ex = String
np String -> ShowS
forall a. [a] -> [a] -> [a]
++ ":" String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
lp
                  res :: IRI
res = PrefixMap -> IRI -> IRI
expandIRI' PrefixMap
pm IRI
iri
                in if String -> [String] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
elem String
np ["http", "https"] Bool -> Bool -> Bool
&& Bool -> Bool
not (IRI -> Bool
isAbbrev IRI
iri) then -- abbreviate
                        case String -> PrefixMap -> Maybe String
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup "" PrefixMap
pm of
                          Just ep :: String
ep | String -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
ep Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 5 -> case String -> String -> Maybe String
forall a. Eq a => [a] -> [a] -> Maybe [a]
stripPrefix String
ep String
ex of
                            Just rl :: String
rl@(_ : _) -> IRI
res
                              { prefixName :: String
prefixName = ""
                              , iriPath :: Id
iriPath = String -> Id
stringToId String
rl -- todo: maybe we should keep the Id structure of iriPath iri. See #1820
                              }
                            _ -> IRI
res
                          _ -> IRI
res
                      else IRI
res
               else if IRI -> Bool
isBlankNode IRI
iri then IRI
iri
               else let iriMap :: PrefixMap
iriMap = PrefixMap -> PrefixMap -> PrefixMap
forall k a. Ord k => Map k a -> Map k a -> Map k a
Map.union PrefixMap
pm PrefixMap
predefPrefixes
                    in PrefixMap -> IRI -> IRI
expandIRI' PrefixMap
iriMap IRI
iri
      in IRI -> IRI
setReservedPrefix IRI
iRi
    _ -> IRI
iri

instance Function Sign where
   function :: Action -> AMap -> Sign -> Sign
function t :: Action
t mp :: AMap
mp (Sign p1 :: Set IRI
p1 p2 :: Set IRI
p2 p3 :: Set IRI
p3 p4 :: Set IRI
p4 p5 :: Set IRI
p5 p6 :: Set IRI
p6 p7 :: Map IRI String
p7 p8 :: PrefixMap
p8) = case AMap
mp of
    StringMap _ ->
        Set IRI
-> Set IRI
-> Set IRI
-> Set IRI
-> Set IRI
-> Set IRI
-> Map IRI String
-> PrefixMap
-> Sign
Sign ((IRI -> IRI) -> Set IRI -> Set IRI
forall b a. Ord b => (a -> b) -> Set a -> Set b
Set.map (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp) Set IRI
p1)
            ((IRI -> IRI) -> Set IRI -> Set IRI
forall b a. Ord b => (a -> b) -> Set a -> Set b
Set.map (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp) Set IRI
p2)
            ((IRI -> IRI) -> Set IRI -> Set IRI
forall b a. Ord b => (a -> b) -> Set a -> Set b
Set.map (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp) Set IRI
p3)
            ((IRI -> IRI) -> Set IRI -> Set IRI
forall b a. Ord b => (a -> b) -> Set a -> Set b
Set.map (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp) Set IRI
p4)
            ((IRI -> IRI) -> Set IRI -> Set IRI
forall b a. Ord b => (a -> b) -> Set a -> Set b
Set.map (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp) Set IRI
p5)
            ((IRI -> IRI) -> Set IRI -> Set IRI
forall b a. Ord b => (a -> b) -> Set a -> Set b
Set.map (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp) Set IRI
p6)
            ((IRI -> IRI) -> Map IRI String -> Map IRI String
forall k2 k1 a. Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a
Map.mapKeys (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp) Map IRI String
p7)
            (Action -> AMap -> PrefixMap -> PrefixMap
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp PrefixMap
p8)
    _ -> Sign
forall t. t
err

instance Function Entity where
    function :: Action -> AMap -> Entity -> Entity
function t :: Action
t pm :: AMap
pm (Entity _ ty :: EntityType
ty ent :: IRI
ent) = case AMap
pm of
        StringMap _ -> EntityType -> IRI -> Entity
mkEntity EntityType
ty (IRI -> Entity) -> IRI -> Entity
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
pm IRI
ent
        MorphMap m :: Map Entity IRI
m -> EntityType -> IRI -> Entity
mkEntity EntityType
ty (IRI -> Entity) -> IRI -> Entity
forall a b. (a -> b) -> a -> b
$ EntityType -> IRI -> Map Entity IRI -> IRI
getIri EntityType
ty IRI
ent Map Entity IRI
m

instance Function Literal where
    function :: Action -> AMap -> Literal -> Literal
function t :: Action
t pm :: AMap
pm l :: Literal
l = case Literal
l of
        Literal lf :: String
lf (Typed dt :: IRI
dt) -> String -> TypedOrUntyped -> Literal
Literal String
lf (TypedOrUntyped -> Literal) -> TypedOrUntyped -> Literal
forall a b. (a -> b) -> a -> b
$ IRI -> TypedOrUntyped
Typed
                (IRI -> TypedOrUntyped) -> IRI -> TypedOrUntyped
forall a b. (a -> b) -> a -> b
$ EntityType -> Action -> AMap -> IRI -> IRI
cutWith EntityType
Datatype Action
t AMap
pm IRI
dt
        _ -> Literal
l

instance Function ObjectPropertyExpression where
    function :: Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
function t :: Action
t s :: AMap
s opr :: ObjectPropertyExpression
opr = case ObjectPropertyExpression
opr of
        ObjectProp op :: IRI
op -> IRI -> ObjectPropertyExpression
ObjectProp (IRI -> ObjectPropertyExpression)
-> IRI -> ObjectPropertyExpression
forall a b. (a -> b) -> a -> b
$ EntityType -> Action -> AMap -> IRI -> IRI
cutWith EntityType
ObjectProperty Action
t AMap
s IRI
op
        ObjectInverseOf op :: ObjectPropertyExpression
op -> ObjectPropertyExpression -> ObjectPropertyExpression
ObjectInverseOf (ObjectPropertyExpression -> ObjectPropertyExpression)
-> ObjectPropertyExpression -> ObjectPropertyExpression
forall a b. (a -> b) -> a -> b
$ Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s ObjectPropertyExpression
op

instance Function DataRange where
    function :: Action -> AMap -> DataRange -> DataRange
function t :: Action
t s :: AMap
s dra :: DataRange
dra = case DataRange
dra of
        DataType dt :: IRI
dt ls :: [(IRI, Literal)]
ls -> IRI -> [(IRI, Literal)] -> DataRange
DataType (EntityType -> Action -> AMap -> IRI -> IRI
cutWith EntityType
Datatype Action
t AMap
s IRI
dt)
            ([(IRI, Literal)] -> DataRange) -> [(IRI, Literal)] -> DataRange
forall a b. (a -> b) -> a -> b
$ ((IRI, Literal) -> (IRI, Literal))
-> [(IRI, Literal)] -> [(IRI, Literal)]
forall a b. (a -> b) -> [a] -> [b]
map (\ (cf :: IRI
cf, rv :: Literal
rv) -> (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s IRI
cf, Action -> AMap -> Literal -> Literal
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s Literal
rv)) [(IRI, Literal)]
ls
        DataJunction jt :: JunctionType
jt drl :: [DataRange]
drl -> JunctionType -> [DataRange] -> DataRange
DataJunction JunctionType
jt ([DataRange] -> DataRange) -> [DataRange] -> DataRange
forall a b. (a -> b) -> a -> b
$ (DataRange -> DataRange) -> [DataRange] -> [DataRange]
forall a b. (a -> b) -> [a] -> [b]
map (Action -> AMap -> DataRange -> DataRange
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s) [DataRange]
drl
        DataComplementOf dr :: DataRange
dr -> DataRange -> DataRange
DataComplementOf (DataRange -> DataRange) -> DataRange -> DataRange
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> DataRange -> DataRange
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s DataRange
dr
        DataOneOf ll :: [Literal]
ll -> [Literal] -> DataRange
DataOneOf ([Literal] -> DataRange) -> [Literal] -> DataRange
forall a b. (a -> b) -> a -> b
$ (Literal -> Literal) -> [Literal] -> [Literal]
forall a b. (a -> b) -> [a] -> [b]
map (Action -> AMap -> Literal -> Literal
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s) [Literal]
ll

instance Function ClassExpression where
    function :: Action -> AMap -> ClassExpression -> ClassExpression
function t :: Action
t s :: AMap
s cle :: ClassExpression
cle = case ClassExpression
cle of
        Expression c :: IRI
c -> IRI -> ClassExpression
Expression (IRI -> ClassExpression) -> IRI -> ClassExpression
forall a b. (a -> b) -> a -> b
$ EntityType -> Action -> AMap -> IRI -> IRI
cutWith EntityType
Class Action
t AMap
s IRI
c
        ObjectJunction jt :: JunctionType
jt cel :: [ClassExpression]
cel -> JunctionType -> [ClassExpression] -> ClassExpression
ObjectJunction JunctionType
jt ([ClassExpression] -> ClassExpression)
-> [ClassExpression] -> ClassExpression
forall a b. (a -> b) -> a -> b
$ (ClassExpression -> ClassExpression)
-> [ClassExpression] -> [ClassExpression]
forall a b. (a -> b) -> [a] -> [b]
map (Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s) [ClassExpression]
cel
        ObjectComplementOf ce :: ClassExpression
ce -> ClassExpression -> ClassExpression
ObjectComplementOf (ClassExpression -> ClassExpression)
-> ClassExpression -> ClassExpression
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s ClassExpression
ce
        ObjectOneOf il :: [IRI]
il -> [IRI] -> ClassExpression
ObjectOneOf ([IRI] -> ClassExpression) -> [IRI] -> ClassExpression
forall a b. (a -> b) -> a -> b
$ (IRI -> IRI) -> [IRI] -> [IRI]
forall a b. (a -> b) -> [a] -> [b]
map (EntityType -> Action -> AMap -> IRI -> IRI
cutWith EntityType
NamedIndividual Action
t AMap
s) [IRI]
il
        ObjectValuesFrom qt :: QuantifierType
qt op :: ObjectPropertyExpression
op ce :: ClassExpression
ce ->
            QuantifierType
-> ObjectPropertyExpression -> ClassExpression -> ClassExpression
ObjectValuesFrom QuantifierType
qt (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s ObjectPropertyExpression
op) (ClassExpression -> ClassExpression)
-> ClassExpression -> ClassExpression
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s ClassExpression
ce
        ObjectHasValue op :: ObjectPropertyExpression
op i :: IRI
i -> ObjectPropertyExpression -> IRI -> ClassExpression
ObjectHasValue (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s ObjectPropertyExpression
op)
            (IRI -> ClassExpression) -> IRI -> ClassExpression
forall a b. (a -> b) -> a -> b
$ EntityType -> Action -> AMap -> IRI -> IRI
cutWith EntityType
NamedIndividual Action
t AMap
s IRI
i
        ObjectHasSelf op :: ObjectPropertyExpression
op -> ObjectPropertyExpression -> ClassExpression
ObjectHasSelf (ObjectPropertyExpression -> ClassExpression)
-> ObjectPropertyExpression -> ClassExpression
forall a b. (a -> b) -> a -> b
$ Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s ObjectPropertyExpression
op
        ObjectCardinality (Cardinality ct :: CardinalityType
ct i :: Int
i op :: ObjectPropertyExpression
op mce :: Maybe ClassExpression
mce) -> Cardinality ObjectPropertyExpression ClassExpression
-> ClassExpression
ObjectCardinality
            (Cardinality ObjectPropertyExpression ClassExpression
 -> ClassExpression)
-> Cardinality ObjectPropertyExpression ClassExpression
-> ClassExpression
forall a b. (a -> b) -> a -> b
$ CardinalityType
-> Int
-> ObjectPropertyExpression
-> Maybe ClassExpression
-> Cardinality ObjectPropertyExpression ClassExpression
forall a b.
CardinalityType -> Int -> a -> Maybe b -> Cardinality a b
Cardinality CardinalityType
ct Int
i (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s ObjectPropertyExpression
op) (Maybe ClassExpression
 -> Cardinality ObjectPropertyExpression ClassExpression)
-> Maybe ClassExpression
-> Cardinality ObjectPropertyExpression ClassExpression
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> Maybe ClassExpression -> Maybe ClassExpression
forall a. Function a => Action -> AMap -> Maybe a -> Maybe a
maybeDo Action
t AMap
s Maybe ClassExpression
mce
        DataValuesFrom qt :: QuantifierType
qt dps :: [IRI]
dps dr :: DataRange
dr -> QuantifierType -> [IRI] -> DataRange -> ClassExpression
DataValuesFrom QuantifierType
qt
            (EntityType -> Action -> AMap -> IRI -> IRI
cutWith EntityType
DataProperty Action
t AMap
s (IRI -> IRI) -> [IRI] -> [IRI]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [IRI]
dps) (DataRange -> ClassExpression) -> DataRange -> ClassExpression
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> DataRange -> DataRange
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s DataRange
dr
        DataHasValue dp :: IRI
dp l :: Literal
l -> IRI -> Literal -> ClassExpression
DataHasValue (EntityType -> Action -> AMap -> IRI -> IRI
cutWith EntityType
DataProperty Action
t AMap
s IRI
dp)
            (Literal -> ClassExpression) -> Literal -> ClassExpression
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> Literal -> Literal
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s Literal
l
        DataCardinality (Cardinality ct :: CardinalityType
ct i :: Int
i dp :: IRI
dp mdr :: Maybe DataRange
mdr) -> Cardinality IRI DataRange -> ClassExpression
DataCardinality
              (Cardinality IRI DataRange -> ClassExpression)
-> Cardinality IRI DataRange -> ClassExpression
forall a b. (a -> b) -> a -> b
$ CardinalityType
-> Int -> IRI -> Maybe DataRange -> Cardinality IRI DataRange
forall a b.
CardinalityType -> Int -> a -> Maybe b -> Cardinality a b
Cardinality CardinalityType
ct Int
i (EntityType -> Action -> AMap -> IRI -> IRI
cutWith EntityType
DataProperty Action
t AMap
s IRI
dp) (Maybe DataRange -> Cardinality IRI DataRange)
-> Maybe DataRange -> Cardinality IRI DataRange
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> Maybe DataRange -> Maybe DataRange
forall a. Function a => Action -> AMap -> Maybe a -> Maybe a
maybeDo Action
t AMap
s Maybe DataRange
mdr

instance Function Annotation where
    function :: Action -> AMap -> Annotation -> Annotation
function t :: Action
t s :: AMap
s (Annotation al :: [Annotation]
al ap :: IRI
ap av :: AnnotationValue
av) = [Annotation] -> IRI -> AnnotationValue -> Annotation
Annotation ((Annotation -> Annotation) -> [Annotation] -> [Annotation]
forall a b. (a -> b) -> [a] -> [b]
map (Action -> AMap -> Annotation -> Annotation
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s) [Annotation]
al)
        (EntityType -> Action -> AMap -> IRI -> IRI
cutWith EntityType
AnnotationProperty Action
t AMap
s IRI
ap) (AnnotationValue -> Annotation) -> AnnotationValue -> Annotation
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> AnnotationValue -> AnnotationValue
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s AnnotationValue
av

instance Function AnnotationValue where
    function :: Action -> AMap -> AnnotationValue -> AnnotationValue
function t :: Action
t s :: AMap
s av :: AnnotationValue
av = case AnnotationValue
av of
        AnnValue anIri :: IRI
anIri -> IRI -> AnnotationValue
AnnValue (IRI -> AnnotationValue) -> IRI -> AnnotationValue
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s IRI
anIri
        AnnValLit l :: Literal
l -> Literal -> AnnotationValue
AnnValLit (Literal -> AnnotationValue) -> Literal -> AnnotationValue
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> Literal -> Literal
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s Literal
l
        AnnAnInd i :: IRI
i -> IRI -> AnnotationValue
AnnAnInd (IRI -> AnnotationValue) -> IRI -> AnnotationValue
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s IRI
i

instance Function AnnotationSubject where
    function :: Action -> AMap -> AnnotationSubject -> AnnotationSubject
function t :: Action
t s :: AMap
s av :: AnnotationSubject
av = case AnnotationSubject
av of
        AnnSubIri i :: IRI
i -> IRI -> AnnotationSubject
AnnSubIri (IRI -> AnnotationSubject) -> IRI -> AnnotationSubject
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s IRI
i
        AnnSubAnInd i :: IRI
i -> IRI -> AnnotationSubject
AnnSubAnInd (IRI -> AnnotationSubject) -> IRI -> AnnotationSubject
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
s IRI
i


instance Function AnnotationAxiom where
    function :: Action -> AMap -> AnnotationAxiom -> AnnotationAxiom
function t :: Action
t mp :: AMap
mp (AnnotationAssertion anno :: [Annotation]
anno p :: IRI
p s :: AnnotationSubject
s v :: AnnotationValue
v) = [Annotation]
-> IRI -> AnnotationSubject -> AnnotationValue -> AnnotationAxiom
AnnotationAssertion
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anno)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
p)
        (Action -> AMap -> AnnotationSubject -> AnnotationSubject
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp AnnotationSubject
s)
        (Action -> AMap -> AnnotationValue -> AnnotationValue
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp AnnotationValue
v)
    function t :: Action
t mp :: AMap
mp (SubAnnotationPropertyOf anno :: [Annotation]
anno subP :: IRI
subP supP :: IRI
supP) = [Annotation] -> IRI -> IRI -> AnnotationAxiom
SubAnnotationPropertyOf
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anno)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
subP)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
supP)
    function t :: Action
t mp :: AMap
mp (AnnotationPropertyDomain anno :: [Annotation]
anno p :: IRI
p i :: IRI
i) = [Annotation] -> IRI -> IRI -> AnnotationAxiom
AnnotationPropertyDomain
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anno)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
p)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
i)
    function t :: Action
t mp :: AMap
mp (AnnotationPropertyRange anno :: [Annotation]
anno p :: IRI
p i :: IRI
i) = [Annotation] -> IRI -> IRI -> AnnotationAxiom
AnnotationPropertyRange
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anno)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
p)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
i)

instance Function Axiom where
    function :: Action -> AMap -> Axiom -> Axiom
function t :: Action
t mp :: AMap
mp (Declaration anns :: [Annotation]
anns e :: Entity
e) = [Annotation] -> Entity -> Axiom
Declaration (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
        (Action -> AMap -> Entity -> Entity
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp Entity
e)
    function t :: Action
t mp :: AMap
mp (ClassAxiom c :: ClassAxiom
c) = ClassAxiom -> Axiom
ClassAxiom (Action -> AMap -> ClassAxiom -> ClassAxiom
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ClassAxiom
c)
    function t :: Action
t mp :: AMap
mp (ObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx) =
        ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom (Action -> AMap -> ObjectPropertyAxiom -> ObjectPropertyAxiom
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyAxiom
opAx)
    function t :: Action
t mp :: AMap
mp (DataPropertyAxiom d :: DataPropertyAxiom
d) =
        DataPropertyAxiom -> Axiom
DataPropertyAxiom (Action -> AMap -> DataPropertyAxiom -> DataPropertyAxiom
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp DataPropertyAxiom
d)
    function t :: Action
t mp :: AMap
mp  (DatatypeDefinition anns :: [Annotation]
anns dt :: IRI
dt dr :: DataRange
dr) =
        [Annotation] -> IRI -> DataRange -> Axiom
DatatypeDefinition (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns) (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
dt)
            (Action -> AMap -> DataRange -> DataRange
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp DataRange
dr)
    function t :: Action
t mp :: AMap
mp (HasKey anns :: [Annotation]
anns c :: ClassExpression
c o :: [ObjectPropertyExpression]
o d :: [IRI]
d) = [Annotation]
-> ClassExpression -> [ObjectPropertyExpression] -> [IRI] -> Axiom
HasKey
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
        (Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ClassExpression
c)
        (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp (ObjectPropertyExpression -> ObjectPropertyExpression)
-> [ObjectPropertyExpression] -> [ObjectPropertyExpression]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ObjectPropertyExpression]
o)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp (IRI -> IRI) -> [IRI] -> [IRI]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [IRI]
d)

    function t :: Action
t mp :: AMap
mp (Assertion assertion :: Assertion
assertion) = Assertion -> Axiom
Assertion (Action -> AMap -> Assertion -> Assertion
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp Assertion
assertion)   
    function t :: Action
t mp :: AMap
mp (AnnotationAxiom a :: AnnotationAxiom
a) = AnnotationAxiom -> Axiom
AnnotationAxiom (Action -> AMap -> AnnotationAxiom -> AnnotationAxiom
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp AnnotationAxiom
a)
    function t :: Action
t mp :: AMap
mp (Rule r :: Rule
r) = Rule -> Axiom
Rule (Action -> AMap -> Rule -> Rule
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp Rule
r)
    function t :: Action
t mp :: AMap
mp (DGAxiom anns :: [Annotation]
anns dgName :: IRI
dgName dgNodes :: DGNodes
dgNodes dgEdges :: DGEdges
dgEdges mainClasses :: [IRI]
mainClasses) =
        [Annotation] -> IRI -> DGNodes -> DGEdges -> [IRI] -> Axiom
DGAxiom (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns) (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
dgName)
            (Action -> AMap -> DGNodes -> DGNodes
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp DGNodes
dgNodes) (Action -> AMap -> DGEdges -> DGEdges
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp DGEdges
dgEdges)
            (Action -> AMap -> [IRI] -> [IRI]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [IRI]
mainClasses)

instance Function ClassAxiom where
    function :: Action -> AMap -> ClassAxiom -> ClassAxiom
function t :: Action
t mp :: AMap
mp (SubClassOf anns :: [Annotation]
anns subClExpr :: ClassExpression
subClExpr supClExpr :: ClassExpression
supClExpr) =
        [Annotation] -> ClassExpression -> ClassExpression -> ClassAxiom
SubClassOf (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns) (Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ClassExpression
subClExpr)
            (Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ClassExpression
supClExpr)

    function t :: Action
t mp :: AMap
mp (EquivalentClasses anns :: [Annotation]
anns clExprs :: [ClassExpression]
clExprs) =
        [Annotation] -> [ClassExpression] -> ClassAxiom
EquivalentClasses (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp (ClassExpression -> ClassExpression)
-> [ClassExpression] -> [ClassExpression]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ClassExpression]
clExprs)
    
    function t :: Action
t mp :: AMap
mp (DisjointClasses anns :: [Annotation]
anns clExprs :: [ClassExpression]
clExprs) =
        [Annotation] -> [ClassExpression] -> ClassAxiom
DisjointClasses (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp (ClassExpression -> ClassExpression)
-> [ClassExpression] -> [ClassExpression]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ClassExpression]
clExprs)

    function t :: Action
t mp :: AMap
mp (DisjointUnion anns :: [Annotation]
anns clIri :: IRI
clIri clExprs :: [ClassExpression]
clExprs) = 
        [Annotation] -> IRI -> [ClassExpression] -> ClassAxiom
DisjointUnion (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns) (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
clIri)
            (Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp (ClassExpression -> ClassExpression)
-> [ClassExpression] -> [ClassExpression]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ClassExpression]
clExprs)


instance Function SubObjectPropertyExpression where
    function :: Action
-> AMap
-> SubObjectPropertyExpression
-> SubObjectPropertyExpression
function t :: Action
t mp :: AMap
mp (SubObjPropExpr_obj e :: ObjectPropertyExpression
e) = ObjectPropertyExpression -> SubObjectPropertyExpression
SubObjPropExpr_obj
        (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
e)
    function t :: Action
t mp :: AMap
mp (SubObjPropExpr_exprchain e :: [ObjectPropertyExpression]
e) = [ObjectPropertyExpression] -> SubObjectPropertyExpression
SubObjPropExpr_exprchain
        (Action
-> AMap -> [ObjectPropertyExpression] -> [ObjectPropertyExpression]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [ObjectPropertyExpression]
e)

instance Function ObjectPropertyAxiom where
    function :: Action -> AMap -> ObjectPropertyAxiom -> ObjectPropertyAxiom
function t :: Action
t mp :: AMap
mp (SubObjectPropertyOf anns :: [Annotation]
anns subExpr :: SubObjectPropertyExpression
subExpr supExpr :: ObjectPropertyExpression
supExpr) = 
        [Annotation]
-> SubObjectPropertyExpression
-> ObjectPropertyExpression
-> ObjectPropertyAxiom
SubObjectPropertyOf (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action
-> AMap
-> SubObjectPropertyExpression
-> SubObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp SubObjectPropertyExpression
subExpr)
            (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
supExpr)
            
    function t :: Action
t mp :: AMap
mp (EquivalentObjectProperties anns :: [Annotation]
anns exprs :: [ObjectPropertyExpression]
exprs) = 
        [Annotation] -> [ObjectPropertyExpression] -> ObjectPropertyAxiom
EquivalentObjectProperties (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp (ObjectPropertyExpression -> ObjectPropertyExpression)
-> [ObjectPropertyExpression] -> [ObjectPropertyExpression]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ObjectPropertyExpression]
exprs)

    function t :: Action
t mp :: AMap
mp (DisjointObjectProperties anns :: [Annotation]
anns exprs :: [ObjectPropertyExpression]
exprs) = 
        [Annotation] -> [ObjectPropertyExpression] -> ObjectPropertyAxiom
DisjointObjectProperties (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp (ObjectPropertyExpression -> ObjectPropertyExpression)
-> [ObjectPropertyExpression] -> [ObjectPropertyExpression]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ObjectPropertyExpression]
exprs)

    function t :: Action
t mp :: AMap
mp (InverseObjectProperties anns :: [Annotation]
anns expr1 :: ObjectPropertyExpression
expr1 expr2 :: ObjectPropertyExpression
expr2) = 
        [Annotation]
-> ObjectPropertyExpression
-> ObjectPropertyExpression
-> ObjectPropertyAxiom
InverseObjectProperties (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
expr1) (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
expr2)

    function t :: Action
t mp :: AMap
mp (ObjectPropertyDomain anns :: [Annotation]
anns opExpr :: ObjectPropertyExpression
opExpr clExpr :: ClassExpression
clExpr) = 
        [Annotation]
-> ObjectPropertyExpression
-> ClassExpression
-> ObjectPropertyAxiom
ObjectPropertyDomain (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
opExpr) (Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ClassExpression
clExpr)

    function t :: Action
t mp :: AMap
mp (ObjectPropertyRange anns :: [Annotation]
anns opExpr :: ObjectPropertyExpression
opExpr clExpr :: ClassExpression
clExpr) = 
        [Annotation]
-> ObjectPropertyExpression
-> ClassExpression
-> ObjectPropertyAxiom
ObjectPropertyRange (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
opExpr) (Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ClassExpression
clExpr)
            
    function t :: Action
t mp :: AMap
mp (FunctionalObjectProperty anns :: [Annotation]
anns opExpr :: ObjectPropertyExpression
opExpr) =
        [Annotation] -> ObjectPropertyExpression -> ObjectPropertyAxiom
FunctionalObjectProperty (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
opExpr)

    function t :: Action
t mp :: AMap
mp (InverseFunctionalObjectProperty anns :: [Annotation]
anns opExpr :: ObjectPropertyExpression
opExpr) = 
        [Annotation] -> ObjectPropertyExpression -> ObjectPropertyAxiom
InverseFunctionalObjectProperty (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
opExpr)
            
    function t :: Action
t mp :: AMap
mp (ReflexiveObjectProperty anns :: [Annotation]
anns opExpr :: ObjectPropertyExpression
opExpr) =
        [Annotation] -> ObjectPropertyExpression -> ObjectPropertyAxiom
ReflexiveObjectProperty (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
opExpr)
            
    function t :: Action
t mp :: AMap
mp (IrreflexiveObjectProperty anns :: [Annotation]
anns opExpr :: ObjectPropertyExpression
opExpr) =
        [Annotation] -> ObjectPropertyExpression -> ObjectPropertyAxiom
IrreflexiveObjectProperty (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
opExpr)

    function t :: Action
t mp :: AMap
mp (SymmetricObjectProperty anns :: [Annotation]
anns opExpr :: ObjectPropertyExpression
opExpr) =
        [Annotation] -> ObjectPropertyExpression -> ObjectPropertyAxiom
SymmetricObjectProperty (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
opExpr)

    function t :: Action
t mp :: AMap
mp (AsymmetricObjectProperty anns :: [Annotation]
anns opExpr :: ObjectPropertyExpression
opExpr) =
        [Annotation] -> ObjectPropertyExpression -> ObjectPropertyAxiom
AsymmetricObjectProperty (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
opExpr)

    function t :: Action
t mp :: AMap
mp (TransitiveObjectProperty anns :: [Annotation]
anns opExpr :: ObjectPropertyExpression
opExpr) =
        [Annotation] -> ObjectPropertyExpression -> ObjectPropertyAxiom
TransitiveObjectProperty (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
opExpr)

instance Function DataPropertyAxiom where
    function :: Action -> AMap -> DataPropertyAxiom -> DataPropertyAxiom
function t :: Action
t mp :: AMap
mp (SubDataPropertyOf anns :: [Annotation]
anns subD :: IRI
subD supD :: IRI
supD) =
        [Annotation] -> IRI -> IRI -> DataPropertyAxiom
SubDataPropertyOf (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
subD) (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
supD)
    
    function t :: Action
t mp :: AMap
mp (EquivalentDataProperties anns :: [Annotation]
anns dpExprs :: [IRI]
dpExprs) =
        [Annotation] -> [IRI] -> DataPropertyAxiom
EquivalentDataProperties (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp (IRI -> IRI) -> [IRI] -> [IRI]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [IRI]
dpExprs)
            
    function t :: Action
t mp :: AMap
mp (DisjointDataProperties anns :: [Annotation]
anns dpExprs :: [IRI]
dpExprs) =
        [Annotation] -> [IRI] -> DataPropertyAxiom
DisjointDataProperties (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action -> AMap -> [IRI] -> [IRI]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [IRI]
dpExprs)

    function t :: Action
t mp :: AMap
mp (DataPropertyDomain anns :: [Annotation]
anns dpExpr :: IRI
dpExpr clExpr :: ClassExpression
clExpr) =
        [Annotation] -> IRI -> ClassExpression -> DataPropertyAxiom
DataPropertyDomain (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
dpExpr) (Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ClassExpression
clExpr)
    
    function t :: Action
t mp :: AMap
mp (DataPropertyRange anns :: [Annotation]
anns dpExpr :: IRI
dpExpr dr :: DataRange
dr) =
        [Annotation] -> IRI -> DataRange -> DataPropertyAxiom
DataPropertyRange (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
dpExpr) (Action -> AMap -> DataRange -> DataRange
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp DataRange
dr)

    function t :: Action
t mp :: AMap
mp (FunctionalDataProperty anns :: [Annotation]
anns dpExpr :: IRI
dpExpr) = 
        [Annotation] -> IRI -> DataPropertyAxiom
FunctionalDataProperty (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
            (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
dpExpr)

instance Function Assertion where
    function :: Action -> AMap -> Assertion -> Assertion
function t :: Action
t mp :: AMap
mp (SameIndividual anns :: [Annotation]
anns is :: [IRI]
is) = [Annotation] -> [IRI] -> Assertion
SameIndividual
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp (IRI -> IRI) -> [IRI] -> [IRI]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [IRI]
is)
    function t :: Action
t mp :: AMap
mp (DifferentIndividuals anns :: [Annotation]
anns is :: [IRI]
is) = [Annotation] -> [IRI] -> Assertion
DifferentIndividuals
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp (IRI -> IRI) -> [IRI] -> [IRI]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [IRI]
is)
    function t :: Action
t mp :: AMap
mp (ClassAssertion anns :: [Annotation]
anns c :: ClassExpression
c i :: IRI
i) = [Annotation] -> ClassExpression -> IRI -> Assertion
ClassAssertion
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
        (Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ClassExpression
c)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
i)
    function t :: Action
t mp :: AMap
mp (ObjectPropertyAssertion anns :: [Annotation]
anns o :: ObjectPropertyExpression
o s :: IRI
s t_ :: IRI
t_) = [Annotation] -> ObjectPropertyExpression -> IRI -> IRI -> Assertion
ObjectPropertyAssertion
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
        (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
o)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
s)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
t_)
    function t :: Action
t mp :: AMap
mp (NegativeObjectPropertyAssertion anns :: [Annotation]
anns o :: ObjectPropertyExpression
o s :: IRI
s t_ :: IRI
t_) = [Annotation] -> ObjectPropertyExpression -> IRI -> IRI -> Assertion
NegativeObjectPropertyAssertion
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
        (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
o)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
s)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
t_)
    function t :: Action
t mp :: AMap
mp (DataPropertyAssertion anns :: [Annotation]
anns d :: IRI
d s :: IRI
s t_ :: Literal
t_) = [Annotation] -> IRI -> IRI -> Literal -> Assertion
DataPropertyAssertion
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
d)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
s)
        (Action -> AMap -> Literal -> Literal
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp Literal
t_)
    function t :: Action
t mp :: AMap
mp (NegativeDataPropertyAssertion anns :: [Annotation]
anns d :: IRI
d s :: IRI
s t_ :: Literal
t_) = [Annotation] -> IRI -> IRI -> Literal -> Assertion
NegativeDataPropertyAssertion
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
d)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
s)
        (Action -> AMap -> Literal -> Literal
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp Literal
t_)


instance (Function a) => Function [a] where
    function :: Action -> AMap -> [a] -> [a]
function t :: Action
t mp :: AMap
mp l :: [a]
l = Action -> AMap -> a -> a
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp (a -> a) -> [a] -> [a]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [a]
l

instance (Function a) => Function (Maybe a) where
    function :: Action -> AMap -> Maybe a -> Maybe a
function _ _ Nothing = Maybe a
forall a. Maybe a
Nothing
    function t :: Action
t mp :: AMap
mp (Just l :: a
l) = a -> Maybe a
forall a. a -> Maybe a
Just (Action -> AMap -> a -> a
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp a
l)

instance Function Rule where
    function :: Action -> AMap -> Rule -> Rule
function t :: Action
t mp :: AMap
mp (DLSafeRule anns :: [Annotation]
anns b :: Body
b h :: Body
h) = [Annotation] -> Body -> Body -> Rule
DLSafeRule
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
        (Action -> AMap -> Body -> Body
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp Body
b)
        (Action -> AMap -> Body -> Body
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp Body
h)
    function t :: Action
t mp :: AMap
mp (DGRule anns :: [Annotation]
anns b :: DGBody
b h :: DGBody
h) = [Annotation] -> DGBody -> DGBody -> Rule
DGRule
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
        (Action -> AMap -> DGBody -> DGBody
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp DGBody
b)
        (Action -> AMap -> DGBody -> DGBody
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp DGBody
h)

instance Function DataArg where
    function :: Action -> AMap -> DataArg -> DataArg
function t :: Action
t mp :: AMap
mp (DArg l :: Literal
l) = Literal -> DataArg
DArg (Action -> AMap -> Literal -> Literal
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp Literal
l)
    function t :: Action
t mp :: AMap
mp (DVar v :: IRI
v) = IRI -> DataArg
DVar (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
v)

instance Function IndividualArg where
    function :: Action -> AMap -> IndividualArg -> IndividualArg
function t :: Action
t mp :: AMap
mp (IArg i :: IRI
i) = IRI -> IndividualArg
IArg (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
i)
    function t :: Action
t mp :: AMap
mp (IVar v :: IRI
v) = IRI -> IndividualArg
IVar (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
v)

instance Function UnknownArg   where
    function :: Action -> AMap -> UnknownArg -> UnknownArg
function t :: Action
t mp :: AMap
mp (IndividualArg i :: IndividualArg
i) = IndividualArg -> UnknownArg
IndividualArg (Action -> AMap -> IndividualArg -> IndividualArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IndividualArg
i)
    function t :: Action
t mp :: AMap
mp (DataArg d :: DataArg
d) = DataArg -> UnknownArg
DataArg (Action -> AMap -> DataArg -> DataArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp DataArg
d)
    function t :: Action
t mp :: AMap
mp (Variable v :: IRI
v) = IRI -> UnknownArg
Variable (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
v)
    
instance Function Atom where
    function :: Action -> AMap -> Atom -> Atom
function t :: Action
t mp :: AMap
mp (ClassAtom c :: ClassExpression
c arg :: IndividualArg
arg) = ClassExpression -> IndividualArg -> Atom
ClassAtom
        (Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ClassExpression
c)
        (Action -> AMap -> IndividualArg -> IndividualArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IndividualArg
arg)
    function t :: Action
t mp :: AMap
mp (DataRangeAtom d :: DataRange
d arg :: DataArg
arg) = DataRange -> DataArg -> Atom
DataRangeAtom
        (Action -> AMap -> DataRange -> DataRange
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp DataRange
d)
        (Action -> AMap -> DataArg -> DataArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp DataArg
arg)
    function t :: Action
t mp :: AMap
mp (ObjectPropertyAtom oexpr :: ObjectPropertyExpression
oexpr arg1 :: IndividualArg
arg1 arg2 :: IndividualArg
arg2) = ObjectPropertyExpression -> IndividualArg -> IndividualArg -> Atom
ObjectPropertyAtom
        (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
oexpr)
        (Action -> AMap -> IndividualArg -> IndividualArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IndividualArg
arg1)
        (Action -> AMap -> IndividualArg -> IndividualArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IndividualArg
arg2)
    function t :: Action
t mp :: AMap
mp (DataPropertyAtom d :: IRI
d arg1 :: IndividualArg
arg1 arg2 :: DataArg
arg2) = IRI -> IndividualArg -> DataArg -> Atom
DataPropertyAtom
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
d)
        (Action -> AMap -> IndividualArg -> IndividualArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IndividualArg
arg1)
        (Action -> AMap -> DataArg -> DataArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp DataArg
arg2)
    function t :: Action
t mp :: AMap
mp (BuiltInAtom i :: IRI
i args :: [DataArg]
args) = IRI -> [DataArg] -> Atom
BuiltInAtom
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
i)
        (Action -> AMap -> DataArg -> DataArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp (DataArg -> DataArg) -> [DataArg] -> [DataArg]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [DataArg]
args)
    function t :: Action
t mp :: AMap
mp (SameIndividualAtom arg1 :: IndividualArg
arg1 arg2 :: IndividualArg
arg2) = IndividualArg -> IndividualArg -> Atom
SameIndividualAtom
        (Action -> AMap -> IndividualArg -> IndividualArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IndividualArg
arg1)
        (Action -> AMap -> IndividualArg -> IndividualArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IndividualArg
arg2)
    function t :: Action
t mp :: AMap
mp (DifferentIndividualsAtom arg1 :: IndividualArg
arg1 arg2 :: IndividualArg
arg2) = IndividualArg -> IndividualArg -> Atom
DifferentIndividualsAtom
        (Action -> AMap -> IndividualArg -> IndividualArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IndividualArg
arg1)
        (Action -> AMap -> IndividualArg -> IndividualArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IndividualArg
arg2)
    function t :: Action
t mp :: AMap
mp (UnknownUnaryAtom i :: IRI
i arg :: UnknownArg
arg) = IRI -> UnknownArg -> Atom
UnknownUnaryAtom
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
i)
        (Action -> AMap -> UnknownArg -> UnknownArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp UnknownArg
arg)
    function t :: Action
t mp :: AMap
mp (UnknownBinaryAtom i :: IRI
i arg1 :: UnknownArg
arg1 arg2 :: UnknownArg
arg2) = IRI -> UnknownArg -> UnknownArg -> Atom
UnknownBinaryAtom
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
i)
        (Action -> AMap -> UnknownArg -> UnknownArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp UnknownArg
arg1)
        (Action -> AMap -> UnknownArg -> UnknownArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp UnknownArg
arg2)
    

instance Function DGAtom where
    function :: Action -> AMap -> DGAtom -> DGAtom
function t :: Action
t mp :: AMap
mp (DGClassAtom c :: ClassExpression
c arg :: IndividualArg
arg) = ClassExpression -> IndividualArg -> DGAtom
DGClassAtom
        (Action -> AMap -> ClassExpression -> ClassExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ClassExpression
c)
        (Action -> AMap -> IndividualArg -> IndividualArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IndividualArg
arg)
    function t :: Action
t mp :: AMap
mp (DGObjectPropertyAtom e :: ObjectPropertyExpression
e a1 :: IndividualArg
a1 a2 :: IndividualArg
a2) = ObjectPropertyExpression
-> IndividualArg -> IndividualArg -> DGAtom
DGObjectPropertyAtom
        (Action
-> AMap -> ObjectPropertyExpression -> ObjectPropertyExpression
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp ObjectPropertyExpression
e)
        (Action -> AMap -> IndividualArg -> IndividualArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IndividualArg
a1)
        (Action -> AMap -> IndividualArg -> IndividualArg
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IndividualArg
a2)

instance Function DGEdgeAssertion where
    function :: Action -> AMap -> DGEdgeAssertion -> DGEdgeAssertion
function t :: Action
t mp :: AMap
mp (DGEdgeAssertion o :: IRI
o v1 :: IRI
v1 v2 :: IRI
v2) = IRI -> IRI -> IRI -> DGEdgeAssertion
DGEdgeAssertion
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
o)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
v1)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
v2)

instance Function DGNodeAssertion where
    function :: Action -> AMap -> DGNodeAssertion -> DGNodeAssertion
function t :: Action
t mp :: AMap
mp (DGNodeAssertion c :: IRI
c node :: IRI
node) = IRI -> IRI -> DGNodeAssertion
DGNodeAssertion
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
c)
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
node)


instance Function Ontology where
    function :: Action -> AMap -> Ontology -> Ontology
function t :: Action
t mp :: AMap
mp (Ontology n :: Maybe IRI
n version :: Maybe IRI
version imp :: [IRI]
imp anns :: [Annotation]
anns ax :: [Axiom]
ax) = Maybe IRI
-> Maybe IRI -> [IRI] -> [Annotation] -> [Axiom] -> Ontology
Ontology
        (Action -> AMap -> Maybe IRI -> Maybe IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp Maybe IRI
n)
        (Action -> AMap -> Maybe IRI -> Maybe IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp Maybe IRI
version)
        (Action -> AMap -> [IRI] -> [IRI]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [IRI]
imp)
        (Action -> AMap -> [Annotation] -> [Annotation]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Annotation]
anns)
        (Action -> AMap -> [Axiom] -> [Axiom]
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp [Axiom]
ax)

instance Function PrefixDeclaration where
    function :: Action -> AMap -> PrefixDeclaration -> PrefixDeclaration
function t :: Action
t mp :: AMap
mp (PrefixDeclaration n :: String
n i :: IRI
i) = String -> IRI -> PrefixDeclaration
PrefixDeclaration
        String
n
        (Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
i)

instance Function OntologyDocument where
  function :: Action -> AMap -> OntologyDocument -> OntologyDocument
function t :: Action
t mp :: AMap
mp (OntologyDocument m :: OntologyMetadata
m pm :: PrefixMap
pm onto :: Ontology
onto) =
      OntologyMetadata -> PrefixMap -> Ontology -> OntologyDocument
OntologyDocument OntologyMetadata
m (Action -> AMap -> PrefixMap -> PrefixMap
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp PrefixMap
pm) (Action -> AMap -> Ontology -> Ontology
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp Ontology
onto)

instance Function RawSymb where
  function :: Action -> AMap -> RawSymb -> RawSymb
function t :: Action
t mp :: AMap
mp rs :: RawSymb
rs = case RawSymb
rs of
     ASymbol e :: Entity
e -> Entity -> RawSymb
ASymbol (Entity -> RawSymb) -> Entity -> RawSymb
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> Entity -> Entity
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp Entity
e
     AnUri i :: IRI
i -> IRI -> RawSymb
AnUri (IRI -> RawSymb) -> IRI -> RawSymb
forall a b. (a -> b) -> a -> b
$ Action -> AMap -> IRI -> IRI
forall a. Function a => Action -> AMap -> a -> a
function Action
t AMap
mp IRI
i
     p :: RawSymb
p -> RawSymb
p