module OWL2.PrintAS where

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

import OWL2.AS
import OWL2.ASKeywords

import qualified Data.Map as M

-- | auxiliary parens function
sParens :: Doc -> Doc
sParens :: Doc -> Doc
sParens d :: Doc
d = Doc -> Doc
parens (Doc
space Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc
d Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc
space)

-- | print IRI
printIRI :: GA.PrefixMap -> IRI -> Doc
printIRI :: PrefixMap -> IRI -> Doc
printIRI pds :: PrefixMap
pds iri :: IRI
iri
    | 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 (String
prefName String -> String -> String
forall a. [a] -> [a] -> [a]
++ ":" String -> String -> String
forall a. [a] -> [a] -> [a]
++ (IRI -> String
iFragment 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 ":") Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> IRI -> Doc
forall a. Pretty a => a -> Doc
pretty IRI
iri  

    | Bool
otherwise = IRI -> Doc
forall a. Pretty a => a -> Doc
pretty IRI
iri
  where 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 -> Literal -> Doc
printLiteral pds :: PrefixMap
pds lit :: Literal
lit = case Literal
lit of 
    Literal lexi :: String
lexi ty :: TypedOrUntyped
ty -> String -> Doc
plainText ('"' Char -> String -> String
forall a. a -> [a] -> [a]
: String -> String
escapeString String
lexi String -> String -> String
forall a. [a] -> [a] -> [a]
++ "\"")
        Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> TypedOrUntyped -> Doc
literalTail TypedOrUntyped
ty
    NumberLit f :: FloatLit
f -> String -> Doc
text (FloatLit -> String
forall a. Show a => a -> String
show FloatLit
f)
    where 
        literalTail :: TypedOrUntyped -> Doc
literalTail ty :: TypedOrUntyped
ty = case TypedOrUntyped
ty of
            Typed iri :: IRI
iri -> String -> Doc
keyword String
cTypeS Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> PrefixMap -> IRI -> Doc
printDataIRI PrefixMap
pds IRI
iri
            Untyped tag :: Maybe String
tag -> 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

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

-- | print PropertyExpression
printObjectPropertyExpression :: GA.PrefixMap -> ObjectPropertyExpression
    -> Doc
printObjectPropertyExpression :: PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression pds :: PrefixMap
pds obExpr :: ObjectPropertyExpression
obExpr = case ObjectPropertyExpression
obExpr of
    ObjectProp objProp :: IRI
objProp -> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
objProp
    ObjectInverseOf iObjPropExpr :: ObjectPropertyExpression
iObjPropExpr ->
        String -> Doc
keyword String
objectInverseOfS
        Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens (PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
iObjPropExpr)

-- | print Entity
printEntity :: GA.PrefixMap -> Entity -> Doc
printEntity :: PrefixMap -> Entity -> Doc
printEntity pds :: PrefixMap
pds (Entity _ ty :: EntityType
ty ent :: IRI
ent) =
    String -> Doc
keyword String
entityTypeS Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens (Doc
docEnt)
    where
        docEnt :: Doc
docEnt = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
ent
        entityTypeS :: String
entityTypeS = case EntityType
ty of
            Datatype -> "Datatype"
            Class -> "Class"
            ObjectProperty -> "ObjectProperty"
            DataProperty -> "DataProperty"
            AnnotationProperty -> "AnnotationProperty"
            NamedIndividual -> "NamedIndividual"

-- | print DataRanges
printDataRange :: GA.PrefixMap -> DataRange -> Doc
printDataRange :: PrefixMap -> DataRange -> Doc
printDataRange pds :: PrefixMap
pds dr :: DataRange
dr = case DataRange
dr of
    DataType dt :: IRI
dt fvs :: [(IRI, Literal)]
fvs -> PrefixMap -> IRI -> [(IRI, Literal)] -> Doc
printDataRestriction PrefixMap
pds IRI
dt [(IRI, Literal)]
fvs
    DataJunction jt :: JunctionType
jt drs :: [DataRange]
drs -> PrefixMap -> JunctionType -> [DataRange] -> Doc
printDataJunction PrefixMap
pds JunctionType
jt [DataRange]
drs
    DataComplementOf dr' :: DataRange
dr' -> PrefixMap -> DataRange -> Doc
printDataComplementOf PrefixMap
pds DataRange
dr'
    DataOneOf lits :: [Literal]
lits -> PrefixMap -> [Literal] -> Doc
printDataOneOf PrefixMap
pds [Literal]
lits

printDataRestriction :: GA.PrefixMap -> Datatype
    -> [(ConstrainingFacet, RestrictionValue)] -> Doc
printDataRestriction :: PrefixMap -> IRI -> [(IRI, Literal)] -> Doc
printDataRestriction pds :: PrefixMap
pds dt :: IRI
dt fvs :: [(IRI, Literal)]
fvs
    | [(IRI, Literal)] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [(IRI, Literal)]
fvs = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dt
    | Bool
otherwise = String -> Doc
keyword String
datatypeRestrictionS
        Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$ [[Doc
docDt], [Doc]
fvsUnwrapped])
    where
        fvsUnwrapped :: [Doc]
fvsUnwrapped = [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [[PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
f, PrefixMap -> Literal -> Doc
printLiteral PrefixMap
pds Literal
v]
            | (f :: IRI
f, v :: Literal
v) <- [(IRI, Literal)]
fvs]
        docDt :: Doc
docDt = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dt

printDataJunction :: GA.PrefixMap -> JunctionType -> [DataRange] -> Doc
printDataJunction :: PrefixMap -> JunctionType -> [DataRange] -> Doc
printDataJunction pds :: PrefixMap
pds jt :: JunctionType
jt drs :: [DataRange]
drs =
    Doc
junctionKeyword Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep [Doc]
docDrs)
    where 
        junctionKeyword :: Doc
junctionKeyword = case JunctionType
jt of 
            UnionOf -> String -> Doc
keyword String
dataUnionOfS
            IntersectionOf -> String -> Doc
keyword String
dataIntersectionOfS
        docDrs :: [Doc]
docDrs = (DataRange -> Doc) -> [DataRange] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> DataRange -> Doc
printDataRange PrefixMap
pds) [DataRange]
drs

printDataComplementOf :: GA.PrefixMap -> DataRange -> Doc
printDataComplementOf :: PrefixMap -> DataRange -> Doc
printDataComplementOf pds :: PrefixMap
pds dr :: DataRange
dr =
    String -> Doc
keyword String
dataComplementOfS Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens Doc
docDr
    where docDr :: Doc
docDr = PrefixMap -> DataRange -> Doc
printDataRange PrefixMap
pds DataRange
dr

printDataOneOf :: GA.PrefixMap -> [Literal] -> Doc
printDataOneOf :: PrefixMap -> [Literal] -> Doc
printDataOneOf pds :: PrefixMap
pds lits :: [Literal]
lits = String -> Doc
keyword String
dataOneOfS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([Literal] -> [Doc]) -> [Literal] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Literal -> Doc) -> [Literal] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Literal -> Doc
printLiteral PrefixMap
pds) ([Literal] -> Doc) -> [Literal] -> Doc
forall a b. (a -> b) -> a -> b
$ [Literal]
lits)

-- | print ClassExpressions
printClassExpression :: GA.PrefixMap -> ClassExpression -> Doc
printClassExpression :: PrefixMap -> ClassExpression -> Doc
printClassExpression pds :: PrefixMap
pds clExpr :: ClassExpression
clExpr = case ClassExpression
clExpr of
    Expression cl :: IRI
cl -> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
cl
    ObjectJunction jt :: JunctionType
jt clExprs :: [ClassExpression]
clExprs -> PrefixMap -> JunctionType -> [ClassExpression] -> Doc
printObjectJunction PrefixMap
pds JunctionType
jt [ClassExpression]
clExprs
    ObjectComplementOf clexpr :: ClassExpression
clexpr -> PrefixMap -> ClassExpression -> Doc
printObjectComplementOf PrefixMap
pds ClassExpression
clexpr
    ObjectOneOf inds :: [IRI]
inds -> PrefixMap -> [IRI] -> Doc
printObjectOneOf PrefixMap
pds [IRI]
inds
    ObjectValuesFrom qt :: QuantifierType
qt obPropExpr :: ObjectPropertyExpression
obPropExpr clexpr :: ClassExpression
clexpr ->
        PrefixMap
-> QuantifierType
-> ObjectPropertyExpression
-> ClassExpression
-> Doc
printObjectValuesFrom PrefixMap
pds QuantifierType
qt ObjectPropertyExpression
obPropExpr ClassExpression
clexpr
    ObjectHasValue objPropExpr :: ObjectPropertyExpression
objPropExpr ind :: IRI
ind ->
        PrefixMap -> ObjectPropertyExpression -> IRI -> Doc
printObjectHasValue PrefixMap
pds ObjectPropertyExpression
objPropExpr IRI
ind
    ObjectHasSelf objPropExpr :: ObjectPropertyExpression
objPropExpr -> PrefixMap -> ObjectPropertyExpression -> Doc
printObjectHasSelf PrefixMap
pds ObjectPropertyExpression
objPropExpr
    ObjectCardinality card :: Cardinality ObjectPropertyExpression ClassExpression
card -> PrefixMap
-> Cardinality ObjectPropertyExpression ClassExpression -> Doc
printObjectCardinality PrefixMap
pds Cardinality ObjectPropertyExpression ClassExpression
card
    DataValuesFrom qt :: QuantifierType
qt dPropExprs :: [IRI]
dPropExprs dr :: DataRange
dr ->
        PrefixMap -> QuantifierType -> [IRI] -> DataRange -> Doc
printDataValuesFrom PrefixMap
pds QuantifierType
qt [IRI]
dPropExprs DataRange
dr
    DataHasValue dPropExpr :: IRI
dPropExpr lit :: Literal
lit -> PrefixMap -> IRI -> Literal -> Doc
printDataHasValue PrefixMap
pds IRI
dPropExpr Literal
lit
    DataCardinality card :: Cardinality IRI DataRange
card -> PrefixMap -> Cardinality IRI DataRange -> Doc
printDataCardinality PrefixMap
pds Cardinality IRI DataRange
card

printObjectJunction :: GA.PrefixMap -> JunctionType
    -> [ClassExpression] -> Doc
printObjectJunction :: PrefixMap -> JunctionType -> [ClassExpression] -> Doc
printObjectJunction pds :: PrefixMap
pds jt :: JunctionType
jt clExprs :: [ClassExpression]
clExprs =
    Doc
junctionKeyword Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep [Doc]
docClExprs)
    where 
        junctionKeyword :: Doc
junctionKeyword = case JunctionType
jt of
            UnionOf -> String -> Doc
keyword String
objectUnionOfS
            IntersectionOf -> String -> Doc
keyword String
objectIntersectionOfS
        docClExprs :: [Doc]
docClExprs = (ClassExpression -> Doc) -> [ClassExpression] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds) [ClassExpression]
clExprs

printObjectComplementOf :: GA.PrefixMap -> ClassExpression -> Doc
printObjectComplementOf :: PrefixMap -> ClassExpression -> Doc
printObjectComplementOf pds :: PrefixMap
pds clExpr :: ClassExpression
clExpr =
    String -> Doc
keyword String
objectComplementOfS Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens (Doc
docClExpr)
    where docClExpr :: Doc
docClExpr = PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
clExpr

printObjectOneOf :: GA.PrefixMap -> [Individual] -> Doc
printObjectOneOf :: PrefixMap -> [IRI] -> Doc
printObjectOneOf pds :: PrefixMap
pds inds :: [IRI]
inds =
    String -> Doc
keyword String
objectOneOfS Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep [Doc]
docInds)
    where docInds :: [Doc]
docInds = (IRI -> Doc) -> [IRI] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds) [IRI]
inds

printObjectValuesFrom :: GA.PrefixMap -> QuantifierType
    -> ObjectPropertyExpression -> ClassExpression -> Doc
printObjectValuesFrom :: PrefixMap
-> QuantifierType
-> ObjectPropertyExpression
-> ClassExpression
-> Doc
printObjectValuesFrom pds :: PrefixMap
pds qt :: QuantifierType
qt obPropExpr :: ObjectPropertyExpression
obPropExpr clExpr :: ClassExpression
clExpr =
    Doc
quantifierKeyword Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep [Doc
docObPropExpr, Doc
docClExpr])
    where
        quantifierKeyword :: Doc
quantifierKeyword = case QuantifierType
qt of
            AllValuesFrom -> String -> Doc
keyword String
objectAllValuesFromS
            SomeValuesFrom -> String -> Doc
keyword String
objectSomeValuesFromS
        docObPropExpr :: Doc
docObPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
obPropExpr
        docClExpr :: Doc
docClExpr = PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
clExpr

printObjectHasValue :: GA.PrefixMap -> ObjectPropertyExpression
    -> Individual -> Doc
printObjectHasValue :: PrefixMap -> ObjectPropertyExpression -> IRI -> Doc
printObjectHasValue pds :: PrefixMap
pds objPropExpr :: ObjectPropertyExpression
objPropExpr ind :: IRI
ind =
    String -> Doc
keyword String
objectHasValueS Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep [Doc
docObjPropExpr, Doc
docInd])
    where
        docObjPropExpr :: Doc
docObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr
        docInd :: Doc
docInd = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
ind

printObjectHasSelf :: GA.PrefixMap -> ObjectPropertyExpression -> Doc
printObjectHasSelf :: PrefixMap -> ObjectPropertyExpression -> Doc
printObjectHasSelf pds :: PrefixMap
pds objPropExpr :: ObjectPropertyExpression
objPropExpr =
    String -> Doc
keyword String
objectHasSelfS Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens Doc
docObjPropExpr
    where docObjPropExpr :: Doc
docObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr

printObjectCardinality :: GA.PrefixMap 
    -> Cardinality ObjectPropertyExpression ClassExpression -> Doc
printObjectCardinality :: PrefixMap
-> Cardinality ObjectPropertyExpression ClassExpression -> Doc
printObjectCardinality pds :: PrefixMap
pds card :: Cardinality ObjectPropertyExpression ClassExpression
card =
    Doc
cardinalityKeyword Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$
        [String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ Int -> String
forall a. Show a => a -> String
show Int
n, Doc
docObjPropExpr, Doc
docClExpr])
    where
        (Cardinality cardType :: CardinalityType
cardType n :: Int
n objPropExpr :: ObjectPropertyExpression
objPropExpr mClExpr :: Maybe ClassExpression
mClExpr) = Cardinality ObjectPropertyExpression ClassExpression
card
        cardinalityKeyword :: Doc
cardinalityKeyword = case CardinalityType
cardType of
            MaxCardinality -> String -> Doc
keyword String
objectMaxCardinalityS
            MinCardinality -> String -> Doc
keyword String
objectMinCardinalityS
            ExactCardinality -> String -> Doc
keyword String
objectExactCardinalityS
        docObjPropExpr :: Doc
docObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr
        docClExpr :: Doc
docClExpr = case Maybe ClassExpression
mClExpr of
            Nothing -> Doc
empty
            Just clExpr :: ClassExpression
clExpr -> PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
clExpr

printDataValuesFrom :: GA.PrefixMap -> QuantifierType
    -> [DataPropertyExpression] -> DataRange -> Doc
printDataValuesFrom :: PrefixMap -> QuantifierType -> [IRI] -> DataRange -> Doc
printDataValuesFrom pds :: PrefixMap
pds qt :: QuantifierType
qt dPropExprs :: [IRI]
dPropExprs dr :: DataRange
dr =
    Doc
quantifierKeyword Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docDPropExprs, [Doc
docDr]])
    where
        quantifierKeyword :: Doc
quantifierKeyword = case QuantifierType
qt of
            AllValuesFrom -> String -> Doc
keyword String
dataAllValuesFromS
            SomeValuesFrom -> String -> Doc
keyword String
dataSomeValuesFromS
        docDPropExprs :: [Doc]
docDPropExprs = (IRI -> Doc) -> [IRI] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds) [IRI]
dPropExprs
        docDr :: Doc
docDr = PrefixMap -> DataRange -> Doc
printDataRange PrefixMap
pds DataRange
dr

printDataCardinality :: GA.PrefixMap
    -> Cardinality DataPropertyExpression DataRange -> Doc
printDataCardinality :: PrefixMap -> Cardinality IRI DataRange -> Doc
printDataCardinality pds :: PrefixMap
pds card :: Cardinality IRI DataRange
card = Doc
cardinalityKeyword Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$
        [String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ Int -> String
forall a. Show a => a -> String
show Int
n, Doc
docDataPropExpr, Doc
docDr])
    where
        (Cardinality cardType :: CardinalityType
cardType n :: Int
n dataPropExpr :: IRI
dataPropExpr mDr :: Maybe DataRange
mDr) = Cardinality IRI DataRange
card
        cardinalityKeyword :: Doc
cardinalityKeyword = case CardinalityType
cardType of
            MaxCardinality -> String -> Doc
keyword String
dataMaxCardinalityS
            MinCardinality -> String -> Doc
keyword String
dataMinCardinalityS
            ExactCardinality -> String -> Doc
keyword String
dataExactCardinalityS
        docDataPropExpr :: Doc
docDataPropExpr = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dataPropExpr
        docDr :: Doc
docDr = case Maybe DataRange
mDr of
            Nothing -> Doc
empty
            Just drange :: DataRange
drange -> PrefixMap -> DataRange -> Doc
printDataRange PrefixMap
pds DataRange
drange

printDataHasValue :: GA.PrefixMap -> DataPropertyExpression
    -> Literal -> Doc
printDataHasValue :: PrefixMap -> IRI -> Literal -> Doc
printDataHasValue pds :: PrefixMap
pds dPropExpr :: IRI
dPropExpr lit :: Literal
lit = 
    String -> Doc
keyword String
dataHasValueS Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens([Doc] -> Doc
hsep [Doc
docDPropExpr, Doc
docLit])
    where
        docDPropExpr :: Doc
docDPropExpr = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dPropExpr
        docLit :: Doc
docLit = PrefixMap -> Literal -> Doc
printLiteral PrefixMap
pds Literal
lit

-- | 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 :: Literal
lit -> PrefixMap -> Literal -> Doc
printLiteral PrefixMap
pds Literal
lit

printAnnotation :: GA.PrefixMap -> Annotation -> Doc
printAnnotation :: PrefixMap -> Annotation -> Doc
printAnnotation pds :: PrefixMap
pds (Annotation ans :: [Annotation]
ans anProp :: IRI
anProp anVal :: AnnotationValue
anVal) =
    String -> Doc
keyword String
annotationS Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAns, [Doc
docAnProp, Doc
docAnVal]])
    where
        docAns :: [Doc]
docAns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
ans
        docAnProp :: Doc
docAnProp = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
anProp
        docAnVal :: Doc
docAnVal = PrefixMap -> AnnotationValue -> Doc
printAnnotationValue PrefixMap
pds AnnotationValue
anVal

printAnnotationSubject :: GA.PrefixMap -> AnnotationSubject -> Doc
printAnnotationSubject :: PrefixMap -> AnnotationSubject -> Doc
printAnnotationSubject pds :: PrefixMap
pds annSub :: AnnotationSubject
annSub = case AnnotationSubject
annSub of
    AnnSubIri iri :: IRI
iri -> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri
    AnnSubAnInd ind :: IRI
ind -> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
ind

-- | print Axioms
printAxiom :: GA.PrefixMap -> Axiom -> Doc
printAxiom :: PrefixMap -> Axiom -> Doc
printAxiom pds :: PrefixMap
pds axiom :: Axiom
axiom = case Axiom
axiom of 
    Declaration axAnns :: [Annotation]
axAnns ent :: Entity
ent -> PrefixMap -> [Annotation] -> Entity -> Doc
printDeclaration PrefixMap
pds [Annotation]
axAnns Entity
ent
    ClassAxiom ax :: ClassAxiom
ax -> PrefixMap -> ClassAxiom -> Doc
printClassAxiom PrefixMap
pds ClassAxiom
ax
    ObjectPropertyAxiom ax :: ObjectPropertyAxiom
ax -> PrefixMap -> ObjectPropertyAxiom -> Doc
printObjectPropertyAxiom PrefixMap
pds ObjectPropertyAxiom
ax
    DataPropertyAxiom ax :: DataPropertyAxiom
ax -> PrefixMap -> DataPropertyAxiom -> Doc
printDataPropertyAxiom PrefixMap
pds DataPropertyAxiom
ax
    DatatypeDefinition axAnns :: [Annotation]
axAnns dt :: IRI
dt dr :: DataRange
dr 
        -> PrefixMap -> [Annotation] -> IRI -> DataRange -> Doc
printDatatypeDefinition PrefixMap
pds [Annotation]
axAnns IRI
dt DataRange
dr
    HasKey axAnns :: [Annotation]
axAnns clExpr :: ClassExpression
clExpr objPropExprs :: [ObjectPropertyExpression]
objPropExprs dataPropExprs :: [IRI]
dataPropExprs
        -> PrefixMap
-> [Annotation]
-> ClassExpression
-> [ObjectPropertyExpression]
-> [IRI]
-> Doc
printHasKey PrefixMap
pds [Annotation]
axAnns ClassExpression
clExpr [ObjectPropertyExpression]
objPropExprs [IRI]
dataPropExprs
    Assertion ax :: Assertion
ax -> PrefixMap -> Assertion -> Doc
printAssertion PrefixMap
pds Assertion
ax
    AnnotationAxiom ax :: AnnotationAxiom
ax -> PrefixMap -> AnnotationAxiom -> Doc
printAnnotationAxiom PrefixMap
pds AnnotationAxiom
ax
    Rule (DLSafeRule anns :: [Annotation]
anns body :: Body
body hd :: Body
hd) -> PrefixMap -> [Annotation] -> Body -> Body -> Doc
printDLSafeRule PrefixMap
pds [Annotation]
anns Body
body Body
hd
    Rule (DGRule anns :: [Annotation]
anns dgBody :: DGBody
dgBody dgHead :: DGBody
dgHead) -> PrefixMap -> [Annotation] -> DGBody -> DGBody -> Doc
printDGRule PrefixMap
pds [Annotation]
anns DGBody
dgBody DGBody
dgHead
    DGAxiom anns :: [Annotation]
anns dgName :: IRI
dgName dgNodes :: DGNodes
dgNodes dgEdges :: DGEdges
dgEdges mainClasses :: [IRI]
mainClasses ->
        PrefixMap
-> [Annotation] -> IRI -> DGNodes -> DGEdges -> [IRI] -> Doc
printDGAxiom PrefixMap
pds [Annotation]
anns IRI
dgName DGNodes
dgNodes DGEdges
dgEdges [IRI]
mainClasses

printDeclaration :: GA.PrefixMap -> AxiomAnnotations -> Entity -> Doc
printDeclaration :: PrefixMap -> [Annotation] -> Entity -> Doc
printDeclaration pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns ent :: Entity
ent =
    String -> Doc
keyword "Declaration"
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docEnt]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docEnt :: Doc
docEnt = PrefixMap -> Entity -> Doc
printEntity PrefixMap
pds Entity
ent

-- | print ClassAxiom
printClassAxiom :: GA.PrefixMap -> ClassAxiom -> Doc
printClassAxiom :: PrefixMap -> ClassAxiom -> Doc
printClassAxiom pds :: PrefixMap
pds ca :: ClassAxiom
ca = case ClassAxiom
ca of
    SubClassOf axAnns :: [Annotation]
axAnns subClExpr :: ClassExpression
subClExpr supClExpr :: ClassExpression
supClExpr ->
        PrefixMap
-> [Annotation] -> ClassExpression -> ClassExpression -> Doc
printSubClassOf PrefixMap
pds [Annotation]
axAnns ClassExpression
subClExpr ClassExpression
supClExpr
    EquivalentClasses axAnns :: [Annotation]
axAnns clExprs :: [ClassExpression]
clExprs ->
        PrefixMap -> [Annotation] -> [ClassExpression] -> Doc
printEquivalentClasses PrefixMap
pds [Annotation]
axAnns [ClassExpression]
clExprs
    DisjointClasses axAnns :: [Annotation]
axAnns clExprs :: [ClassExpression]
clExprs -> PrefixMap -> [Annotation] -> [ClassExpression] -> Doc
printDisjointClasses PrefixMap
pds [Annotation]
axAnns [ClassExpression]
clExprs
    DisjointUnion axAnns :: [Annotation]
axAnns cl :: IRI
cl disjClExprs :: [ClassExpression]
disjClExprs ->
        PrefixMap -> [Annotation] -> IRI -> [ClassExpression] -> Doc
printDisjointUnion PrefixMap
pds [Annotation]
axAnns IRI
cl [ClassExpression]
disjClExprs

printSubClassOf :: GA.PrefixMap -> AxiomAnnotations
    -> SubClassExpression -> SuperClassExpression -> Doc
printSubClassOf :: PrefixMap
-> [Annotation] -> ClassExpression -> ClassExpression -> Doc
printSubClassOf pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns subClExpr :: ClassExpression
subClExpr supClExpr :: ClassExpression
supClExpr =
    String -> Doc
keyword String
subClassOfS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docSubClExpr, Doc
docSupClExpr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docSubClExpr :: Doc
docSubClExpr = PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
subClExpr
        docSupClExpr :: Doc
docSupClExpr = PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
supClExpr

printEquivalentClasses :: GA.PrefixMap -> AxiomAnnotations
    -> [ClassExpression] -> Doc
printEquivalentClasses :: PrefixMap -> [Annotation] -> [ClassExpression] -> Doc
printEquivalentClasses pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns clExprs :: [ClassExpression]
clExprs =
    String -> Doc
keyword String
equivalentClassesS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc]
docClExprs])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docClExprs :: [Doc]
docClExprs = (ClassExpression -> Doc) -> [ClassExpression] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds) [ClassExpression]
clExprs

printDisjointClasses :: GA.PrefixMap -> AxiomAnnotations
    -> [ClassExpression] -> Doc
printDisjointClasses :: PrefixMap -> [Annotation] -> [ClassExpression] -> Doc
printDisjointClasses pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns clExprs :: [ClassExpression]
clExprs =
    String -> Doc
keyword String
disjointClassesS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc]
docClExprs])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docClExprs :: [Doc]
docClExprs = (ClassExpression -> Doc) -> [ClassExpression] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds) [ClassExpression]
clExprs

printDisjointUnion :: GA.PrefixMap -> AxiomAnnotations -> Class
    -> DisjointClassExpression  -> Doc
printDisjointUnion :: PrefixMap -> [Annotation] -> IRI -> [ClassExpression] -> Doc
printDisjointUnion pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns cl :: IRI
cl disjClExprs :: [ClassExpression]
disjClExprs = 
    String -> Doc
keyword String
disjointUnionS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docCl], [Doc]
docDisjClExprs])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docCl :: Doc
docCl = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
cl
        docDisjClExprs :: [Doc]
docDisjClExprs = (ClassExpression -> Doc) -> [ClassExpression] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds) [ClassExpression]
disjClExprs

-- | print SubObjectProperyExpression
printSubObjectPropertyExpression :: GA.PrefixMap
    -> SubObjectPropertyExpression -> Doc
printSubObjectPropertyExpression :: PrefixMap -> SubObjectPropertyExpression -> Doc
printSubObjectPropertyExpression pds :: PrefixMap
pds subObjPropExpr :: SubObjectPropertyExpression
subObjPropExpr =
    case SubObjectPropertyExpression
subObjPropExpr of
        SubObjPropExpr_obj objPropExpr :: ObjectPropertyExpression
objPropExpr
            -> PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr
        SubObjPropExpr_exprchain propExprChain :: [ObjectPropertyExpression]
propExprChain
            -> String -> Doc
keyword String
objectPropertyChainS 
                Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep
                    ([Doc] -> Doc)
-> ([ObjectPropertyExpression] -> [Doc])
-> [ObjectPropertyExpression]
-> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ObjectPropertyExpression -> Doc)
-> [ObjectPropertyExpression] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds) ([ObjectPropertyExpression] -> Doc)
-> [ObjectPropertyExpression] -> Doc
forall a b. (a -> b) -> a -> b
$ [ObjectPropertyExpression]
propExprChain)

-- | print ObjectPropertyAxiom
printObjectPropertyAxiom :: GA.PrefixMap -> ObjectPropertyAxiom -> Doc
printObjectPropertyAxiom :: PrefixMap -> ObjectPropertyAxiom -> Doc
printObjectPropertyAxiom pds :: PrefixMap
pds objPropAx :: ObjectPropertyAxiom
objPropAx = case ObjectPropertyAxiom
objPropAx of
    SubObjectPropertyOf axAnns :: [Annotation]
axAnns subObjPropExpr :: SubObjectPropertyExpression
subObjPropExpr supObjPropExpr :: ObjectPropertyExpression
supObjPropExpr
        -> PrefixMap
-> [Annotation]
-> SubObjectPropertyExpression
-> ObjectPropertyExpression
-> Doc
printSubObjectPropertyOf PrefixMap
pds [Annotation]
axAnns SubObjectPropertyExpression
subObjPropExpr ObjectPropertyExpression
supObjPropExpr
    EquivalentObjectProperties axAnns :: [Annotation]
axAnns objPropExprs :: [ObjectPropertyExpression]
objPropExprs
        -> PrefixMap -> [Annotation] -> [ObjectPropertyExpression] -> Doc
printEquivalentObjectProperties PrefixMap
pds [Annotation]
axAnns [ObjectPropertyExpression]
objPropExprs
    DisjointObjectProperties axAnns :: [Annotation]
axAnns objPropExprs :: [ObjectPropertyExpression]
objPropExprs
        -> PrefixMap -> [Annotation] -> [ObjectPropertyExpression] -> Doc
printDisjointObjectProperties PrefixMap
pds [Annotation]
axAnns [ObjectPropertyExpression]
objPropExprs
    InverseObjectProperties axAnns :: [Annotation]
axAnns objPropExpr1 :: ObjectPropertyExpression
objPropExpr1 objPropExpr2 :: ObjectPropertyExpression
objPropExpr2
        -> PrefixMap
-> [Annotation]
-> ObjectPropertyExpression
-> ObjectPropertyExpression
-> Doc
printInverseObjectProperties PrefixMap
pds [Annotation]
axAnns ObjectPropertyExpression
objPropExpr1 ObjectPropertyExpression
objPropExpr2
    ObjectPropertyDomain axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr clExpr :: ClassExpression
clExpr
        -> PrefixMap
-> [Annotation]
-> ObjectPropertyExpression
-> ClassExpression
-> Doc
printObjectPropertyDomain PrefixMap
pds [Annotation]
axAnns ObjectPropertyExpression
objPropExpr ClassExpression
clExpr
    ObjectPropertyRange axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr clExpr :: ClassExpression
clExpr
        -> PrefixMap
-> [Annotation]
-> ObjectPropertyExpression
-> ClassExpression
-> Doc
printObjectPropertyRange PrefixMap
pds [Annotation]
axAnns ObjectPropertyExpression
objPropExpr ClassExpression
clExpr
    FunctionalObjectProperty axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr
        -> PrefixMap -> [Annotation] -> ObjectPropertyExpression -> Doc
printFunctionalObjectProperty PrefixMap
pds [Annotation]
axAnns ObjectPropertyExpression
objPropExpr
    InverseFunctionalObjectProperty axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr
        -> PrefixMap -> [Annotation] -> ObjectPropertyExpression -> Doc
printInverseFunctionalObjectProperty PrefixMap
pds [Annotation]
axAnns ObjectPropertyExpression
objPropExpr
    ReflexiveObjectProperty axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr
        -> PrefixMap -> [Annotation] -> ObjectPropertyExpression -> Doc
printReflexiveObjectProperty PrefixMap
pds [Annotation]
axAnns ObjectPropertyExpression
objPropExpr
    IrreflexiveObjectProperty axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr
        -> PrefixMap -> [Annotation] -> ObjectPropertyExpression -> Doc
printIrreflexiveObjectProperty PrefixMap
pds [Annotation]
axAnns ObjectPropertyExpression
objPropExpr
    SymmetricObjectProperty axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr
        -> PrefixMap -> [Annotation] -> ObjectPropertyExpression -> Doc
printSymmetricObjectProperty PrefixMap
pds [Annotation]
axAnns ObjectPropertyExpression
objPropExpr
    AsymmetricObjectProperty axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr
        -> PrefixMap -> [Annotation] -> ObjectPropertyExpression -> Doc
printAsymmetricObjectProperty PrefixMap
pds [Annotation]
axAnns ObjectPropertyExpression
objPropExpr
    TransitiveObjectProperty axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr
        -> PrefixMap -> [Annotation] -> ObjectPropertyExpression -> Doc
printTransitiveObjectProperty PrefixMap
pds [Annotation]
axAnns ObjectPropertyExpression
objPropExpr

printSubObjectPropertyOf :: GA.PrefixMap -> AxiomAnnotations
    -> SubObjectPropertyExpression -> SuperObjectPropertyExpression -> Doc
printSubObjectPropertyOf :: PrefixMap
-> [Annotation]
-> SubObjectPropertyExpression
-> ObjectPropertyExpression
-> Doc
printSubObjectPropertyOf pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns subObjPropExpr :: SubObjectPropertyExpression
subObjPropExpr supObjPropExpr :: ObjectPropertyExpression
supObjPropExpr =
    String -> Doc
keyword String
subObjectPropertyOfS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$ 
        [[Doc]
docAxAnns, [Doc
docSubObjPropExpr, Doc
docSupObjPropExpr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docSubObjPropExpr :: Doc
docSubObjPropExpr = PrefixMap -> SubObjectPropertyExpression -> Doc
printSubObjectPropertyExpression PrefixMap
pds SubObjectPropertyExpression
subObjPropExpr
        docSupObjPropExpr :: Doc
docSupObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
supObjPropExpr

printEquivalentObjectProperties :: GA.PrefixMap -> AxiomAnnotations
    -> [ObjectPropertyExpression] -> Doc
printEquivalentObjectProperties :: PrefixMap -> [Annotation] -> [ObjectPropertyExpression] -> Doc
printEquivalentObjectProperties pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns objPropExprs :: [ObjectPropertyExpression]
objPropExprs =
    String -> Doc
keyword String
equivalentObjectPropertiesS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc]
docObjPropExprs])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docObjPropExprs :: [Doc]
docObjPropExprs = (ObjectPropertyExpression -> Doc)
-> [ObjectPropertyExpression] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds) [ObjectPropertyExpression]
objPropExprs

printDisjointObjectProperties :: GA.PrefixMap -> AxiomAnnotations
    -> [ObjectPropertyExpression] -> Doc
printDisjointObjectProperties :: PrefixMap -> [Annotation] -> [ObjectPropertyExpression] -> Doc
printDisjointObjectProperties pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns objPropExprs :: [ObjectPropertyExpression]
objPropExprs =
    String -> Doc
keyword String
disjointObjectPropertiesS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc]
docObjPropExprs])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docObjPropExprs :: [Doc]
docObjPropExprs = (ObjectPropertyExpression -> Doc)
-> [ObjectPropertyExpression] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds) [ObjectPropertyExpression]
objPropExprs

printInverseObjectProperties :: GA.PrefixMap -> AxiomAnnotations
    -> ObjectPropertyExpression -> ObjectPropertyExpression -> Doc
printInverseObjectProperties :: PrefixMap
-> [Annotation]
-> ObjectPropertyExpression
-> ObjectPropertyExpression
-> Doc
printInverseObjectProperties pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns objPropExpr1 :: ObjectPropertyExpression
objPropExpr1 objPropExpr2 :: ObjectPropertyExpression
objPropExpr2 =
    String -> Doc
keyword String
inverseObjectPropertiesS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$ 
        [[Doc]
docAxAnns, [Doc
docObjPropExpr1, Doc
docObjPropExpr2]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docObjPropExpr1 :: Doc
docObjPropExpr1 = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr1
        docObjPropExpr2 :: Doc
docObjPropExpr2 = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr2


printObjectPropertyDomain :: GA.PrefixMap -> AxiomAnnotations
    -> ObjectPropertyExpression -> ClassExpression -> Doc
printObjectPropertyDomain :: PrefixMap
-> [Annotation]
-> ObjectPropertyExpression
-> ClassExpression
-> Doc
printObjectPropertyDomain pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr clExpr :: ClassExpression
clExpr =
    String -> Doc
keyword String
objectPropertyDomainS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$ 
        [[Doc]
docAxAnns, [Doc
docObjPropExpr, Doc
docClassExpr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docObjPropExpr :: Doc
docObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr
        docClassExpr :: Doc
docClassExpr = PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
clExpr

printObjectPropertyRange :: GA.PrefixMap -> AxiomAnnotations
    -> ObjectPropertyExpression -> ClassExpression -> Doc
printObjectPropertyRange :: PrefixMap
-> [Annotation]
-> ObjectPropertyExpression
-> ClassExpression
-> Doc
printObjectPropertyRange pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr clExpr :: ClassExpression
clExpr = 
    String -> Doc
keyword String
objectPropertyRangeS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$ 
        [[Doc]
docAxAnns, [Doc
docObjPropExpr, Doc
docClassExpr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docObjPropExpr :: Doc
docObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr
        docClassExpr :: Doc
docClassExpr = PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
clExpr
    

printFunctionalObjectProperty :: GA.PrefixMap -> AxiomAnnotations
    -> ObjectPropertyExpression -> Doc
printFunctionalObjectProperty :: PrefixMap -> [Annotation] -> ObjectPropertyExpression -> Doc
printFunctionalObjectProperty pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr =
    String -> Doc
keyword String
functionalObjectPropertyS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docObjPropExpr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docObjPropExpr :: Doc
docObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr

printInverseFunctionalObjectProperty :: GA.PrefixMap -> AxiomAnnotations
    -> ObjectPropertyExpression -> Doc
printInverseFunctionalObjectProperty :: PrefixMap -> [Annotation] -> ObjectPropertyExpression -> Doc
printInverseFunctionalObjectProperty pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr =
    String -> Doc
keyword String
inverseFunctionalObjectPropertyS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docObjPropExpr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docObjPropExpr :: Doc
docObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr

printReflexiveObjectProperty :: GA.PrefixMap -> AxiomAnnotations
    -> ObjectPropertyExpression -> Doc
printReflexiveObjectProperty :: PrefixMap -> [Annotation] -> ObjectPropertyExpression -> Doc
printReflexiveObjectProperty pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr =
    String -> Doc
keyword String
reflexiveObjectPropertyS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docObjPropExpr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docObjPropExpr :: Doc
docObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr


printIrreflexiveObjectProperty :: GA.PrefixMap -> AxiomAnnotations
    -> ObjectPropertyExpression -> Doc
printIrreflexiveObjectProperty :: PrefixMap -> [Annotation] -> ObjectPropertyExpression -> Doc
printIrreflexiveObjectProperty pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr =
    String -> Doc
keyword String
irreflexiveObjectPropertyS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docObjPropExpr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docObjPropExpr :: Doc
docObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr

printSymmetricObjectProperty :: GA.PrefixMap -> AxiomAnnotations
    -> ObjectPropertyExpression -> Doc
printSymmetricObjectProperty :: PrefixMap -> [Annotation] -> ObjectPropertyExpression -> Doc
printSymmetricObjectProperty pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr =
    String -> Doc
keyword String
symmetricObjectPropertyS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docObjPropExpr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docObjPropExpr :: Doc
docObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr

printAsymmetricObjectProperty :: GA.PrefixMap -> AxiomAnnotations
    -> ObjectPropertyExpression -> Doc
printAsymmetricObjectProperty :: PrefixMap -> [Annotation] -> ObjectPropertyExpression -> Doc
printAsymmetricObjectProperty pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr =
    String -> Doc
keyword String
asymmetricObjectPropertyS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docObjPropExpr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docObjPropExpr :: Doc
docObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr

printTransitiveObjectProperty :: GA.PrefixMap -> AxiomAnnotations
    -> ObjectPropertyExpression -> Doc
printTransitiveObjectProperty :: PrefixMap -> [Annotation] -> ObjectPropertyExpression -> Doc
printTransitiveObjectProperty pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr =
    String -> Doc
keyword String
transitiveObjectPropertyS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docObjPropExpr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docObjPropExpr :: Doc
docObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr

-- | print DataPropertyAxiom
printDataPropertyAxiom :: GA.PrefixMap -> DataPropertyAxiom -> Doc
printDataPropertyAxiom :: PrefixMap -> DataPropertyAxiom -> Doc
printDataPropertyAxiom pds :: PrefixMap
pds dpAx :: DataPropertyAxiom
dpAx = case DataPropertyAxiom
dpAx of
    SubDataPropertyOf axAnns :: [Annotation]
axAnns subDataPropExpr :: IRI
subDataPropExpr supDataPropExpr :: IRI
supDataPropExpr
        -> PrefixMap -> [Annotation] -> IRI -> IRI -> Doc
printSubDataPropertyOf PrefixMap
pds [Annotation]
axAnns IRI
subDataPropExpr IRI
supDataPropExpr
    EquivalentDataProperties axAnns :: [Annotation]
axAnns dataPropExprs :: [IRI]
dataPropExprs
        -> PrefixMap -> [Annotation] -> [IRI] -> Doc
printEquivalentDataProperties PrefixMap
pds [Annotation]
axAnns [IRI]
dataPropExprs
    DisjointDataProperties axAnns :: [Annotation]
axAnns dataPropExprs :: [IRI]
dataPropExprs
        -> PrefixMap -> [Annotation] -> [IRI] -> Doc
printDisjointDataProperties PrefixMap
pds [Annotation]
axAnns [IRI]
dataPropExprs
    DataPropertyDomain axAnns :: [Annotation]
axAnns dataPropExpr :: IRI
dataPropExpr clExpr :: ClassExpression
clExpr
        -> PrefixMap -> [Annotation] -> IRI -> ClassExpression -> Doc
printDataPropertyDomain PrefixMap
pds [Annotation]
axAnns IRI
dataPropExpr ClassExpression
clExpr
    DataPropertyRange axAnns :: [Annotation]
axAnns dataPropExpr :: IRI
dataPropExpr dr :: DataRange
dr
        -> PrefixMap -> [Annotation] -> IRI -> DataRange -> Doc
printDataPropertyRange PrefixMap
pds [Annotation]
axAnns IRI
dataPropExpr DataRange
dr
    FunctionalDataProperty axAnns :: [Annotation]
axAnns dataPropExpr :: IRI
dataPropExpr
        -> PrefixMap -> [Annotation] -> IRI -> Doc
printFunctionalDataProperty PrefixMap
pds [Annotation]
axAnns IRI
dataPropExpr

printSubDataPropertyOf :: GA.PrefixMap -> AxiomAnnotations ->
    SubDataPropertyExpression -> SuperDataPropertyExpression -> Doc
printSubDataPropertyOf :: PrefixMap -> [Annotation] -> IRI -> IRI -> Doc
printSubDataPropertyOf pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns subDataPropExpr :: IRI
subDataPropExpr supDataPropExpr :: IRI
supDataPropExpr = 
    String -> Doc
keyword String
subDataPropertyOfS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docSubDataPropExpr, Doc
docSupDataPropExpr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docSubDataPropExpr :: Doc
docSubDataPropExpr = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
subDataPropExpr
        docSupDataPropExpr :: Doc
docSupDataPropExpr = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
supDataPropExpr

printEquivalentDataProperties :: GA.PrefixMap -> AxiomAnnotations
    -> [DataPropertyExpression] -> Doc
printEquivalentDataProperties :: PrefixMap -> [Annotation] -> [IRI] -> Doc
printEquivalentDataProperties pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns dataPropExprs :: [IRI]
dataPropExprs =
    String -> Doc
keyword String
equivalentDataPropertiesS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat  ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc]
docDataPropExprs])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docDataPropExprs :: [Doc]
docDataPropExprs = (IRI -> Doc) -> [IRI] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds) [IRI]
dataPropExprs

printDisjointDataProperties :: GA.PrefixMap -> AxiomAnnotations
    -> [DataPropertyExpression] -> Doc
printDisjointDataProperties :: PrefixMap -> [Annotation] -> [IRI] -> Doc
printDisjointDataProperties pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns dataPropExprs :: [IRI]
dataPropExprs =
    String -> Doc
keyword String
disjointDataPropertiesS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc]
docDataPropExprs])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docDataPropExprs :: [Doc]
docDataPropExprs = (IRI -> Doc) -> [IRI] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds) [IRI]
dataPropExprs

printDataPropertyDomain :: GA.PrefixMap -> AxiomAnnotations
    -> DataPropertyExpression -> ClassExpression -> Doc
printDataPropertyDomain :: PrefixMap -> [Annotation] -> IRI -> ClassExpression -> Doc
printDataPropertyDomain pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns dataPropExpr :: IRI
dataPropExpr clExpr :: ClassExpression
clExpr =
    String -> Doc
keyword String
dataPropertyDomainS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docDataPropExpr, Doc
docClassExpr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docDataPropExpr :: Doc
docDataPropExpr = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dataPropExpr
        docClassExpr :: Doc
docClassExpr = PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
clExpr

printDataPropertyRange  :: GA.PrefixMap -> AxiomAnnotations 
    -> DataPropertyExpression -> DataRange -> Doc
printDataPropertyRange :: PrefixMap -> [Annotation] -> IRI -> DataRange -> Doc
printDataPropertyRange pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns dataPropExpr :: IRI
dataPropExpr dr :: DataRange
dr =
    String -> Doc
keyword String
dataPropertyRangeS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docDataPropExpr, Doc
docDataRange]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docDataPropExpr :: Doc
docDataPropExpr = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dataPropExpr
        docDataRange :: Doc
docDataRange = PrefixMap -> DataRange -> Doc
printDataRange PrefixMap
pds DataRange
dr

printFunctionalDataProperty :: GA.PrefixMap -> AxiomAnnotations
    -> DataPropertyExpression -> Doc
printFunctionalDataProperty :: PrefixMap -> [Annotation] -> IRI -> Doc
printFunctionalDataProperty pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns dataPropExpr :: IRI
dataPropExpr =
    String -> Doc
keyword String
functionalDataPropertyS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$ 
        [[Doc]
docAxAnns, [Doc
docDataPropExpr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docDataPropExpr :: Doc
docDataPropExpr = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dataPropExpr

-- | print DatatypeDefinition axiom

printDatatypeDefinition :: GA.PrefixMap -> AxiomAnnotations -> Datatype
    -> DataRange -> Doc
printDatatypeDefinition :: PrefixMap -> [Annotation] -> IRI -> DataRange -> Doc
printDatatypeDefinition pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns dt :: IRI
dt dr :: DataRange
dr =
    String -> Doc
keyword String
datatypeDefinitionS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docDt, Doc
docDr]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docDt :: Doc
docDt = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dt
        docDr :: Doc
docDr = PrefixMap -> DataRange -> Doc
printDataRange PrefixMap
pds DataRange
dr

-- | print HasKey axiom

printHasKey :: GA.PrefixMap -> AxiomAnnotations -> ClassExpression
    -> [ObjectPropertyExpression] -> [DataPropertyExpression] -> Doc
printHasKey :: PrefixMap
-> [Annotation]
-> ClassExpression
-> [ObjectPropertyExpression]
-> [IRI]
-> Doc
printHasKey pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns clExpr :: ClassExpression
clExpr objPropExprs :: [ObjectPropertyExpression]
objPropExprs dataPropExprs :: [IRI]
dataPropExprs =
    String -> Doc
keyword String
hasKeyS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docClassExpr, Doc
docObjPropExprs, Doc
docDataPropExprs]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docClassExpr :: Doc
docClassExpr = PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
clExpr
        docObjPropExprs :: Doc
docObjPropExprs = Doc -> Doc
sParens (Doc -> Doc)
-> ([ObjectPropertyExpression] -> Doc)
-> [ObjectPropertyExpression]
-> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Doc] -> Doc
hsep
            ([Doc] -> Doc)
-> ([ObjectPropertyExpression] -> [Doc])
-> [ObjectPropertyExpression]
-> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ObjectPropertyExpression -> Doc)
-> [ObjectPropertyExpression] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds) ([ObjectPropertyExpression] -> Doc)
-> [ObjectPropertyExpression] -> Doc
forall a b. (a -> b) -> a -> b
$ [ObjectPropertyExpression]
objPropExprs
        docDataPropExprs :: Doc
docDataPropExprs = Doc -> Doc
sParens (Doc -> Doc) -> ([IRI] -> Doc) -> [IRI] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Doc] -> Doc
hsep
            ([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]
dataPropExprs

-- | print Assertion axiom
printAssertion :: GA.PrefixMap -> Assertion -> Doc
printAssertion :: PrefixMap -> Assertion -> Doc
printAssertion pds :: PrefixMap
pds assertion :: Assertion
assertion = case Assertion
assertion of
    SameIndividual axAnns :: [Annotation]
axAnns inds :: [IRI]
inds -> PrefixMap -> [Annotation] -> [IRI] -> Doc
printSameIndividual PrefixMap
pds [Annotation]
axAnns [IRI]
inds
    DifferentIndividuals axAnns :: [Annotation]
axAnns inds :: [IRI]
inds
        -> PrefixMap -> [Annotation] -> [IRI] -> Doc
printDifferentIndividuals PrefixMap
pds [Annotation]
axAnns [IRI]
inds
    ClassAssertion axAnns :: [Annotation]
axAnns clExpr :: ClassExpression
clExpr ind :: IRI
ind
        -> PrefixMap -> [Annotation] -> ClassExpression -> IRI -> Doc
printClassAssertion PrefixMap
pds [Annotation]
axAnns ClassExpression
clExpr IRI
ind
    ObjectPropertyAssertion axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr srcInd :: IRI
srcInd targInd :: IRI
targInd
        -> PrefixMap
-> [Annotation] -> ObjectPropertyExpression -> IRI -> IRI -> Doc
printObjectPropertyAssertion PrefixMap
pds [Annotation]
axAnns ObjectPropertyExpression
objPropExpr IRI
srcInd IRI
targInd
    NegativeObjectPropertyAssertion axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr srcInd :: IRI
srcInd targInd :: IRI
targInd
        -> PrefixMap
-> [Annotation] -> ObjectPropertyExpression -> IRI -> IRI -> Doc
printNegativeObjectPropertyAssertion PrefixMap
pds [Annotation]
axAnns ObjectPropertyExpression
objPropExpr IRI
srcInd
            IRI
targInd
    DataPropertyAssertion axAnns :: [Annotation]
axAnns dataPropExpr :: IRI
dataPropExpr srcInd :: IRI
srcInd targVal :: Literal
targVal
        -> PrefixMap -> [Annotation] -> IRI -> IRI -> Literal -> Doc
printDataPropertyAssertion PrefixMap
pds [Annotation]
axAnns IRI
dataPropExpr IRI
srcInd Literal
targVal
    NegativeDataPropertyAssertion axAnns :: [Annotation]
axAnns dataPropExpr :: IRI
dataPropExpr srcInd :: IRI
srcInd targVal :: Literal
targVal
        -> PrefixMap -> [Annotation] -> IRI -> IRI -> Literal -> Doc
printNegativeDataPropertyAssertion PrefixMap
pds [Annotation]
axAnns IRI
dataPropExpr IRI
srcInd
            Literal
targVal

printSameIndividual :: GA.PrefixMap -> AxiomAnnotations -> [Individual]
    -> Doc
printSameIndividual :: PrefixMap -> [Annotation] -> [IRI] -> Doc
printSameIndividual pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns inds :: [IRI]
inds =
    String -> Doc
keyword String
sameIndividualS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc]
docInds])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docInds :: [Doc]
docInds = (IRI -> Doc) -> [IRI] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds) [IRI]
inds

printDifferentIndividuals :: GA.PrefixMap -> AxiomAnnotations
    -> [Individual] -> Doc
printDifferentIndividuals :: PrefixMap -> [Annotation] -> [IRI] -> Doc
printDifferentIndividuals pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns inds :: [IRI]
inds =
    String -> Doc
keyword String
differentIndividualsS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc]
docInds])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docInds :: [Doc]
docInds = (IRI -> Doc) -> [IRI] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds) [IRI]
inds

printClassAssertion :: GA.PrefixMap -> AxiomAnnotations
    -> ClassExpression -> Individual -> Doc
printClassAssertion :: PrefixMap -> [Annotation] -> ClassExpression -> IRI -> Doc
printClassAssertion pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns clExpr :: ClassExpression
clExpr ind :: IRI
ind =
    String -> Doc
keyword String
classAssertionS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docClassExpr, Doc
docInd]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docClassExpr :: Doc
docClassExpr = PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
clExpr
        docInd :: Doc
docInd = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
ind

printObjectPropertyAssertion :: GA.PrefixMap -> AxiomAnnotations
    -> ObjectPropertyExpression -> SourceIndividual -> TargetIndividual -> Doc
printObjectPropertyAssertion :: PrefixMap
-> [Annotation] -> ObjectPropertyExpression -> IRI -> IRI -> Doc
printObjectPropertyAssertion pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr srcInd :: IRI
srcInd targInd :: IRI
targInd =
    String -> Doc
keyword String
objectPropertyAssertionS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docObjPropExpr, Doc
docSrcInd, Doc
docTargInd]])
    where 
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docObjPropExpr :: Doc
docObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr
        docSrcInd :: Doc
docSrcInd = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
srcInd
        docTargInd :: Doc
docTargInd = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
targInd


printNegativeObjectPropertyAssertion :: GA.PrefixMap -> AxiomAnnotations
    -> ObjectPropertyExpression -> SourceIndividual -> TargetIndividual -> Doc
printNegativeObjectPropertyAssertion :: PrefixMap
-> [Annotation] -> ObjectPropertyExpression -> IRI -> IRI -> Doc
printNegativeObjectPropertyAssertion pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns objPropExpr :: ObjectPropertyExpression
objPropExpr srcInd :: IRI
srcInd targInd :: IRI
targInd =
    String -> Doc
keyword String
negativeObjectPropertyAssertionS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docObjPropExpr, Doc
docSrcInd, Doc
docTargInd]])
    where 
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docObjPropExpr :: Doc
docObjPropExpr = PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
objPropExpr
        docSrcInd :: Doc
docSrcInd = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
srcInd
        docTargInd :: Doc
docTargInd = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
targInd

printDataPropertyAssertion :: GA.PrefixMap -> AxiomAnnotations
    -> DataPropertyExpression -> SourceIndividual -> TargetValue -> Doc
printDataPropertyAssertion :: PrefixMap -> [Annotation] -> IRI -> IRI -> Literal -> Doc
printDataPropertyAssertion pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns dataPropExpr :: IRI
dataPropExpr srcInd :: IRI
srcInd targVal :: Literal
targVal =
    String -> Doc
keyword String
dataPropertyAssertionS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
      [[Doc]
docAxAnns, [Doc
docDataPropExpr, Doc
docSrcInd, Doc
docTargVal]])
     where 
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docDataPropExpr :: Doc
docDataPropExpr = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dataPropExpr
        docSrcInd :: Doc
docSrcInd = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
srcInd
        docTargVal :: Doc
docTargVal = PrefixMap -> Literal -> Doc
printLiteral PrefixMap
pds Literal
targVal

printNegativeDataPropertyAssertion :: GA.PrefixMap -> AxiomAnnotations
    -> DataPropertyExpression -> SourceIndividual -> TargetValue -> Doc
printNegativeDataPropertyAssertion :: PrefixMap -> [Annotation] -> IRI -> IRI -> Literal -> Doc
printNegativeDataPropertyAssertion pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns dataPropExpr :: IRI
dataPropExpr srcInd :: IRI
srcInd targVal :: Literal
targVal =
    String -> Doc
keyword String
negativeDataPropertyAssertionS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
         [[Doc]
docAxAnns, [Doc
docDataPropExpr, Doc
docSrcInd, Doc
docTargVal]])
     where 
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docDataPropExpr :: Doc
docDataPropExpr = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dataPropExpr
        docSrcInd :: Doc
docSrcInd = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
srcInd
        docTargVal :: Doc
docTargVal = PrefixMap -> Literal -> Doc
printLiteral PrefixMap
pds Literal
targVal

-- | print AnnotationAxiom
printAnnotationAxiom :: GA.PrefixMap -> AnnotationAxiom -> Doc
printAnnotationAxiom :: PrefixMap -> AnnotationAxiom -> Doc
printAnnotationAxiom pds :: PrefixMap
pds annAxs :: AnnotationAxiom
annAxs = case AnnotationAxiom
annAxs of
    AnnotationAssertion axAnns :: [Annotation]
axAnns annProp :: IRI
annProp annSub :: AnnotationSubject
annSub annVal :: AnnotationValue
annVal
        -> PrefixMap
-> [Annotation]
-> IRI
-> AnnotationSubject
-> AnnotationValue
-> Doc
printAnnotationAssertion PrefixMap
pds [Annotation]
axAnns IRI
annProp AnnotationSubject
annSub AnnotationValue
annVal
    SubAnnotationPropertyOf axAnns :: [Annotation]
axAnns subAnnProp :: IRI
subAnnProp supAnnProp :: IRI
supAnnProp
        -> PrefixMap -> [Annotation] -> IRI -> IRI -> Doc
printSubAnnotationPropertyOf PrefixMap
pds [Annotation]
axAnns IRI
subAnnProp IRI
supAnnProp
    AnnotationPropertyDomain axAnns :: [Annotation]
axAnns annProp :: IRI
annProp iri :: IRI
iri
        -> PrefixMap -> [Annotation] -> IRI -> IRI -> Doc
printAnnotationPropertyDomain PrefixMap
pds [Annotation]
axAnns IRI
annProp IRI
iri
    AnnotationPropertyRange axAnns :: [Annotation]
axAnns annProp :: IRI
annProp iri :: IRI
iri
        -> PrefixMap -> [Annotation] -> IRI -> IRI -> Doc
printAnnotationPropertyRange PrefixMap
pds [Annotation]
axAnns IRI
annProp IRI
iri

printAnnotationAssertion :: GA.PrefixMap -> AxiomAnnotations
    -> AnnotationProperty -> AnnotationSubject ->  AnnotationValue -> Doc
printAnnotationAssertion :: PrefixMap
-> [Annotation]
-> IRI
-> AnnotationSubject
-> AnnotationValue
-> Doc
printAnnotationAssertion pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns annProp :: IRI
annProp annSub :: AnnotationSubject
annSub annVal :: AnnotationValue
annVal =
    String -> Doc
keyword String
annotationAssertionS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docAnnProp, Doc
docAnnSub, Doc
docAnnValue]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docAnnProp :: Doc
docAnnProp = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
annProp
        docAnnSub :: Doc
docAnnSub = PrefixMap -> AnnotationSubject -> Doc
printAnnotationSubject PrefixMap
pds AnnotationSubject
annSub
        docAnnValue :: Doc
docAnnValue = PrefixMap -> AnnotationValue -> Doc
printAnnotationValue PrefixMap
pds AnnotationValue
annVal

printSubAnnotationPropertyOf :: GA.PrefixMap -> AxiomAnnotations
    -> SubAnnotationProperty -> SuperAnnotationProperty -> Doc
printSubAnnotationPropertyOf :: PrefixMap -> [Annotation] -> IRI -> IRI -> Doc
printSubAnnotationPropertyOf pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns subAnnProp :: IRI
subAnnProp supAnnProp :: IRI
supAnnProp =
    String -> Doc
keyword String
subAnnotationPropertyOfS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$ [[Doc]
docAxAnns, [Doc
docSubAnnProp, Doc
docSupAnnProp]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docSubAnnProp :: Doc
docSubAnnProp  = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
subAnnProp
        docSupAnnProp :: Doc
docSupAnnProp = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
supAnnProp


printAnnotationPropertyDomain :: GA.PrefixMap -> AxiomAnnotations
    -> AnnotationProperty -> IRI -> Doc
printAnnotationPropertyDomain :: PrefixMap -> [Annotation] -> IRI -> IRI -> Doc
printAnnotationPropertyDomain pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns annProp :: IRI
annProp iri :: IRI
iri =
    String -> Doc
keyword String
annotationPropertyDomainS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docAnnProp, Doc
docIri]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docAnnProp :: Doc
docAnnProp = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
annProp
        docIri :: Doc
docIri = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri    

printAnnotationPropertyRange :: GA.PrefixMap -> AxiomAnnotations
    -> AnnotationProperty -> IRI -> Doc
printAnnotationPropertyRange :: PrefixMap -> [Annotation] -> IRI -> IRI -> Doc
printAnnotationPropertyRange pds :: PrefixMap
pds axAnns :: [Annotation]
axAnns annProp :: IRI
annProp iri :: IRI
iri =
    String -> Doc
keyword String
annotationPropertyRangeS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
        [[Doc]
docAxAnns, [Doc
docAnnProp, Doc
docIri]])
    where
        docAxAnns :: [Doc]
docAxAnns = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
axAnns
        docAnnProp :: Doc
docAnnProp = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
annProp
        docIri :: Doc
docIri = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri

-- | print DLSafeRules
printDLSafeRule :: GA.PrefixMap -> AxiomAnnotations -> Body -> Head -> Doc
printDLSafeRule :: PrefixMap -> [Annotation] -> Body -> Body -> Doc
printDLSafeRule pds :: PrefixMap
pds anns :: [Annotation]
anns body :: Body
body hd :: Body
hd = 
    String -> Doc
keyword String
dlSafeRuleS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep [Doc
docAnns, [Doc] -> Doc
fsep [Doc
docBody, Doc
docHead]])
    where
        docAnns :: Doc
docAnns = [Doc] -> Doc
fsep ([Doc] -> Doc) -> ([Annotation] -> [Doc]) -> [Annotation] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) ([Annotation] -> Doc) -> [Annotation] -> Doc
forall a b. (a -> b) -> a -> b
$ [Annotation]
anns
        docHead :: Doc
docHead = PrefixMap -> Body -> Doc
printDLSafeRuleHead PrefixMap
pds Body
hd
        docBody :: Doc
docBody = PrefixMap -> Body -> Doc
printDLSafeRuleBody PrefixMap
pds Body
body

printDLSafeRuleHead :: GA.PrefixMap -> Head -> Doc
printDLSafeRuleHead :: PrefixMap -> Body -> Doc
printDLSafeRuleHead pds :: PrefixMap
pds atoms :: Body
atoms =
    String -> Doc
keyword String
headS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$ (Atom -> Doc) -> Body -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Atom -> Doc
printAtom PrefixMap
pds) Body
atoms)

printDLSafeRuleBody :: GA.PrefixMap -> Body -> Doc
printDLSafeRuleBody :: PrefixMap -> Body -> Doc
printDLSafeRuleBody pds :: PrefixMap
pds atoms :: Body
atoms =
    String -> Doc
keyword String
bodyS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$ (Atom -> Doc) -> Body -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Atom -> Doc
printAtom PrefixMap
pds) Body
atoms)

printAtom :: GA.PrefixMap -> Atom -> Doc
printAtom :: PrefixMap -> Atom -> Doc
printAtom pds :: PrefixMap
pds atom :: Atom
atom = case Atom
atom of
    ClassAtom ce :: ClassExpression
ce ia :: IndividualArg
ia -> PrefixMap -> ClassExpression -> IndividualArg -> Doc
printClassAtom PrefixMap
pds ClassExpression
ce IndividualArg
ia
    DataRangeAtom dr :: DataRange
dr da :: DataArg
da -> PrefixMap -> DataRange -> DataArg -> Doc
printDataRangeAtom PrefixMap
pds DataRange
dr DataArg
da
    ObjectPropertyAtom oe :: ObjectPropertyExpression
oe ia1 :: IndividualArg
ia1 ia2 :: IndividualArg
ia2 -> PrefixMap
-> ObjectPropertyExpression
-> IndividualArg
-> IndividualArg
-> Doc
printObjectPropertyAtom PrefixMap
pds ObjectPropertyExpression
oe IndividualArg
ia1 IndividualArg
ia2
    DataPropertyAtom dp :: IRI
dp ia :: IndividualArg
ia da :: DataArg
da -> PrefixMap -> IRI -> IndividualArg -> DataArg -> Doc
printDataPropertyAtom PrefixMap
pds IRI
dp IndividualArg
ia DataArg
da
    BuiltInAtom iri :: IRI
iri das :: [DataArg]
das -> PrefixMap -> IRI -> [DataArg] -> Doc
printBuiltInAtom PrefixMap
pds IRI
iri [DataArg]
das
    SameIndividualAtom ia1 :: IndividualArg
ia1 ia2 :: IndividualArg
ia2 -> PrefixMap -> IndividualArg -> IndividualArg -> Doc
printSameIndividualAtom PrefixMap
pds IndividualArg
ia1 IndividualArg
ia2
    DifferentIndividualsAtom ia1 :: IndividualArg
ia1 ia2 :: IndividualArg
ia2 ->
        PrefixMap -> IndividualArg -> IndividualArg -> Doc
printDifferentIndividualsAtom PrefixMap
pds IndividualArg
ia1 IndividualArg
ia2
    _ -> String -> Doc
keyword "Atom" -- ?

printClassAtom :: GA.PrefixMap -> ClassExpression -> IndividualArg -> Doc
printClassAtom :: PrefixMap -> ClassExpression -> IndividualArg -> Doc
printClassAtom pds :: PrefixMap
pds ce :: ClassExpression
ce ia :: IndividualArg
ia =
    String -> Doc
keyword String
classAtomS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep [PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
ce,  PrefixMap -> IndividualArg -> Doc
printIndividualArg PrefixMap
pds IndividualArg
ia])

printDataRangeAtom :: GA.PrefixMap -> DataRange -> DataArg -> Doc
printDataRangeAtom :: PrefixMap -> DataRange -> DataArg -> Doc
printDataRangeAtom pds :: PrefixMap
pds dr :: DataRange
dr da :: DataArg
da =
    String -> Doc
keyword String
dataRangeAtomS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep [PrefixMap -> DataRange -> Doc
printDataRange PrefixMap
pds DataRange
dr, PrefixMap -> DataArg -> Doc
printDataArg PrefixMap
pds DataArg
da])

printObjectPropertyAtom :: GA.PrefixMap -> ObjectPropertyExpression
    -> IndividualArg -> IndividualArg -> Doc
printObjectPropertyAtom :: PrefixMap
-> ObjectPropertyExpression
-> IndividualArg
-> IndividualArg
-> Doc
printObjectPropertyAtom pds :: PrefixMap
pds oe :: ObjectPropertyExpression
oe ia1 :: IndividualArg
ia1 ia2 :: IndividualArg
ia2 =
    String -> Doc
keyword String
objectPropertyAtomS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep [PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
oe
        , PrefixMap -> IndividualArg -> Doc
printIndividualArg PrefixMap
pds IndividualArg
ia1
        , PrefixMap -> IndividualArg -> Doc
printIndividualArg PrefixMap
pds IndividualArg
ia2])

printDataPropertyAtom :: GA.PrefixMap -> DataProperty -> IndividualArg
    -> DataArg -> Doc
printDataPropertyAtom :: PrefixMap -> IRI -> IndividualArg -> DataArg -> Doc
printDataPropertyAtom pds :: PrefixMap
pds dp :: IRI
dp ia :: IndividualArg
ia da :: DataArg
da = 
    String -> Doc
keyword String
dataPropertyAtomS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep [PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dp, PrefixMap -> IndividualArg -> Doc
printIndividualArg PrefixMap
pds IndividualArg
ia
        , PrefixMap -> DataArg -> Doc
printDataArg PrefixMap
pds DataArg
da])

printBuiltInAtom :: GA.PrefixMap -> IRI -> [DataArg] -> Doc
printBuiltInAtom :: PrefixMap -> IRI -> [DataArg] -> Doc
printBuiltInAtom pds :: PrefixMap
pds iri :: IRI
iri das :: [DataArg]
das = 
    String -> Doc
keyword String
builtInAtomS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
        ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$ [[PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri], (DataArg -> Doc) -> [DataArg] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> DataArg -> Doc
printDataArg PrefixMap
pds ) [DataArg]
das])

printSameIndividualAtom :: GA.PrefixMap -> IndividualArg -> IndividualArg -> Doc
printSameIndividualAtom :: PrefixMap -> IndividualArg -> IndividualArg -> Doc
printSameIndividualAtom pds :: PrefixMap
pds ia1 :: IndividualArg
ia1 ia2 :: IndividualArg
ia2 =
    String -> Doc
keyword String
sameIndividualAtomS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep ([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
ia1, IndividualArg
ia2])

printDifferentIndividualsAtom :: GA.PrefixMap -> IndividualArg -> IndividualArg
    -> Doc
printDifferentIndividualsAtom :: PrefixMap -> IndividualArg -> IndividualArg -> Doc
printDifferentIndividualsAtom pds :: PrefixMap
pds ia1 :: IndividualArg
ia1 ia2 :: IndividualArg
ia2 =
    String -> Doc
keyword String
differentIndividualsAtomS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep ([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
ia1, IndividualArg
ia2])

printIndividualArg :: GA.PrefixMap -> IndividualArg -> Doc
printIndividualArg :: PrefixMap -> IndividualArg -> Doc
printIndividualArg pds :: PrefixMap
pds ia :: IndividualArg
ia = case IndividualArg
ia of
    IArg iri :: IRI
iri -> PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri
    IVar iri :: IRI
iri -> String -> Doc
keyword String
variableS Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri)

printDataArg :: GA.PrefixMap -> DataArg -> Doc
printDataArg :: PrefixMap -> DataArg -> Doc
printDataArg pds :: PrefixMap
pds da :: DataArg
da = case DataArg
da of
    DArg lit :: Literal
lit -> PrefixMap -> Literal -> Doc
printLiteral PrefixMap
pds Literal
lit
    DVar iri :: IRI
iri -> String -> Doc
keyword String
variableS Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens (PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
iri)

-- | print DGRules
printDGRule :: GA.PrefixMap -> AxiomAnnotations -> DGBody -> DGHead -> Doc
printDGRule :: PrefixMap -> [Annotation] -> DGBody -> DGBody -> Doc
printDGRule pds :: PrefixMap
pds anns :: [Annotation]
anns dgBody :: DGBody
dgBody dgHead :: DGBody
dgHead =
    String -> Doc
keyword String
descriptionGraphRuleS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
hsep [Doc
docAnns, [Doc] -> Doc
fsep [Doc
docBody, Doc
docHead]])
    where
        docAnns :: Doc
docAnns = [Doc] -> Doc
fsep ([Doc] -> Doc) -> ([Annotation] -> [Doc]) -> [Annotation] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) ([Annotation] -> Doc) -> [Annotation] -> Doc
forall a b. (a -> b) -> a -> b
$ [Annotation]
anns
        docHead :: Doc
docHead = PrefixMap -> DGBody -> Doc
printDGHead PrefixMap
pds DGBody
dgHead
        docBody :: Doc
docBody = PrefixMap -> DGBody -> Doc
printDGBody PrefixMap
pds DGBody
dgBody

printDGHead :: GA.PrefixMap -> DGHead -> Doc
printDGHead :: PrefixMap -> DGBody -> Doc
printDGHead pds :: PrefixMap
pds dgAtoms :: DGBody
dgAtoms =
    String -> Doc
keyword String
headS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep ([Doc] -> Doc) -> (DGBody -> [Doc]) -> DGBody -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DGAtom -> Doc) -> DGBody -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> DGAtom -> Doc
printDGAtom PrefixMap
pds) (DGBody -> Doc) -> DGBody -> Doc
forall a b. (a -> b) -> a -> b
$ DGBody
dgAtoms)

printDGBody :: GA.PrefixMap -> DGBody -> Doc
printDGBody :: PrefixMap -> DGBody -> Doc
printDGBody pds :: PrefixMap
pds dgAtoms :: DGBody
dgAtoms =
    String -> Doc
keyword String
bodyS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep ([Doc] -> Doc) -> (DGBody -> [Doc]) -> DGBody -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DGAtom -> Doc) -> DGBody -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> DGAtom -> Doc
printDGAtom PrefixMap
pds) (DGBody -> Doc) -> DGBody -> Doc
forall a b. (a -> b) -> a -> b
$ DGBody
dgAtoms)

printDGAtom :: GA.PrefixMap -> DGAtom -> Doc
printDGAtom :: PrefixMap -> DGAtom -> Doc
printDGAtom pds :: PrefixMap
pds dgAtom :: DGAtom
dgAtom = case DGAtom
dgAtom of
    DGClassAtom ce :: ClassExpression
ce ia :: IndividualArg
ia -> String -> Doc
keyword String
classAtomS
        Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep [PrefixMap -> ClassExpression -> Doc
printClassExpression PrefixMap
pds ClassExpression
ce
            , PrefixMap -> IndividualArg -> Doc
printIndividualArg PrefixMap
pds IndividualArg
ia])

    DGObjectPropertyAtom oe :: ObjectPropertyExpression
oe ia1 :: IndividualArg
ia1 ia2 :: IndividualArg
ia2 -> String -> Doc
keyword String
objectPropertyAtomS
        Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep [PrefixMap -> ObjectPropertyExpression -> Doc
printObjectPropertyExpression PrefixMap
pds ObjectPropertyExpression
oe
            , PrefixMap -> IndividualArg -> Doc
printIndividualArg PrefixMap
pds IndividualArg
ia1
            , PrefixMap -> IndividualArg -> Doc
printIndividualArg PrefixMap
pds IndividualArg
ia2])

-- | print DGAxiom
printDGAxiom :: GA.PrefixMap -> AxiomAnnotations -> DGName -> DGNodes
    -> DGEdges -> MainClasses -> Doc
printDGAxiom :: PrefixMap
-> [Annotation] -> IRI -> DGNodes -> DGEdges -> [IRI] -> Doc
printDGAxiom pds :: PrefixMap
pds anns :: [Annotation]
anns dgName :: IRI
dgName dgNodes :: DGNodes
dgNodes dgEdges :: DGEdges
dgEdges mainClasses :: [IRI]
mainClasses =
    String -> Doc
keyword String
descriptionGraphS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep 
        [Doc
docAnns, [Doc] -> Doc
fsep [Doc
docDGName, Doc
docDGNodes, Doc
docDGEdges, Doc
docMainClasses]])
    where
        docAnns :: Doc
docAnns = [Doc] -> Doc
fsep ([Doc] -> Doc) -> ([Annotation] -> [Doc]) -> [Annotation] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) ([Annotation] -> Doc) -> [Annotation] -> Doc
forall a b. (a -> b) -> a -> b
$ [Annotation]
anns
        docDGName :: Doc
docDGName = PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
dgName
        docDGNodes :: Doc
docDGNodes = PrefixMap -> DGNodes -> Doc
printDGNodes PrefixMap
pds DGNodes
dgNodes
        docDGEdges :: Doc
docDGEdges = PrefixMap -> DGEdges -> Doc
printDGEdges PrefixMap
pds DGEdges
dgEdges
        docMainClasses :: Doc
docMainClasses = PrefixMap -> [IRI] -> Doc
printMainClasses PrefixMap
pds [IRI]
mainClasses

printDGNodes :: GA.PrefixMap -> DGNodes -> Doc
printDGNodes :: PrefixMap -> DGNodes -> Doc
printDGNodes pds :: PrefixMap
pds dgNodes :: DGNodes
dgNodes =
    String -> Doc
keyword String
nodesS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep ([Doc] -> Doc) -> (DGNodes -> [Doc]) -> DGNodes -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DGNodeAssertion -> Doc) -> DGNodes -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> DGNodeAssertion -> Doc
printDGNodeAssertion PrefixMap
pds) (DGNodes -> Doc) -> DGNodes -> Doc
forall a b. (a -> b) -> a -> b
$ DGNodes
dgNodes)

printDGEdges :: GA.PrefixMap -> DGEdges -> Doc
printDGEdges :: PrefixMap -> DGEdges -> Doc
printDGEdges pds :: PrefixMap
pds dgEdges :: DGEdges
dgEdges =
    String -> Doc
keyword String
edgesS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep ([Doc] -> Doc) -> (DGEdges -> [Doc]) -> DGEdges -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DGEdgeAssertion -> Doc) -> DGEdges -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> DGEdgeAssertion -> Doc
printDGEdgeAssertion PrefixMap
pds) (DGEdges -> Doc) -> DGEdges -> Doc
forall a b. (a -> b) -> a -> b
$ DGEdges
dgEdges)

printDGNodeAssertion :: GA.PrefixMap -> DGNodeAssertion -> Doc
printDGNodeAssertion :: PrefixMap -> DGNodeAssertion -> Doc
printDGNodeAssertion pds :: PrefixMap
pds (DGNodeAssertion clIri :: IRI
clIri nodeIri :: IRI
nodeIri) =
    String -> Doc
keyword String
nodeAssertionS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep ([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
clIri, IRI
nodeIri]) 

printDGEdgeAssertion :: GA.PrefixMap -> DGEdgeAssertion -> Doc
printDGEdgeAssertion :: PrefixMap -> DGEdgeAssertion -> Doc
printDGEdgeAssertion pds :: PrefixMap
pds (DGEdgeAssertion dp :: IRI
dp nodeIri1 :: IRI
nodeIri1 nodeIri2 :: IRI
nodeIri2) =
    String -> Doc
keyword String
edgeAssertionS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep ([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
dp, IRI
nodeIri1, IRI
nodeIri2])

printMainClasses :: GA.PrefixMap -> MainClasses -> Doc
printMainClasses :: PrefixMap -> [IRI] -> Doc
printMainClasses pds :: PrefixMap
pds cls :: [IRI]
cls = String -> Doc
keyword String
mainClassesS
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
fsep ([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]
cls)

-- | print Root
printPrefixDeclaration :: (String, IRI) -> Doc
printPrefixDeclaration :: (String, IRI) -> Doc
printPrefixDeclaration (prName :: String
prName, iri :: IRI
iri) =
    String -> Doc
keyword "Prefix"
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ((String -> Doc
text (String
prName String -> String -> String
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
<> IRI -> Doc
forall a. Pretty a => a -> Doc
pretty IRI
iri)

printOnt :: GA.PrefixMap -> Ontology -> Doc
printOnt :: PrefixMap -> Ontology -> Doc
printOnt pds :: PrefixMap
pds (Ontology mOnt :: Maybe IRI
mOnt mVerIri :: Maybe IRI
mVerIri dImpDocs :: [IRI]
dImpDocs ontAnns :: [Annotation]
ontAnns axs :: [Axiom]
axs) =
    String -> Doc
keyword "Ontology"
    Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
sParens ([Doc] -> Doc
vsep ([Doc] -> Doc) -> ([[Doc]] -> [Doc]) -> [[Doc]] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Doc]] -> [Doc]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Doc]] -> Doc) -> [[Doc]] -> Doc
forall a b. (a -> b) -> a -> b
$
    [[Doc
ontNameDoc], [Doc
importedDocs], [Doc]
ontAnnsDocs, [Doc]
axiomsDocs])
    where
        ontAnnsDocs :: [Doc]
ontAnnsDocs = (Annotation -> Doc) -> [Annotation] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Annotation -> Doc
printAnnotation PrefixMap
pds) [Annotation]
ontAnns
        axiomsDocs :: [Doc]
axiomsDocs = (Axiom -> Doc) -> [Axiom] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (PrefixMap -> Axiom -> Doc
printAxiom PrefixMap
pds) [Axiom]
axs
        versionIriDoc :: Doc
versionIriDoc = 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
mVerIri
        ontNameDoc :: Doc
ontNameDoc = Doc -> (IRI -> Doc) -> Maybe IRI -> Doc
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Doc
empty (\ontvalue :: IRI
ontvalue -> [Doc] -> Doc
hsep [PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds IRI
ontvalue,
            Doc
versionIriDoc]) Maybe IRI
mOnt
        importedDocs :: Doc
importedDocs
            | [IRI] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [IRI]
dImpDocs = Doc
empty
            | Bool
otherwise =
                [Doc] -> Doc
vsep ([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 ((String -> Doc
keyword "Import" Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<>)
                    (Doc -> Doc) -> (IRI -> Doc) -> IRI -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> Doc
sParens (Doc -> Doc) -> (IRI -> Doc) -> IRI -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PrefixMap -> IRI -> Doc
printIRI PrefixMap
pds) ([IRI] -> Doc) -> [IRI] -> Doc
forall a b. (a -> b) -> a -> b
$ [IRI]
dImpDocs

printOntologyDocument :: OntologyDocument -> Doc
printOntologyDocument :: OntologyDocument -> Doc
printOntologyDocument (OntologyDocument _ prefDecls :: PrefixMap
prefDecls ont :: Ontology
ont) = 
    ([Doc] -> Doc
vsep ([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
printOnt PrefixMap
prefDecls Ontology
ont