module OWL2.PrintMS where

import qualified Data.Map as M
import qualified Data.Set as S

import Common.Doc
import Common.DocUtils
import Common.Keywords
import Common.IRI
import Common.GlobalAnnotations as GA (PrefixMap)

import OWL2.AS
import OWL2.Keywords
import OWL2.ColonKeywords

----- auxiliary MS data structures and transformations functions to MS -----
type Annotations = [Annotation]

data FrameIdValue = 
      IriId IRI
    | ObjInvOfId IRI
    | ComplexClassExpr ClassExpression
    | MiscId
    | RuleId
    deriving(Int -> FrameIdValue -> ShowS
[FrameIdValue] -> ShowS
FrameIdValue -> String
(Int -> FrameIdValue -> ShowS)
-> (FrameIdValue -> String)
-> ([FrameIdValue] -> ShowS)
-> Show FrameIdValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FrameIdValue] -> ShowS
$cshowList :: [FrameIdValue] -> ShowS
show :: FrameIdValue -> String
$cshow :: FrameIdValue -> String
showsPrec :: Int -> FrameIdValue -> ShowS
$cshowsPrec :: Int -> FrameIdValue -> ShowS
Show, FrameIdValue -> FrameIdValue -> Bool
(FrameIdValue -> FrameIdValue -> Bool)
-> (FrameIdValue -> FrameIdValue -> Bool) -> Eq FrameIdValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FrameIdValue -> FrameIdValue -> Bool
$c/= :: FrameIdValue -> FrameIdValue -> Bool
== :: FrameIdValue -> FrameIdValue -> Bool
$c== :: FrameIdValue -> FrameIdValue -> Bool
Eq, Eq FrameIdValue
Eq FrameIdValue =>
(FrameIdValue -> FrameIdValue -> Ordering)
-> (FrameIdValue -> FrameIdValue -> Bool)
-> (FrameIdValue -> FrameIdValue -> Bool)
-> (FrameIdValue -> FrameIdValue -> Bool)
-> (FrameIdValue -> FrameIdValue -> Bool)
-> (FrameIdValue -> FrameIdValue -> FrameIdValue)
-> (FrameIdValue -> FrameIdValue -> FrameIdValue)
-> Ord FrameIdValue
FrameIdValue -> FrameIdValue -> Bool
FrameIdValue -> FrameIdValue -> Ordering
FrameIdValue -> FrameIdValue -> FrameIdValue
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 :: FrameIdValue -> FrameIdValue -> FrameIdValue
$cmin :: FrameIdValue -> FrameIdValue -> FrameIdValue
max :: FrameIdValue -> FrameIdValue -> FrameIdValue
$cmax :: FrameIdValue -> FrameIdValue -> FrameIdValue
>= :: FrameIdValue -> FrameIdValue -> Bool
$c>= :: FrameIdValue -> FrameIdValue -> Bool
> :: FrameIdValue -> FrameIdValue -> Bool
$c> :: FrameIdValue -> FrameIdValue -> Bool
<= :: FrameIdValue -> FrameIdValue -> Bool
$c<= :: FrameIdValue -> FrameIdValue -> Bool
< :: FrameIdValue -> FrameIdValue -> Bool
$c< :: FrameIdValue -> FrameIdValue -> Bool
compare :: FrameIdValue -> FrameIdValue -> Ordering
$ccompare :: FrameIdValue -> FrameIdValue -> Ordering
$cp1Ord :: Eq FrameIdValue
Ord)

data FrameType =
      DatatypeFrame
    | ClassFrame
    | ObjectPropertyFrame
    | DataPropertyFrame
    | AnnotationPropertyFrame
    | IndividualFrame
    | MiscFrame
    | RuleFrame
    deriving(Int -> FrameType -> ShowS
[FrameType] -> ShowS
FrameType -> String
(Int -> FrameType -> ShowS)
-> (FrameType -> String)
-> ([FrameType] -> ShowS)
-> Show FrameType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FrameType] -> ShowS
$cshowList :: [FrameType] -> ShowS
show :: FrameType -> String
$cshow :: FrameType -> String
showsPrec :: Int -> FrameType -> ShowS
$cshowsPrec :: Int -> FrameType -> ShowS
Show, FrameType -> FrameType -> Bool
(FrameType -> FrameType -> Bool)
-> (FrameType -> FrameType -> Bool) -> Eq FrameType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FrameType -> FrameType -> Bool
$c/= :: FrameType -> FrameType -> Bool
== :: FrameType -> FrameType -> Bool
$c== :: FrameType -> FrameType -> Bool
Eq, Eq FrameType
Eq FrameType =>
(FrameType -> FrameType -> Ordering)
-> (FrameType -> FrameType -> Bool)
-> (FrameType -> FrameType -> Bool)
-> (FrameType -> FrameType -> Bool)
-> (FrameType -> FrameType -> Bool)
-> (FrameType -> FrameType -> FrameType)
-> (FrameType -> FrameType -> FrameType)
-> Ord FrameType
FrameType -> FrameType -> Bool
FrameType -> FrameType -> Ordering
FrameType -> FrameType -> FrameType
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 :: FrameType -> FrameType -> FrameType
$cmin :: FrameType -> FrameType -> FrameType
max :: FrameType -> FrameType -> FrameType
$cmax :: FrameType -> FrameType -> FrameType
>= :: FrameType -> FrameType -> Bool
$c>= :: FrameType -> FrameType -> Bool
> :: FrameType -> FrameType -> Bool
$c> :: FrameType -> FrameType -> Bool
<= :: FrameType -> FrameType -> Bool
$c<= :: FrameType -> FrameType -> Bool
< :: FrameType -> FrameType -> Bool
$c< :: FrameType -> FrameType -> Bool
compare :: FrameType -> FrameType -> Ordering
$ccompare :: FrameType -> FrameType -> Ordering
$cp1Ord :: Eq FrameType
Ord, Int -> FrameType
FrameType -> Int
FrameType -> [FrameType]
FrameType -> FrameType
FrameType -> FrameType -> [FrameType]
FrameType -> FrameType -> FrameType -> [FrameType]
(FrameType -> FrameType)
-> (FrameType -> FrameType)
-> (Int -> FrameType)
-> (FrameType -> Int)
-> (FrameType -> [FrameType])
-> (FrameType -> FrameType -> [FrameType])
-> (FrameType -> FrameType -> [FrameType])
-> (FrameType -> FrameType -> FrameType -> [FrameType])
-> Enum FrameType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: FrameType -> FrameType -> FrameType -> [FrameType]
$cenumFromThenTo :: FrameType -> FrameType -> FrameType -> [FrameType]
enumFromTo :: FrameType -> FrameType -> [FrameType]
$cenumFromTo :: FrameType -> FrameType -> [FrameType]
enumFromThen :: FrameType -> FrameType -> [FrameType]
$cenumFromThen :: FrameType -> FrameType -> [FrameType]
enumFrom :: FrameType -> [FrameType]
$cenumFrom :: FrameType -> [FrameType]
fromEnum :: FrameType -> Int
$cfromEnum :: FrameType -> Int
toEnum :: Int -> FrameType
$ctoEnum :: Int -> FrameType
pred :: FrameType -> FrameType
$cpred :: FrameType -> FrameType
succ :: FrameType -> FrameType
$csucc :: FrameType -> FrameType
Enum, FrameType
FrameType -> FrameType -> Bounded FrameType
forall a. a -> a -> Bounded a
maxBound :: FrameType
$cmaxBound :: FrameType
minBound :: FrameType
$cminBound :: FrameType
Bounded)

data FrameSectionType =
      AnnotationsSection
    | EquivalentToSection
    | SubClassOfSection
    | DisjointWithSection
    | DisjointUnionOfSection
    | HasKeySection
    | DomainSection
    | RangeSection
    | CharacteristicsSection
    | SubPropertyOfSection
    | InverseOfSection
    | SubPropertyChainSection
    | TypesSection
    | FactsSection
    | SameAsSection
    | DifferentFromSection
    | EquivalentClassesSection
    | DisjointClassesSection
    | EquivalentDataPropertiesSection
    | EquivalentObjectPropertiesSection
    | DisjointDataPropertiesSection
    | DisjointObjectPropertiesSection
    | SameIndividualSection
    | DifferentIndividualsSection
    | RuleSection
    | DeclarationSection
    deriving(Int -> FrameSectionType -> ShowS
[FrameSectionType] -> ShowS
FrameSectionType -> String
(Int -> FrameSectionType -> ShowS)
-> (FrameSectionType -> String)
-> ([FrameSectionType] -> ShowS)
-> Show FrameSectionType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FrameSectionType] -> ShowS
$cshowList :: [FrameSectionType] -> ShowS
show :: FrameSectionType -> String
$cshow :: FrameSectionType -> String
showsPrec :: Int -> FrameSectionType -> ShowS
$cshowsPrec :: Int -> FrameSectionType -> ShowS
Show, FrameSectionType -> FrameSectionType -> Bool
(FrameSectionType -> FrameSectionType -> Bool)
-> (FrameSectionType -> FrameSectionType -> Bool)
-> Eq FrameSectionType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FrameSectionType -> FrameSectionType -> Bool
$c/= :: FrameSectionType -> FrameSectionType -> Bool
== :: FrameSectionType -> FrameSectionType -> Bool
$c== :: FrameSectionType -> FrameSectionType -> Bool
Eq, Eq FrameSectionType
Eq FrameSectionType =>
(FrameSectionType -> FrameSectionType -> Ordering)
-> (FrameSectionType -> FrameSectionType -> Bool)
-> (FrameSectionType -> FrameSectionType -> Bool)
-> (FrameSectionType -> FrameSectionType -> Bool)
-> (FrameSectionType -> FrameSectionType -> Bool)
-> (FrameSectionType -> FrameSectionType -> FrameSectionType)
-> (FrameSectionType -> FrameSectionType -> FrameSectionType)
-> Ord FrameSectionType
FrameSectionType -> FrameSectionType -> Bool
FrameSectionType -> FrameSectionType -> Ordering
FrameSectionType -> FrameSectionType -> FrameSectionType
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 :: FrameSectionType -> FrameSectionType -> FrameSectionType
$cmin :: FrameSectionType -> FrameSectionType -> FrameSectionType
max :: FrameSectionType -> FrameSectionType -> FrameSectionType
$cmax :: FrameSectionType -> FrameSectionType -> FrameSectionType
>= :: FrameSectionType -> FrameSectionType -> Bool
$c>= :: FrameSectionType -> FrameSectionType -> Bool
> :: FrameSectionType -> FrameSectionType -> Bool
$c> :: FrameSectionType -> FrameSectionType -> Bool
<= :: FrameSectionType -> FrameSectionType -> Bool
$c<= :: FrameSectionType -> FrameSectionType -> Bool
< :: FrameSectionType -> FrameSectionType -> Bool
$c< :: FrameSectionType -> FrameSectionType -> Bool
compare :: FrameSectionType -> FrameSectionType -> Ordering
$ccompare :: FrameSectionType -> FrameSectionType -> Ordering
$cp1Ord :: Eq FrameSectionType
Ord)

type FrameId = (FrameType, FrameIdValue)
type Frame = M.Map FrameSectionType [Axiom]
type MnchstrSntx = M.Map FrameId Frame

-- | function to extract IRI from ObjectInverseOf
obPropExprToIRI :: ObjectPropertyExpression -> IRI
obPropExprToIRI :: ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectProp iri :: IRI
iri) = IRI
iri
obPropExprToIRI (ObjectInverseOf obExpr :: ObjectPropertyExpression
obExpr) = ObjectPropertyExpression -> IRI
obPropExprToIRI ObjectPropertyExpression
obExpr 

obPropExprToIdVal :: ObjectPropertyExpression -> FrameIdValue
obPropExprToIdVal :: ObjectPropertyExpression -> FrameIdValue
obPropExprToIdVal (ObjectProp iri :: IRI
iri) = IRI -> FrameIdValue
IriId IRI
iri
obPropExprToIdVal (ObjectInverseOf o :: ObjectPropertyExpression
o) = IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
o

emptyMS :: MnchstrSntx
emptyMS :: MnchstrSntx
emptyMS = MnchstrSntx
forall k a. Map k a
M.empty

tabs :: Int -> Doc
tabs :: Int -> Doc
tabs n :: Int
n
    | Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< 1 = Doc
empty
    | Bool
otherwise = String -> Doc
text ['\t' | Int
_ <- [1..Int
n]]

-- transfromation functions, static analysis
-- From AS to intermediate MS
-- | transform Axioms
tAxioms :: [Axiom] -> MnchstrSntx -> MnchstrSntx
tAxioms :: [Axiom] -> MnchstrSntx -> MnchstrSntx
tAxioms = (MnchstrSntx -> [Axiom] -> MnchstrSntx)
-> [Axiom] -> MnchstrSntx -> MnchstrSntx
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((MnchstrSntx -> [Axiom] -> MnchstrSntx)
 -> [Axiom] -> MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> [Axiom] -> MnchstrSntx)
-> [Axiom]
-> MnchstrSntx
-> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ (MnchstrSntx -> Axiom -> MnchstrSntx)
-> MnchstrSntx -> [Axiom] -> MnchstrSntx
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl (\m :: MnchstrSntx
m a :: Axiom
a -> Axiom -> MnchstrSntx -> MnchstrSntx
tAxiom Axiom
a MnchstrSntx
m) 

-- | transform Axiom
tAxiom :: Axiom -> MnchstrSntx -> MnchstrSntx
tAxiom :: Axiom -> MnchstrSntx -> MnchstrSntx
tAxiom axiom :: Axiom
axiom ms :: MnchstrSntx
ms = case Axiom
axiom of
    Declaration {} -> Axiom -> MnchstrSntx -> MnchstrSntx
tDeclaration Axiom
axiom MnchstrSntx
ms
    ClassAxiom ca :: ClassAxiom
ca -> ClassAxiom -> MnchstrSntx -> MnchstrSntx
tClassAxiom ClassAxiom
ca MnchstrSntx
ms
    ObjectPropertyAxiom opa :: ObjectPropertyAxiom
opa -> ObjectPropertyAxiom -> MnchstrSntx -> MnchstrSntx
tObjectPropertyAxiom ObjectPropertyAxiom
opa MnchstrSntx
ms
    DataPropertyAxiom dpa :: DataPropertyAxiom
dpa -> DataPropertyAxiom -> MnchstrSntx -> MnchstrSntx
tDataPropertyAxiom DataPropertyAxiom
dpa MnchstrSntx
ms
    DatatypeDefinition {} -> Axiom -> MnchstrSntx -> MnchstrSntx
tDatatypeDefinition Axiom
axiom MnchstrSntx
ms
    Assertion a :: Assertion
a -> Assertion -> MnchstrSntx -> MnchstrSntx
tAssertion Assertion
a MnchstrSntx
ms
    AnnotationAxiom a :: AnnotationAxiom
a -> AnnotationAxiom -> MnchstrSntx -> MnchstrSntx
tAnnotationAxiom AnnotationAxiom
a MnchstrSntx
ms
    HasKey {} -> Axiom -> MnchstrSntx -> MnchstrSntx
tHasKey Axiom
axiom MnchstrSntx
ms
    Rule ruel :: Rule
ruel-> Rule -> MnchstrSntx -> MnchstrSntx
tRule Rule
ruel MnchstrSntx
ms
    DGAxiom _ _ _ _ _ -> MnchstrSntx
ms

-- | transform Declaration
tDeclaration :: Axiom -> MnchstrSntx -> MnchstrSntx
tDeclaration :: Axiom -> MnchstrSntx -> MnchstrSntx
tDeclaration (Declaration anns :: AxiomAnnotations
anns entity :: Entity
entity) =
    Entity -> AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAddDecAnnAssertions Entity
entity AxiomAnnotations
anns
    (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Entity -> MnchstrSntx -> MnchstrSntx
tEntity Entity
entity

tDeclaration _ = MnchstrSntx -> MnchstrSntx
forall a. a -> a
id

tAddDecAnnAssertions :: Entity -> Annotations -> MnchstrSntx -> MnchstrSntx
tAddDecAnnAssertions :: Entity -> AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAddDecAnnAssertions entity :: Entity
entity anns :: AxiomAnnotations
anns ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DeclarationSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m1) MnchstrSntx
ms
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
frameType, IRI -> FrameIdValue
IriId IRI
frameIRI)

        frameIRI :: IRI
frameIRI = Entity -> IRI
cutIRI Entity
entity
        frameType :: FrameType
frameType = case Entity -> EntityType
entityKind Entity
entity of
            Class -> FrameType
ClassFrame
            Datatype -> FrameType
DatatypeFrame
            ObjectProperty -> FrameType
ObjectPropertyFrame
            DataProperty -> FrameType
DataPropertyFrame
            AnnotationProperty -> FrameType
AnnotationPropertyFrame
            NamedIndividual -> FrameType
IndividualFrame

        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
ms
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DeclarationSection Map FrameSectionType [Axiom]
m1
        newAxiom :: Axiom
newAxiom = AxiomAnnotations -> Entity -> Axiom
Declaration AxiomAnnotations
anns Entity
entity
        newAxioms :: [Axiom]
newAxioms = Axiom
newAxiom Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- | transform Entity
tEntity :: Entity -> MnchstrSntx -> MnchstrSntx
tEntity :: Entity -> MnchstrSntx -> MnchstrSntx
tEntity entity :: Entity
entity ms :: MnchstrSntx
ms = case (Entity -> EntityType
entityKind Entity
entity) of
    Datatype ->
        if (FrameType, FrameIdValue) -> MnchstrSntx -> Bool
forall k a. Ord k => k -> Map k a -> Bool
M.notMember (FrameType
DatatypeFrame, IRI -> FrameIdValue
IriId IRI
iri) MnchstrSntx
ms
            then (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType
DatatypeFrame, IRI -> FrameIdValue
IriId IRI
iri) Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty MnchstrSntx
ms
            else MnchstrSntx
ms

    Class -> 
        if (FrameType, FrameIdValue) -> MnchstrSntx -> Bool
forall k a. Ord k => k -> Map k a -> Bool
M.notMember (FrameType
ClassFrame, IRI -> FrameIdValue
IriId IRI
iri) MnchstrSntx
ms
            then (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType
ClassFrame, IRI -> FrameIdValue
IriId IRI
iri) Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty MnchstrSntx
ms
            else MnchstrSntx
ms

    ObjectProperty ->
        if (FrameType, FrameIdValue) -> MnchstrSntx -> Bool
forall k a. Ord k => k -> Map k a -> Bool
M.notMember (FrameType
ObjectPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri) MnchstrSntx
ms
            then (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType
ObjectPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri) Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty MnchstrSntx
ms
            else MnchstrSntx
ms

    DataProperty -> 
        if (FrameType, FrameIdValue) -> MnchstrSntx -> Bool
forall k a. Ord k => k -> Map k a -> Bool
M.notMember (FrameType
DataPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri) MnchstrSntx
ms
            then (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType
DataPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri) Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty MnchstrSntx
ms
            else MnchstrSntx
ms

    AnnotationProperty ->
        if (FrameType, FrameIdValue) -> MnchstrSntx -> Bool
forall k a. Ord k => k -> Map k a -> Bool
M.notMember (FrameType
AnnotationPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri) MnchstrSntx
ms
            then (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType
AnnotationPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri) Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty MnchstrSntx
ms
            else MnchstrSntx
ms
    
    NamedIndividual ->
        if (FrameType, FrameIdValue) -> MnchstrSntx -> Bool
forall k a. Ord k => k -> Map k a -> Bool
M.notMember (FrameType
IndividualFrame, IRI -> FrameIdValue
IriId IRI
iri) MnchstrSntx
ms
            then (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType
IndividualFrame, IRI -> FrameIdValue
IriId IRI
iri) Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty MnchstrSntx
ms
            else MnchstrSntx
ms

    where iri :: IRI
iri = Entity -> IRI
cutIRI Entity
entity

-- | transform ObjectProperty axiom
tObjectPropertyAxiom :: ObjectPropertyAxiom -> MnchstrSntx -> MnchstrSntx
-- SubObjectPropertyOf axiom
tObjectPropertyAxiom :: ObjectPropertyAxiom -> MnchstrSntx -> MnchstrSntx
tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(SubObjectPropertyOf anns :: AxiomAnnotations
anns 
    (SubObjPropExpr_obj opExpr1 :: ObjectPropertyExpression
opExpr1) opExpr2 :: ObjectPropertyExpression
opExpr2) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
SubPropertyOfSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        fIdValue :: FrameIdValue
fIdValue = case ObjectPropertyExpression
opExpr1 of
            ObjectProp iri :: IRI
iri -> IRI -> FrameIdValue
IriId IRI
iri
            ObjectInverseOf expr :: ObjectPropertyExpression
expr -> IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr

        k :: (FrameType, FrameIdValue)
k = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
True ObjectPropertyExpression
opExpr1 
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
.Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
False ObjectPropertyExpression
opExpr2 (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
SubPropertyOfSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(SubObjectPropertyOf anns :: AxiomAnnotations
anns
    (SubObjPropExpr_exprchain opExprs :: PropertyExpressionChain
opExprs) opExpr :: ObjectPropertyExpression
opExpr) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
SubPropertyChainSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
ObjectPropertyFrame, ObjectPropertyExpression -> FrameIdValue
obPropExprToIdVal ObjectPropertyExpression
opExpr)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> PropertyExpressionChain -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpressions Bool
False PropertyExpressionChain
opExprs (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
SubPropertyChainSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- EquivalentObjectProperties axiom
tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(EquivalentObjectProperties anns :: AxiomAnnotations
anns
    [opExpr1 :: ObjectPropertyExpression
opExpr1, opExpr2 :: ObjectPropertyExpression
opExpr2]) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k1 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
EquivalentToSection [Axiom]
newAxioms1 Map FrameSectionType [Axiom]
m1)
    (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k2 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
EquivalentToSection [Axiom]
newAxioms2 Map FrameSectionType [Axiom]
m2) (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        fIdValue1 :: FrameIdValue
fIdValue1 = case ObjectPropertyExpression
opExpr1 of
            ObjectProp iri :: IRI
iri -> IRI -> FrameIdValue
IriId IRI
iri
            ObjectInverseOf expr :: ObjectPropertyExpression
expr -> IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr

        fIdValue2 :: FrameIdValue
fIdValue2 = case ObjectPropertyExpression
opExpr2 of
            ObjectProp iri :: IRI
iri -> IRI -> FrameIdValue
IriId IRI
iri
            ObjectInverseOf expr :: ObjectPropertyExpression
expr -> IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr

        k1 :: (FrameType, FrameIdValue)
k1 = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue1)
        k2 :: (FrameType, FrameIdValue)
k2 = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue2)
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k1 MnchstrSntx
m'
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k2 MnchstrSntx
m'
        axioms1 :: [Axiom]
axioms1 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
EquivalentToSection Map FrameSectionType [Axiom]
m1
        axioms2 :: [Axiom]
axioms2 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
EquivalentToSection Map FrameSectionType [Axiom]
m2
        newAx :: ObjectPropertyAxiom
newAx = AxiomAnnotations -> PropertyExpressionChain -> ObjectPropertyAxiom
EquivalentObjectProperties AxiomAnnotations
anns (PropertyExpressionChain -> ObjectPropertyAxiom)
-> PropertyExpressionChain -> ObjectPropertyAxiom
forall a b. (a -> b) -> a -> b
$ [ObjectPropertyExpression
opExpr2, ObjectPropertyExpression
opExpr1]
        newAxioms1 :: [Axiom]
newAxioms1 = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms1
        newAxioms2 :: [Axiom]
newAxioms2 = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
newAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms2

tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(EquivalentObjectProperties anns :: AxiomAnnotations
anns opExprs :: PropertyExpressionChain
opExprs) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
EquivalentObjectPropertiesSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m1) (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
MiscFrame, FrameIdValue
MiscId)
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> PropertyExpressionChain -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpressions Bool
True PropertyExpressionChain
opExprs (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m'
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
EquivalentObjectPropertiesSection Map FrameSectionType [Axiom]
m1
        newAxioms :: [Axiom]
newAxioms = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- DisjointObjectProperties axiom
tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(DisjointObjectProperties anns :: AxiomAnnotations
anns
    [opExpr1 :: ObjectPropertyExpression
opExpr1, opExpr2 :: ObjectPropertyExpression
opExpr2]) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k1 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DisjointWithSection [Axiom]
newAxioms1 Map FrameSectionType [Axiom]
m1)
    (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k2 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DisjointWithSection [Axiom]
newAxioms2 Map FrameSectionType [Axiom]
m2) (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        fIdValue1 :: FrameIdValue
fIdValue1 = case ObjectPropertyExpression
opExpr1 of
            ObjectProp iri :: IRI
iri -> IRI -> FrameIdValue
IriId IRI
iri
            ObjectInverseOf expr :: ObjectPropertyExpression
expr -> IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr

        fIdValue2 :: FrameIdValue
fIdValue2 = case ObjectPropertyExpression
opExpr2 of
            ObjectProp iri :: IRI
iri -> IRI -> FrameIdValue
IriId IRI
iri
            ObjectInverseOf expr :: ObjectPropertyExpression
expr -> IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr

        k1 :: (FrameType, FrameIdValue)
k1 = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue1)
        k2 :: (FrameType, FrameIdValue)
k2 = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue2)
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k1 MnchstrSntx
m'
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k2 MnchstrSntx
m'
        axioms1 :: [Axiom]
axioms1 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DisjointWithSection Map FrameSectionType [Axiom]
m1
        axioms2 :: [Axiom]
axioms2 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DisjointWithSection Map FrameSectionType [Axiom]
m2
        newAx :: ObjectPropertyAxiom
newAx = AxiomAnnotations -> PropertyExpressionChain -> ObjectPropertyAxiom
DisjointObjectProperties AxiomAnnotations
anns (PropertyExpressionChain -> ObjectPropertyAxiom)
-> PropertyExpressionChain -> ObjectPropertyAxiom
forall a b. (a -> b) -> a -> b
$ [ObjectPropertyExpression
opExpr2, ObjectPropertyExpression
opExpr1]
        newAxioms1 :: [Axiom]
newAxioms1 = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms1
        newAxioms2 :: [Axiom]
newAxioms2 = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
newAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms2

tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(DisjointObjectProperties anns :: AxiomAnnotations
anns opExprs :: PropertyExpressionChain
opExprs) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DisjointObjectPropertiesSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m1) (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
MiscFrame, FrameIdValue
MiscId)
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> PropertyExpressionChain -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpressions Bool
True PropertyExpressionChain
opExprs (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m'
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DisjointObjectPropertiesSection Map FrameSectionType [Axiom]
m1
        newAxioms :: [Axiom]
newAxioms = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- InverseObjectProperties axiom
tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(InverseObjectProperties anns :: AxiomAnnotations
anns opExpr1 :: ObjectPropertyExpression
opExpr1 opExpr2 :: ObjectPropertyExpression
opExpr2) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k1 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
InverseOfSection [Axiom]
newAxioms1 Map FrameSectionType [Axiom]
m1) MnchstrSntx
m'
    where
        fIdValue1 :: FrameIdValue
fIdValue1 = ObjectPropertyExpression -> FrameIdValue
obPropExprToIdVal ObjectPropertyExpression
opExpr1

        k1 :: (FrameType, FrameIdValue)
k1 = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue1)
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> PropertyExpressionChain -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpressions Bool
True [ObjectPropertyExpression
opExpr1, ObjectPropertyExpression
opExpr2] (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k1 MnchstrSntx
m'
        axioms1 :: [Axiom]
axioms1 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
InverseOfSection Map FrameSectionType [Axiom]
m1
        newAxioms1 :: [Axiom]
newAxioms1 = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms1

-- ObjectPropertyDomain axiom
tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(ObjectPropertyDomain anns :: AxiomAnnotations
anns opExpr :: ObjectPropertyExpression
opExpr clExpr :: ClassExpression
clExpr) ms :: MnchstrSntx
ms =
   (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DomainSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
   where
        fIdValue :: FrameIdValue
fIdValue = case ObjectPropertyExpression
opExpr of
            ObjectProp iri :: IRI
iri -> IRI -> FrameIdValue
IriId IRI
iri
            ObjectInverseOf expr :: ObjectPropertyExpression
expr -> IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr

        k :: (FrameType, FrameIdValue)
k = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
True ObjectPropertyExpression
opExpr
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ClassExpression -> MnchstrSntx -> MnchstrSntx
tClassExpression ClassExpression
clExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DomainSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- ObjectPropertyRange axiom
tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(ObjectPropertyRange anns :: AxiomAnnotations
anns opExpr :: ObjectPropertyExpression
opExpr clExpr :: ClassExpression
clExpr) ms :: MnchstrSntx
ms =
   (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
RangeSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
   where
        fIdValue :: FrameIdValue
fIdValue = case ObjectPropertyExpression
opExpr of
            ObjectProp iri :: IRI
iri -> IRI -> FrameIdValue
IriId IRI
iri
            ObjectInverseOf expr :: ObjectPropertyExpression
expr -> IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr

        k :: (FrameType, FrameIdValue)
k = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
True ObjectPropertyExpression
opExpr
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ClassExpression -> MnchstrSntx -> MnchstrSntx
tClassExpression ClassExpression
clExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
RangeSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- FunctionalObjectProperty axiom
tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(FunctionalObjectProperty anns :: AxiomAnnotations
anns opExpr :: ObjectPropertyExpression
opExpr) ms :: MnchstrSntx
ms =
   (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
CharacteristicsSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
   where
        fIdValue :: FrameIdValue
fIdValue = case ObjectPropertyExpression
opExpr of
            ObjectProp iri :: IRI
iri -> IRI -> FrameIdValue
IriId IRI
iri
            ObjectInverseOf expr :: ObjectPropertyExpression
expr -> IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr

        k :: (FrameType, FrameIdValue)
k = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
True ObjectPropertyExpression
opExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
CharacteristicsSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs


-- InverseFunctionalObjectProperty axiom
tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(InverseFunctionalObjectProperty anns :: AxiomAnnotations
anns opExpr :: ObjectPropertyExpression
opExpr) ms :: MnchstrSntx
ms =
   (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
CharacteristicsSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
   where
        fIdValue :: FrameIdValue
fIdValue = case ObjectPropertyExpression
opExpr of
            ObjectProp iri :: IRI
iri -> IRI -> FrameIdValue
IriId IRI
iri
            ObjectInverseOf expr :: ObjectPropertyExpression
expr -> IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr

        k :: (FrameType, FrameIdValue)
k = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
True ObjectPropertyExpression
opExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
CharacteristicsSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- ReflexiveObjectProperty axiom
tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(ReflexiveObjectProperty anns :: AxiomAnnotations
anns opExpr :: ObjectPropertyExpression
opExpr) ms :: MnchstrSntx
ms =
   (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
CharacteristicsSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
   where
        fIdValue :: FrameIdValue
fIdValue = case ObjectPropertyExpression
opExpr of
            ObjectProp iri :: IRI
iri -> IRI -> FrameIdValue
IriId IRI
iri
            ObjectInverseOf expr :: ObjectPropertyExpression
expr -> IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr

        k :: (FrameType, FrameIdValue)
k = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
True ObjectPropertyExpression
opExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
CharacteristicsSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- IrreflexiveObjectProperty axiom
tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(IrreflexiveObjectProperty anns :: AxiomAnnotations
anns opExpr :: ObjectPropertyExpression
opExpr) ms :: MnchstrSntx
ms =
   (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
CharacteristicsSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
   where
        fIdValue :: FrameIdValue
fIdValue = case ObjectPropertyExpression
opExpr of
            ObjectProp iri :: IRI
iri -> IRI -> FrameIdValue
IriId IRI
iri
            ObjectInverseOf expr :: ObjectPropertyExpression
expr -> IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr

        k :: (FrameType, FrameIdValue)
k = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
True ObjectPropertyExpression
opExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
CharacteristicsSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- SymmetricObjectProperty axiom
tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(SymmetricObjectProperty anns :: AxiomAnnotations
anns opExpr :: ObjectPropertyExpression
opExpr) ms :: MnchstrSntx
ms =
   (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
CharacteristicsSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
   where
        fIdValue :: FrameIdValue
fIdValue = case ObjectPropertyExpression
opExpr of
            ObjectProp iri :: IRI
iri -> IRI -> FrameIdValue
IriId IRI
iri
            ObjectInverseOf expr :: ObjectPropertyExpression
expr -> IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr

        k :: (FrameType, FrameIdValue)
k = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
True ObjectPropertyExpression
opExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
CharacteristicsSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- AsymmetricObjectProperty axiom
tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(AsymmetricObjectProperty anns :: AxiomAnnotations
anns opExpr :: ObjectPropertyExpression
opExpr) ms :: MnchstrSntx
ms =
   (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
CharacteristicsSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
   where
        fIdValue :: FrameIdValue
fIdValue = case ObjectPropertyExpression
opExpr of
            ObjectProp iri :: IRI
iri -> IRI -> FrameIdValue
IriId IRI
iri
            ObjectInverseOf expr :: ObjectPropertyExpression
expr -> IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr

        k :: (FrameType, FrameIdValue)
k = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
True ObjectPropertyExpression
opExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
CharacteristicsSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- TransitiveObjectProperty axiom
tObjectPropertyAxiom opAx :: ObjectPropertyAxiom
opAx@(TransitiveObjectProperty anns :: AxiomAnnotations
anns opExpr :: ObjectPropertyExpression
opExpr) ms :: MnchstrSntx
ms =
   (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
CharacteristicsSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
   where
        fIdValue :: FrameIdValue
fIdValue = case ObjectPropertyExpression
opExpr of
            ObjectProp iri :: IRI
iri -> IRI -> FrameIdValue
IriId IRI
iri
            ObjectInverseOf expr :: ObjectPropertyExpression
expr -> IRI -> FrameIdValue
ObjInvOfId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr

        k :: (FrameType, FrameIdValue)
k = (FrameType
ObjectPropertyFrame, FrameIdValue
fIdValue)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
True ObjectPropertyExpression
opExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
CharacteristicsSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = ObjectPropertyAxiom -> Axiom
ObjectPropertyAxiom ObjectPropertyAxiom
opAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs


-- | transform DataProperty axioms
tDataPropertyAxiom :: DataPropertyAxiom -> MnchstrSntx -> MnchstrSntx
-- SubDataPropertyOf axiom
tDataPropertyAxiom :: DataPropertyAxiom -> MnchstrSntx -> MnchstrSntx
tDataPropertyAxiom dpAx :: DataPropertyAxiom
dpAx@(SubDataPropertyOf anns :: AxiomAnnotations
anns iri1 :: IRI
iri1 iri2 :: IRI
iri2) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
SubPropertyOfSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2)  MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
DataPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri1)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [IRI] -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpressions [IRI
iri1, IRI
iri2] (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
SubPropertyOfSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = DataPropertyAxiom -> Axiom
DataPropertyAxiom DataPropertyAxiom
dpAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- EquivalentDataProperties axiom
tDataPropertyAxiom dpAx :: DataPropertyAxiom
dpAx@(EquivalentDataProperties anns :: AxiomAnnotations
anns [iri1 :: IRI
iri1, iri2 :: IRI
iri2]) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k1 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
EquivalentToSection [Axiom]
newAxioms1 Map FrameSectionType [Axiom]
m1)
    (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k2 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
EquivalentToSection [Axiom]
newAxioms2 Map FrameSectionType [Axiom]
m2) (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        k1 :: (FrameType, FrameIdValue)
k1 = (FrameType
DataPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri1)
        k2 :: (FrameType, FrameIdValue)
k2 = (FrameType
DataPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri2)
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [IRI] -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpressions [IRI
iri1, IRI
iri2] (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k1 MnchstrSntx
m'
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k2 MnchstrSntx
m'
        axioms1 :: [Axiom]
axioms1 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
EquivalentToSection Map FrameSectionType [Axiom]
m1
        axioms2 :: [Axiom]
axioms2 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
EquivalentToSection Map FrameSectionType [Axiom]
m2
        newAx :: DataPropertyAxiom
newAx = AxiomAnnotations -> [IRI] -> DataPropertyAxiom
EquivalentDataProperties AxiomAnnotations
anns [IRI
iri2, IRI
iri1]
        newAxioms1 :: [Axiom]
newAxioms1 = DataPropertyAxiom -> Axiom
DataPropertyAxiom DataPropertyAxiom
dpAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms1
        newAxioms2 :: [Axiom]
newAxioms2 = DataPropertyAxiom -> Axiom
DataPropertyAxiom DataPropertyAxiom
newAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms2

tDataPropertyAxiom dpAx :: DataPropertyAxiom
dpAx@(EquivalentDataProperties anns :: AxiomAnnotations
anns iris :: [IRI]
iris@(_:_:_:_)) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
EquivalentDataPropertiesSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
MiscFrame, FrameIdValue
MiscId)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [IRI] -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpressions [IRI]
iris (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
EquivalentDataPropertiesSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = DataPropertyAxiom -> Axiom
DataPropertyAxiom DataPropertyAxiom
dpAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- DisjointDataProperties axiom
tDataPropertyAxiom dpAx :: DataPropertyAxiom
dpAx@(DisjointDataProperties anns :: AxiomAnnotations
anns [iri1 :: IRI
iri1, iri2 :: IRI
iri2]) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DisjointWithSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
DataPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri1)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [IRI] -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpressions [IRI
iri1, IRI
iri2] (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DisjointWithSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = DataPropertyAxiom -> Axiom
DataPropertyAxiom DataPropertyAxiom
dpAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

tDataPropertyAxiom dpAx :: DataPropertyAxiom
dpAx@(DisjointDataProperties anns :: AxiomAnnotations
anns iris :: [IRI]
iris@(_:_:_:_)) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DisjointDataPropertiesSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
MiscFrame, FrameIdValue
MiscId)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [IRI] -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpressions [IRI]
iris (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DisjointDataPropertiesSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = DataPropertyAxiom -> Axiom
DataPropertyAxiom DataPropertyAxiom
dpAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- DataPropertyDomain axiom
tDataPropertyAxiom dpAx :: DataPropertyAxiom
dpAx@(DataPropertyDomain anns :: AxiomAnnotations
anns iri :: IRI
iri clExpr :: ClassExpression
clExpr) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DomainSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
DataPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IRI -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpression IRI
iri
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ClassExpression -> MnchstrSntx -> MnchstrSntx
tClassExpression ClassExpression
clExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$  MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DomainSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = DataPropertyAxiom -> Axiom
DataPropertyAxiom DataPropertyAxiom
dpAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- DataPropertyRange axiom
tDataPropertyAxiom dpAx :: DataPropertyAxiom
dpAx@(DataPropertyRange anns :: AxiomAnnotations
anns iri :: IRI
iri dr :: DataRange
dr) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
RangeSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
DataPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IRI -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpression IRI
iri
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DataRange -> MnchstrSntx -> MnchstrSntx
tDataRange DataRange
dr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
RangeSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = DataPropertyAxiom -> Axiom
DataPropertyAxiom DataPropertyAxiom
dpAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- FunctionalDataProperty axiom
tDataPropertyAxiom dpAx :: DataPropertyAxiom
dpAx@(FunctionalDataProperty anns :: AxiomAnnotations
anns iri :: IRI
iri) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
CharacteristicsSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
DataPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IRI -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpression IRI
iri (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
CharacteristicsSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = DataPropertyAxiom -> Axiom
DataPropertyAxiom DataPropertyAxiom
dpAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

tDataPropertyAxiom _ ms :: MnchstrSntx
ms = MnchstrSntx
ms

-- | transform Class axiom
tClassAxiom :: ClassAxiom -> MnchstrSntx -> MnchstrSntx
-- SubClassOf axiom
tClassAxiom :: ClassAxiom -> MnchstrSntx -> MnchstrSntx
tClassAxiom clAx :: ClassAxiom
clAx@(SubClassOf anns :: AxiomAnnotations
anns e :: ClassExpression
e supClExpr :: ClassExpression
supClExpr) ms :: MnchstrSntx
ms = 
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
SubClassOfSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = case ClassExpression
e of
            Expression iri :: IRI
iri -> (FrameType
ClassFrame,  IRI -> FrameIdValue
IriId IRI
iri)
            _ -> (FrameType
ClassFrame, ClassExpression -> FrameIdValue
ComplexClassExpr ClassExpression
e)
        m1 :: MnchstrSntx
m1 = ClassExpression -> MnchstrSntx -> MnchstrSntx
tClassExpression ClassExpression
supClExpr (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
SubClassOfSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = ClassAxiom -> Axiom
ClassAxiom ClassAxiom
clAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- EquivalentClasses axiom
tClassAxiom clAx :: ClassAxiom
clAx@(EquivalentClasses anns :: AxiomAnnotations
anns
    [Expression iri1 :: IRI
iri1, Expression iri2 :: IRI
iri2]) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k1 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
EquivalentToSection [Axiom]
newAxioms1 Map FrameSectionType [Axiom]
m1)
    (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k2 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
EquivalentToSection [Axiom]
newAxioms2 Map FrameSectionType [Axiom]
m2) (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns MnchstrSntx
ms
        k1 :: (FrameType, FrameIdValue)
k1 = (FrameType
ClassFrame, IRI -> FrameIdValue
IriId IRI
iri1)
        k2 :: (FrameType, FrameIdValue)
k2 = (FrameType
ClassFrame, IRI -> FrameIdValue
IriId IRI
iri2)
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k1 MnchstrSntx
m'
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k2 MnchstrSntx
m'
        axioms1 :: [Axiom]
axioms1 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
EquivalentToSection Map FrameSectionType [Axiom]
m1
        axioms2 :: [Axiom]
axioms2 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
EquivalentToSection Map FrameSectionType [Axiom]
m2
        newAx :: ClassAxiom
newAx = AxiomAnnotations -> [ClassExpression] -> ClassAxiom
EquivalentClasses AxiomAnnotations
anns [IRI -> ClassExpression
Expression IRI
iri2, IRI -> ClassExpression
Expression IRI
iri1]
        newAxioms1 :: [Axiom]
newAxioms1 = ClassAxiom -> Axiom
ClassAxiom ClassAxiom
clAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms1
        newAxioms2 :: [Axiom]
newAxioms2 = ClassAxiom -> Axiom
ClassAxiom ClassAxiom
newAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms2

tClassAxiom clAx :: ClassAxiom
clAx@(EquivalentClasses anns :: AxiomAnnotations
anns [Expression iri :: IRI
iri, clExpr :: ClassExpression
clExpr]) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
EquivalentToSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m1) (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
ClassFrame, IRI -> FrameIdValue
IriId IRI
iri)
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ClassExpression -> MnchstrSntx -> MnchstrSntx
tClassExpression ClassExpression
clExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m'
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
EquivalentToSection Map FrameSectionType [Axiom]
m1
        newAxioms :: [Axiom]
newAxioms = ClassAxiom -> Axiom
ClassAxiom ClassAxiom
clAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

tClassAxiom clAx :: ClassAxiom
clAx@(EquivalentClasses anns :: AxiomAnnotations
anns clExprs :: [ClassExpression]
clExprs) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
EquivalentClassesSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m1) (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
MiscFrame, FrameIdValue
MiscId)
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [ClassExpression] -> MnchstrSntx -> MnchstrSntx
tClassExpressions [ClassExpression]
clExprs (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m'
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
EquivalentClassesSection Map FrameSectionType [Axiom]
m1
        newAxioms :: [Axiom]
newAxioms = ClassAxiom -> Axiom
ClassAxiom ClassAxiom
clAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- DisjointClasses axiom
tClassAxiom clAx :: ClassAxiom
clAx@(DisjointClasses anns :: AxiomAnnotations
anns
    [Expression iri1 :: IRI
iri1, Expression iri2 :: IRI
iri2]) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k1 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DisjointWithSection [Axiom]
newAxioms1 Map FrameSectionType [Axiom]
m1)
    (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k2 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DisjointWithSection [Axiom]
newAxioms2 Map FrameSectionType [Axiom]
m2) (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        k1 :: (FrameType, FrameIdValue)
k1 = (FrameType
ClassFrame, IRI -> FrameIdValue
IriId IRI
iri1)
        k2 :: (FrameType, FrameIdValue)
k2 = (FrameType
ClassFrame, IRI -> FrameIdValue
IriId IRI
iri2)
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k1 MnchstrSntx
m'
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k2 MnchstrSntx
m'
        axioms1 :: [Axiom]
axioms1 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DisjointWithSection Map FrameSectionType [Axiom]
m1
        axioms2 :: [Axiom]
axioms2 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DisjointWithSection Map FrameSectionType [Axiom]
m2
        newAx :: ClassAxiom
newAx = AxiomAnnotations -> [ClassExpression] -> ClassAxiom
DisjointClasses AxiomAnnotations
anns [IRI -> ClassExpression
Expression IRI
iri2, IRI -> ClassExpression
Expression IRI
iri1]
        newAxioms1 :: [Axiom]
newAxioms1 = ClassAxiom -> Axiom
ClassAxiom ClassAxiom
clAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms1
        newAxioms2 :: [Axiom]
newAxioms2 = ClassAxiom -> Axiom
ClassAxiom ClassAxiom
newAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms2

tClassAxiom clAx :: ClassAxiom
clAx@(DisjointClasses anns :: AxiomAnnotations
anns [Expression iri :: IRI
iri, clExpr :: ClassExpression
clExpr]) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DisjointWithSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m1) (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
ClassFrame, IRI -> FrameIdValue
IriId IRI
iri)
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ClassExpression -> MnchstrSntx -> MnchstrSntx
tClassExpression ClassExpression
clExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m'
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DisjointWithSection Map FrameSectionType [Axiom]
m1
        newAxioms :: [Axiom]
newAxioms = ClassAxiom -> Axiom
ClassAxiom ClassAxiom
clAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

tClassAxiom clAx :: ClassAxiom
clAx@(DisjointClasses anns :: AxiomAnnotations
anns clExprs :: [ClassExpression]
clExprs) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DisjointClassesSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m1) (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
MiscFrame, FrameIdValue
MiscId)
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [ClassExpression] -> MnchstrSntx -> MnchstrSntx
tClassExpressions [ClassExpression]
clExprs (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m'
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DisjointClassesSection Map FrameSectionType [Axiom]
m1
        newAxioms :: [Axiom]
newAxioms = ClassAxiom -> Axiom
ClassAxiom ClassAxiom
clAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- DisjointUnion axiom
tClassAxiom clAx :: ClassAxiom
clAx@(DisjointUnion anns :: AxiomAnnotations
anns iri :: IRI
iri clExprs :: [ClassExpression]
clExprs) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DisjointUnionOfSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m1) (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
ClassFrame, IRI -> FrameIdValue
IriId IRI
iri)
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [ClassExpression] -> MnchstrSntx -> MnchstrSntx
tClassExpressions [ClassExpression]
clExprs (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m'
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DisjointUnionOfSection Map FrameSectionType [Axiom]
m1
        newAxioms :: [Axiom]
newAxioms = ClassAxiom -> Axiom
ClassAxiom ClassAxiom
clAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- | transform DatatypeDefinition axiom
tDatatypeDefinition :: Axiom -> MnchstrSntx -> MnchstrSntx
tDatatypeDefinition :: Axiom -> MnchstrSntx -> MnchstrSntx
tDatatypeDefinition ax :: Axiom
ax@(DatatypeDefinition anns :: AxiomAnnotations
anns dtIri :: IRI
dtIri dr :: DataRange
dr) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
EquivalentToSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
DatatypeFrame, IRI -> FrameIdValue
IriId IRI
dtIri)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IRI -> MnchstrSntx -> MnchstrSntx
tDatatype IRI
dtIri (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DataRange -> MnchstrSntx -> MnchstrSntx
tDataRange DataRange
dr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
EquivalentToSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = Axiom
ax Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs
        
tDatatypeDefinition _ ms :: MnchstrSntx
ms = MnchstrSntx
ms

-- | transform HasKey axiom
tHasKey :: Axiom -> MnchstrSntx -> MnchstrSntx
tHasKey :: Axiom -> MnchstrSntx -> MnchstrSntx
tHasKey (HasKey anns :: AxiomAnnotations
anns e :: ClassExpression
e opExprs :: PropertyExpressionChain
opExprs dpExprs :: [IRI]
dpExprs) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
HasKeySection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m1) (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        k :: (FrameType, FrameIdValue)
k = case ClassExpression
e of 
            Expression iri :: IRI
iri -> (FrameType
ClassFrame, IRI -> FrameIdValue
IriId IRI
iri)
            _ -> (FrameType
ClassFrame, ClassExpression -> FrameIdValue
ComplexClassExpr ClassExpression
e)
        opExprs' :: PropertyExpressionChain
opExprs' = Set ObjectPropertyExpression -> PropertyExpressionChain
forall a. Set a -> [a]
S.toList (Set ObjectPropertyExpression -> PropertyExpressionChain)
-> (PropertyExpressionChain -> Set ObjectPropertyExpression)
-> PropertyExpressionChain
-> PropertyExpressionChain
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PropertyExpressionChain -> Set ObjectPropertyExpression
forall a. Ord a => [a] -> Set a
S.fromList (PropertyExpressionChain -> PropertyExpressionChain)
-> PropertyExpressionChain -> PropertyExpressionChain
forall a b. (a -> b) -> a -> b
$ PropertyExpressionChain
opExprs
        dpExprs' :: [IRI]
dpExprs' = Set IRI -> [IRI]
forall a. Set a -> [a]
S.toList (Set IRI -> [IRI]) -> ([IRI] -> Set IRI) -> [IRI] -> [IRI]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [IRI] -> Set IRI
forall a. Ord a => [a] -> Set a
S.fromList ([IRI] -> [IRI]) -> [IRI] -> [IRI]
forall a b. (a -> b) -> a -> b
$ [IRI]
dpExprs
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> PropertyExpressionChain -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpressions Bool
False PropertyExpressionChain
opExprs'
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [IRI] -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpressions [IRI]
dpExprs' (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m'
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
HasKeySection Map FrameSectionType [Axiom]
m1
        newAxioms :: [Axiom]
newAxioms = (AxiomAnnotations
-> ClassExpression -> PropertyExpressionChain -> [IRI] -> Axiom
HasKey AxiomAnnotations
anns ClassExpression
e PropertyExpressionChain
opExprs' [IRI]
dpExprs') Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

tHasKey _  ms :: MnchstrSntx
ms = MnchstrSntx
ms

-- | transform Assertion axioms
tAssertion :: Assertion -> MnchstrSntx -> MnchstrSntx
-- SameIndividual axiom
tAssertion :: Assertion -> MnchstrSntx -> MnchstrSntx
tAssertion ax :: Assertion
ax@(SameIndividual anns :: AxiomAnnotations
anns [i1 :: IRI
i1, i2 :: IRI
i2]) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k1 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
SameAsSection [Axiom]
newAxioms1 Map FrameSectionType [Axiom]
m1)
    (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k2 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
SameAsSection [Axiom]
newAxioms2 Map FrameSectionType [Axiom]
m2)
    (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        k1 :: (FrameType, FrameIdValue)
k1 = (FrameType
IndividualFrame, IRI -> FrameIdValue
IriId IRI
i1)
        k2 :: (FrameType, FrameIdValue)
k2 = (FrameType
IndividualFrame, IRI -> FrameIdValue
IriId IRI
i2)
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [IRI] -> MnchstrSntx -> MnchstrSntx
tIndividuals [IRI
i1, IRI
i2] (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k1 MnchstrSntx
m'
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k2 MnchstrSntx
m'
        axioms1 :: [Axiom]
axioms1 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
SameAsSection Map FrameSectionType [Axiom]
m1
        axioms2 :: [Axiom]
axioms2 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
SameAsSection Map FrameSectionType [Axiom]
m2
        newAx :: Assertion
newAx = AxiomAnnotations -> [IRI] -> Assertion
SameIndividual AxiomAnnotations
anns [IRI
i2, IRI
i1]
        newAxioms1 :: [Axiom]
newAxioms1 = Assertion -> Axiom
Assertion Assertion
ax Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms1
        newAxioms2 :: [Axiom]
newAxioms2 = Assertion -> Axiom
Assertion Assertion
newAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms2

tAssertion ax :: Assertion
ax@(SameIndividual anns :: AxiomAnnotations
anns inds :: [IRI]
inds@(_:_:_:_)) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
SameIndividualSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
MiscFrame, FrameIdValue
MiscId)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [IRI] -> MnchstrSntx -> MnchstrSntx
tIndividuals [IRI]
inds (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
SameIndividualSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = Assertion -> Axiom
Assertion Assertion
ax Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs 

-- DifferentIndividual axiom
tAssertion ax :: Assertion
ax@(DifferentIndividuals anns :: AxiomAnnotations
anns [i1 :: IRI
i1, i2 :: IRI
i2]) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k1 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DifferentFromSection [Axiom]
newAxioms1 Map FrameSectionType [Axiom]
m1)
    (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k2 (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DifferentFromSection [Axiom]
newAxioms2 Map FrameSectionType [Axiom]
m2)
    (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
m'
    where
        k1 :: (FrameType, FrameIdValue)
k1 = (FrameType
IndividualFrame, IRI -> FrameIdValue
IriId IRI
i1)
        k2 :: (FrameType, FrameIdValue)
k2 = (FrameType
IndividualFrame, IRI -> FrameIdValue
IriId IRI
i2)
        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [IRI] -> MnchstrSntx -> MnchstrSntx
tIndividuals [IRI
i1, IRI
i2] (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m1 :: Map FrameSectionType [Axiom]
m1 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k1 MnchstrSntx
m'
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k2 MnchstrSntx
m'
        axioms1 :: [Axiom]
axioms1 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DifferentFromSection Map FrameSectionType [Axiom]
m1
        axioms2 :: [Axiom]
axioms2 = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DifferentFromSection Map FrameSectionType [Axiom]
m2
        newAx :: Assertion
newAx = AxiomAnnotations -> [IRI] -> Assertion
SameIndividual AxiomAnnotations
anns [IRI
i2, IRI
i1]
        newAxioms1 :: [Axiom]
newAxioms1 = Assertion -> Axiom
Assertion Assertion
ax Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms1
        newAxioms2 :: [Axiom]
newAxioms2 = Assertion -> Axiom
Assertion Assertion
newAx Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axioms2

tAssertion ax :: Assertion
ax@(DifferentIndividuals anns :: AxiomAnnotations
anns inds :: [IRI]
inds@(_:_:_:_)) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DifferentIndividualsSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
MiscFrame, FrameIdValue
MiscId)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [IRI] -> MnchstrSntx -> MnchstrSntx
tIndividuals [IRI]
inds (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DifferentIndividualsSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = Assertion -> Axiom
Assertion Assertion
ax Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs 

-- ClassAssertion axiom
tAssertion ax :: Assertion
ax@(ClassAssertion anns :: AxiomAnnotations
anns clExpr :: ClassExpression
clExpr iri :: IRI
iri) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
TypesSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
IndividualFrame, IRI -> FrameIdValue
IriId IRI
iri)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IRI -> MnchstrSntx -> MnchstrSntx
tIndividual IRI
iri
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ClassExpression -> MnchstrSntx -> MnchstrSntx
tClassExpression ClassExpression
clExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
TypesSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = Assertion -> Axiom
Assertion Assertion
ax Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs 

-- ObjectPropertyAssertion axiom
tAssertion ax :: Assertion
ax@(ObjectPropertyAssertion anns :: AxiomAnnotations
anns opExpr :: ObjectPropertyExpression
opExpr iri1 :: IRI
iri1 iri2 :: IRI
iri2) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
FactsSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
IndividualFrame, IRI -> FrameIdValue
IriId IRI
iri1)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [IRI] -> MnchstrSntx -> MnchstrSntx
tIndividuals [IRI
iri1, IRI
iri2]
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
False ObjectPropertyExpression
opExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
FactsSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = Assertion -> Axiom
Assertion Assertion
ax Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- NegativeObjectPropertyAssertion axiom
tAssertion ax :: Assertion
ax@(NegativeObjectPropertyAssertion anns :: AxiomAnnotations
anns opExpr :: ObjectPropertyExpression
opExpr iri1 :: IRI
iri1 iri2 :: IRI
iri2) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
FactsSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
IndividualFrame, IRI -> FrameIdValue
IriId IRI
iri1)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [IRI] -> MnchstrSntx -> MnchstrSntx
tIndividuals [IRI
iri1, IRI
iri2]
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
False ObjectPropertyExpression
opExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
FactsSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = Assertion -> Axiom
Assertion Assertion
ax Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- DataPropertyAssertion axiom
tAssertion ax :: Assertion
ax@(DataPropertyAssertion anns :: AxiomAnnotations
anns dpIri :: IRI
dpIri iri :: IRI
iri lit :: TargetValue
lit) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
FactsSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
IndividualFrame, IRI -> FrameIdValue
IriId IRI
iri)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IRI -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpression IRI
dpIri
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IRI -> MnchstrSntx -> MnchstrSntx
tIndividual IRI
iri (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TargetValue -> MnchstrSntx -> MnchstrSntx
tLiteral TargetValue
lit (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
FactsSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = Assertion -> Axiom
Assertion Assertion
ax Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- NegativeDataPropertyAssertion axiom
tAssertion ax :: Assertion
ax@(NegativeDataPropertyAssertion anns :: AxiomAnnotations
anns dpIri :: IRI
dpIri iri :: IRI
iri lit :: TargetValue
lit) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
FactsSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
IndividualFrame, IRI -> FrameIdValue
IriId IRI
iri)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IRI -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpression IRI
dpIri
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IRI -> MnchstrSntx -> MnchstrSntx
tIndividual IRI
iri (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TargetValue -> MnchstrSntx -> MnchstrSntx
tLiteral TargetValue
lit (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
FactsSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = Assertion -> Axiom
Assertion Assertion
ax Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

tAssertion _ ms :: MnchstrSntx
ms = MnchstrSntx
ms

-- | transform AnnotationAxiom axioms
tAnnotationAxiom :: AnnotationAxiom -> MnchstrSntx -> MnchstrSntx
-- AnnotationAssertion axiom
tAnnotationAxiom :: AnnotationAxiom -> MnchstrSntx -> MnchstrSntx
tAnnotationAxiom (AnnotationAssertion anns :: AxiomAnnotations
anns prop :: IRI
prop subj :: AnnotationSubject
subj value :: AnnotationValue
value) ms :: MnchstrSntx
ms = MnchstrSntx
res
    where
        frameIri :: IRI
frameIri = case AnnotationSubject
subj of
            AnnSubIri iri :: IRI
iri -> IRI
iri
            AnnSubAnInd iri :: IRI
iri -> IRI
iri

        m' :: MnchstrSntx
m' = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AnnotationValue -> MnchstrSntx -> MnchstrSntx
tAnnotationValue AnnotationValue
value
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IRI -> MnchstrSntx -> MnchstrSntx
tAnnotationProperty IRI
prop (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        ks :: [(FrameType, FrameIdValue)]
ks = (FrameType
 -> [(FrameType, FrameIdValue)] -> [(FrameType, FrameIdValue)])
-> [(FrameType, FrameIdValue)]
-> [FrameType]
-> [(FrameType, FrameIdValue)]
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (\f :: FrameType
f a :: [(FrameType, FrameIdValue)]
a -> [(FrameType, FrameIdValue)]
-> (Map FrameSectionType [Axiom] -> [(FrameType, FrameIdValue)])
-> Maybe (Map FrameSectionType [Axiom])
-> [(FrameType, FrameIdValue)]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [(FrameType, FrameIdValue)]
a ([(FrameType, FrameIdValue)]
-> Map FrameSectionType [Axiom] -> [(FrameType, FrameIdValue)]
forall a b. a -> b -> a
const ([(FrameType, FrameIdValue)]
 -> Map FrameSectionType [Axiom] -> [(FrameType, FrameIdValue)])
-> [(FrameType, FrameIdValue)]
-> Map FrameSectionType [Axiom]
-> [(FrameType, FrameIdValue)]
forall a b. (a -> b) -> a -> b
$ (FrameType
f, IRI -> FrameIdValue
IriId IRI
frameIri) (FrameType, FrameIdValue)
-> [(FrameType, FrameIdValue)] -> [(FrameType, FrameIdValue)]
forall a. a -> [a] -> [a]
: [(FrameType, FrameIdValue)]
a)
            ((FrameType, FrameIdValue)
-> MnchstrSntx -> Maybe (Map FrameSectionType [Axiom])
forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup (FrameType
f, IRI -> FrameIdValue
IriId IRI
frameIri) MnchstrSntx
m')) [] [FrameType
forall a. Bounded a => a
minBound..FrameType
forall a. Bounded a => a
maxBound]
        subTrees :: [Map FrameSectionType [Axiom]]
subTrees = ((FrameType, FrameIdValue) -> Map FrameSectionType [Axiom])
-> [(FrameType, FrameIdValue)] -> [Map FrameSectionType [Axiom]]
forall a b. (a -> b) -> [a] -> [b]
map (\k :: (FrameType, FrameIdValue)
k -> Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m') [(FrameType, FrameIdValue)]
ks
        axiomsList :: [[Axiom]]
axiomsList = (Map FrameSectionType [Axiom] -> [Axiom])
-> [Map FrameSectionType [Axiom]] -> [[Axiom]]
forall a b. (a -> b) -> [a] -> [b]
map ([Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
AnnotationsSection) [Map FrameSectionType [Axiom]]
subTrees
        newAxiom :: Axiom
newAxiom = AnnotationAxiom -> Axiom
AnnotationAxiom
            (AnnotationAxiom -> Axiom) -> AnnotationAxiom -> Axiom
forall a b. (a -> b) -> a -> b
$ (AxiomAnnotations
-> IRI -> AnnotationSubject -> AnnotationValue -> AnnotationAxiom
AnnotationAssertion AxiomAnnotations
anns IRI
prop (IRI -> AnnotationSubject
AnnSubIri IRI
frameIri) AnnotationValue
value) 
        newAxiomsList :: [[Axiom]]
newAxiomsList = ([Axiom] -> [Axiom]) -> [[Axiom]] -> [[Axiom]]
forall a b. (a -> b) -> [a] -> [b]
map (Axiom
newAxiomAxiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
:) ([[Axiom]] -> [[Axiom]]) -> [[Axiom]] -> [[Axiom]]
forall a b. (a -> b) -> a -> b
$ [[Axiom]]
axiomsList

        newSubTrees :: [Map FrameSectionType [Axiom]]
newSubTrees = ([Axiom]
 -> Map FrameSectionType [Axiom] -> Map FrameSectionType [Axiom])
-> [[Axiom]]
-> [Map FrameSectionType [Axiom]]
-> [Map FrameSectionType [Axiom]]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
AnnotationsSection)
            [[Axiom]]
newAxiomsList [Map FrameSectionType [Axiom]]
subTrees

        res :: MnchstrSntx
res = (MnchstrSntx
 -> ((FrameType, FrameIdValue), Map FrameSectionType [Axiom])
 -> MnchstrSntx)
-> MnchstrSntx
-> [((FrameType, FrameIdValue), Map FrameSectionType [Axiom])]
-> MnchstrSntx
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl (\m :: MnchstrSntx
m (k :: (FrameType, FrameIdValue)
k, st :: Map FrameSectionType [Axiom]
st) -> (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k Map FrameSectionType [Axiom]
st MnchstrSntx
m) MnchstrSntx
m' ([((FrameType, FrameIdValue), Map FrameSectionType [Axiom])]
 -> MnchstrSntx)
-> [((FrameType, FrameIdValue), Map FrameSectionType [Axiom])]
-> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ [(FrameType, FrameIdValue)]
-> [Map FrameSectionType [Axiom]]
-> [((FrameType, FrameIdValue), Map FrameSectionType [Axiom])]
forall a b. [a] -> [b] -> [(a, b)]
zip [(FrameType, FrameIdValue)]
ks [Map FrameSectionType [Axiom]]
newSubTrees

-- SubAnnotationPropertyOf axiom
tAnnotationAxiom ax :: AnnotationAxiom
ax@(SubAnnotationPropertyOf anns :: AxiomAnnotations
anns iri1 :: IRI
iri1 iri2 :: IRI
iri2) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
SubPropertyOfSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
AnnotationPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri1)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IRI -> MnchstrSntx -> MnchstrSntx
tAnnotationProperty IRI
iri2 (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
SubPropertyOfSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = AnnotationAxiom -> Axiom
AnnotationAxiom AnnotationAxiom
ax Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- AnnotationPropertyDomain axiom
tAnnotationAxiom ax :: AnnotationAxiom
ax@(AnnotationPropertyDomain anns :: AxiomAnnotations
anns iri1 :: IRI
iri1 _) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
DomainSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
AnnotationPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri1)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DomainSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = AnnotationAxiom -> Axiom
AnnotationAxiom AnnotationAxiom
ax Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

-- AnnotationPropertyRange axiom
tAnnotationAxiom ax :: AnnotationAxiom
ax@(AnnotationPropertyRange anns :: AxiomAnnotations
anns iri1 :: IRI
iri1 _) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
RangeSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
AnnotationPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri1)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
RangeSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = AnnotationAxiom -> Axiom
AnnotationAxiom AnnotationAxiom
ax Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs

tRule :: Rule -> MnchstrSntx -> MnchstrSntx
tRule :: Rule -> MnchstrSntx -> MnchstrSntx
tRule ax :: Rule
ax@(DLSafeRule anns :: AxiomAnnotations
anns body :: Body
body h :: Body
h) ms :: MnchstrSntx
ms =
    let k :: (FrameType, FrameIdValue)
k = (FrameType
RuleFrame, FrameIdValue
RuleId) 
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Body -> MnchstrSntx -> MnchstrSntx
tAtoms Body
body (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Body -> MnchstrSntx -> MnchstrSntx
tAtoms Body
h (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        m2 :: Map FrameSectionType [Axiom]
m2 = Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1
        axs :: [Axiom]
axs = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
RuleSection Map FrameSectionType [Axiom]
m2
        newAxioms :: [Axiom]
newAxioms = Rule -> Axiom
Rule Rule
ax Axiom -> [Axiom] -> [Axiom]
forall a. a -> [a] -> [a]
: [Axiom]
axs
    in (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (FrameSectionType
-> [Axiom]
-> Map FrameSectionType [Axiom]
-> Map FrameSectionType [Axiom]
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert FrameSectionType
RuleSection [Axiom]
newAxioms Map FrameSectionType [Axiom]
m2) MnchstrSntx
m1
    
tRule _ ms :: MnchstrSntx
ms = MnchstrSntx
ms

-- | transform Annotations
tAnnotations :: [Annotation] -> MnchstrSntx -> MnchstrSntx
tAnnotations :: AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations = (MnchstrSntx -> AxiomAnnotations -> MnchstrSntx)
-> AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((MnchstrSntx -> AxiomAnnotations -> MnchstrSntx)
 -> AxiomAnnotations -> MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> AxiomAnnotations -> MnchstrSntx)
-> AxiomAnnotations
-> MnchstrSntx
-> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ (Annotation -> MnchstrSntx -> MnchstrSntx)
-> MnchstrSntx -> AxiomAnnotations -> MnchstrSntx
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr Annotation -> MnchstrSntx -> MnchstrSntx
tAnnotation

tAnnotation :: Annotation -> MnchstrSntx -> MnchstrSntx
tAnnotation :: Annotation -> MnchstrSntx -> MnchstrSntx
tAnnotation (Annotation anns :: AxiomAnnotations
anns annProp :: IRI
annProp annVal :: AnnotationValue
annVal) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
m1) MnchstrSntx
m1
    where
        k :: (FrameType, FrameIdValue)
k = (FrameType
AnnotationPropertyFrame, IRI -> FrameIdValue
IriId IRI
annProp)
        m1 :: MnchstrSntx
m1 = AxiomAnnotations -> MnchstrSntx -> MnchstrSntx
tAnnotations AxiomAnnotations
anns (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AnnotationValue -> MnchstrSntx -> MnchstrSntx
tAnnotationValue AnnotationValue
annVal (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms

-- | transform AnnotationProperty
tAnnotationProperty :: IRI -> MnchstrSntx -> MnchstrSntx
tAnnotationProperty :: IRI -> MnchstrSntx -> MnchstrSntx
tAnnotationProperty iri :: IRI
iri ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
ms) MnchstrSntx
ms
    where k :: (FrameType, FrameIdValue)
k = (FrameType
AnnotationPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri)

-- | transform AnnotationValue
tAnnotationValue :: AnnotationValue -> MnchstrSntx -> MnchstrSntx
tAnnotationValue :: AnnotationValue -> MnchstrSntx -> MnchstrSntx
tAnnotationValue (AnnAnInd ind :: IRI
ind) ms :: MnchstrSntx
ms = IRI -> MnchstrSntx -> MnchstrSntx
tIndividual IRI
ind MnchstrSntx
ms
tAnnotationValue (AnnValue _) ms :: MnchstrSntx
ms = MnchstrSntx
ms
tAnnotationValue (AnnValLit lit :: TargetValue
lit) ms :: MnchstrSntx
ms = TargetValue -> MnchstrSntx -> MnchstrSntx
tLiteral TargetValue
lit MnchstrSntx
ms

-- | transform AnnotationSubject
tAnnotationSubject :: AnnotationSubject -> MnchstrSntx -> MnchstrSntx
tAnnotationSubject :: AnnotationSubject -> MnchstrSntx -> MnchstrSntx
tAnnotationSubject (AnnSubAnInd iri :: IRI
iri) ms :: MnchstrSntx
ms = IRI -> MnchstrSntx -> MnchstrSntx
tIndividual IRI
iri MnchstrSntx
ms
tAnnotationSubject _ ms :: MnchstrSntx
ms = MnchstrSntx
ms

-- | transform ClassExpression
tClassExpressions :: [ClassExpression] -> MnchstrSntx -> MnchstrSntx
tClassExpressions :: [ClassExpression] -> MnchstrSntx -> MnchstrSntx
tClassExpressions = (MnchstrSntx -> [ClassExpression] -> MnchstrSntx)
-> [ClassExpression] -> MnchstrSntx -> MnchstrSntx
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((MnchstrSntx -> [ClassExpression] -> MnchstrSntx)
 -> [ClassExpression] -> MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> [ClassExpression] -> MnchstrSntx)
-> [ClassExpression]
-> MnchstrSntx
-> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ (ClassExpression -> MnchstrSntx -> MnchstrSntx)
-> MnchstrSntx -> [ClassExpression] -> MnchstrSntx
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr ClassExpression -> MnchstrSntx -> MnchstrSntx
tClassExpression 

tClassExpression :: ClassExpression -> MnchstrSntx -> MnchstrSntx
tClassExpression :: ClassExpression -> MnchstrSntx -> MnchstrSntx
tClassExpression (Expression iri :: IRI
iri) ms :: MnchstrSntx
ms = 
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
ms) MnchstrSntx
ms
    where k :: (FrameType, FrameIdValue)
k = (FrameType
ClassFrame, IRI -> FrameIdValue
IriId IRI
iri)

tClassExpression (ObjectJunction _ clExprs :: [ClassExpression]
clExprs) ms :: MnchstrSntx
ms = [ClassExpression] -> MnchstrSntx -> MnchstrSntx
tClassExpressions [ClassExpression]
clExprs MnchstrSntx
ms

tClassExpression (ObjectComplementOf clExpr :: ClassExpression
clExpr) ms :: MnchstrSntx
ms = ClassExpression -> MnchstrSntx -> MnchstrSntx
tClassExpression ClassExpression
clExpr MnchstrSntx
ms

tClassExpression (ObjectOneOf inds :: [IRI]
inds) ms :: MnchstrSntx
ms = [IRI] -> MnchstrSntx -> MnchstrSntx
tIndividuals [IRI]
inds MnchstrSntx
ms

tClassExpression (ObjectValuesFrom _ obPropExpr :: ObjectPropertyExpression
obPropExpr clExpr :: ClassExpression
clExpr) ms :: MnchstrSntx
ms =
    Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
False ObjectPropertyExpression
obPropExpr
    (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ClassExpression -> MnchstrSntx -> MnchstrSntx
tClassExpression ClassExpression
clExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms

tClassExpression (ObjectHasValue obPropExpr :: ObjectPropertyExpression
obPropExpr ind :: IRI
ind) ms :: MnchstrSntx
ms =
    Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
False ObjectPropertyExpression
obPropExpr
    (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IRI -> MnchstrSntx -> MnchstrSntx
tIndividual IRI
ind (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms

tClassExpression (ObjectHasSelf obPropExpr :: ObjectPropertyExpression
obPropExpr) ms :: MnchstrSntx
ms = 
    Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
False ObjectPropertyExpression
obPropExpr MnchstrSntx
ms

tClassExpression (ObjectCardinality card :: Cardinality ObjectPropertyExpression ClassExpression
card) ms :: MnchstrSntx
ms =
    case Cardinality ObjectPropertyExpression ClassExpression
card of
        Cardinality _ _ obPropExpr :: ObjectPropertyExpression
obPropExpr (Just clExpr :: ClassExpression
clExpr) ->
            Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
False ObjectPropertyExpression
obPropExpr
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ClassExpression -> MnchstrSntx -> MnchstrSntx
tClassExpression ClassExpression
clExpr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        Cardinality _ _ obPropExpr :: ObjectPropertyExpression
obPropExpr Nothing ->
            Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
False ObjectPropertyExpression
obPropExpr MnchstrSntx
ms

tClassExpression (DataValuesFrom _ iris :: [IRI]
iris dr :: DataRange
dr) ms :: MnchstrSntx
ms =
    IRI -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpression ([IRI] -> IRI
forall a. [a] -> a
head [IRI]
iris) (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DataRange -> MnchstrSntx -> MnchstrSntx
tDataRange DataRange
dr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms

tClassExpression (DataHasValue dpExpr :: IRI
dpExpr lit :: TargetValue
lit) ms :: MnchstrSntx
ms =
    IRI -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpression IRI
dpExpr (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TargetValue -> MnchstrSntx -> MnchstrSntx
tLiteral TargetValue
lit (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms

tClassExpression (DataCardinality card :: Cardinality IRI DataRange
card) ms :: MnchstrSntx
ms =
    case Cardinality IRI DataRange
card of
        Cardinality _ _ dpExpr :: IRI
dpExpr (Just dr :: DataRange
dr) ->
            IRI -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpression IRI
dpExpr
            (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DataRange -> MnchstrSntx -> MnchstrSntx
tDataRange DataRange
dr (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms
        Cardinality _ _ dpExpr :: IRI
dpExpr Nothing ->
            IRI -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpression IRI
dpExpr MnchstrSntx
ms

-- | transform ObjectPropertyExpression
tObjectPropertyExpressions :: Bool -> [ObjectPropertyExpression]
    -> MnchstrSntx ->  MnchstrSntx
tObjectPropertyExpressions :: Bool -> PropertyExpressionChain -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpressions flag :: Bool
flag = (MnchstrSntx -> PropertyExpressionChain -> MnchstrSntx)
-> PropertyExpressionChain -> MnchstrSntx -> MnchstrSntx
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((MnchstrSntx -> PropertyExpressionChain -> MnchstrSntx)
 -> PropertyExpressionChain -> MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> PropertyExpressionChain -> MnchstrSntx)
-> PropertyExpressionChain
-> MnchstrSntx
-> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ (ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx)
-> MnchstrSntx -> PropertyExpressionChain -> MnchstrSntx
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
flag)

tObjectPropertyExpression :: Bool -> ObjectPropertyExpression
    -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression :: Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression _ (ObjectProp iri :: IRI
iri) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
ms) MnchstrSntx
ms
    where k :: (FrameType, FrameIdValue)
k = (FrameType
ObjectPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri)

tObjectPropertyExpression True (ObjectInverseOf expr :: ObjectPropertyExpression
expr) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k2 (Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k2 MnchstrSntx
m1) MnchstrSntx
m1
    where 
        iri :: IRI
iri = ObjectPropertyExpression -> IRI
obPropExprToIRI ObjectPropertyExpression
expr
        k1 :: (FrameType, FrameIdValue)
k1 = (FrameType
ObjectPropertyFrame, IRI -> FrameIdValue
ObjInvOfId IRI
iri)
        k2 :: (FrameType, FrameIdValue)
k2 = (FrameType
ObjectPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri)
        m1 :: MnchstrSntx
m1 = (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k1 (Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k1 MnchstrSntx
ms) MnchstrSntx
ms

tObjectPropertyExpression False (ObjectInverseOf expr :: ObjectPropertyExpression
expr) ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
ms) MnchstrSntx
ms
    where k :: (FrameType, FrameIdValue)
k = (FrameType
ObjectPropertyFrame, IRI -> FrameIdValue
IriId (IRI -> FrameIdValue)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> FrameIdValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
obPropExprToIRI (ObjectPropertyExpression -> FrameIdValue)
-> ObjectPropertyExpression -> FrameIdValue
forall a b. (a -> b) -> a -> b
$ ObjectPropertyExpression
expr)

-- | transform DataRange
tDataRange :: DataRange -> MnchstrSntx -> MnchstrSntx
tDataRange :: DataRange -> MnchstrSntx -> MnchstrSntx
tDataRange (DataType dt :: IRI
dt fvs :: [(IRI, TargetValue)]
fvs) ms :: MnchstrSntx
ms =
    IRI -> MnchstrSntx -> MnchstrSntx
tDatatype IRI
dt (MnchstrSntx -> MnchstrSntx)
-> ([(IRI, TargetValue)] -> MnchstrSntx)
-> [(IRI, TargetValue)]
-> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((IRI, TargetValue) -> MnchstrSntx -> MnchstrSntx)
-> MnchstrSntx -> [(IRI, TargetValue)] -> MnchstrSntx
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (\x :: (IRI, TargetValue)
x m :: MnchstrSntx
m -> TargetValue -> MnchstrSntx -> MnchstrSntx
tLiteral ((IRI, TargetValue) -> TargetValue
forall a b. (a, b) -> b
snd (IRI, TargetValue)
x) MnchstrSntx
m) MnchstrSntx
ms ([(IRI, TargetValue)] -> MnchstrSntx)
-> [(IRI, TargetValue)] -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ [(IRI, TargetValue)]
fvs

tDataRange (DataJunction _ drs :: [DataRange]
drs) ms :: MnchstrSntx
ms = (DataRange -> MnchstrSntx -> MnchstrSntx)
-> MnchstrSntx -> [DataRange] -> MnchstrSntx
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr DataRange -> MnchstrSntx -> MnchstrSntx
tDataRange MnchstrSntx
ms [DataRange]
drs

tDataRange (DataComplementOf dr :: DataRange
dr) ms :: MnchstrSntx
ms = DataRange -> MnchstrSntx -> MnchstrSntx
tDataRange DataRange
dr MnchstrSntx
ms

tDataRange (DataOneOf lits :: [TargetValue]
lits) ms :: MnchstrSntx
ms = (TargetValue -> MnchstrSntx -> MnchstrSntx)
-> MnchstrSntx -> [TargetValue] -> MnchstrSntx
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr TargetValue -> MnchstrSntx -> MnchstrSntx
tLiteral MnchstrSntx
ms [TargetValue]
lits

-- | transform Datatype
tDatatype :: Datatype -> MnchstrSntx -> MnchstrSntx
tDatatype :: IRI -> MnchstrSntx -> MnchstrSntx
tDatatype iri :: IRI
iri ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
ms) MnchstrSntx
ms
    where k :: (FrameType, FrameIdValue)
k = (FrameType
DatatypeFrame, IRI -> FrameIdValue
IriId IRI
iri)

-- | transform Literal
tLiteral :: Literal -> MnchstrSntx -> MnchstrSntx
tLiteral :: TargetValue -> MnchstrSntx -> MnchstrSntx
tLiteral (Literal _ t :: TypedOrUntyped
t) ms :: MnchstrSntx
ms = case TypedOrUntyped
t of
    Typed dt :: IRI
dt -> IRI -> MnchstrSntx -> MnchstrSntx
tDatatype IRI
dt MnchstrSntx
ms
    Untyped _ ->  IRI -> MnchstrSntx -> MnchstrSntx
tDatatype IRI
plainDatatypeIRI MnchstrSntx
ms

tLiteral (NumberLit _) ms :: MnchstrSntx
ms = MnchstrSntx
ms

-- | transform DataPropertyExpression
tDataPropertyExpressions :: [DataPropertyExpression]
    -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpressions :: [IRI] -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpressions = (MnchstrSntx -> [IRI] -> MnchstrSntx)
-> [IRI] -> MnchstrSntx -> MnchstrSntx
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((MnchstrSntx -> [IRI] -> MnchstrSntx)
 -> [IRI] -> MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> [IRI] -> MnchstrSntx)
-> [IRI]
-> MnchstrSntx
-> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ (IRI -> MnchstrSntx -> MnchstrSntx)
-> MnchstrSntx -> [IRI] -> MnchstrSntx
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr IRI -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpression

tDataPropertyExpression :: DataPropertyExpression
    -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpression :: IRI -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpression iri :: IRI
iri ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
ms) MnchstrSntx
ms
    where k :: (FrameType, FrameIdValue)
k = (FrameType
DataPropertyFrame, IRI -> FrameIdValue
IriId IRI
iri)

-- | transform Individual
tIndividuals :: [Individual] -> MnchstrSntx -> MnchstrSntx
tIndividuals :: [IRI] -> MnchstrSntx -> MnchstrSntx
tIndividuals = (MnchstrSntx -> [IRI] -> MnchstrSntx)
-> [IRI] -> MnchstrSntx -> MnchstrSntx
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((MnchstrSntx -> [IRI] -> MnchstrSntx)
 -> [IRI] -> MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> [IRI] -> MnchstrSntx)
-> [IRI]
-> MnchstrSntx
-> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ (IRI -> MnchstrSntx -> MnchstrSntx)
-> MnchstrSntx -> [IRI] -> MnchstrSntx
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr IRI -> MnchstrSntx -> MnchstrSntx
tIndividual

tIndividual :: Individual -> MnchstrSntx -> MnchstrSntx
tIndividual :: IRI -> MnchstrSntx -> MnchstrSntx
tIndividual iri :: IRI
iri ms :: MnchstrSntx
ms =
    (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom] -> MnchstrSntx -> MnchstrSntx
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (FrameType, FrameIdValue)
k (Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
k MnchstrSntx
ms) MnchstrSntx
ms
    where k :: (FrameType, FrameIdValue)
k = (FrameType
IndividualFrame, IRI -> FrameIdValue
IriId IRI
iri)

-- | transform Atoms
tAtoms :: [Atom] -> MnchstrSntx -> MnchstrSntx
tAtoms :: Body -> MnchstrSntx -> MnchstrSntx
tAtoms = (MnchstrSntx -> Body -> MnchstrSntx)
-> Body -> MnchstrSntx -> MnchstrSntx
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((MnchstrSntx -> Body -> MnchstrSntx)
 -> Body -> MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> Body -> MnchstrSntx)
-> Body
-> MnchstrSntx
-> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ (Atom -> MnchstrSntx -> MnchstrSntx)
-> MnchstrSntx -> Body -> MnchstrSntx
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr Atom -> MnchstrSntx -> MnchstrSntx
tAtom

tAtom :: Atom -> MnchstrSntx -> MnchstrSntx
tAtom :: Atom -> MnchstrSntx -> MnchstrSntx
tAtom (ClassAtom ce :: ClassExpression
ce iarg :: IndividualArg
iarg) ms :: MnchstrSntx
ms = ClassExpression -> MnchstrSntx -> MnchstrSntx
tClassExpression ClassExpression
ce (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IndividualArg -> MnchstrSntx -> MnchstrSntx
tIndividualArg IndividualArg
iarg (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms

tAtom (DataRangeAtom dr :: DataRange
dr darg :: DataArg
darg) ms :: MnchstrSntx
ms = DataRange -> MnchstrSntx -> MnchstrSntx
tDataRange DataRange
dr (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DataArg -> MnchstrSntx -> MnchstrSntx
tDataArg DataArg
darg (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms

tAtom (ObjectPropertyAtom oe :: ObjectPropertyExpression
oe iarg1 :: IndividualArg
iarg1 iarg2 :: IndividualArg
iarg2) ms :: MnchstrSntx
ms = Bool -> ObjectPropertyExpression -> MnchstrSntx -> MnchstrSntx
tObjectPropertyExpression Bool
True ObjectPropertyExpression
oe
    (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IndividualArg -> MnchstrSntx -> MnchstrSntx
tIndividualArg IndividualArg
iarg1 (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IndividualArg -> MnchstrSntx -> MnchstrSntx
tIndividualArg IndividualArg
iarg2 (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms

tAtom (DataPropertyAtom dp :: IRI
dp iarg :: IndividualArg
iarg darg :: DataArg
darg) ms :: MnchstrSntx
ms = IRI -> MnchstrSntx -> MnchstrSntx
tDataPropertyExpression IRI
dp
    (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IndividualArg -> MnchstrSntx -> MnchstrSntx
tIndividualArg IndividualArg
iarg (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DataArg -> MnchstrSntx -> MnchstrSntx
tDataArg DataArg
darg (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms

tAtom (BuiltInAtom _ dargs :: [DataArg]
dargs) ms :: MnchstrSntx
ms = (DataArg -> MnchstrSntx -> MnchstrSntx)
-> MnchstrSntx -> [DataArg] -> MnchstrSntx
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr DataArg -> MnchstrSntx -> MnchstrSntx
tDataArg MnchstrSntx
ms [DataArg]
dargs

tAtom (SameIndividualAtom iarg1 :: IndividualArg
iarg1 iarg2 :: IndividualArg
iarg2) ms :: MnchstrSntx
ms = IndividualArg -> MnchstrSntx -> MnchstrSntx
tIndividualArg IndividualArg
iarg1
    (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IndividualArg -> MnchstrSntx -> MnchstrSntx
tIndividualArg IndividualArg
iarg2 (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms

tAtom (DifferentIndividualsAtom iarg1 :: IndividualArg
iarg1 iarg2 :: IndividualArg
iarg2) ms :: MnchstrSntx
ms = IndividualArg -> MnchstrSntx -> MnchstrSntx
tIndividualArg IndividualArg
iarg1
    (MnchstrSntx -> MnchstrSntx)
-> (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IndividualArg -> MnchstrSntx -> MnchstrSntx
tIndividualArg IndividualArg
iarg2 (MnchstrSntx -> MnchstrSntx) -> MnchstrSntx -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms

tAtom atom :: Atom
atom _ = String -> MnchstrSntx
forall a. HasCallStack => String -> a
error (String -> MnchstrSntx) -> String -> MnchstrSntx
forall a b. (a -> b) -> a -> b
$ "Unexpected Atoms in SWRLRules: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Atom -> String
forall a. Show a => a -> String
show Atom
atom

-- | transform IndividualArg
tIndividualArg :: IndividualArg -> MnchstrSntx -> MnchstrSntx
tIndividualArg :: IndividualArg -> MnchstrSntx -> MnchstrSntx
tIndividualArg iarg :: IndividualArg
iarg ms :: MnchstrSntx
ms = case IndividualArg
iarg of
    IArg iri :: IRI
iri -> IRI -> MnchstrSntx -> MnchstrSntx
tIndividual IRI
iri MnchstrSntx
ms
    IVar _ -> MnchstrSntx
ms

-- | transform DataArg
tDataArg :: DataArg -> MnchstrSntx -> MnchstrSntx
tDataArg :: DataArg -> MnchstrSntx -> MnchstrSntx
tDataArg darg :: DataArg
darg ms :: MnchstrSntx
ms = case DataArg
darg of
    DArg lit :: TargetValue
lit -> TargetValue -> MnchstrSntx -> MnchstrSntx
tLiteral TargetValue
lit MnchstrSntx
ms
    DVar _ -> MnchstrSntx
ms
    
------------- main printing part ----------------  

printOntologyDocument :: OntologyDocument -> Doc
printOntologyDocument :: OntologyDocument -> Doc
printOntologyDocument (OntologyDocument _ prefDecls :: PrefixMap
prefDecls ont :: Ontology
ont) = 
        ([Doc] -> Doc
vcat ([Doc] -> Doc)
-> ([(String, IRI)] -> [Doc]) -> [(String, IRI)] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((String, IRI) -> Doc) -> [(String, IRI)] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (String, IRI) -> Doc
printPrefixDeclaration ([(String, IRI)] -> Doc) -> [(String, IRI)] -> Doc
forall a b. (a -> b) -> a -> b
$ PrefixMap -> [(String, IRI)]
forall k a. Map k a -> [(k, a)]
M.toList PrefixMap
prefDecls)
        Doc -> Doc -> Doc
$++$ PrefixMap -> Ontology -> Doc
printOntology PrefixMap
prefDecls Ontology
ont

printPrefixDeclaration :: (String, IRI) -> Doc
printPrefixDeclaration :: (String, IRI) -> Doc
printPrefixDeclaration (prName :: String
prName, iri :: IRI
iri) =
    [Doc] -> Doc
hsep [String -> Doc
keyword "Prefix:", String -> Doc
text (String
prName String -> ShowS
forall a. [a] -> [a] -> [a]
++ ":"), String -> Doc
text (String -> Doc) -> (IRI -> String) -> IRI -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IRI -> String
showIRIFull (IRI -> String) -> (IRI -> IRI) -> IRI -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> IRI -> IRI
setAngles Bool
True (IRI -> Doc) -> IRI -> Doc
forall a b. (a -> b) -> a -> b
$ IRI
iri]

printOntology :: GA.PrefixMap -> Ontology -> Doc
printOntology :: PrefixMap -> Ontology -> Doc
printOntology pds :: PrefixMap
pds 
    (Ontology mOntIRI :: Maybe IRI
mOntIRI mVersionIRI :: Maybe IRI
mVersionIRI importedDocs :: [IRI]
importedDocs annotations :: AxiomAnnotations
annotations axioms' :: [Axiom]
axioms') =
        String -> Doc
keyword "Ontology:"
        Doc -> Doc -> Doc
<+> Doc
ontIRI
        Doc -> Doc -> Doc
$++$ Doc
impDocs
        Doc -> Doc -> Doc
$++$ Doc
anns
        Doc -> Doc -> Doc
$++$ Doc
axs
    where
        versionIRI :: Doc
versionIRI = Doc -> (IRI -> Doc) -> Maybe IRI -> Doc
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Doc
empty (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds) Maybe IRI
mVersionIRI
        ontIRI :: Doc
ontIRI = Doc -> (IRI -> Doc) -> Maybe IRI -> Doc
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Doc
empty (\x :: IRI
x -> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
x Doc -> Doc -> Doc
<+> Doc
versionIRI) Maybe IRI
mOntIRI
        impDocs :: Doc
impDocs = [Doc] -> Doc
vcat ([Doc] -> Doc) -> ([IRI] -> [Doc]) -> [IRI] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (IRI -> Doc) -> [IRI] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map
            (\x :: IRI
x -> String -> Doc
keyword "Import:" Doc -> Doc -> Doc
<+> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
x) ([IRI] -> Doc) -> [IRI] -> Doc
forall a b. (a -> b) -> a -> b
$ [IRI]
importedDocs
        anns :: Doc
anns = PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds 0 AxiomAnnotations
annotations
        axiomsUnique :: [Axiom]
axiomsUnique = Set Axiom -> [Axiom]
forall a. Set a -> [a]
S.toList (Set Axiom -> [Axiom])
-> ([Axiom] -> Set Axiom) -> [Axiom] -> [Axiom]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Axiom] -> Set Axiom
forall a. Ord a => [a] -> Set a
S.fromList ([Axiom] -> [Axiom]) -> [Axiom] -> [Axiom]
forall a b. (a -> b) -> a -> b
$ [Axiom]
axioms'
        ms :: MnchstrSntx
ms = [Axiom] -> MnchstrSntx -> MnchstrSntx
tAxioms [Axiom]
axiomsUnique MnchstrSntx
emptyMS
        axs :: Doc
axs = PrefixMap -> MnchstrSntx -> Doc
printMS PrefixMap
pds MnchstrSntx
ms 

-- | print Manchester Syntax
printMS :: GA.PrefixMap -> MnchstrSntx -> Doc
printMS :: PrefixMap -> MnchstrSntx -> Doc
printMS pds :: PrefixMap
pds ms :: MnchstrSntx
ms = 
    [Doc] -> Doc
vsep [Doc
objectPropertyFrames, Doc
dataPropertyFrames, Doc
annotationPropertyFrames
        , Doc
datatypeFrames, Doc
classFrames, Doc
individualFrames, Doc
miscFrame, Doc
rules]
    where
        objectPropertyFrames :: Doc
objectPropertyFrames = PrefixMap -> Int -> MnchstrSntx -> Doc
printOPFs PrefixMap
pds 0 MnchstrSntx
ms
        dataPropertyFrames :: Doc
dataPropertyFrames = PrefixMap -> Int -> MnchstrSntx -> Doc
printDPFs PrefixMap
pds 0 MnchstrSntx
ms
        annotationPropertyFrames :: Doc
annotationPropertyFrames = PrefixMap -> Int -> MnchstrSntx -> Doc
printAPFs PrefixMap
pds 0 MnchstrSntx
ms
        datatypeFrames :: Doc
datatypeFrames = PrefixMap -> Int -> MnchstrSntx -> Doc
printDFs PrefixMap
pds 0 MnchstrSntx
ms
        classFrames :: Doc
classFrames = PrefixMap -> Int -> MnchstrSntx -> Doc
printCFs PrefixMap
pds 0 MnchstrSntx
ms
        individualFrames :: Doc
individualFrames = PrefixMap -> Int -> MnchstrSntx -> Doc
printIFs PrefixMap
pds 0 MnchstrSntx
ms
        miscFrame :: Doc
miscFrame = PrefixMap -> Int -> MnchstrSntx -> Doc
printMF PrefixMap
pds 0 MnchstrSntx
ms
        rules :: Doc
rules = PrefixMap -> Int -> MnchstrSntx -> Doc
printRules PrefixMap
pds 0 MnchstrSntx
ms

-------------------- Print Frames --------------------

-- | print Object Property Frames
printOPFs :: GA.PrefixMap -> Int -> MnchstrSntx -> Doc
printOPFs :: PrefixMap -> Int -> MnchstrSntx -> Doc
printOPFs pds :: PrefixMap
pds n :: Int
n ms :: MnchstrSntx
ms
    | [(FrameType, FrameIdValue)] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [(FrameType, FrameIdValue)]
headers = Doc
empty
    | Bool
otherwise = (Doc -> Doc -> Doc) -> Doc -> [Doc] -> Doc
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl Doc -> Doc -> Doc
($++$) Doc
empty
        ([Doc] -> Doc)
-> ([(FrameType, FrameIdValue)] -> [Doc])
-> [(FrameType, FrameIdValue)]
-> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((FrameType, FrameIdValue) -> Doc)
-> [(FrameType, FrameIdValue)] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (\h :: (FrameType, FrameIdValue)
h -> PrefixMap
-> Int
-> (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom]
-> Doc
printOPF PrefixMap
pds Int
n (FrameType, FrameIdValue)
h (Map FrameSectionType [Axiom] -> Doc)
-> Map FrameSectionType [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ Map FrameSectionType [Axiom]
-> (FrameType, FrameIdValue)
-> MnchstrSntx
-> Map FrameSectionType [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault Map FrameSectionType [Axiom]
forall k a. Map k a
M.empty (FrameType, FrameIdValue)
h MnchstrSntx
ms)
        ([(FrameType, FrameIdValue)] -> Doc)
-> [(FrameType, FrameIdValue)] -> Doc
forall a b. (a -> b) -> a -> b
$ [(FrameType, FrameIdValue)]
headers
    where
        headers :: [(FrameType, FrameIdValue)]
headers = ((FrameType, FrameIdValue) -> Bool)
-> [(FrameType, FrameIdValue)] -> [(FrameType, FrameIdValue)]
forall a. (a -> Bool) -> [a] -> [a]
filter ((FrameType -> FrameType -> Bool
forall a. Eq a => a -> a -> Bool
== FrameType
ObjectPropertyFrame) (FrameType -> Bool)
-> ((FrameType, FrameIdValue) -> FrameType)
-> (FrameType, FrameIdValue)
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FrameType, FrameIdValue) -> FrameType
forall a b. (a, b) -> a
fst) ([(FrameType, FrameIdValue)] -> [(FrameType, FrameIdValue)])
-> (MnchstrSntx -> [(FrameType, FrameIdValue)])
-> MnchstrSntx
-> [(FrameType, FrameIdValue)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MnchstrSntx -> [(FrameType, FrameIdValue)]
forall k a. Map k a -> [k]
M.keys (MnchstrSntx -> [(FrameType, FrameIdValue)])
-> MnchstrSntx -> [(FrameType, FrameIdValue)]
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms

-- | print Object Property Frame
printOPF :: GA.PrefixMap -> Int -> FrameId
    -> M.Map FrameSectionType [Axiom] -> Doc
printOPF :: PrefixMap
-> Int
-> (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom]
-> Doc
printOPF pds :: PrefixMap
pds n :: Int
n header :: (FrameType, FrameIdValue)
header body :: Map FrameSectionType [Axiom]
body =
    [Doc] -> Doc
vcat [Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
objectPropertyC Doc -> Doc -> Doc
<+> PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds Int
n AxiomAnnotations
annos Doc -> Doc -> Doc
<+> Doc
hDoc
        , Doc
annDoc, Doc
subPropOfDoc, Doc
subPropChainDoc, Doc
eqDoc, Doc
disjDoc
        , Doc
invDoc, Doc
domDoc, Doc
rangeDoc, Doc
charsDoc]
    where
        hDoc :: Doc
hDoc = case (FrameType, FrameIdValue) -> FrameIdValue
forall a b. (a, b) -> b
snd (FrameType, FrameIdValue)
header of 
                IriId iri :: IRI
iri -> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri
                ObjInvOfId iri :: IRI
iri -> String -> Doc
keyword String
inverseS Doc -> Doc -> Doc
<+> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri
                s :: FrameIdValue
s -> String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Unexpected Frame ID: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ FrameIdValue -> String
forall a. Show a => a -> String
show FrameIdValue
s

        declAxioms :: [Axiom]
declAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DeclarationSection Map FrameSectionType [Axiom]
body
        annos :: AxiomAnnotations
annos = [Axiom] -> AxiomAnnotations
getAnnosFromDeclarationAxioms [Axiom]
declAxioms

        annAxioms :: [Axiom]
annAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
AnnotationsSection Map FrameSectionType [Axiom]
body
        annDoc :: Doc
annDoc = PrefixMap -> Int -> [AnnotationAxiom] -> Doc
annotationAssertionsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)
            ([AnnotationAxiom] -> Doc)
-> ([Axiom] -> [AnnotationAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> AnnotationAxiom) -> [Axiom] -> [AnnotationAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> AnnotationAxiom
unpackAnnotationAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
annAxioms

        subPropOfAxioms :: [Axiom]
subPropOfAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
SubPropertyOfSection Map FrameSectionType [Axiom]
body
        subPropOfDoc :: Doc
subPropOfDoc = PrefixMap
-> Int -> FrameSectionType -> [ObjectPropertyAxiom] -> Doc
opAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
SubPropertyOfSection
            ([ObjectPropertyAxiom] -> Doc)
-> ([Axiom] -> [ObjectPropertyAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> ObjectPropertyAxiom) -> [Axiom] -> [ObjectPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> ObjectPropertyAxiom
unpackObjectPropertyAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
subPropOfAxioms
        
        subPropChainAxioms :: [Axiom]
subPropChainAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
SubPropertyChainSection Map FrameSectionType [Axiom]
body
        subPropChainDoc :: Doc
subPropChainDoc = PrefixMap
-> Int -> FrameSectionType -> [ObjectPropertyAxiom] -> Doc
opAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
SubPropertyChainSection
            ([ObjectPropertyAxiom] -> Doc)
-> ([Axiom] -> [ObjectPropertyAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> ObjectPropertyAxiom) -> [Axiom] -> [ObjectPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> ObjectPropertyAxiom
unpackObjectPropertyAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
subPropChainAxioms

        eqAxioms :: [Axiom]
eqAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
EquivalentToSection Map FrameSectionType [Axiom]
body
        eqDoc :: Doc
eqDoc = PrefixMap
-> Int -> FrameSectionType -> [ObjectPropertyAxiom] -> Doc
opAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
EquivalentToSection
            ([ObjectPropertyAxiom] -> Doc)
-> ([Axiom] -> [ObjectPropertyAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> ObjectPropertyAxiom) -> [Axiom] -> [ObjectPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> ObjectPropertyAxiom
unpackObjectPropertyAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
eqAxioms

        disjAxioms :: [Axiom]
disjAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DisjointWithSection Map FrameSectionType [Axiom]
body
        disjDoc :: Doc
disjDoc = PrefixMap
-> Int -> FrameSectionType -> [ObjectPropertyAxiom] -> Doc
opAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
DisjointWithSection
            ([ObjectPropertyAxiom] -> Doc)
-> ([Axiom] -> [ObjectPropertyAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> ObjectPropertyAxiom) -> [Axiom] -> [ObjectPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> ObjectPropertyAxiom
unpackObjectPropertyAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
disjAxioms

        invAxioms :: [Axiom]
invAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
InverseOfSection Map FrameSectionType [Axiom]
body
        invDoc :: Doc
invDoc = PrefixMap
-> Int -> FrameSectionType -> [ObjectPropertyAxiom] -> Doc
opAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
InverseOfSection
            ([ObjectPropertyAxiom] -> Doc)
-> ([Axiom] -> [ObjectPropertyAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> ObjectPropertyAxiom) -> [Axiom] -> [ObjectPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> ObjectPropertyAxiom
unpackObjectPropertyAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
invAxioms

        domAxioms :: [Axiom]
domAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DomainSection Map FrameSectionType [Axiom]
body
        domDoc :: Doc
domDoc = PrefixMap
-> Int -> FrameSectionType -> [ObjectPropertyAxiom] -> Doc
opAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
DomainSection
            ([ObjectPropertyAxiom] -> Doc)
-> ([Axiom] -> [ObjectPropertyAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> ObjectPropertyAxiom) -> [Axiom] -> [ObjectPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> ObjectPropertyAxiom
unpackObjectPropertyAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
domAxioms

        rangeAxioms :: [Axiom]
rangeAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
RangeSection Map FrameSectionType [Axiom]
body
        rangeDoc :: Doc
rangeDoc = PrefixMap
-> Int -> FrameSectionType -> [ObjectPropertyAxiom] -> Doc
opAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
RangeSection
            ([ObjectPropertyAxiom] -> Doc)
-> ([Axiom] -> [ObjectPropertyAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> ObjectPropertyAxiom) -> [Axiom] -> [ObjectPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> ObjectPropertyAxiom
unpackObjectPropertyAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
rangeAxioms

        charsAxioms :: [Axiom]
charsAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
CharacteristicsSection Map FrameSectionType [Axiom]
body
        charsDoc :: Doc
charsDoc = PrefixMap
-> Int -> FrameSectionType -> [ObjectPropertyAxiom] -> Doc
opAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
CharacteristicsSection
            ([ObjectPropertyAxiom] -> Doc)
-> ([Axiom] -> [ObjectPropertyAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> ObjectPropertyAxiom) -> [Axiom] -> [ObjectPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> ObjectPropertyAxiom
unpackObjectPropertyAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
charsAxioms

annotationAssertionsToDoc :: GA.PrefixMap -> Int -> [AnnotationAxiom]
    -> Doc
annotationAssertionsToDoc :: PrefixMap -> Int -> [AnnotationAxiom] -> Doc
annotationAssertionsToDoc _ _ [] = Doc
empty
annotationAssertionsToDoc pds :: PrefixMap
pds n :: Int
n axs :: [AnnotationAxiom]
axs =
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
annotationsC
    Doc -> Doc -> Doc
$+$
    ([Doc] -> Doc
vcat ([Doc] -> Doc)
-> ([AnnotationAxiom] -> [Doc]) -> [AnnotationAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([AnnotationAxiom] -> [Doc]) -> [AnnotationAxiom] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AnnotationAxiom -> Doc) -> [AnnotationAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> AnnotationAxiom -> Doc
printAnnAssertion PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([AnnotationAxiom] -> Doc) -> [AnnotationAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [AnnotationAxiom]
axs)

opAxiomsToDoc :: GA.PrefixMap -> Int -> FrameSectionType
    -> [ObjectPropertyAxiom] -> Doc
opAxiomsToDoc :: PrefixMap
-> Int -> FrameSectionType -> [ObjectPropertyAxiom] -> Doc
opAxiomsToDoc _ _ _ [] = Doc
empty

opAxiomsToDoc pds :: PrefixMap
pds n :: Int
n SubPropertyOfSection axs :: [ObjectPropertyAxiom]
axs =
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
subPropertyOfC
    Doc -> Doc -> Doc
$+$
    ([Doc] -> Doc
vcat ([Doc] -> Doc)
-> ([ObjectPropertyAxiom] -> [Doc]) -> [ObjectPropertyAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma
        ([Doc] -> [Doc])
-> ([ObjectPropertyAxiom] -> [Doc])
-> [ObjectPropertyAxiom]
-> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ObjectPropertyAxiom -> Doc) -> [ObjectPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printSubPropOf PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([ObjectPropertyAxiom] -> Doc) -> [ObjectPropertyAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [ObjectPropertyAxiom]
axs)

opAxiomsToDoc pds :: PrefixMap
pds n :: Int
n SubPropertyChainSection axs :: [ObjectPropertyAxiom]
axs =
    [Doc] -> Doc
vsep
    ([Doc] -> Doc)
-> ([ObjectPropertyAxiom] -> [Doc]) -> [ObjectPropertyAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Doc -> Doc) -> [Doc] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (\d :: Doc
d -> Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
subPropertyChainC Doc -> Doc -> Doc
$+$ Doc
d)
    ([Doc] -> [Doc])
-> ([ObjectPropertyAxiom] -> [Doc])
-> [ObjectPropertyAxiom]
-> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ObjectPropertyAxiom -> Doc) -> [ObjectPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printSubPropChain PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1))
    ([ObjectPropertyAxiom] -> Doc) -> [ObjectPropertyAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [ObjectPropertyAxiom]
axs

opAxiomsToDoc pds :: PrefixMap
pds n :: Int
n EquivalentToSection axs :: [ObjectPropertyAxiom]
axs =
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
equivalentToC
    Doc -> Doc -> Doc
$+$
    ([Doc] -> Doc
vcat ([Doc] -> Doc)
-> ([ObjectPropertyAxiom] -> [Doc]) -> [ObjectPropertyAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([ObjectPropertyAxiom] -> [Doc])
-> [ObjectPropertyAxiom]
-> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ObjectPropertyAxiom -> Doc) -> [ObjectPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printEqObProp PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([ObjectPropertyAxiom] -> Doc) -> [ObjectPropertyAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [ObjectPropertyAxiom]
axs)

opAxiomsToDoc pds :: PrefixMap
pds n :: Int
n DisjointWithSection axs :: [ObjectPropertyAxiom]
axs =
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
disjointWithC
    Doc -> Doc -> Doc
$+$
    ([Doc] -> Doc
vcat ([Doc] -> Doc)
-> ([ObjectPropertyAxiom] -> [Doc]) -> [ObjectPropertyAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([ObjectPropertyAxiom] -> [Doc])
-> [ObjectPropertyAxiom]
-> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ObjectPropertyAxiom -> Doc) -> [ObjectPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printDisjObProp PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([ObjectPropertyAxiom] -> Doc) -> [ObjectPropertyAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [ObjectPropertyAxiom]
axs)

opAxiomsToDoc pds :: PrefixMap
pds n :: Int
n InverseOfSection axs :: [ObjectPropertyAxiom]
axs =
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
inverseOfC
    Doc -> Doc -> Doc
$+$
    ([Doc] -> Doc
vcat ([Doc] -> Doc)
-> ([ObjectPropertyAxiom] -> [Doc]) -> [ObjectPropertyAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([ObjectPropertyAxiom] -> [Doc])
-> [ObjectPropertyAxiom]
-> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ObjectPropertyAxiom -> Doc) -> [ObjectPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printInvObProp PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([ObjectPropertyAxiom] -> Doc) -> [ObjectPropertyAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [ObjectPropertyAxiom]
axs)

opAxiomsToDoc pds :: PrefixMap
pds n :: Int
n DomainSection axs :: [ObjectPropertyAxiom]
axs =
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
domainC
    Doc -> Doc -> Doc
$+$
    ([Doc] -> Doc
vcat ([Doc] -> Doc)
-> ([ObjectPropertyAxiom] -> [Doc]) -> [ObjectPropertyAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([ObjectPropertyAxiom] -> [Doc])
-> [ObjectPropertyAxiom]
-> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ObjectPropertyAxiom -> Doc) -> [ObjectPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printObPropDom PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([ObjectPropertyAxiom] -> Doc) -> [ObjectPropertyAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [ObjectPropertyAxiom]
axs)

opAxiomsToDoc pds :: PrefixMap
pds n :: Int
n RangeSection axs :: [ObjectPropertyAxiom]
axs =
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
rangeC
    Doc -> Doc -> Doc
$+$
    ([Doc] -> Doc
vcat ([Doc] -> Doc)
-> ([ObjectPropertyAxiom] -> [Doc]) -> [ObjectPropertyAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([ObjectPropertyAxiom] -> [Doc])
-> [ObjectPropertyAxiom]
-> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ObjectPropertyAxiom -> Doc) -> [ObjectPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printObPropRange PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([ObjectPropertyAxiom] -> Doc) -> [ObjectPropertyAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [ObjectPropertyAxiom]
axs)

opAxiomsToDoc pds :: PrefixMap
pds n :: Int
n CharacteristicsSection axs :: [ObjectPropertyAxiom]
axs =
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
characteristicsC
    Doc -> Doc -> Doc
$+$
    ([Doc] -> Doc
vcat ([Doc] -> Doc)
-> ([ObjectPropertyAxiom] -> [Doc]) -> [ObjectPropertyAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([ObjectPropertyAxiom] -> [Doc])
-> [ObjectPropertyAxiom]
-> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ObjectPropertyAxiom -> Doc) -> [ObjectPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printCharacteristics PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([ObjectPropertyAxiom] -> Doc) -> [ObjectPropertyAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [ObjectPropertyAxiom]
axs)

opAxiomsToDoc  _ _ s :: FrameSectionType
s _ = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Unexpected Section type in ObjectProperty Frame: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ FrameSectionType -> String
forall a. Show a => a -> String
show FrameSectionType
s

printSubPropOf :: GA.PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printSubPropOf :: PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printSubPropOf pds :: PrefixMap
pds n :: Int
n (SubObjectPropertyOf anns :: AxiomAnnotations
anns 
    (SubObjPropExpr_obj _) opExpr :: ObjectPropertyExpression
opExpr) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
opExpr

printSubPropOf _ _ ax :: ObjectPropertyAxiom
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Expected SubObjectPropertyOf, got: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ ObjectPropertyAxiom -> String
forall a. Show a => a -> String
show ObjectPropertyAxiom
ax


printSubPropChain :: GA.PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printSubPropChain :: PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printSubPropChain pds :: PrefixMap
pds n :: Int
n (SubObjectPropertyOf anns :: AxiomAnnotations
anns
    (SubObjPropExpr_exprchain opExprs :: PropertyExpressionChain
opExprs) _) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> 
    ([Doc] -> Doc
hcat ([Doc] -> Doc)
-> (PropertyExpressionChain -> [Doc])
-> PropertyExpressionChain
-> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate (String -> Doc
text " o ")
    ([Doc] -> [Doc])
-> (PropertyExpressionChain -> [Doc])
-> PropertyExpressionChain
-> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ObjectPropertyExpression -> Doc)
-> PropertyExpressionChain -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds) (PropertyExpressionChain -> Doc) -> PropertyExpressionChain -> Doc
forall a b. (a -> b) -> a -> b
$ PropertyExpressionChain
opExprs)
    
printSubPropChain _ _ ax :: ObjectPropertyAxiom
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Expected SubObjectPropertyOf, got: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ ObjectPropertyAxiom -> String
forall a. Show a => a -> String
show ObjectPropertyAxiom
ax

printEqObProp :: GA.PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printEqObProp :: PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printEqObProp pds :: PrefixMap
pds n :: Int
n (EquivalentObjectProperties anns :: AxiomAnnotations
anns (_:es :: PropertyExpressionChain
es)) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    ([Doc] -> Doc
vcat ([Doc] -> Doc)
-> (PropertyExpressionChain -> [Doc])
-> PropertyExpressionChain
-> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma
    ([Doc] -> [Doc])
-> (PropertyExpressionChain -> [Doc])
-> PropertyExpressionChain
-> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ObjectPropertyExpression -> Doc)
-> PropertyExpressionChain -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (\e :: ObjectPropertyExpression
e -> Int -> Doc
tabs (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)
        Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
e) (PropertyExpressionChain -> Doc) -> PropertyExpressionChain -> Doc
forall a b. (a -> b) -> a -> b
$ PropertyExpressionChain
es)

printEqObProp _ _ ax :: ObjectPropertyAxiom
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Expected EquivalentObjectProperties, got: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ ObjectPropertyAxiom -> String
forall a. Show a => a -> String
show ObjectPropertyAxiom
ax

printDisjObProp :: GA.PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printDisjObProp :: PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printDisjObProp pds :: PrefixMap
pds n :: Int
n (DisjointObjectProperties anns :: AxiomAnnotations
anns (_:es :: PropertyExpressionChain
es)) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    ([Doc] -> Doc
vcat ([Doc] -> Doc)
-> (PropertyExpressionChain -> [Doc])
-> PropertyExpressionChain
-> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma
    ([Doc] -> [Doc])
-> (PropertyExpressionChain -> [Doc])
-> PropertyExpressionChain
-> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ObjectPropertyExpression -> Doc)
-> PropertyExpressionChain -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (\e :: ObjectPropertyExpression
e -> Int -> Doc
tabs (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)
        Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
e) (PropertyExpressionChain -> Doc) -> PropertyExpressionChain -> Doc
forall a b. (a -> b) -> a -> b
$ PropertyExpressionChain
es)

printDisjObProp _ _ ax :: ObjectPropertyAxiom
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Expected DisjointObjectProperties, got: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ ObjectPropertyAxiom -> String
forall a. Show a => a -> String
show ObjectPropertyAxiom
ax

printInvObProp :: GA.PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printInvObProp :: PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printInvObProp pds :: PrefixMap
pds n :: Int
n (InverseObjectProperties anns :: AxiomAnnotations
anns _ opExpr :: ObjectPropertyExpression
opExpr) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
opExpr
printInvObProp _ _ ax :: ObjectPropertyAxiom
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Expected InverseObjectProperties, got: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ ObjectPropertyAxiom -> String
forall a. Show a => a -> String
show ObjectPropertyAxiom
ax

printObPropDom :: GA.PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printObPropDom :: PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printObPropDom pds :: PrefixMap
pds n :: Int
n (ObjectPropertyDomain anns :: AxiomAnnotations
anns _ clExpr :: ClassExpression
clExpr) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
clExpr

printObPropDom _ _ ax :: ObjectPropertyAxiom
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Expected ObjectPropertyDomain, got: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ ObjectPropertyAxiom -> String
forall a. Show a => a -> String
show ObjectPropertyAxiom
ax

printObPropRange :: GA.PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printObPropRange :: PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printObPropRange pds :: PrefixMap
pds n :: Int
n (ObjectPropertyRange anns :: AxiomAnnotations
anns _ clExpr :: ClassExpression
clExpr) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
clExpr

printObPropRange _ _ ax :: ObjectPropertyAxiom
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Expected ObjectPropertyRange, got: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ ObjectPropertyAxiom -> String
forall a. Show a => a -> String
show ObjectPropertyAxiom
ax

printCharacteristics :: GA.PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printCharacteristics :: PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printCharacteristics pds :: PrefixMap
pds n :: Int
n (FunctionalObjectProperty anns :: AxiomAnnotations
anns _) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
functionalS

printCharacteristics pds :: PrefixMap
pds n :: Int
n (InverseFunctionalObjectProperty anns :: AxiomAnnotations
anns _) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
inverseFunctionalS

printCharacteristics pds :: PrefixMap
pds n :: Int
n (ReflexiveObjectProperty anns :: AxiomAnnotations
anns _) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
reflexiveS

printCharacteristics pds :: PrefixMap
pds n :: Int
n (IrreflexiveObjectProperty anns :: AxiomAnnotations
anns _) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
irreflexiveS

printCharacteristics pds :: PrefixMap
pds n :: Int
n (SymmetricObjectProperty anns :: AxiomAnnotations
anns _) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
symmetricS

printCharacteristics pds :: PrefixMap
pds n :: Int
n (AsymmetricObjectProperty anns :: AxiomAnnotations
anns _) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
asymmetricS

printCharacteristics pds :: PrefixMap
pds n :: Int
n (TransitiveObjectProperty anns :: AxiomAnnotations
anns _) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
transitiveS

printCharacteristics  _ _ ax :: ObjectPropertyAxiom
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Expected ObjectPropertyAxiom, got: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ ObjectPropertyAxiom -> String
forall a. Show a => a -> String
show ObjectPropertyAxiom
ax

printAnnAssertion :: GA.PrefixMap -> Int -> AnnotationAxiom -> Doc
printAnnAssertion :: PrefixMap -> Int -> AnnotationAxiom -> Doc
printAnnAssertion pds :: PrefixMap
pds n :: Int
n (AnnotationAssertion anns :: AxiomAnnotations
anns prop :: IRI
prop _ value :: AnnotationValue
value) =
    PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) AxiomAnnotations
anns
    Doc -> Doc -> Doc
$+$
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
prop Doc -> Doc -> Doc
<+> PrefixMap -> AnnotationValue -> Doc
printAnnotationValue PrefixMap
pds AnnotationValue