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
value

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

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

-- | print Data Property Frames
printDPFs :: GA.PrefixMap -> Int -> MnchstrSntx -> Doc
printDPFs :: PrefixMap -> Int -> MnchstrSntx -> Doc
printDPFs 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
printDPF 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
DataPropertyFrame) (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 Data Property Frame
printDPF :: GA.PrefixMap -> Int -> FrameId
    -> M.Map FrameSectionType [Axiom] -> Doc
printDPF :: PrefixMap
-> Int
-> (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom]
-> Doc
printDPF 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
dataPropertyC Doc -> Doc -> Doc
<+> PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds Int
n AxiomAnnotations
annos Doc -> Doc -> Doc
<+> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri
        , Doc
annDoc, Doc
subDataPropOfDoc, Doc
eqDataPropsDoc, Doc
disjDataPropsDoc
        , Doc
domDataPropDoc, Doc
rangeDataPropDoc, Doc
funcDataPropDoc]
    where
        IriId iri :: IRI
iri = (FrameType, FrameIdValue) -> FrameIdValue
forall a b. (a, b) -> b
snd (FrameType, FrameIdValue)
header

        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

        subDataPropOfAxioms :: [Axiom]
subDataPropOfAxioms = [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
        subDataPropOfDoc :: Doc
subDataPropOfDoc = PrefixMap -> Int -> FrameSectionType -> [DataPropertyAxiom] -> Doc
dpAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
SubPropertyOfSection
            ([DataPropertyAxiom] -> Doc)
-> ([Axiom] -> [DataPropertyAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> DataPropertyAxiom) -> [Axiom] -> [DataPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> DataPropertyAxiom
unpackDataPropertyAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
subDataPropOfAxioms

        eqDataPropsAxioms :: [Axiom]
eqDataPropsAxioms = [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
        eqDataPropsDoc :: Doc
eqDataPropsDoc = PrefixMap -> Int -> FrameSectionType -> [DataPropertyAxiom] -> Doc
dpAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
EquivalentToSection
            ([DataPropertyAxiom] -> Doc)
-> ([Axiom] -> [DataPropertyAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> DataPropertyAxiom) -> [Axiom] -> [DataPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> DataPropertyAxiom
unpackDataPropertyAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
eqDataPropsAxioms

        disjDataPropsAxioms :: [Axiom]
disjDataPropsAxioms = [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
        disjDataPropsDoc :: Doc
disjDataPropsDoc = PrefixMap -> Int -> FrameSectionType -> [DataPropertyAxiom] -> Doc
dpAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
DisjointWithSection
            ([DataPropertyAxiom] -> Doc)
-> ([Axiom] -> [DataPropertyAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> DataPropertyAxiom) -> [Axiom] -> [DataPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> DataPropertyAxiom
unpackDataPropertyAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
disjDataPropsAxioms

        domDataPropAxioms :: [Axiom]
domDataPropAxioms = [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
        domDataPropDoc :: Doc
domDataPropDoc = PrefixMap -> Int -> FrameSectionType -> [DataPropertyAxiom] -> Doc
dpAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
DomainSection
            ([DataPropertyAxiom] -> Doc)
-> ([Axiom] -> [DataPropertyAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> DataPropertyAxiom) -> [Axiom] -> [DataPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> DataPropertyAxiom
unpackDataPropertyAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
domDataPropAxioms

        rangeDataPropAxioms :: [Axiom]
rangeDataPropAxioms = [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
        rangeDataPropDoc :: Doc
rangeDataPropDoc = PrefixMap -> Int -> FrameSectionType -> [DataPropertyAxiom] -> Doc
dpAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
RangeSection
            ([DataPropertyAxiom] -> Doc)
-> ([Axiom] -> [DataPropertyAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> DataPropertyAxiom) -> [Axiom] -> [DataPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> DataPropertyAxiom
unpackDataPropertyAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
rangeDataPropAxioms

        funcDataPropAxioms :: [Axiom]
funcDataPropAxioms = [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
        funcDataPropDoc :: Doc
funcDataPropDoc = PrefixMap -> Int -> FrameSectionType -> [DataPropertyAxiom] -> Doc
dpAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
CharacteristicsSection
            ([DataPropertyAxiom] -> Doc)
-> ([Axiom] -> [DataPropertyAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> DataPropertyAxiom) -> [Axiom] -> [DataPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> DataPropertyAxiom
unpackDataPropertyAxiom ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
funcDataPropAxioms

dpAxiomsToDoc :: GA.PrefixMap -> Int -> FrameSectionType
    -> [DataPropertyAxiom] -> Doc
dpAxiomsToDoc :: PrefixMap -> Int -> FrameSectionType -> [DataPropertyAxiom] -> Doc
dpAxiomsToDoc _ _ _ [] = Doc
empty

dpAxiomsToDoc pds :: PrefixMap
pds n :: Int
n SubPropertyOfSection axs :: [DataPropertyAxiom]
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)
-> ([DataPropertyAxiom] -> [Doc]) -> [DataPropertyAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma
        ([Doc] -> [Doc])
-> ([DataPropertyAxiom] -> [Doc]) -> [DataPropertyAxiom] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DataPropertyAxiom -> Doc) -> [DataPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> DataPropertyAxiom -> Doc
printDataPropAxiom PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([DataPropertyAxiom] -> Doc) -> [DataPropertyAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [DataPropertyAxiom]
axs)

dpAxiomsToDoc pds :: PrefixMap
pds n :: Int
n EquivalentToSection axs :: [DataPropertyAxiom]
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)
-> ([DataPropertyAxiom] -> [Doc]) -> [DataPropertyAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma
        ([Doc] -> [Doc])
-> ([DataPropertyAxiom] -> [Doc]) -> [DataPropertyAxiom] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DataPropertyAxiom -> Doc) -> [DataPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> DataPropertyAxiom -> Doc
printDataPropAxiom PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([DataPropertyAxiom] -> Doc) -> [DataPropertyAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [DataPropertyAxiom]
axs)

dpAxiomsToDoc pds :: PrefixMap
pds n :: Int
n DisjointWithSection axs :: [DataPropertyAxiom]
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)
-> ([DataPropertyAxiom] -> [Doc]) -> [DataPropertyAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma
        ([Doc] -> [Doc])
-> ([DataPropertyAxiom] -> [Doc]) -> [DataPropertyAxiom] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DataPropertyAxiom -> Doc) -> [DataPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> DataPropertyAxiom -> Doc
printDataPropAxiom PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([DataPropertyAxiom] -> Doc) -> [DataPropertyAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [DataPropertyAxiom]
axs)

dpAxiomsToDoc pds :: PrefixMap
pds n :: Int
n DomainSection axs :: [DataPropertyAxiom]
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)
-> ([DataPropertyAxiom] -> [Doc]) -> [DataPropertyAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma
        ([Doc] -> [Doc])
-> ([DataPropertyAxiom] -> [Doc]) -> [DataPropertyAxiom] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DataPropertyAxiom -> Doc) -> [DataPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> DataPropertyAxiom -> Doc
printDataPropAxiom PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([DataPropertyAxiom] -> Doc) -> [DataPropertyAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [DataPropertyAxiom]
axs)

dpAxiomsToDoc pds :: PrefixMap
pds n :: Int
n RangeSection axs :: [DataPropertyAxiom]
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)
-> ([DataPropertyAxiom] -> [Doc]) -> [DataPropertyAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma
        ([Doc] -> [Doc])
-> ([DataPropertyAxiom] -> [Doc]) -> [DataPropertyAxiom] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DataPropertyAxiom -> Doc) -> [DataPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> DataPropertyAxiom -> Doc
printDataPropAxiom PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([DataPropertyAxiom] -> Doc) -> [DataPropertyAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [DataPropertyAxiom]
axs)

dpAxiomsToDoc pds :: PrefixMap
pds n :: Int
n CharacteristicsSection axs :: [DataPropertyAxiom]
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)
-> ([DataPropertyAxiom] -> [Doc]) -> [DataPropertyAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma
        ([Doc] -> [Doc])
-> ([DataPropertyAxiom] -> [Doc]) -> [DataPropertyAxiom] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DataPropertyAxiom -> Doc) -> [DataPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> DataPropertyAxiom -> Doc
printDataPropAxiom PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([DataPropertyAxiom] -> Doc) -> [DataPropertyAxiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [DataPropertyAxiom]
axs)

dpAxiomsToDoc _ _ 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 DataProperty Frame: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ FrameSectionType -> String
forall a. Show a => a -> String
show FrameSectionType
s

printDataPropAxiom :: GA.PrefixMap -> Int -> DataPropertyAxiom -> Doc
printDataPropAxiom :: PrefixMap -> Int -> DataPropertyAxiom -> Doc
printDataPropAxiom pds :: PrefixMap
pds n :: Int
n (SubDataPropertyOf anns :: AxiomAnnotations
anns _ iri :: IRI
iri) =
    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
iri

printDataPropAxiom pds :: PrefixMap
pds n :: Int
n (EquivalentDataProperties anns :: AxiomAnnotations
anns [_, iri :: IRI
iri]) = 
    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
iri

printDataPropAxiom pds :: PrefixMap
pds n :: Int
n (DisjointDataProperties anns :: AxiomAnnotations
anns [_, iri :: IRI
iri]) =
    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
iri

printDataPropAxiom pds :: PrefixMap
pds n :: Int
n (DataPropertyDomain 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

printDataPropAxiom pds :: PrefixMap
pds n :: Int
n (DataPropertyRange anns :: AxiomAnnotations
anns _ dr :: DataRange
dr) =
    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 -> DataRange -> Doc
printDataRange PrefixMap
pds DataRange
dr

printDataPropAxiom pds :: PrefixMap
pds n :: Int
n (FunctionalDataProperty 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
text String
functionalS

printDataPropAxiom _ _ ax :: DataPropertyAxiom
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Unexpected DataPropertyAxiom in DataProperty Frame: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ DataPropertyAxiom -> String
forall a. Show a => a -> String
show DataPropertyAxiom
ax
 
unpackDataPropertyAxiom :: Axiom -> DataPropertyAxiom
unpackDataPropertyAxiom :: Axiom -> DataPropertyAxiom
unpackDataPropertyAxiom (DataPropertyAxiom a :: DataPropertyAxiom
a) = DataPropertyAxiom
a
unpackDataPropertyAxiom ax :: Axiom
ax = String -> DataPropertyAxiom
forall a. HasCallStack => String -> a
error (String -> DataPropertyAxiom) -> String -> DataPropertyAxiom
forall a b. (a -> b) -> a -> b
$ "Expected DataPropertyAxiom, got: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Axiom -> String
forall a. Show a => a -> String
show Axiom
ax

-- | print Annotation Property Frames
printAPFs :: GA.PrefixMap -> Int -> MnchstrSntx -> Doc
printAPFs :: PrefixMap -> Int -> MnchstrSntx -> Doc
printAPFs 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
printAPF 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
AnnotationPropertyFrame) (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 Annotation Property Frame
printAPF :: GA.PrefixMap -> Int -> FrameId
    -> M.Map FrameSectionType [Axiom] -> Doc
printAPF :: PrefixMap
-> Int
-> (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom]
-> Doc
printAPF 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
annotationPropertyC Doc -> Doc -> Doc
<+> PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds Int
n AxiomAnnotations
annos Doc -> Doc -> Doc
<+> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri
        , Doc
annDoc, Doc
subPropOfDoc, Doc
domainDoc, Doc
rangeDoc]
    where
        IriId iri :: IRI
iri = (FrameType, FrameIdValue) -> FrameIdValue
forall a b. (a, b) -> b
snd (FrameType, FrameIdValue)
header

        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 -> [AnnotationAxiom] -> Doc
afAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
SubPropertyOfSection
            ([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]
subPropOfAxioms

        domainAxioms :: [Axiom]
domainAxioms = [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
        domainDoc :: Doc
domainDoc = PrefixMap -> Int -> FrameSectionType -> [AnnotationAxiom] -> Doc
afAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
DomainSection
            ([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]
domainAxioms

        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 -> [AnnotationAxiom] -> Doc
afAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
RangeSection
            ([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]
rangeAxioms

afAxiomsToDoc :: GA.PrefixMap -> Int -> FrameSectionType
    -> [AnnotationAxiom] -> Doc
afAxiomsToDoc :: PrefixMap -> Int -> FrameSectionType -> [AnnotationAxiom] -> Doc
afAxiomsToDoc _ _ _ [] = Doc
empty

afAxiomsToDoc pds :: PrefixMap
pds n :: Int
n frameSectionType :: FrameSectionType
frameSectionType axs :: [AnnotationAxiom]
axs =
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
header
    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
printAFAxiom 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)
    where header :: String
header = case FrameSectionType
frameSectionType of
            SubPropertyOfSection -> String
subPropertyOfC
            DomainSection -> String
domainC
            RangeSection -> String
rangeC
            s :: FrameSectionType
s -> ShowS
forall a. HasCallStack => String -> a
error ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ "Unexpected Section type in Annotation Property Frame: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ FrameSectionType -> String
forall a. Show a => a -> String
show FrameSectionType
s


printAFAxiom :: GA.PrefixMap -> Int -> AnnotationAxiom -> Doc
printAFAxiom :: PrefixMap -> Int -> AnnotationAxiom -> Doc
printAFAxiom pds :: PrefixMap
pds n :: Int
n (SubAnnotationPropertyOf anns :: AxiomAnnotations
anns _ iri :: IRI
iri) =
    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
iri

printAFAxiom pds :: PrefixMap
pds n :: Int
n (AnnotationPropertyDomain anns :: AxiomAnnotations
anns _ iri :: IRI
iri) =
    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
iri

printAFAxiom pds :: PrefixMap
pds n :: Int
n (AnnotationPropertyRange anns :: AxiomAnnotations
anns _ iri :: IRI
iri) =
    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
iri

printAFAxiom  _ _ ax :: AnnotationAxiom
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Unexpected AnnotationAxiom in Annotation Property Frame: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ AnnotationAxiom -> String
forall a. Show a => a -> String
show AnnotationAxiom
ax


-- | print Datatype Frames
printDFs :: GA.PrefixMap -> Int -> MnchstrSntx -> Doc
printDFs :: PrefixMap -> Int -> MnchstrSntx -> Doc
printDFs 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
printDF 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
DatatypeFrame) (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 Datatype Frame
printDF :: GA.PrefixMap -> Int -> FrameId
    -> M.Map FrameSectionType [Axiom] -> Doc
printDF :: PrefixMap
-> Int
-> (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom]
-> Doc
printDF 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
datatypeC Doc -> Doc -> Doc
<+> PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds Int
n AxiomAnnotations
annos Doc -> Doc -> Doc
<+> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri
        , Doc
annDoc, Doc
eqDoc]
    where
        IriId iri :: IRI
iri = (FrameType, FrameIdValue) -> FrameIdValue
forall a b. (a, b) -> b
snd (FrameType, FrameIdValue)
header

        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

        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 -> [Axiom] -> Doc
dtAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
EquivalentToSection [Axiom]
eqAxioms

dtAxiomsToDoc :: GA.PrefixMap -> Int -> FrameSectionType
    -> [Axiom] -> Doc
dtAxiomsToDoc :: PrefixMap -> Int -> FrameSectionType -> [Axiom] -> Doc
dtAxiomsToDoc _ _ _ [] = Doc
empty

dtAxiomsToDoc pds :: PrefixMap
pds n :: Int
n EquivalentToSection axs :: [Axiom]
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) -> ([Axiom] -> [Doc]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma
        ([Doc] -> [Doc]) -> ([Axiom] -> [Doc]) -> [Axiom] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> Doc) -> [Axiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> Axiom -> Doc
printDatatypeDefinitionAxiom PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
axs)

dtAxiomsToDoc _ _ 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 Datateyp Frame: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ FrameSectionType -> String
forall a. Show a => a -> String
show FrameSectionType
s

printDatatypeDefinitionAxiom :: GA.PrefixMap -> Int -> Axiom -> Doc
printDatatypeDefinitionAxiom :: PrefixMap -> Int -> Axiom -> Doc
printDatatypeDefinitionAxiom pds :: PrefixMap
pds n :: Int
n (DatatypeDefinition anns :: AxiomAnnotations
anns _ dr :: DataRange
dr) =
    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 -> DataRange -> Doc
printDataRange PrefixMap
pds DataRange
dr

printDatatypeDefinitionAxiom _ _ ax :: Axiom
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Unexpected Axiom in Datatype Frame: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Axiom -> String
forall a. Show a => a -> String
show Axiom
ax

-- | print Class Frames
printCFs :: GA.PrefixMap -> Int -> MnchstrSntx -> Doc
printCFs :: PrefixMap -> Int -> MnchstrSntx -> Doc
printCFs 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
printCF 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
ClassFrame) (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 Class Frame
printCF :: GA.PrefixMap -> Int -> FrameId
    -> M.Map FrameSectionType [Axiom] -> Doc
printCF :: PrefixMap
-> Int
-> (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom]
-> Doc
printCF 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
classC Doc -> Doc -> Doc
<+> PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds Int
n AxiomAnnotations
annos Doc -> Doc -> Doc
<+> PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
e
        , Doc
annDoc, Doc
scoDoc, Doc
eqDoc, Doc
disjDoc, Doc
disjuDoc, Doc
haskDoc]
    where
        e :: ClassExpression
e = case (FrameType, FrameIdValue) -> FrameIdValue
forall a b. (a, b) -> b
snd (FrameType, FrameIdValue)
header of
            IriId iri :: IRI
iri -> IRI -> ClassExpression
Expression IRI
iri
            ComplexClassExpr c :: ClassExpression
c -> ClassExpression
c
            _ -> String -> ClassExpression
forall a. HasCallStack => String -> a
error (String -> ClassExpression) -> String -> ClassExpression
forall a b. (a -> b) -> a -> b
$ "Unexpected subject in class frame"

        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

        scoAxioms :: [Axiom]
scoAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
SubClassOfSection Map FrameSectionType [Axiom]
body
        scoDoc :: Doc
scoDoc = PrefixMap -> Int -> FrameSectionType -> [Axiom] -> Doc
classAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
SubClassOfSection [Axiom]
scoAxioms

        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 -> [Axiom] -> Doc
classAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
EquivalentToSection [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 -> [Axiom] -> Doc
classAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
DisjointWithSection [Axiom]
disjAxioms

        disjuAxioms :: [Axiom]
disjuAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DisjointUnionOfSection Map FrameSectionType [Axiom]
body
        disjuDoc :: Doc
disjuDoc = PrefixMap -> Int -> FrameSectionType -> [Axiom] -> Doc
classAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)
            FrameSectionType
DisjointUnionOfSection [Axiom]
disjuAxioms

        haskAxioms :: [Axiom]
haskAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
HasKeySection Map FrameSectionType [Axiom]
body
        haskDoc :: Doc
haskDoc = PrefixMap -> Int -> [Axiom] -> Doc
hasKeyAxiomsToCFDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) [Axiom]
haskAxioms


classAxiomsToDoc :: GA.PrefixMap -> Int -> FrameSectionType
    -> [Axiom] -> Doc
classAxiomsToDoc :: PrefixMap -> Int -> FrameSectionType -> [Axiom] -> Doc
classAxiomsToDoc _ _ _ [] = Doc
empty

classAxiomsToDoc pds :: PrefixMap
pds n :: Int
n frameSectionType :: FrameSectionType
frameSectionType axs :: [Axiom]
axs =
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
header
    Doc -> Doc -> Doc
$+$ (PrefixMap -> Int -> [ClassAxiom] -> Doc
printClassAxiomsVer PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)
        ([ClassAxiom] -> Doc)
-> ([Axiom] -> [ClassAxiom]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> ClassAxiom) -> [Axiom] -> [ClassAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> ClassAxiom
unpackClassAxiom
        ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
axs)
    where header :: String
header = case FrameSectionType
frameSectionType of
            SubClassOfSection -> String
subClassOfC
            EquivalentToSection -> String
equivalentToC
            DisjointWithSection -> String
disjointWithC
            DisjointUnionOfSection -> String
disjointUnionOfC
            s :: FrameSectionType
s -> ShowS
forall a. HasCallStack => String -> a
error ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ "Unexpected Section type in Class Frame: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ FrameSectionType -> String
forall a. Show a => a -> String
show FrameSectionType
s

hasKeyAxiomsToCFDoc :: GA.PrefixMap -> Int -> [Axiom] -> Doc
hasKeyAxiomsToCFDoc :: PrefixMap -> Int -> [Axiom] -> Doc
hasKeyAxiomsToCFDoc pds :: PrefixMap
pds n :: Int
n axs :: [Axiom]
axs =  
    (Doc -> Axiom -> Doc) -> Doc -> [Axiom] -> Doc
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl (\d :: Doc
d ax :: Axiom
ax -> PrefixMap -> Int -> Axiom -> Doc
printHasKeyAxiom PrefixMap
pds Int
n Axiom
ax Doc -> Doc -> Doc
$+$ Doc
d) Doc
empty [Axiom]
axs

getAnnosFromDeclarationAxioms :: [Axiom] -> Annotations
getAnnosFromDeclarationAxioms :: [Axiom] -> AxiomAnnotations
getAnnosFromDeclarationAxioms = (Axiom -> AxiomAnnotations) -> [Axiom] -> AxiomAnnotations
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap ((Axiom -> AxiomAnnotations) -> [Axiom] -> AxiomAnnotations)
-> (Axiom -> AxiomAnnotations) -> [Axiom] -> AxiomAnnotations
forall a b. (a -> b) -> a -> b
$ \a :: Axiom
a -> case Axiom
a of
    Declaration annos :: AxiomAnnotations
annos _ -> AxiomAnnotations
annos
    _ -> []

unpackClassAxiom :: Axiom -> ClassAxiom
unpackClassAxiom :: Axiom -> ClassAxiom
unpackClassAxiom (ClassAxiom a :: ClassAxiom
a) = ClassAxiom
a
unpackClassAxiom ax :: Axiom
ax = String -> ClassAxiom
forall a. HasCallStack => String -> a
error (String -> ClassAxiom) -> String -> ClassAxiom
forall a b. (a -> b) -> a -> b
$ "Expected ClassAxiom, got: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Axiom -> String
forall a. Show a => a -> String
show Axiom
ax

-- | print HasKey axiom
printHasKeyAxiom :: GA.PrefixMap -> Int -> Axiom -> Doc
printHasKeyAxiom :: PrefixMap -> Int -> Axiom -> Doc
printHasKeyAxiom pds :: PrefixMap
pds n :: Int
n (HasKey anns :: AxiomAnnotations
anns _ opExprs :: PropertyExpressionChain
opExprs dpExprs :: [IRI]
dpExprs) =
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
hasKeyC
    Doc -> Doc -> Doc
$+$ 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
resDoc
    where
        resDoc :: Doc
resDoc = case (PropertyExpressionChain -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null PropertyExpressionChain
opExprs, [IRI] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [IRI]
dpExprs) of
            (True, True) -> Doc
empty
            (True, False) -> Doc
dpExprsDoc
            (False, True) -> Doc
opExprsDoc
            (False, False) -> [Doc] -> Doc
vcat ([Doc] -> Doc) -> ([Doc] -> [Doc]) -> [Doc] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$ [Doc
opExprsDoc, Doc
dpExprsDoc]

        opExprsDoc :: Doc
opExprsDoc = [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
opExprs
        dpExprsDoc :: Doc
dpExprsDoc = [Doc] -> Doc
vcat ([Doc] -> Doc) -> ([IRI] -> [Doc]) -> [IRI] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma
            ([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 (\e :: IRI
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 -> IRI -> Doc
printIRI PrefixMap
pds IRI
e) ([IRI] -> Doc) -> [IRI] -> Doc
forall a b. (a -> b) -> a -> b
$ [IRI]
dpExprs

printHasKeyAxiom _ _ ax :: Axiom
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Expected HasKeyAxiom, got: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Axiom -> String
forall a. Show a => a -> String
show Axiom
ax
         
-- | print ClassAxioms
printClassAxiomsVer :: GA.PrefixMap -> Int -> [ClassAxiom] -> Doc
printClassAxiomsVer :: PrefixMap -> Int -> [ClassAxiom] -> Doc
printClassAxiomsVer pds :: PrefixMap
pds n :: Int
n =
    [Doc] -> Doc
vcat ([Doc] -> Doc) -> ([ClassAxiom] -> [Doc]) -> [ClassAxiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([ClassAxiom] -> [Doc]) -> [ClassAxiom] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ClassAxiom -> Doc) -> [ClassAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> ClassAxiom -> Doc
printClassAxiom PrefixMap
pds Int
n)

printClassAxiom :: GA.PrefixMap -> Int -> ClassAxiom -> Doc
-- subClassOf axiom
printClassAxiom :: PrefixMap -> Int -> ClassAxiom -> Doc
printClassAxiom pds :: PrefixMap
pds n :: Int
n (SubClassOf anns :: AxiomAnnotations
anns _ supClExpr :: ClassExpression
supClExpr) =
    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
supClExpr

-- EquivalentClasses axiom
printClassAxiom pds :: PrefixMap
pds n :: Int
n (EquivalentClasses 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

printClassAxiom pds :: PrefixMap
pds n :: Int
n (EquivalentClasses anns :: AxiomAnnotations
anns clExprs :: [ClassExpression]
clExprs) = 
    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
printClassExpressionsHor PrefixMap
pds [ClassExpression]
clExprs

-- DisjointClasses axiom
printClassAxiom pds :: PrefixMap
pds n :: Int
n (DisjointClasses 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

printClassAxiom pds :: PrefixMap
pds n :: Int
n (DisjointClasses anns :: AxiomAnnotations
anns clExprs :: [ClassExpression]
clExprs) = 
    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
printClassExpressionsHor PrefixMap
pds [ClassExpression]
clExprs

-- DisjointUnion axiom
printClassAxiom pds :: PrefixMap
pds n :: Int
n (DisjointUnion anns :: AxiomAnnotations
anns _ clExprs :: [ClassExpression]
clExprs) =
    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
printClassExpressionsHor PrefixMap
pds [ClassExpression]
clExprs

-- | print Individual Frames
printIFs :: GA.PrefixMap -> Int -> MnchstrSntx -> Doc
printIFs :: PrefixMap -> Int -> MnchstrSntx -> Doc
printIFs 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
printIF 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
IndividualFrame) (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 Individual Frame
printIF :: GA.PrefixMap -> Int -> FrameId
    -> M.Map FrameSectionType [Axiom] -> Doc
printIF :: PrefixMap
-> Int
-> (FrameType, FrameIdValue)
-> Map FrameSectionType [Axiom]
-> Doc
printIF 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
individualC Doc -> Doc -> Doc
<+> PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds Int
n AxiomAnnotations
annos Doc -> Doc -> Doc
<+> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri
        , Doc
annDoc, Doc
sameAsDoc, Doc
difFromDoc, Doc
typesDoc, Doc
propAssertionDoc]
    where 
        IriId iri :: IRI
iri = (FrameType, FrameIdValue) -> FrameIdValue
forall a b. (a, b) -> b
snd (FrameType, FrameIdValue)
header

        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

        sameAsAxioms :: [Axiom]
sameAsAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
SameAsSection Map FrameSectionType [Axiom]
body
        sameAsDoc :: Doc
sameAsDoc = PrefixMap -> Int -> FrameSectionType -> [Axiom] -> Doc
iFrameAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
SameAsSection ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
sameAsAxioms

        difFromAxioms :: [Axiom]
difFromAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DifferentFromSection Map FrameSectionType [Axiom]
body
        difFromDoc :: Doc
difFromDoc = PrefixMap -> Int -> FrameSectionType -> [Axiom] -> Doc
iFrameAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
DifferentFromSection
            ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
difFromAxioms

        typesAxioms :: [Axiom]
typesAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
TypesSection Map FrameSectionType [Axiom]
body
        typesDoc :: Doc
typesDoc = PrefixMap -> Int -> FrameSectionType -> [Axiom] -> Doc
iFrameAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
TypesSection ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
typesAxioms

        propAssertionAxioms :: [Axiom]
propAssertionAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
FactsSection Map FrameSectionType [Axiom]
body
        propAssertionDoc :: Doc
propAssertionDoc = PrefixMap -> Int -> FrameSectionType -> [Axiom] -> Doc
iFrameAxiomsToDoc PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) FrameSectionType
FactsSection
            ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
propAssertionAxioms

iFrameAxiomsToDoc :: GA.PrefixMap -> Int -> FrameSectionType
    -> [Axiom] -> Doc
iFrameAxiomsToDoc :: PrefixMap -> Int -> FrameSectionType -> [Axiom] -> Doc
iFrameAxiomsToDoc _ _ _ [] = Doc
empty
iFrameAxiomsToDoc pds :: PrefixMap
pds n :: Int
n frameSectionType :: FrameSectionType
frameSectionType axs :: [Axiom]
axs = 
    Int -> Doc
tabs Int
n Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
keyword String
header
    Doc -> Doc -> Doc
$+$
    ([Doc] -> Doc
vcat ([Doc] -> Doc) -> ([Axiom] -> [Doc]) -> [Axiom] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc]) -> ([Axiom] -> [Doc]) -> [Axiom] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Assertion -> Doc) -> [Assertion] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> Assertion -> Doc
printIFAssertionAxiom PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) 
        ([Assertion] -> [Doc])
-> ([Axiom] -> [Assertion]) -> [Axiom] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> Assertion) -> [Axiom] -> [Assertion]
forall a b. (a -> b) -> [a] -> [b]
map (\(Assertion a :: Assertion
a) -> Assertion
a) ([Axiom] -> Doc) -> [Axiom] -> Doc
forall a b. (a -> b) -> a -> b
$ [Axiom]
axs)
    where header :: String
header = case FrameSectionType
frameSectionType of
            SameAsSection -> String
sameAsC
            DifferentFromSection -> String
differentFromC
            TypesSection -> String
typesC
            FactsSection -> String
factsC
            s :: FrameSectionType
s -> ShowS
forall a. HasCallStack => String -> a
error ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ "Unexpected Section type in Individual Frame: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ FrameSectionType -> String
forall a. Show a => a -> String
show FrameSectionType
s

printIFAssertionAxiom :: GA.PrefixMap -> Int -> Assertion -> Doc
printIFAssertionAxiom :: PrefixMap -> Int -> Assertion -> Doc
printIFAssertionAxiom pds :: PrefixMap
pds n :: Int
n (SameIndividual anns :: AxiomAnnotations
anns [_, ind :: IRI
ind]) =
    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
ind

printIFAssertionAxiom pds :: PrefixMap
pds n :: Int
n (DifferentIndividuals anns :: AxiomAnnotations
anns [_, ind :: IRI
ind]) =
    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
ind

printIFAssertionAxiom pds :: PrefixMap
pds n :: Int
n (ClassAssertion 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

printIFAssertionAxiom pds :: PrefixMap
pds n :: Int
n (ObjectPropertyAssertion anns :: AxiomAnnotations
anns opExpr :: ObjectPropertyExpression
opExpr _ iri2 :: IRI
iri2) =
    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 Doc -> Doc -> Doc
<+> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri2

printIFAssertionAxiom pds :: PrefixMap
pds n :: Int
n
    (NegativeObjectPropertyAssertion anns :: AxiomAnnotations
anns opExpr :: ObjectPropertyExpression
opExpr _ iri2 :: IRI
iri2) =
    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
notS
    Doc -> Doc -> Doc
<+> PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
opExpr Doc -> Doc -> Doc
<+> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri2

printIFAssertionAxiom pds :: PrefixMap
pds n :: Int
n (DataPropertyAssertion anns :: AxiomAnnotations
anns dpIri :: IRI
dpIri _ lit :: TargetValue
lit) =
    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
dpIri Doc -> Doc -> Doc
<+> PrefixMap -> TargetValue -> Doc
printLiteral PrefixMap
pds TargetValue
lit

printIFAssertionAxiom pds :: PrefixMap
pds n :: Int
n
    (NegativeDataPropertyAssertion anns :: AxiomAnnotations
anns dpIri :: IRI
dpIri _ lit :: TargetValue
lit) =
    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
notS Doc -> Doc -> Doc
<+> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dpIri Doc -> Doc -> Doc
<+> PrefixMap -> TargetValue -> Doc
printLiteral PrefixMap
pds TargetValue
lit

printIFAssertionAxiom _ _ ax :: Assertion
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Unexpected Assertion in Individual Frame: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Assertion -> String
forall a. Show a => a -> String
show Assertion
ax

-- | print Misc Frame
printMF :: GA.PrefixMap -> Int -> MnchstrSntx -> Doc
printMF :: PrefixMap -> Int -> MnchstrSntx -> Doc
printMF pds :: PrefixMap
pds n :: Int
n ms :: MnchstrSntx
ms
    | Map FrameSectionType [Axiom] -> Bool
forall k a. Map k a -> Bool
M.null Map FrameSectionType [Axiom]
mRoot = Doc
empty
    | Bool
otherwise = 
        [Doc] -> Doc
vcat [Doc
eqClsDoc, Doc
disjClsDoc, Doc
eqObPropsDoc, Doc
disjObPropsDoc
            , Doc
eqDataPropsDoc, Doc
disjDataPropsDoc, Doc
sameIndsDoc, Doc
difIndsDoc]
    where
        mRoot :: Map FrameSectionType [Axiom]
mRoot = 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
MiscFrame, FrameIdValue
MiscId) MnchstrSntx
ms
        eqClsAxioms :: [Axiom]
eqClsAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
EquivalentClassesSection Map FrameSectionType [Axiom]
mRoot
        eqClsDoc :: Doc
eqClsDoc = PrefixMap -> Int -> [Axiom] -> Doc
eqClsAxiomsToMFDoc PrefixMap
pds Int
n [Axiom]
eqClsAxioms

        disjClsAxioms :: [Axiom]
disjClsAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DisjointClassesSection Map FrameSectionType [Axiom]
mRoot
        disjClsDoc :: Doc
disjClsDoc = PrefixMap -> Int -> [Axiom] -> Doc
disjClsAxiomsToMFDoc PrefixMap
pds Int
n [Axiom]
disjClsAxioms

        eqObPropsAxioms :: [Axiom]
eqObPropsAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault []
            FrameSectionType
EquivalentObjectPropertiesSection Map FrameSectionType [Axiom]
mRoot
        eqObPropsDoc :: Doc
eqObPropsDoc = PrefixMap -> Int -> [Axiom] -> Doc
eqObPropsAxiomsToMFDoc PrefixMap
pds Int
n [Axiom]
eqObPropsAxioms

        disjObPropsAxioms :: [Axiom]
disjObPropsAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault []
            FrameSectionType
DisjointObjectPropertiesSection Map FrameSectionType [Axiom]
mRoot
        disjObPropsDoc :: Doc
disjObPropsDoc = PrefixMap -> Int -> [Axiom] -> Doc
disjObPropsAxiomsToMFDoc PrefixMap
pds Int
n [Axiom]
disjObPropsAxioms

        eqDataPropsAxioms :: [Axiom]
eqDataPropsAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] 
            FrameSectionType
EquivalentDataPropertiesSection Map FrameSectionType [Axiom]
mRoot
        eqDataPropsDoc :: Doc
eqDataPropsDoc = PrefixMap -> Int -> [Axiom] -> Doc
eqDataPropsAxiomsToMFDoc PrefixMap
pds Int
n [Axiom]
eqDataPropsAxioms

        disjDataPropsAxioms :: [Axiom]
disjDataPropsAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault []
            FrameSectionType
DisjointDataPropertiesSection Map FrameSectionType [Axiom]
mRoot
        disjDataPropsDoc :: Doc
disjDataPropsDoc = PrefixMap -> Int -> [Axiom] -> Doc
disjDataPropsAxiomsToMFDoc PrefixMap
pds Int
n [Axiom]
disjDataPropsAxioms
        
        sameIndsAxioms :: [Axiom]
sameIndsAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
SameIndividualSection Map FrameSectionType [Axiom]
mRoot
        sameIndsDoc :: Doc
sameIndsDoc = PrefixMap -> Int -> [Axiom] -> Doc
sameIndsAxiomsToMFDoc PrefixMap
pds Int
n [Axiom]
sameIndsAxioms

        difIndsAxioms :: [Axiom]
difIndsAxioms = [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
DifferentIndividualsSection Map FrameSectionType [Axiom]
mRoot
        difIndsDoc :: Doc
difIndsDoc = PrefixMap -> Int -> [Axiom] -> Doc
difIndsAxiomsToMFDoc PrefixMap
pds Int
n [Axiom]
difIndsAxioms

eqClsAxiomsToMFDoc :: GA.PrefixMap -> Int -> [Axiom] -> Doc
eqClsAxiomsToMFDoc :: PrefixMap -> Int -> [Axiom] -> Doc
eqClsAxiomsToMFDoc _ _ [] = Doc
empty
eqClsAxiomsToMFDoc pds :: PrefixMap
pds n :: Int
n axs :: [Axiom]
axs =
    [Doc] -> Doc
vsep [Doc]
docsWithHeaders
    where
        classAxioms :: [ClassAxiom]
classAxioms = (Axiom -> ClassAxiom) -> [Axiom] -> [ClassAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> ClassAxiom
unpackClassAxiom [Axiom]
axs
        bodyDocs :: [Doc]
bodyDocs = (ClassAxiom -> Doc) -> [ClassAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> ClassAxiom -> Doc
printClassAxiom PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) [ClassAxiom]
classAxioms
        docsWithHeaders :: [Doc]
docsWithHeaders = (Doc -> Doc) -> [Doc] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (\d :: Doc
d -> String -> Doc
keyword String
equivalentClassesC Doc -> Doc -> Doc
$+$ Doc
d) [Doc]
bodyDocs

disjClsAxiomsToMFDoc :: GA.PrefixMap -> Int -> [Axiom] -> Doc
disjClsAxiomsToMFDoc :: PrefixMap -> Int -> [Axiom] -> Doc
disjClsAxiomsToMFDoc _ _[] = Doc
empty
disjClsAxiomsToMFDoc pds :: PrefixMap
pds n :: Int
n axs :: [Axiom]
axs =
    [Doc] -> Doc
vsep [Doc]
docsWithHeaders
    where
        classAxioms :: [ClassAxiom]
classAxioms = (Axiom -> ClassAxiom) -> [Axiom] -> [ClassAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> ClassAxiom
unpackClassAxiom [Axiom]
axs
        bodyDocs :: [Doc]
bodyDocs = (ClassAxiom -> Doc) -> [ClassAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> ClassAxiom -> Doc
printClassAxiom PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) [ClassAxiom]
classAxioms
        docsWithHeaders :: [Doc]
docsWithHeaders = (Doc -> Doc) -> [Doc] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (\d :: Doc
d -> String -> Doc
keyword String
disjointClassesC Doc -> Doc -> Doc
$+$ Doc
d) [Doc]
bodyDocs

eqObPropsAxiomsToMFDoc :: GA.PrefixMap -> Int -> [Axiom] -> Doc
eqObPropsAxiomsToMFDoc :: PrefixMap -> Int -> [Axiom] -> Doc
eqObPropsAxiomsToMFDoc _ _[] = Doc
empty
eqObPropsAxiomsToMFDoc pds :: PrefixMap
pds n :: Int
n axs :: [Axiom]
axs =
    [Doc] -> Doc
vsep [Doc]
docsWithHeaders
    where 
        opAxioms :: [ObjectPropertyAxiom]
opAxioms = (Axiom -> ObjectPropertyAxiom) -> [Axiom] -> [ObjectPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> ObjectPropertyAxiom
unpackObjectPropertyAxiom [Axiom]
axs
        bodyDocs :: [Doc]
bodyDocs = (ObjectPropertyAxiom -> Doc) -> [ObjectPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printObPropAxiomMF PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) [ObjectPropertyAxiom]
opAxioms
        docsWithHeaders :: [Doc]
docsWithHeaders =
            (Doc -> Doc) -> [Doc] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (\d :: Doc
d -> String -> Doc
keyword String
equivalentPropertiesC Doc -> Doc -> Doc
$+$ Doc
d) [Doc]
bodyDocs

disjObPropsAxiomsToMFDoc :: GA.PrefixMap -> Int -> [Axiom] -> Doc
disjObPropsAxiomsToMFDoc :: PrefixMap -> Int -> [Axiom] -> Doc
disjObPropsAxiomsToMFDoc _ _[] = Doc
empty
disjObPropsAxiomsToMFDoc pds :: PrefixMap
pds n :: Int
n axs :: [Axiom]
axs =
    [Doc] -> Doc
vsep [Doc]
docsWithHeaders
    where 
        opAxioms :: [ObjectPropertyAxiom]
opAxioms = (Axiom -> ObjectPropertyAxiom) -> [Axiom] -> [ObjectPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> ObjectPropertyAxiom
unpackObjectPropertyAxiom [Axiom]
axs
        bodyDocs :: [Doc]
bodyDocs = (ObjectPropertyAxiom -> Doc) -> [ObjectPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printObPropAxiomMF PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) [ObjectPropertyAxiom]
opAxioms
        docsWithHeaders :: [Doc]
docsWithHeaders =
            (Doc -> Doc) -> [Doc] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (\d :: Doc
d -> String -> Doc
keyword String
disjointPropertiesC Doc -> Doc -> Doc
$+$ Doc
d) [Doc]
bodyDocs

eqDataPropsAxiomsToMFDoc :: GA.PrefixMap -> Int -> [Axiom] -> Doc
eqDataPropsAxiomsToMFDoc :: PrefixMap -> Int -> [Axiom] -> Doc
eqDataPropsAxiomsToMFDoc _ _ [] = Doc
empty
eqDataPropsAxiomsToMFDoc pds :: PrefixMap
pds n :: Int
n axs :: [Axiom]
axs = 
    [Doc] -> Doc
vsep [Doc]
docsWithHeaders
    where
        dpAxioms :: [DataPropertyAxiom]
dpAxioms = (Axiom -> DataPropertyAxiom) -> [Axiom] -> [DataPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> DataPropertyAxiom
unpackDataPropertyAxiom [Axiom]
axs
        bodyDocs :: [Doc]
bodyDocs = (DataPropertyAxiom -> Doc) -> [DataPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> DataPropertyAxiom -> Doc
printDataPropAxiomMF PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) [DataPropertyAxiom]
dpAxioms
        docsWithHeaders :: [Doc]
docsWithHeaders = 
            (Doc -> Doc) -> [Doc] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (\d :: Doc
d -> String -> Doc
keyword String
equivalentPropertiesC Doc -> Doc -> Doc
$+$ Doc
d) [Doc]
bodyDocs

disjDataPropsAxiomsToMFDoc :: GA.PrefixMap -> Int -> [Axiom] -> Doc
disjDataPropsAxiomsToMFDoc :: PrefixMap -> Int -> [Axiom] -> Doc
disjDataPropsAxiomsToMFDoc _ _[] = Doc
empty
disjDataPropsAxiomsToMFDoc pds :: PrefixMap
pds n :: Int
n axs :: [Axiom]
axs = 
    [Doc] -> Doc
vsep [Doc]
docsWithHeaders
    where
        dpAxioms :: [DataPropertyAxiom]
dpAxioms = (Axiom -> DataPropertyAxiom) -> [Axiom] -> [DataPropertyAxiom]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> DataPropertyAxiom
unpackDataPropertyAxiom [Axiom]
axs
        bodyDocs :: [Doc]
bodyDocs = (DataPropertyAxiom -> Doc) -> [DataPropertyAxiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> DataPropertyAxiom -> Doc
printDataPropAxiomMF PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) [DataPropertyAxiom]
dpAxioms
        docsWithHeaders :: [Doc]
docsWithHeaders = 
            (Doc -> Doc) -> [Doc] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (\d :: Doc
d -> String -> Doc
keyword String
disjointPropertiesC Doc -> Doc -> Doc
$+$ Doc
d) [Doc]
bodyDocs

sameIndsAxiomsToMFDoc :: GA.PrefixMap -> Int -> [Axiom] -> Doc
sameIndsAxiomsToMFDoc :: PrefixMap -> Int -> [Axiom] -> Doc
sameIndsAxiomsToMFDoc _ _ [] = Doc
empty
sameIndsAxiomsToMFDoc pds :: PrefixMap
pds n :: Int
n axs :: [Axiom]
axs =
    [Doc] -> Doc
vsep [Doc]
docsWithHeaders
    where
        unpackedAxioms :: [Assertion]
unpackedAxioms = (Axiom -> Assertion) -> [Axiom] -> [Assertion]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> Assertion
unpackAssertionAxiom [Axiom]
axs
        bodyDocs :: [Doc]
bodyDocs = (Assertion -> Doc) -> [Assertion] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> Assertion -> Doc
printAssertionAxiomMF PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) [Assertion]
unpackedAxioms
        docsWithHeaders :: [Doc]
docsWithHeaders = 
            (Doc -> Doc) -> [Doc] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (\d :: Doc
d -> String -> Doc
keyword String
sameIndividualC Doc -> Doc -> Doc
$+$ Doc
d) [Doc]
bodyDocs

difIndsAxiomsToMFDoc :: GA.PrefixMap -> Int -> [Axiom] -> Doc
difIndsAxiomsToMFDoc :: PrefixMap -> Int -> [Axiom] -> Doc
difIndsAxiomsToMFDoc _ _ [] = Doc
empty
difIndsAxiomsToMFDoc pds :: PrefixMap
pds n :: Int
n axs :: [Axiom]
axs =
    [Doc] -> Doc
vsep [Doc]
docsWithHeaders
    where
        unpackedAxioms :: [Assertion]
unpackedAxioms = (Axiom -> Assertion) -> [Axiom] -> [Assertion]
forall a b. (a -> b) -> [a] -> [b]
map Axiom -> Assertion
unpackAssertionAxiom [Axiom]
axs
        bodyDocs :: [Doc]
bodyDocs = (Assertion -> Doc) -> [Assertion] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> Assertion -> Doc
printAssertionAxiomMF PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) [Assertion]
unpackedAxioms
        docsWithHeaders :: [Doc]
docsWithHeaders = 
            (Doc -> Doc) -> [Doc] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (\d :: Doc
d -> String -> Doc
keyword String
differentIndividualsC Doc -> Doc -> Doc
$+$ Doc
d) [Doc]
bodyDocs

unpackAssertionAxiom :: Axiom -> Assertion
unpackAssertionAxiom :: Axiom -> Assertion
unpackAssertionAxiom (Assertion a :: Assertion
a) = Assertion
a
unpackAssertionAxiom ax :: Axiom
ax = String -> Assertion
forall a. HasCallStack => String -> a
error (String -> Assertion) -> String -> Assertion
forall a b. (a -> b) -> a -> b
$ "Expected Assertion, got: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Axiom -> String
forall a. Show a => a -> String
show Axiom
ax

unpackAnnotationAxiom :: Axiom -> AnnotationAxiom
unpackAnnotationAxiom :: Axiom -> AnnotationAxiom
unpackAnnotationAxiom (AnnotationAxiom a :: AnnotationAxiom
a) = AnnotationAxiom
a
unpackAnnotationAxiom ax :: Axiom
ax = String -> AnnotationAxiom
forall a. HasCallStack => String -> a
error (String -> AnnotationAxiom) -> String -> AnnotationAxiom
forall a b. (a -> b) -> a -> b
$ "Expected AnnotationAxiom, got: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Axiom -> String
forall a. Show a => a -> String
show Axiom
ax

printObPropAxiomMF :: GA.PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printObPropAxiomMF :: PrefixMap -> Int -> ObjectPropertyAxiom -> Doc
printObPropAxiomMF pds :: PrefixMap
pds n :: Int
n (EquivalentObjectProperties anns :: AxiomAnnotations
anns 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
<> PrefixMap -> PropertyExpressionChain -> Doc
printObjectPropertyExpressionsHor PrefixMap
pds PropertyExpressionChain
opExprs 

printObPropAxiomMF pds :: PrefixMap
pds n :: Int
n (DisjointObjectProperties anns :: AxiomAnnotations
anns 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
<> PrefixMap -> PropertyExpressionChain -> Doc
printObjectPropertyExpressionsHor PrefixMap
pds PropertyExpressionChain
opExprs 

printObPropAxiomMF _ _ ax :: ObjectPropertyAxiom
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Unexpected ObjectPropertyAxiom in Misc Frame: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ ObjectPropertyAxiom -> String
forall a. Show a => a -> String
show ObjectPropertyAxiom
ax

printDataPropAxiomMF :: GA.PrefixMap -> Int -> DataPropertyAxiom -> Doc
printDataPropAxiomMF :: PrefixMap -> Int -> DataPropertyAxiom -> Doc
printDataPropAxiomMF pds :: PrefixMap
pds n :: Int
n (EquivalentDataProperties anns :: AxiomAnnotations
anns dpExprs :: [IRI]
dpExprs) =
    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
hsep ([Doc] -> Doc) -> ([IRI] -> [Doc]) -> [IRI] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([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 (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds) ([IRI] -> Doc) -> [IRI] -> Doc
forall a b. (a -> b) -> a -> b
$ [IRI]
dpExprs)

printDataPropAxiomMF pds :: PrefixMap
pds n :: Int
n (DisjointDataProperties anns :: AxiomAnnotations
anns dpExprs :: [IRI]
dpExprs) =
    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
hsep ([Doc] -> Doc) -> ([IRI] -> [Doc]) -> [IRI] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([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 (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds) ([IRI] -> Doc) -> [IRI] -> Doc
forall a b. (a -> b) -> a -> b
$ [IRI]
dpExprs)
    
printDataPropAxiomMF _ _ ax :: DataPropertyAxiom
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Unexpected DataPropertyAxiom in Misc Frame: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ DataPropertyAxiom -> String
forall a. Show a => a -> String
show DataPropertyAxiom
ax

printAssertionAxiomMF :: GA.PrefixMap -> Int -> Assertion -> Doc
printAssertionAxiomMF :: PrefixMap -> Int -> Assertion -> Doc
printAssertionAxiomMF pds :: PrefixMap
pds n :: Int
n (SameIndividual anns :: AxiomAnnotations
anns inds :: [IRI]
inds) =
    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
hsep ([Doc] -> Doc) -> ([IRI] -> [Doc]) -> [IRI] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([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 (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds) ([IRI] -> Doc) -> [IRI] -> Doc
forall a b. (a -> b) -> a -> b
$ [IRI]
inds)

printAssertionAxiomMF pds :: PrefixMap
pds n :: Int
n (DifferentIndividuals anns :: AxiomAnnotations
anns inds :: [IRI]
inds) =
    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
hsep ([Doc] -> Doc) -> ([IRI] -> [Doc]) -> [IRI] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([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 (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds) ([IRI] -> Doc) -> [IRI] -> Doc
forall a b. (a -> b) -> a -> b
$ [IRI]
inds)

printAssertionAxiomMF _ _ ax :: Assertion
ax = String -> Doc
forall a. HasCallStack => String -> a
error (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Unexpected AssertionAxiom in Misc Frame: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Assertion -> String
forall a. Show a => a -> String
show Assertion
ax

-- | print Rules
printRules :: GA.PrefixMap -> Int -> MnchstrSntx -> Doc
printRules :: PrefixMap -> Int -> MnchstrSntx -> Doc
printRules pds :: PrefixMap
pds _ ms :: MnchstrSntx
ms =
    [Doc] -> Doc
vcat ([Doc] -> Doc) -> (MnchstrSntx -> [Doc]) -> MnchstrSntx -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Axiom -> Doc) -> [Axiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Rule -> Doc
printRule PrefixMap
pds (Rule -> Doc) -> (Axiom -> Rule) -> Axiom -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (\(Rule rule :: Rule
rule) -> Rule
rule))
        ([Axiom] -> [Doc])
-> (MnchstrSntx -> [Axiom]) -> MnchstrSntx -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Axiom]
-> FrameSectionType -> Map FrameSectionType [Axiom] -> [Axiom]
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault [] FrameSectionType
RuleSection
        (Map FrameSectionType [Axiom] -> [Axiom])
-> (MnchstrSntx -> Map FrameSectionType [Axiom])
-> MnchstrSntx
-> [Axiom]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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
RuleFrame, FrameIdValue
RuleId) (MnchstrSntx -> Doc) -> MnchstrSntx -> Doc
forall a b. (a -> b) -> a -> b
$ MnchstrSntx
ms

printRule :: GA.PrefixMap -> Rule -> Doc
printRule :: PrefixMap -> Rule -> Doc
printRule pds :: PrefixMap
pds (DLSafeRule anns :: AxiomAnnotations
anns body :: Body
body h :: Body
h) = 
    String -> Doc
text "Rule:" Doc -> Doc -> Doc
$+$ PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations PrefixMap
pds 1 AxiomAnnotations
anns 
        Doc -> Doc -> Doc
$+$ Int -> Doc
tabs 1 Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> PrefixMap -> Body -> Doc
printAtoms PrefixMap
pds Body
body Doc -> Doc -> Doc
<+> String -> Doc
text " -> " Doc -> Doc -> Doc
<+> PrefixMap -> Body -> Doc
printAtoms PrefixMap
pds Body
h
printRule _ rule :: Rule
rule = String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "# Unsupported Rule: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Rule -> String
forall a. Show a => a -> String
show Rule
rule

printAtoms :: GA.PrefixMap -> [Atom] -> Doc
printAtoms :: PrefixMap -> Body -> Doc
printAtoms pds :: PrefixMap
pds atoms :: Body
atoms = [Doc] -> Doc
hcat ([Doc] -> Doc) -> (Body -> [Doc]) -> Body -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc]) -> (Body -> [Doc]) -> Body -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Atom -> Doc) -> Body -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Atom -> Doc
printAtom PrefixMap
pds) (Body -> Doc) -> Body -> Doc
forall a b. (a -> b) -> a -> b
$ Body
atoms

printAtom :: GA.PrefixMap -> Atom -> Doc
printAtom :: PrefixMap -> Atom -> Doc
printAtom pds :: PrefixMap
pds (ClassAtom ce :: ClassExpression
ce iarg :: IndividualArg
iarg) =
    PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
ce Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
parens (PrefixMap -> IndividualArg -> Doc
printIndividualArg PrefixMap
pds IndividualArg
iarg)

printAtom pds :: PrefixMap
pds (DataRangeAtom dr :: DataRange
dr darg :: DataArg
darg) =
    PrefixMap -> DataRange -> Doc
printDataRange PrefixMap
pds DataRange
dr Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
parens (PrefixMap -> DataArg -> Doc
printDataArg PrefixMap
pds DataArg
darg)

printAtom pds :: PrefixMap
pds (ObjectPropertyAtom oe :: ObjectPropertyExpression
oe iarg1 :: IndividualArg
iarg1 iarg2 :: IndividualArg
iarg2) =
    PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
oe
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
parens ([Doc] -> Doc
hcat ([Doc] -> Doc)
-> ([IndividualArg] -> [Doc]) -> [IndividualArg] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([IndividualArg] -> [Doc]) -> [IndividualArg] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (IndividualArg -> Doc) -> [IndividualArg] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> IndividualArg -> Doc
printIndividualArg PrefixMap
pds) ([IndividualArg] -> Doc) -> [IndividualArg] -> Doc
forall a b. (a -> b) -> a -> b
$ [IndividualArg
iarg1, IndividualArg
iarg2])

printAtom pds :: PrefixMap
pds (DataPropertyAtom dp :: IRI
dp iarg :: IndividualArg
iarg darg :: DataArg
darg) =
    PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dp Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> (Doc -> Doc
parens (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ PrefixMap -> IndividualArg -> Doc
printIndividualArg PrefixMap
pds IndividualArg
iarg Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
text ", "
        Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> PrefixMap -> DataArg -> Doc
printDataArg PrefixMap
pds DataArg
darg)

printAtom pds :: PrefixMap
pds (BuiltInAtom iri :: IRI
iri dargs :: [DataArg]
dargs) =  
    PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
parens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([DataArg] -> [Doc]) -> [DataArg] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc]) -> ([DataArg] -> [Doc]) -> [DataArg] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DataArg -> Doc) -> [DataArg] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> DataArg -> Doc
printDataArg PrefixMap
pds) ([DataArg] -> Doc) -> [DataArg] -> Doc
forall a b. (a -> b) -> a -> b
$ [DataArg]
dargs)

printAtom pds :: PrefixMap
pds (SameIndividualAtom iarg1 :: IndividualArg
iarg1 iarg2 :: IndividualArg
iarg2) =
    String -> Doc
text String
sameAsS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
parens ([Doc] -> Doc
hsep ([Doc] -> Doc)
-> ([IndividualArg] -> [Doc]) -> [IndividualArg] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([IndividualArg] -> [Doc]) -> [IndividualArg] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (IndividualArg -> Doc) -> [IndividualArg] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> IndividualArg -> Doc
printIndividualArg PrefixMap
pds)
        ([IndividualArg] -> Doc) -> [IndividualArg] -> Doc
forall a b. (a -> b) -> a -> b
$ [IndividualArg
iarg1, IndividualArg
iarg2])

printAtom pds :: PrefixMap
pds (DifferentIndividualsAtom iarg1 :: IndividualArg
iarg1 iarg2 :: IndividualArg
iarg2) =
    String -> Doc
text String
differentFromS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
parens ([Doc] -> Doc
hsep ([Doc] -> Doc)
-> ([IndividualArg] -> [Doc]) -> [IndividualArg] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([IndividualArg] -> [Doc]) -> [IndividualArg] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (IndividualArg -> Doc) -> [IndividualArg] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> IndividualArg -> Doc
printIndividualArg PrefixMap
pds)
        ([IndividualArg] -> Doc) -> [IndividualArg] -> Doc
forall a b. (a -> b) -> a -> b
$ [IndividualArg
iarg1, IndividualArg
iarg2])

printAtom pds :: PrefixMap
pds (UnknownUnaryAtom iri :: IRI
iri uarg :: UnknownArg
uarg) =
    PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
parens (PrefixMap -> UnknownArg -> Doc
printUnknownArg PrefixMap
pds UnknownArg
uarg)

printAtom pds :: PrefixMap
pds (UnknownBinaryAtom iri :: IRI
iri uarg1 :: UnknownArg
uarg1 uarg2 :: UnknownArg
uarg2) =
    PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
parens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([UnknownArg] -> [Doc]) -> [UnknownArg] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([UnknownArg] -> [Doc]) -> [UnknownArg] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (UnknownArg -> Doc) -> [UnknownArg] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> UnknownArg -> Doc
printUnknownArg PrefixMap
pds)
        ([UnknownArg] -> Doc) -> [UnknownArg] -> Doc
forall a b. (a -> b) -> a -> b
$ [UnknownArg
uarg1, UnknownArg
uarg2])

printUnknownArg :: GA.PrefixMap -> UnknownArg -> Doc
printUnknownArg :: PrefixMap -> UnknownArg -> Doc
printUnknownArg pds :: PrefixMap
pds uarg :: UnknownArg
uarg = case UnknownArg
uarg of
    IndividualArg iarg :: IndividualArg
iarg -> PrefixMap -> IndividualArg -> Doc
printIndividualArg PrefixMap
pds IndividualArg
iarg
    DataArg darg :: DataArg
darg -> PrefixMap -> DataArg -> Doc
printDataArg PrefixMap
pds DataArg
darg
    Variable var :: IRI
var -> String -> Doc
text "?" Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
var

printIndividualArg :: GA.PrefixMap -> IndividualArg -> Doc
printIndividualArg :: PrefixMap -> IndividualArg -> Doc
printIndividualArg pds :: PrefixMap
pds iarg :: IndividualArg
iarg = case IndividualArg
iarg of
    IArg iri :: IRI
iri -> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri
    IVar v :: IRI
v -> String -> Doc
text "?" Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
v

printDataArg :: GA.PrefixMap -> DataArg -> Doc
printDataArg :: PrefixMap -> DataArg -> Doc
printDataArg pds :: PrefixMap
pds darg :: DataArg
darg = case DataArg
darg of
    DArg iri :: TargetValue
iri -> PrefixMap -> TargetValue -> Doc
printLiteral PrefixMap
pds TargetValue
iri
    DVar v :: IRI
v -> String -> Doc
text "?" Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
v

-- | print Annotations
printAnnotationValue :: GA.PrefixMap -> AnnotationValue -> Doc
printAnnotationValue :: PrefixMap -> AnnotationValue -> Doc
printAnnotationValue pds :: PrefixMap
pds anVal :: AnnotationValue
anVal = case AnnotationValue
anVal of
    AnnAnInd anInd :: IRI
anInd -> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
anInd
    AnnValue iri :: IRI
iri -> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri
    AnnValLit lit :: TargetValue
lit -> PrefixMap -> TargetValue -> Doc
printLiteral PrefixMap
pds TargetValue
lit

printAnnotation :: GA.PrefixMap -> Int -> Annotation -> Doc
printAnnotation :: PrefixMap -> Int -> Annotation -> Doc
printAnnotation pds :: PrefixMap
pds n :: Int
n (Annotation anns :: AxiomAnnotations
anns ap :: IRI
ap av :: AnnotationValue
av) =
    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
hsep ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$ [Int -> Doc
tabs Int
n, Doc
docAnnProp, Doc
docAnnVal])
    where
        docAnnProp :: Doc
docAnnProp = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
ap
        docAnnVal :: Doc
docAnnVal = PrefixMap -> AnnotationValue -> Doc
printAnnotationValue PrefixMap
pds AnnotationValue
av

printAnnotations :: GA.PrefixMap -> Int -> Annotations -> Doc
printAnnotations :: PrefixMap -> Int -> AxiomAnnotations -> Doc
printAnnotations _ _ [] = Doc
empty
printAnnotations pds :: PrefixMap
pds n :: Int
n anns :: AxiomAnnotations
anns =
    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)
-> (AxiomAnnotations -> [Doc]) -> AxiomAnnotations -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> (AxiomAnnotations -> [Doc]) -> AxiomAnnotations -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Annotation -> Doc) -> AxiomAnnotations -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Int -> Annotation -> Doc
printAnnotation PrefixMap
pds (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)) (AxiomAnnotations -> Doc) -> AxiomAnnotations -> Doc
forall a b. (a -> b) -> a -> b
$ AxiomAnnotations
anns)

-- | print IRI
printIRI :: GA.PrefixMap -> IRI -> Doc
printIRI :: PrefixMap -> IRI -> Doc
printIRI pds :: PrefixMap
pds i :: IRI
i
    | IRI -> Bool
isAbbrev IRI
iri Bool -> Bool -> Bool
&& String
prefName String -> PrefixMap -> Bool
forall k a. Ord k => k -> Map k a -> Bool
`M.member` PrefixMap
pds = String -> Doc
text (IRI -> String
showIRI IRI
iri)
    | IRI -> Bool
isAbbrev IRI
iri Bool -> Bool -> Bool
&& String -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
prefName = String -> Doc
text (IRI -> String
showIRIFull IRI
iri)
    | Bool
otherwise = String -> Doc
text (IRI -> String
showIRI IRI
iri)
  where
    iri :: IRI
iri = Bool -> IRI -> IRI
setAngles Bool
True IRI
i
    prefName :: String
prefName = IRI -> String
prefixName IRI
iri


printDataIRI :: GA.PrefixMap -> IRI -> Doc
printDataIRI :: PrefixMap -> IRI -> Doc
printDataIRI pds :: PrefixMap
pds q :: IRI
q
    | IRI -> Bool
isDatatypeKey IRI
q = String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ IRI -> String
showIRI (IRI -> String) -> IRI -> String
forall a b. (a -> b) -> a -> b
$ IRI -> IRI
setDatatypePrefix IRI
q
    | Bool
otherwise = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
q

-- | print Literal
printLiteral :: GA.PrefixMap -> Literal -> Doc
printLiteral :: PrefixMap -> TargetValue -> Doc
printLiteral pds :: PrefixMap
pds (Literal lexi :: String
lexi ty :: TypedOrUntyped
ty) =
    case TypedOrUntyped
ty of
        Untyped tag :: Maybe String
tag -> String -> Maybe String -> Doc
printUntypedLiteral String
lexi Maybe String
tag
        Typed iri :: IRI
iri -> PrefixMap -> String -> IRI -> Doc
printTypedLiteral PrefixMap
pds String
lexi IRI
iri

printLiteral _ (NumberLit f :: FloatLit
f) = String -> Doc
text (FloatLit -> String
forall a. Show a => a -> String
show FloatLit
f)

printUntypedLiteral :: String -> Maybe String -> Doc
printUntypedLiteral :: String -> Maybe String -> Doc
printUntypedLiteral lexi :: String
lexi tag :: Maybe String
tag = 
    String -> Doc
plainText ('"' Char -> ShowS
forall a. a -> [a] -> [a]
: ShowS
escapeString String
lexi String -> ShowS
forall a. [a] -> [a] -> [a]
++ "\"") 
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc
literalTail
    where
        literalTail :: Doc
literalTail = case Maybe String
tag of
            Nothing -> Doc
empty
            Just tg :: String
tg -> String -> Doc
text String
asP Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
text String
tg

printTypedLiteral :: GA.PrefixMap -> String -> IRI -> Doc 
printTypedLiteral :: PrefixMap -> String -> IRI -> Doc
printTypedLiteral pds :: PrefixMap
pds lexi :: String
lexi iri :: IRI
iri
    | IRI -> Bool
isAbbrev IRI
iri Bool -> Bool -> Bool
&& String
pn String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "xsd" Bool -> Bool -> Bool
&& String
iFrag String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "float" =
        String -> Doc
plainText (ShowS
escapeString String
lexi) Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
text "f"
    | IRI -> Bool
isAbbrev IRI
iri Bool -> Bool -> Bool
&& String
pn String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "xsd" Bool -> Bool -> Bool
&& String
iFrag String -> [String] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` ["integer", "decimal"] =
        String -> Doc
plainText (String -> Doc) -> ShowS -> String -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShowS
escapeString (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ String
lexi
    | Bool
otherwise = String -> Doc
plainText ('"' Char -> ShowS
forall a. a -> [a] -> [a]
: ShowS
escapeString String
lexi String -> ShowS
forall a. [a] -> [a] -> [a]
++ "\"")
        Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
text "^^" Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> PrefixMap -> IRI -> Doc
printDataIRI PrefixMap
pds IRI
iri
    where
        pn :: String
pn = IRI -> String
prefixName IRI
iri
        iFrag :: String
iFrag = IRI -> String
iFragment IRI
iri

escapeString ::  String -> String
escapeString :: ShowS
escapeString [] = []
escapeString ('"':s :: String
s) = '\\' Char -> ShowS
forall a. a -> [a] -> [a]
: '"' Char -> ShowS
forall a. a -> [a] -> [a]
: ShowS
escapeString String
s
escapeString ('\\':s :: String
s) = '\\' Char -> ShowS
forall a. a -> [a] -> [a]
: '\\' Char -> ShowS
forall a. a -> [a] -> [a]
: ShowS
escapeString String
s
escapeString (c :: Char
c:s :: String
s) = Char
c Char -> ShowS
forall a. a -> [a] -> [a]
: ShowS
escapeString String
s 

---------------- | print ObjectPropertyExpression
printObjectPropertyExpressionsVer :: GA.PrefixMap
    -> [ObjectPropertyExpression] -> Doc
printObjectPropertyExpressionsVer :: PrefixMap -> PropertyExpressionChain -> Doc
printObjectPropertyExpressionsVer pds :: PrefixMap
pds =
    [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 (PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds)

printObjectPropertyExpressionsHor :: GA.PrefixMap
    -> [ObjectPropertyExpression] -> Doc
printObjectPropertyExpressionsHor :: PrefixMap -> PropertyExpressionChain -> Doc
printObjectPropertyExpressionsHor pds :: PrefixMap
pds =
    [Doc] -> Doc
hsep ([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 (PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds)

printObjectPropertyExpression :: GA.PrefixMap
    -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression :: PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression pds :: PrefixMap
pds obExpr :: ObjectPropertyExpression
obExpr =
    case ObjectPropertyExpression
obExpr of
        ObjectProp ou :: IRI
ou -> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
ou
        ObjectInverseOf iopExp :: ObjectPropertyExpression
iopExp -> 
            String -> Doc
keyword String
inverseS
            Doc -> Doc -> Doc
<+> PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
iopExp

---------------- | print DataRange
printFV :: GA.PrefixMap -> (ConstrainingFacet, RestrictionValue) -> Doc
printFV :: PrefixMap -> (IRI, TargetValue) -> Doc
printFV pds :: PrefixMap
pds (facet :: IRI
facet, restValue :: TargetValue
restValue) =
    String -> Doc
text (IRI -> String
fromCF IRI
facet) Doc -> Doc -> Doc
<+> PrefixMap -> TargetValue -> Doc
printLiteral PrefixMap
pds TargetValue
restValue

fromCF :: ConstrainingFacet -> String
fromCF :: IRI -> String
fromCF f :: IRI
f
    | IRI -> Bool
isAbbrev IRI
f Bool -> Bool -> Bool
&& IRI -> String
prefixName IRI
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "xsd"
        Bool -> Bool -> Bool
&& (IRI -> String
iFragment IRI
f) String -> [String] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` ["length", "minLength", "maxLength", "pattern"]
            = IRI -> String
iFragment IRI
f
    | IRI -> Bool
isAbbrev IRI
f Bool -> Bool -> Bool
&& IRI -> String
prefixName IRI
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "rdf" Bool -> Bool -> Bool
&& IRI -> String
iFragment IRI
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "langRange"
        = "langRange"
    | IRI -> Bool
isAbbrev IRI
f Bool -> Bool -> Bool
&& IRI -> String
prefixName IRI
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "xsd" Bool -> Bool -> Bool
&& IRI -> String
iFragment IRI
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "minInclusive"
        = "<="
    | IRI -> Bool
isAbbrev IRI
f Bool -> Bool -> Bool
&& IRI -> String
prefixName IRI
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "xsd" Bool -> Bool -> Bool
&& IRI -> String
iFragment IRI
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "minExclusive"
        = "<"
    | IRI -> Bool
isAbbrev IRI
f Bool -> Bool -> Bool
&& IRI -> String
prefixName IRI
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "xsd" Bool -> Bool -> Bool
&& IRI -> String
iFragment IRI
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "maxInclusive"
        = ">="
    | IRI -> Bool
isAbbrev IRI
f Bool -> Bool -> Bool
&& IRI -> String
prefixName IRI
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "xsd" Bool -> Bool -> Bool
&& IRI -> String
iFragment IRI
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "maxExclusive"
        = ">"
    | IRI -> Bool
hasFullIRI IRI
f = IRI -> String
showIRICompact IRI
f
    | Bool
otherwise = Id -> String
forall a. Show a => a -> String
show (Id -> String) -> Id -> String
forall a b. (a -> b) -> a -> b
$ IRI -> Id
iriPath IRI
f

printDataRange :: GA.PrefixMap -> DataRange -> Doc
printDataRange :: PrefixMap -> DataRange -> Doc
printDataRange pds :: PrefixMap
pds dr :: DataRange
dr = case DataRange
dr of
    DataType dtype :: IRI
dtype l :: [(IRI, TargetValue)]
l -> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dtype Doc -> Doc -> Doc
<+>
        if [(IRI, TargetValue)] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [(IRI, TargetValue)]
l then Doc
empty else Doc -> Doc
brackets (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ [Doc] -> Doc
sepByCommas ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$ ((IRI, TargetValue) -> Doc) -> [(IRI, TargetValue)] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> (IRI, TargetValue) -> Doc
printFV PrefixMap
pds) [(IRI, TargetValue)]
l
    DataComplementOf drange :: DataRange
drange -> String -> Doc
keyword String
notS Doc -> Doc -> Doc
<+> PrefixMap -> DataRange -> Doc
printDataRange PrefixMap
pds DataRange
drange
    DataOneOf constList :: [TargetValue]
constList ->
        Doc -> Doc
specBraces (Doc -> Doc) -> ([TargetValue] -> Doc) -> [TargetValue] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Doc] -> Doc
fsep ([Doc] -> Doc) -> ([TargetValue] -> [Doc]) -> [TargetValue] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([TargetValue] -> [Doc]) -> [TargetValue] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (TargetValue -> Doc) -> [TargetValue] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> TargetValue -> Doc
printLiteral PrefixMap
pds) ([TargetValue] -> Doc) -> [TargetValue] -> Doc
forall a b. (a -> b) -> a -> b
$ [TargetValue]
constList
    DataJunction ty :: JunctionType
ty drlist :: [DataRange]
drlist -> let
      k :: String
k = case JunctionType
ty of
          UnionOf -> String
orS
          IntersectionOf -> String
andS
      in [Doc] -> Doc
fsep ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$ Doc -> [Doc] -> [Doc]
prepPunctuate (String -> Doc
keyword String
k Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc
space)
            ([Doc] -> [Doc]) -> [Doc] -> [Doc]
forall a b. (a -> b) -> a -> b
$ (DataRange -> Doc) -> [DataRange] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> DataRange -> Doc
printDataRange PrefixMap
pds) [DataRange]
drlist

---------------- | print ClassExpression
printClassExpressionsHor :: GA.PrefixMap -> [ClassExpression] -> Doc
printClassExpressionsHor :: PrefixMap -> [ClassExpression] -> Doc
printClassExpressionsHor pds :: PrefixMap
pds =
    [Doc] -> Doc
hsep ([Doc] -> Doc)
-> ([ClassExpression] -> [Doc]) -> [ClassExpression] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([ClassExpression] -> [Doc]) -> [ClassExpression] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ClassExpression -> Doc) -> [ClassExpression] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds)

printClassExpressionsVer :: GA.PrefixMap -> [ClassExpression] -> Doc
printClassExpressionsVer :: PrefixMap -> [ClassExpression] -> Doc
printClassExpressionsVer pds :: PrefixMap
pds =
    [Doc] -> Doc
vcat ([Doc] -> Doc)
-> ([ClassExpression] -> [Doc]) -> [ClassExpression] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> [Doc])
-> ([ClassExpression] -> [Doc]) -> [ClassExpression] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ClassExpression -> Doc) -> [ClassExpression] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds)

printClassExpression :: GA.PrefixMap -> ClassExpression -> Doc
printClassExpression :: PrefixMap -> ClassExpression -> Doc
printClassExpression pds :: PrefixMap
pds expr :: ClassExpression
expr = case ClassExpression
expr of 
    Expression ocUri :: IRI
ocUri -> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
ocUri
    ObjectJunction ty :: JunctionType
ty ds :: [ClassExpression]
ds -> let
        k :: String
k = case JunctionType
ty of
            UnionOf -> String
orS
            IntersectionOf -> String
andS
        in [Doc] -> Doc
fsep ([Doc] -> Doc)
-> ([ClassExpression] -> [Doc]) -> [ClassExpression] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
prepPunctuate (String -> Doc
keyword String
k Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc
space)
                ([Doc] -> [Doc])
-> ([ClassExpression] -> [Doc]) -> [ClassExpression] -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ClassExpression -> Doc) -> [ClassExpression] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> ClassExpression -> Doc
printPrimary PrefixMap
pds) ([ClassExpression] -> Doc) -> [ClassExpression] -> Doc
forall a b. (a -> b) -> a -> b
$ [ClassExpression]
ds
    ObjectComplementOf d :: ClassExpression
d -> String -> Doc
keyword String
notS Doc -> Doc -> Doc
<+> PrefixMap -> ClassExpression -> Doc
printPrimary PrefixMap
pds ClassExpression
d
    ObjectOneOf indUriList :: [IRI]
indUriList ->
        Doc -> Doc
specBraces (Doc -> Doc) -> ([IRI] -> Doc) -> [IRI] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Doc] -> Doc
fsep ([Doc] -> Doc) -> ([IRI] -> [Doc]) -> [IRI] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([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 (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds) ([IRI] -> Doc) -> [IRI] -> Doc
forall a b. (a -> b) -> a -> b
$ [IRI]
indUriList
    ObjectValuesFrom ty :: QuantifierType
ty opExp :: ObjectPropertyExpression
opExp d :: ClassExpression
d ->
        PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
opExp
        Doc -> Doc -> Doc
<+> QuantifierType -> Doc
quantifierType QuantifierType
ty
        Doc -> Doc -> Doc
<+> PrefixMap -> ClassExpression -> Doc
printPrimary PrefixMap
pds ClassExpression
d
    ObjectHasSelf opExp :: ObjectPropertyExpression
opExp ->
        PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
opExp Doc -> Doc -> Doc
<+> String -> Doc
keyword String
selfS
    ObjectHasValue opExp :: ObjectPropertyExpression
opExp indUri :: IRI
indUri ->
        PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
opExp 
        Doc -> Doc -> Doc
<+> String -> Doc
keyword String
valueS Doc -> Doc -> Doc
<+> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
indUri
    ObjectCardinality (Cardinality ty :: CardinalityType
ty card :: Int
card opExp :: ObjectPropertyExpression
opExp maybeDesc :: Maybe ClassExpression
maybeDesc) ->
        PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
opExp Doc -> Doc -> Doc
<+> CardinalityType -> Doc
cardinalityType CardinalityType
ty
        Doc -> Doc -> Doc
<+> String -> Doc
text (Int -> String
forall a. Show a => a -> String
show Int
card)
        Doc -> Doc -> Doc
<+> Doc -> (ClassExpression -> Doc) -> Maybe ClassExpression -> Doc
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Doc
empty (PrefixMap -> ClassExpression -> Doc
printPrimary PrefixMap
pds) Maybe ClassExpression
maybeDesc
    DataValuesFrom ty :: QuantifierType
ty dpExps :: [IRI]
dpExps dRange :: DataRange
dRange -> (case [IRI]
dpExps of
            [dpExp :: IRI
dpExp] -> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dpExp
            _ -> Doc -> Doc
parens (Doc -> Doc) -> ([Doc] -> Doc) -> [Doc] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Doc] -> Doc
hsep ([Doc] -> Doc) -> ([Doc] -> [Doc]) -> [Doc] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
punctuate Doc
comma ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$ (IRI -> Doc) -> [IRI] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds) [IRI]
dpExps)
        Doc -> Doc -> Doc
<+> QuantifierType -> Doc
quantifierType QuantifierType
ty
        Doc -> Doc -> Doc
<+> PrefixMap -> DataRange -> Doc
printDataRange PrefixMap
pds DataRange
dRange
    DataHasValue dpExp :: IRI
dpExp cons :: TargetValue
cons ->
        PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dpExp Doc -> Doc -> Doc
<+> String -> Doc
keyword String
valueS Doc -> Doc -> Doc
<+> PrefixMap -> TargetValue -> Doc
printLiteral PrefixMap
pds TargetValue
cons
    DataCardinality (Cardinality ty :: CardinalityType
ty card :: Int
card dpExp :: IRI
dpExp maybeRange :: Maybe DataRange
maybeRange) ->
        PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dpExp Doc -> Doc -> Doc
<+> CardinalityType -> Doc
cardinalityType CardinalityType
ty 
        Doc -> Doc -> Doc
<+> String -> Doc
text (Int -> String
forall a. Show a => a -> String
show Int
card)
        Doc -> Doc -> Doc
<+> Doc -> (DataRange -> Doc) -> Maybe DataRange -> Doc
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Doc
empty (PrefixMap -> DataRange -> Doc
printDataRange PrefixMap
pds) Maybe DataRange
maybeRange

printPrimary :: GA.PrefixMap -> ClassExpression -> Doc
printPrimary :: PrefixMap -> ClassExpression -> Doc
printPrimary pds :: PrefixMap
pds d :: ClassExpression
d = 
    let dd :: Doc
dd = PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
d
    in case ClassExpression
d of
        Expression _ -> Doc
dd
        ObjectOneOf{} -> Doc
dd
        _ -> Doc -> Doc
parens Doc
dd

quantifierType :: QuantifierType -> Doc
quantifierType :: QuantifierType -> Doc
quantifierType = String -> Doc
keyword (String -> Doc)
-> (QuantifierType -> String) -> QuantifierType -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. QuantifierType -> String
showQuantifierType

cardinalityType :: CardinalityType -> Doc
cardinalityType :: CardinalityType -> Doc
cardinalityType = String -> Doc
keyword (String -> Doc)
-> (CardinalityType -> String) -> CardinalityType -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CardinalityType -> String
showCardinalityType