{- |
Module      :  ./OWL2/Extract.hs
Description :  extraction of the sign from the frames
Copyright   :  (c) Francisc-Nicolae Bungiu, Felix Gabriel Mance
License     :  GPLv2 or higher, see LICENSE.txt

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

Extraction of all the entities in the ontology
-}

module OWL2.Extract where

import qualified OWL2.AS as AS
import OWL2.MS
import OWL2.Sign

import Control.Monad
import Common.Lib.State

import Common.IRI

import qualified Data.Set as Set

fromObjPropExpr :: AS.ObjectPropertyExpression -> State Sign ()
fromObjPropExpr :: ObjectPropertyExpression -> State Sign ()
fromObjPropExpr = Entity -> State Sign ()
addEntity (Entity -> State Sign ())
-> (ObjectPropertyExpression -> Entity)
-> ObjectPropertyExpression
-> State Sign ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EntityType -> IRI -> Entity
AS.mkEntity EntityType
AS.ObjectProperty (IRI -> Entity)
-> (ObjectPropertyExpression -> IRI)
-> ObjectPropertyExpression
-> Entity
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectPropertyExpression -> IRI
AS.objPropToIRI

fromDataPropExpr :: AS.DataPropertyExpression -> State Sign ()
fromDataPropExpr :: IRI -> State Sign ()
fromDataPropExpr = Entity -> State Sign ()
addEntity (Entity -> State Sign ())
-> (IRI -> Entity) -> IRI -> State Sign ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EntityType -> IRI -> Entity
AS.mkEntity EntityType
AS.DataProperty

fromIndividual :: AS.Individual -> State Sign ()
fromIndividual :: IRI -> State Sign ()
fromIndividual ind :: IRI
ind =  Bool -> State Sign () -> State Sign ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (IRI -> Bool
isBlankNode IRI
ind) (State Sign () -> State Sign ()) -> State Sign () -> State Sign ()
forall a b. (a -> b) -> a -> b
$
 Entity -> State Sign ()
addEntity (Entity -> State Sign ()) -> Entity -> State Sign ()
forall a b. (a -> b) -> a -> b
$ EntityType -> IRI -> Entity
AS.mkEntity EntityType
AS.NamedIndividual IRI
ind

fromAnnoProp :: AS.AnnotationProperty -> State Sign ()
fromAnnoProp :: IRI -> State Sign ()
fromAnnoProp = Entity -> State Sign ()
addEntity (Entity -> State Sign ())
-> (IRI -> Entity) -> IRI -> State Sign ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EntityType -> IRI -> Entity
AS.mkEntity EntityType
AS.AnnotationProperty

fromLiteral :: AS.Literal -> State Sign ()
fromLiteral :: Literal -> State Sign ()
fromLiteral l :: Literal
l = case Literal
l of
    AS.Literal _ ty :: TypedOrUntyped
ty -> case TypedOrUntyped
ty of
        AS.Typed u :: IRI
u -> Entity -> State Sign ()
addEntity (Entity -> State Sign ()) -> Entity -> State Sign ()
forall a b. (a -> b) -> a -> b
$ EntityType -> IRI -> Entity
AS.mkEntity EntityType
AS.Datatype IRI
u
        _ -> () -> State Sign ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
    _ -> () -> State Sign ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

fromDType :: AS.Datatype -> State Sign ()
fromDType :: IRI -> State Sign ()
fromDType dt :: IRI
dt = Bool -> State Sign () -> State Sign ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (IRI -> Bool
AS.isDatatypeKey IRI
dt) (State Sign () -> State Sign ()) -> State Sign () -> State Sign ()
forall a b. (a -> b) -> a -> b
$ Entity -> State Sign ()
addEntity (Entity -> State Sign ()) -> Entity -> State Sign ()
forall a b. (a -> b) -> a -> b
$ EntityType -> IRI -> Entity
AS.mkEntity EntityType
AS.Datatype IRI
dt

-- | Adds the DataRange to the Signature and returns it as a State Sign ()
fromDataRange :: AS.DataRange -> State Sign ()
fromDataRange :: DataRange -> State Sign ()
fromDataRange dr :: DataRange
dr = case DataRange
dr of
  AS.DataJunction _ lst :: [DataRange]
lst -> (DataRange -> State Sign ()) -> [DataRange] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ DataRange -> State Sign ()
fromDataRange [DataRange]
lst
  AS.DataComplementOf r :: DataRange
r -> DataRange -> State Sign ()
fromDataRange DataRange
r
  AS.DataOneOf cs :: [Literal]
cs -> (Literal -> State Sign ()) -> [Literal] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ Literal -> State Sign ()
fromLiteral [Literal]
cs
  AS.DataType r :: IRI
r fcs :: [(IRI, Literal)]
fcs -> do
    IRI -> State Sign ()
fromDType IRI
r
    ((IRI, Literal) -> State Sign ())
-> [(IRI, Literal)] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (Literal -> State Sign ()
fromLiteral (Literal -> State Sign ())
-> ((IRI, Literal) -> Literal) -> (IRI, Literal) -> State Sign ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (IRI, Literal) -> Literal
forall a b. (a, b) -> b
snd) [(IRI, Literal)]
fcs

-- | Adds the Fact to the Signature and returns it as a State Sign()
fromFact :: Fact -> State Sign ()
fromFact :: Fact -> State Sign ()
fromFact f :: Fact
f = case Fact
f of
  ObjectPropertyFact _ obe :: ObjectPropertyExpression
obe ind :: IRI
ind -> do
      ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
obe
      IRI -> State Sign ()
fromIndividual IRI
ind
  DataPropertyFact _ dpe :: IRI
dpe _ ->
      IRI -> State Sign ()
fromDataPropExpr IRI
dpe

-- | Adds the Description to the Signature. Returns it as a State
fromDescription :: AS.ClassExpression -> State Sign ()
fromDescription :: ClassExpression -> State Sign ()
fromDescription desc :: ClassExpression
desc = case ClassExpression
desc of
  AS.Expression u :: IRI
u ->
      Bool -> State Sign () -> State Sign ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (IRI -> Bool
AS.isThing IRI
u) (State Sign () -> State Sign ()) -> State Sign () -> State Sign ()
forall a b. (a -> b) -> a -> b
$ Entity -> State Sign ()
addEntity (Entity -> State Sign ()) -> Entity -> State Sign ()
forall a b. (a -> b) -> a -> b
$ EntityType -> IRI -> Entity
AS.mkEntity EntityType
AS.Class IRI
u
  AS.ObjectJunction _ ds :: [ClassExpression]
ds -> (ClassExpression -> State Sign ())
-> [ClassExpression] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ClassExpression -> State Sign ()
fromDescription [ClassExpression]
ds
  AS.ObjectComplementOf d :: ClassExpression
d -> ClassExpression -> State Sign ()
fromDescription ClassExpression
d
  AS.ObjectOneOf is :: [IRI]
is -> (IRI -> State Sign ()) -> [IRI] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ IRI -> State Sign ()
fromIndividual [IRI]
is
  AS.ObjectValuesFrom _ opExpr :: ObjectPropertyExpression
opExpr d :: ClassExpression
d -> do
    ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
opExpr
    ClassExpression -> State Sign ()
fromDescription ClassExpression
d
  AS.ObjectHasSelf opExpr :: ObjectPropertyExpression
opExpr -> ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
opExpr
  AS.ObjectHasValue opExpr :: ObjectPropertyExpression
opExpr i :: IRI
i -> do
    ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
opExpr
    IRI -> State Sign ()
fromIndividual IRI
i
  AS.ObjectCardinality (AS.Cardinality _ _ opExpr :: ObjectPropertyExpression
opExpr md :: Maybe ClassExpression
md) -> do
    ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
opExpr
    State Sign ()
-> (ClassExpression -> State Sign ())
-> Maybe ClassExpression
-> State Sign ()
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (() -> State Sign ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()) ClassExpression -> State Sign ()
fromDescription Maybe ClassExpression
md
  AS.DataValuesFrom _ dExp :: [IRI]
dExp r :: DataRange
r -> do
    IRI -> State Sign ()
fromDataPropExpr ([IRI] -> IRI
forall a. [a] -> a
head [IRI]
dExp)
    DataRange -> State Sign ()
fromDataRange DataRange
r
  AS.DataHasValue dExp :: IRI
dExp c :: Literal
c -> do
    IRI -> State Sign ()
fromDataPropExpr IRI
dExp
    Literal -> State Sign ()
fromLiteral Literal
c
  AS.DataCardinality (AS.Cardinality _ _ dExp :: IRI
dExp mr :: Maybe DataRange
mr) -> do
    IRI -> State Sign ()
fromDataPropExpr IRI
dExp
    State Sign ()
-> (DataRange -> State Sign ()) -> Maybe DataRange -> State Sign ()
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (() -> State Sign ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()) DataRange -> State Sign ()
fromDataRange Maybe DataRange
mr

fromAnno :: AS.Annotation -> State Sign ()
fromAnno :: Annotation -> State Sign ()
fromAnno (AS.Annotation as :: [Annotation]
as apr :: IRI
apr _) = do
    IRI -> State Sign ()
fromAnnoProp IRI
apr
    [Annotation] -> State Sign ()
fromAnnos [Annotation]
as

fromAnnos :: Annotations -> State Sign ()
fromAnnos :: [Annotation] -> State Sign ()
fromAnnos = (Annotation -> State Sign ()) -> [Annotation] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ Annotation -> State Sign ()
fromAnno

fromAnnoList :: (a -> State Sign ()) -> AnnotatedList a -> State Sign ()
fromAnnoList :: (a -> State Sign ()) -> AnnotatedList a -> State Sign ()
fromAnnoList f :: a -> State Sign ()
f al :: AnnotatedList a
al = do
    [Annotation] -> State Sign ()
fromAnnos ([Annotation] -> State Sign ()) -> [Annotation] -> State Sign ()
forall a b. (a -> b) -> a -> b
$ (([Annotation], a) -> [Annotation])
-> AnnotatedList a -> [Annotation]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap ([Annotation], a) -> [Annotation]
forall a b. (a, b) -> a
fst AnnotatedList a
al
    (([Annotation], a) -> State Sign ())
-> AnnotatedList a -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (a -> State Sign ()
f (a -> State Sign ())
-> (([Annotation], a) -> a) -> ([Annotation], a) -> State Sign ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Annotation], a) -> a
forall a b. (a, b) -> b
snd) AnnotatedList a
al

{- | Adds possible ListFrameBits to the Signature by calling
bottom level functions -}
fromLFB :: Maybe AS.Relation -> ListFrameBit -> State Sign ()
fromLFB :: Maybe Relation -> ListFrameBit -> State Sign ()
fromLFB r :: Maybe Relation
r lfb :: ListFrameBit
lfb = case ListFrameBit
lfb of
    AnnotationBit ab :: AnnotatedList IRI
ab ->
      Bool -> State Sign () -> State Sign ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Maybe Relation
r Maybe Relation -> [Maybe Relation] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Relation -> Maybe Relation
forall a. a -> Maybe a
Just (DomainOrRange -> Relation
AS.DRRelation DomainOrRange
AS.ADomain), Relation -> Maybe Relation
forall a. a -> Maybe a
Just (DomainOrRange -> Relation
AS.DRRelation DomainOrRange
AS.ARange)])
        (State Sign () -> State Sign ()) -> State Sign () -> State Sign ()
forall a b. (a -> b) -> a -> b
$ (IRI -> State Sign ()) -> AnnotatedList IRI -> State Sign ()
forall a. (a -> State Sign ()) -> AnnotatedList a -> State Sign ()
fromAnnoList IRI -> State Sign ()
fromAnnoProp AnnotatedList IRI
ab
    ExpressionBit al :: AnnotatedList ClassExpression
al -> (ClassExpression -> State Sign ())
-> AnnotatedList ClassExpression -> State Sign ()
forall a. (a -> State Sign ()) -> AnnotatedList a -> State Sign ()
fromAnnoList ClassExpression -> State Sign ()
fromDescription AnnotatedList ClassExpression
al
    ObjectBit anob :: AnnotatedList ObjectPropertyExpression
anob -> (ObjectPropertyExpression -> State Sign ())
-> AnnotatedList ObjectPropertyExpression -> State Sign ()
forall a. (a -> State Sign ()) -> AnnotatedList a -> State Sign ()
fromAnnoList ObjectPropertyExpression -> State Sign ()
fromObjPropExpr AnnotatedList ObjectPropertyExpression
anob
    DataBit dlst :: AnnotatedList IRI
dlst -> (IRI -> State Sign ()) -> AnnotatedList IRI -> State Sign ()
forall a. (a -> State Sign ()) -> AnnotatedList a -> State Sign ()
fromAnnoList IRI -> State Sign ()
fromDataPropExpr AnnotatedList IRI
dlst
    IndividualSameOrDifferent anind :: AnnotatedList IRI
anind -> (IRI -> State Sign ()) -> AnnotatedList IRI -> State Sign ()
forall a. (a -> State Sign ()) -> AnnotatedList a -> State Sign ()
fromAnnoList IRI -> State Sign ()
fromIndividual AnnotatedList IRI
anind
    ObjectCharacteristics al :: AnnotatedList Character
al -> [Annotation] -> State Sign ()
fromAnnos ([Annotation] -> State Sign ()) -> [Annotation] -> State Sign ()
forall a b. (a -> b) -> a -> b
$ (([Annotation], Character) -> [Annotation])
-> AnnotatedList Character -> [Annotation]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap ([Annotation], Character) -> [Annotation]
forall a b. (a, b) -> a
fst AnnotatedList Character
al
    DataPropRange dr :: AnnotatedList DataRange
dr -> (DataRange -> State Sign ())
-> AnnotatedList DataRange -> State Sign ()
forall a. (a -> State Sign ()) -> AnnotatedList a -> State Sign ()
fromAnnoList DataRange -> State Sign ()
fromDataRange AnnotatedList DataRange
dr
    IndividualFacts fct :: AnnotatedList Fact
fct -> (Fact -> State Sign ()) -> AnnotatedList Fact -> State Sign ()
forall a. (a -> State Sign ()) -> AnnotatedList a -> State Sign ()
fromAnnoList Fact -> State Sign ()
fromFact AnnotatedList Fact
fct

fromAFB :: AnnFrameBit -> State Sign ()
fromAFB :: AnnFrameBit -> State Sign ()
fromAFB afb :: AnnFrameBit
afb = case AnnFrameBit
afb of
    AnnotationFrameBit _ -> () -> State Sign ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
    DataFunctional -> () -> State Sign ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
    DatatypeBit dr :: DataRange
dr -> DataRange -> State Sign ()
fromDataRange DataRange
dr
    ClassDisjointUnion cls :: [ClassExpression]
cls -> (ClassExpression -> State Sign ())
-> [ClassExpression] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ClassExpression -> State Sign ()
fromDescription [ClassExpression]
cls
    ClassHasKey obe :: [ObjectPropertyExpression]
obe dpe :: [IRI]
dpe -> do
      (ObjectPropertyExpression -> State Sign ())
-> [ObjectPropertyExpression] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ObjectPropertyExpression -> State Sign ()
fromObjPropExpr [ObjectPropertyExpression]
obe
      (IRI -> State Sign ()) -> [IRI] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ IRI -> State Sign ()
fromDataPropExpr [IRI]
dpe
    ObjectSubPropertyChain ope :: [ObjectPropertyExpression]
ope -> (ObjectPropertyExpression -> State Sign ())
-> [ObjectPropertyExpression] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ObjectPropertyExpression -> State Sign ()
fromObjPropExpr [ObjectPropertyExpression]
ope

{- | Calls the completion of Signature based on
case separation of ListFrameBit and AnnotationFrameBit -}
fromFB :: Extended -> FrameBit -> State Sign ()
fromFB :: Extended -> FrameBit -> State Sign ()
fromFB ext :: Extended
ext fb :: FrameBit
fb = case FrameBit
fb of
  ListFrameBit rel :: Maybe Relation
rel lfb :: ListFrameBit
lfb -> do
    Extended -> State Sign ()
fromExt Extended
ext
    Maybe Relation -> ListFrameBit -> State Sign ()
fromLFB Maybe Relation
rel ListFrameBit
lfb
  AnnFrameBit an :: [Annotation]
an anf :: AnnFrameBit
anf -> do
    [Annotation] -> State Sign ()
fromAnnos [Annotation]
an
    AnnFrameBit -> State Sign ()
fromAFB AnnFrameBit
anf
    case AnnFrameBit
anf of
        AnnotationFrameBit Assertion -> case Extended
ext of
            Misc _ -> () -> State Sign ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
            _ -> Extended -> State Sign ()
fromExt Extended
ext
        _ -> Extended -> State Sign ()
fromExt Extended
ext

fromFrame :: Frame -> State Sign ()
fromFrame :: Frame -> State Sign ()
fromFrame (Frame ex :: Extended
ex fblist :: [FrameBit]
fblist) = (FrameBit -> State Sign ()) -> [FrameBit] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (Extended -> FrameBit -> State Sign ()
fromFB Extended
ex) [FrameBit]
fblist

fromExt :: Extended -> State Sign ()
fromExt :: Extended -> State Sign ()
fromExt ext :: Extended
ext = case Extended
ext of
    SimpleEntity e :: Entity
e -> Entity -> State Sign ()
addEntity Entity
e
    ObjectEntity op :: ObjectPropertyExpression
op -> ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
op
    ClassEntity ce :: ClassExpression
ce -> ClassExpression -> State Sign ()
fromDescription ClassExpression
ce
    Misc ans :: [Annotation]
ans -> [Annotation] -> State Sign ()
fromAnnos [Annotation]
ans

fromIndividualArg :: AS.IndividualArg -> State Sign ()
fromIndividualArg :: IndividualArg -> State Sign ()
fromIndividualArg arg :: IndividualArg
arg = case IndividualArg
arg of
  AS.IArg i :: IRI
i -> IRI -> State Sign ()
fromIndividual IRI
i
  _ -> () -> State Sign ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

fromDataArg :: AS.DataArg -> State Sign ()
fromDataArg :: DataArg -> State Sign ()
fromDataArg d :: DataArg
d = case DataArg
d of
  AS.DArg l :: Literal
l -> Literal -> State Sign ()
fromLiteral Literal
l
  _ -> () -> State Sign ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

fromDLAtom :: AS.Atom -> State Sign ()
fromDLAtom :: Atom -> State Sign ()
fromDLAtom atom :: Atom
atom = case Atom
atom of
  AS.ClassAtom c :: ClassExpression
c iArg :: IndividualArg
iArg -> do
    ClassExpression -> State Sign ()
fromDescription ClassExpression
c
    IndividualArg -> State Sign ()
fromIndividualArg IndividualArg
iArg
  AS.DataRangeAtom r :: DataRange
r d :: DataArg
d -> do
    DataRange -> State Sign ()
fromDataRange DataRange
r
    DataArg -> State Sign ()
fromDataArg DataArg
d
  AS.ObjectPropertyAtom o :: ObjectPropertyExpression
o i1 :: IndividualArg
i1 i2 :: IndividualArg
i2 -> do
    ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
o
    IndividualArg -> State Sign ()
fromIndividualArg IndividualArg
i1
    IndividualArg -> State Sign ()
fromIndividualArg IndividualArg
i2
  AS.DataPropertyAtom p :: IRI
p i :: IndividualArg
i d :: DataArg
d -> do
    IRI -> State Sign ()
fromDataPropExpr IRI
p
    IndividualArg -> State Sign ()
fromIndividualArg IndividualArg
i
    DataArg -> State Sign ()
fromDataArg DataArg
d
  AS.BuiltInAtom _ _ -> () -> State Sign ()
forall (m :: * -> *) a. Monad m => a -> m a
return () -- built in atoms don't change the sign
  AS.SameIndividualAtom i1 :: IndividualArg
i1 i2 :: IndividualArg
i2 -> do
    IndividualArg -> State Sign ()
fromIndividualArg IndividualArg
i1
    IndividualArg -> State Sign ()
fromIndividualArg IndividualArg
i2
  AS.DifferentIndividualsAtom i1 :: IndividualArg
i1 i2 :: IndividualArg
i2 -> do
    IndividualArg -> State Sign ()
fromIndividualArg IndividualArg
i1
    IndividualArg -> State Sign ()
fromIndividualArg IndividualArg
i2
  _ -> () -> State Sign ()
forall (m :: * -> *) a. Monad m => a -> m a
return () -- unknown atoms are eliminated in static analysis

fromDGAtom :: AS.DGAtom -> State Sign ()
fromDGAtom :: DGAtom -> State Sign ()
fromDGAtom a :: DGAtom
a = case DGAtom
a of
  AS.DGClassAtom c :: ClassExpression
c i :: IndividualArg
i -> do
    ClassExpression -> State Sign ()
fromDescription ClassExpression
c
    IndividualArg -> State Sign ()
fromIndividualArg IndividualArg
i
  AS.DGObjectPropertyAtom o :: ObjectPropertyExpression
o i1 :: IndividualArg
i1 i2 :: IndividualArg
i2 -> do
    ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
o
    IndividualArg -> State Sign ()
fromIndividualArg IndividualArg
i1
    IndividualArg -> State Sign ()
fromIndividualArg IndividualArg
i2

fromAxiom :: AS.Axiom -> State Sign ()
fromAxiom :: Axiom -> State Sign ()
fromAxiom a :: Axiom
a = case Axiom
a of
    AS.Declaration anns :: [Annotation]
anns e :: Entity
e -> do
      [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
      Entity -> State Sign ()
addEntity Entity
e
    
    AS.ClassAxiom cax :: ClassAxiom
cax -> case ClassAxiom
cax of
        AS.SubClassOf anns :: [Annotation]
anns sub :: ClassExpression
sub sup :: ClassExpression
sup -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ClassExpression -> State Sign ()
fromDescription ClassExpression
sub
          ClassExpression -> State Sign ()
fromDescription ClassExpression
sup
          
        AS.EquivalentClasses anns :: [Annotation]
anns clExprs :: [ClassExpression]
clExprs -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          (ClassExpression -> State Sign ())
-> [ClassExpression] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ClassExpression -> State Sign ()
fromDescription [ClassExpression]
clExprs
          
        AS.DisjointClasses anns :: [Annotation]
anns clExprs :: [ClassExpression]
clExprs -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          (ClassExpression -> State Sign ())
-> [ClassExpression] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ClassExpression -> State Sign ()
fromDescription [ClassExpression]
clExprs
          
        AS.DisjointUnion anns :: [Annotation]
anns clIri :: IRI
clIri clExprs :: [ClassExpression]
clExprs -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ClassExpression -> State Sign ()
fromDescription (IRI -> ClassExpression
AS.Expression IRI
clIri)
          (ClassExpression -> State Sign ())
-> [ClassExpression] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ClassExpression -> State Sign ()
fromDescription [ClassExpression]
clExprs

    AS.ObjectPropertyAxiom opax :: ObjectPropertyAxiom
opax -> case ObjectPropertyAxiom
opax of
        AS.SubObjectPropertyOf anns :: [Annotation]
anns subObjProp :: SubObjectPropertyExpression
subObjProp supObjProp :: ObjectPropertyExpression
supObjProp -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
supObjProp
          case SubObjectPropertyExpression
subObjProp of
            AS.SubObjPropExpr_obj op :: ObjectPropertyExpression
op -> ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
op
            AS.SubObjPropExpr_exprchain ops :: [ObjectPropertyExpression]
ops -> (ObjectPropertyExpression -> State Sign ())
-> [ObjectPropertyExpression] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ObjectPropertyExpression -> State Sign ()
fromObjPropExpr [ObjectPropertyExpression]
ops
             
        AS.EquivalentObjectProperties anns :: [Annotation]
anns ops :: [ObjectPropertyExpression]
ops -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns 
          (ObjectPropertyExpression -> State Sign ())
-> [ObjectPropertyExpression] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ObjectPropertyExpression -> State Sign ()
fromObjPropExpr [ObjectPropertyExpression]
ops

        AS.DisjointObjectProperties anns :: [Annotation]
anns ops :: [ObjectPropertyExpression]
ops -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          (ObjectPropertyExpression -> State Sign ())
-> [ObjectPropertyExpression] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ObjectPropertyExpression -> State Sign ()
fromObjPropExpr [ObjectPropertyExpression]
ops
          
        AS.InverseObjectProperties anns :: [Annotation]
anns op1 :: ObjectPropertyExpression
op1 op2 :: ObjectPropertyExpression
op2 -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          (ObjectPropertyExpression -> State Sign ())
-> [ObjectPropertyExpression] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ObjectPropertyExpression -> State Sign ()
fromObjPropExpr [ObjectPropertyExpression
op1, ObjectPropertyExpression
op2]

        AS.ObjectPropertyDomain anns :: [Annotation]
anns op :: ObjectPropertyExpression
op des :: ClassExpression
des -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
op
          ClassExpression -> State Sign ()
fromDescription ClassExpression
des

        AS.ObjectPropertyRange anns :: [Annotation]
anns op :: ObjectPropertyExpression
op des :: ClassExpression
des -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
op
          ClassExpression -> State Sign ()
fromDescription ClassExpression
des

        AS.FunctionalObjectProperty anns :: [Annotation]
anns op :: ObjectPropertyExpression
op -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
op
           
        AS.InverseFunctionalObjectProperty anns :: [Annotation]
anns op :: ObjectPropertyExpression
op -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
op
           
        AS.ReflexiveObjectProperty anns :: [Annotation]
anns op :: ObjectPropertyExpression
op -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
op
          
        AS.IrreflexiveObjectProperty anns :: [Annotation]
anns op :: ObjectPropertyExpression
op -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
op
          
        AS.SymmetricObjectProperty anns :: [Annotation]
anns op :: ObjectPropertyExpression
op -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
op

        AS.AsymmetricObjectProperty anns :: [Annotation]
anns op :: ObjectPropertyExpression
op -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
op
          
        AS.TransitiveObjectProperty anns :: [Annotation]
anns op :: ObjectPropertyExpression
op -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
op
          
    AS.DataPropertyAxiom dpa :: DataPropertyAxiom
dpa -> case DataPropertyAxiom
dpa of
        AS.SubDataPropertyOf anns :: [Annotation]
anns dpSub :: IRI
dpSub dpSup :: IRI
dpSup -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          (IRI -> State Sign ()) -> [IRI] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ IRI -> State Sign ()
fromDataPropExpr [IRI
dpSub, IRI
dpSup]
          
        AS.EquivalentDataProperties anns :: [Annotation]
anns dps :: [IRI]
dps -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          (IRI -> State Sign ()) -> [IRI] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ IRI -> State Sign ()
fromDataPropExpr [IRI]
dps

        AS.DisjointDataProperties anns :: [Annotation]
anns dps :: [IRI]
dps -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          (IRI -> State Sign ()) -> [IRI] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ IRI -> State Sign ()
fromDataPropExpr [IRI]
dps

        AS.DataPropertyDomain anns :: [Annotation]
anns dp :: IRI
dp des :: ClassExpression
des -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          IRI -> State Sign ()
fromDataPropExpr IRI
dp
          ClassExpression -> State Sign ()
fromDescription ClassExpression
des

        AS.DataPropertyRange anns :: [Annotation]
anns dp :: IRI
dp r :: DataRange
r -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          IRI -> State Sign ()
fromDataPropExpr IRI
dp
          DataRange -> State Sign ()
fromDataRange DataRange
r

        AS.FunctionalDataProperty anns :: [Annotation]
anns dp :: IRI
dp -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          IRI -> State Sign ()
fromDataPropExpr IRI
dp
           
    AS.DatatypeDefinition anns :: [Annotation]
anns dt :: IRI
dt dr :: DataRange
dr -> do
      [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
      IRI -> State Sign ()
fromDType IRI
dt
      DataRange -> State Sign ()
fromDataRange DataRange
dr

    AS.HasKey anns :: [Annotation]
anns des :: ClassExpression
des ops :: [ObjectPropertyExpression]
ops dps :: [IRI]
dps -> do
      [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
      ClassExpression -> State Sign ()
fromDescription ClassExpression
des
      (ObjectPropertyExpression -> State Sign ())
-> [ObjectPropertyExpression] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ObjectPropertyExpression -> State Sign ()
fromObjPropExpr [ObjectPropertyExpression]
ops
      (IRI -> State Sign ()) -> [IRI] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ IRI -> State Sign ()
fromDataPropExpr [IRI]
dps
       
    AS.Assertion assertion :: Assertion
assertion -> case Assertion
assertion of
        AS.SameIndividual anns :: [Annotation]
anns inds :: [IRI]
inds -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          (IRI -> State Sign ()) -> [IRI] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ IRI -> State Sign ()
fromIndividual [IRI]
inds
          
        AS.DifferentIndividuals anns :: [Annotation]
anns inds :: [IRI]
inds -> do 
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          (IRI -> State Sign ()) -> [IRI] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ IRI -> State Sign ()
fromIndividual [IRI]
inds
          
        AS.ClassAssertion anns :: [Annotation]
anns c :: ClassExpression
c i :: IRI
i -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ClassExpression -> State Sign ()
fromDescription ClassExpression
c
          IRI -> State Sign ()
fromIndividual IRI
i
        AS.ObjectPropertyAssertion anns :: [Annotation]
anns o :: ObjectPropertyExpression
o s :: IRI
s t :: IRI
t -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
o
          IRI -> State Sign ()
fromIndividual IRI
s
          IRI -> State Sign ()
fromIndividual IRI
t
        AS.NegativeObjectPropertyAssertion anns :: [Annotation]
anns o :: ObjectPropertyExpression
o s :: IRI
s t :: IRI
t -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          ObjectPropertyExpression -> State Sign ()
fromObjPropExpr ObjectPropertyExpression
o
          IRI -> State Sign ()
fromIndividual IRI
s
          IRI -> State Sign ()
fromIndividual IRI
t
        AS.DataPropertyAssertion anns :: [Annotation]
anns d :: IRI
d s :: IRI
s t :: Literal
t -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          IRI -> State Sign ()
fromDataPropExpr IRI
d
          IRI -> State Sign ()
fromIndividual IRI
s
          Literal -> State Sign ()
fromLiteral Literal
t
        AS.NegativeDataPropertyAssertion anns :: [Annotation]
anns d :: IRI
d s :: IRI
s t :: Literal
t -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          IRI -> State Sign ()
fromDataPropExpr IRI
d
          IRI -> State Sign ()
fromIndividual IRI
s
          Literal -> State Sign ()
fromLiteral Literal
t
          
    AS.AnnotationAxiom ax :: AnnotationAxiom
ax -> case AnnotationAxiom
ax of
        AS.AnnotationAssertion anns :: [Annotation]
anns p :: IRI
p _ v :: AnnotationValue
v -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          IRI -> State Sign ()
fromAnnoProp IRI
p
          case AnnotationValue
v of
            AS.AnnValLit l :: Literal
l -> Literal -> State Sign ()
fromLiteral Literal
l
            _ -> () -> State Sign ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
        AS.SubAnnotationPropertyOf anns :: [Annotation]
anns sub :: IRI
sub sup :: IRI
sup -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          IRI -> State Sign ()
fromAnnoProp IRI
sub
          IRI -> State Sign ()
fromAnnoProp IRI
sup
        AS.AnnotationPropertyDomain anns :: [Annotation]
anns p :: IRI
p _ -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          IRI -> State Sign ()
fromAnnoProp IRI
p
        AS.AnnotationPropertyRange anns :: [Annotation]
anns p :: IRI
p _ -> do
          [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
          IRI -> State Sign ()
fromAnnoProp IRI
p
    AS.Rule r :: Rule
r -> case Rule
r of
      AS.DLSafeRule anns :: [Annotation]
anns b :: Body
b h :: Body
h -> do
        [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
        (Atom -> State Sign ()) -> Body -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ Atom -> State Sign ()
fromDLAtom Body
b
        (Atom -> State Sign ()) -> Body -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ Atom -> State Sign ()
fromDLAtom Body
h
      AS.DGRule anns :: [Annotation]
anns b :: DGBody
b h :: DGBody
h -> do
        [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
        (DGAtom -> State Sign ()) -> DGBody -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ DGAtom -> State Sign ()
fromDGAtom DGBody
b
        (DGAtom -> State Sign ()) -> DGBody -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ DGAtom -> State Sign ()
fromDGAtom DGBody
h
    AS.DGAxiom anns :: [Annotation]
anns _ nodes :: DGNodes
nodes edges :: DGEdges
edges classes :: [IRI]
classes -> do
      [Annotation] -> State Sign ()
fromAnnos [Annotation]
anns
      (DGNodeAssertion -> State Sign ()) -> DGNodes -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (\(AS.DGNodeAssertion c :: IRI
c _) -> ClassExpression -> State Sign ()
fromDescription (IRI -> ClassExpression
AS.Expression IRI
c)) DGNodes
nodes
      (DGEdgeAssertion -> State Sign ()) -> DGEdges -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (\(AS.DGEdgeAssertion o :: IRI
o _ _) -> ObjectPropertyExpression -> State Sign ()
fromObjPropExpr (IRI -> ObjectPropertyExpression
AS.ObjectProp IRI
o)) DGEdges
edges
      (IRI -> State Sign ()) -> [IRI] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (ClassExpression -> State Sign ()
fromDescription (ClassExpression -> State Sign ())
-> (IRI -> ClassExpression) -> IRI -> State Sign ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IRI -> ClassExpression
AS.Expression) [IRI]
classes

{- | Top level function: takes the OntologyDocument and completes
the signature by calling completeSignForFrame -}
extractSign :: AS.OntologyDocument -> State Sign ()
extractSign :: OntologyDocument -> State Sign ()
extractSign = (Axiom -> State Sign ()) -> [Axiom] -> State Sign ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ Axiom -> State Sign ()
fromAxiom ([Axiom] -> State Sign ())
-> (OntologyDocument -> [Axiom])
-> OntologyDocument
-> State Sign ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ontology -> [Axiom]
AS.axioms (Ontology -> [Axiom])
-> (OntologyDocument -> Ontology) -> OntologyDocument -> [Axiom]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OntologyDocument -> Ontology
AS.ontology

toDecl :: Sign -> [AS.Axiom]
toDecl :: Sign -> [Axiom]
toDecl s :: Sign
s =
    let cls :: [Entity]
cls = (IRI -> Entity) -> [IRI] -> [Entity]
forall a b. (a -> b) -> [a] -> [b]
map (EntityType -> IRI -> Entity
AS.mkEntity EntityType
AS.Class) ([IRI] -> [Entity]) -> [IRI] -> [Entity]
forall a b. (a -> b) -> a -> b
$ Set IRI -> [IRI]
forall a. Set a -> [a]
Set.toList (Sign -> Set IRI
concepts Sign
s)
        dt :: [Entity]
dt = (IRI -> Entity) -> [IRI] -> [Entity]
forall a b. (a -> b) -> [a] -> [b]
map (EntityType -> IRI -> Entity
AS.mkEntity EntityType
AS.Datatype) ([IRI] -> [Entity]) -> [IRI] -> [Entity]
forall a b. (a -> b) -> a -> b
$ Set IRI -> [IRI]
forall a. Set a -> [a]
Set.toList (Sign -> Set IRI
datatypes Sign
s)
        op :: [Entity]
op = (IRI -> Entity) -> [IRI] -> [Entity]
forall a b. (a -> b) -> [a] -> [b]
map (EntityType -> IRI -> Entity
AS.mkEntity EntityType
AS.ObjectProperty) ([IRI] -> [Entity]) -> [IRI] -> [Entity]
forall a b. (a -> b) -> a -> b
$ Set IRI -> [IRI]
forall a. Set a -> [a]
Set.toList (Sign -> Set IRI
objectProperties Sign
s)
        dp :: [Entity]
dp = (IRI -> Entity) -> [IRI] -> [Entity]
forall a b. (a -> b) -> [a] -> [b]
map (EntityType -> IRI -> Entity
AS.mkEntity EntityType
AS.DataProperty) ([IRI] -> [Entity]) -> [IRI] -> [Entity]
forall a b. (a -> b) -> a -> b
$ Set IRI -> [IRI]
forall a. Set a -> [a]
Set.toList (Sign -> Set IRI
dataProperties Sign
s)
        i :: [Entity]
i = (IRI -> Entity) -> [IRI] -> [Entity]
forall a b. (a -> b) -> [a] -> [b]
map (EntityType -> IRI -> Entity
AS.mkEntity EntityType
AS.NamedIndividual) ([IRI] -> [Entity]) -> [IRI] -> [Entity]
forall a b. (a -> b) -> a -> b
$ Set IRI -> [IRI]
forall a. Set a -> [a]
Set.toList (Sign -> Set IRI
individuals Sign
s)
        ans :: [Entity]
ans = (IRI -> Entity) -> [IRI] -> [Entity]
forall a b. (a -> b) -> [a] -> [b]
map (EntityType -> IRI -> Entity
AS.mkEntity EntityType
AS.AnnotationProperty) ([IRI] -> [Entity]) -> [IRI] -> [Entity]
forall a b. (a -> b) -> a -> b
$ Set IRI -> [IRI]
forall a. Set a -> [a]
Set.toList (Sign -> Set IRI
annotationRoles Sign
s)
    in (Entity -> Axiom) -> [Entity] -> [Axiom]
forall a b. (a -> b) -> [a] -> [b]
map ([Annotation] -> Entity -> Axiom
AS.Declaration []) ([Entity]
cls [Entity] -> [Entity] -> [Entity]
forall a. [a] -> [a] -> [a]
++ [Entity]
dt [Entity] -> [Entity] -> [Entity]
forall a. [a] -> [a] -> [a]
++ [Entity]
op [Entity] -> [Entity] -> [Entity]
forall a. [a] -> [a] -> [a]
++ [Entity]
dp [Entity] -> [Entity] -> [Entity]
forall a. [a] -> [a] -> [a]
++ [Entity]
i [Entity] -> [Entity] -> [Entity]
forall a. [a] -> [a] -> [a]
++ [Entity]
ans)

-- signToFrames :: [Frame] -> [Frame]
-- signToFrames f = let s = mapM_ fromFrame f in toDecl $ execState s emptySign
-- TODO: commented out in 1993
signToFrames :: [Frame] -> [Frame]
signToFrames :: [Frame] -> [Frame]
signToFrames = [Frame] -> [Frame]
forall a. a -> a
id