{-# OPTIONS -w -O0 #-}
{-# LANGUAGE CPP, StandaloneDeriving, DeriveDataTypeable, DeriveGeneric #-}
{- |
Module      :  NeSyPatterns/ATC_NeSyPatterns.der.hs
Description :  generated ShATermConvertible, Json instances
Copyright   :  (c) DFKI GmbH 2012
License     :  GPLv2 or higher, see LICENSE.txt

Maintainer  :  Christian.Maeder@dfki.de
Stability   :  provisional
Portability :  non-portable(derive Typeable instances)

Automatic derivation of instances via DrIFT-rule ShATermConvertible, Json
  for the type(s):
'NeSyPatterns.AS.Node'
'NeSyPatterns.AS.BASIC_SPEC'
'NeSyPatterns.AS.BASIC_ITEM'
'NeSyPatterns.AS.SYMB'
'NeSyPatterns.AS.SYMB_ITEMS'
'NeSyPatterns.AS.SYMB_MAP_ITEMS'
'NeSyPatterns.AS.SYMB_OR_MAP'
'NeSyPatterns.Symbol.Symbol'
'NeSyPatterns.Sign.ResolvedNode'
'NeSyPatterns.Sign.Sign'
'NeSyPatterns.Morphism.Morphism'
-}

{-
Generated by 'genRules' (automatic rule generation for DrIFT). Don't touch!!
  dependency files:
NeSyPatterns/AS.hs
NeSyPatterns/Symbol.hs
NeSyPatterns/Sign.hs
NeSyPatterns/Morphism.hs
-}

module NeSyPatterns.ATC_NeSyPatterns () where

import ATC.AS_Annotation
import ATC.Result
import ATerm.Lib
import Common.AS_Annotation as AS_Anno
import Common.Doc
import Common.DocUtils
import Common.IRI
import Common.Id
import Common.Id as Id
import Common.Json.Instances
import Common.Keywords
import Common.Result
import Common.SetColimit
import Control.Monad (unless, foldM)
import Data.Aeson(ToJSON, FromJSON)
import Data.Data
import Data.List as List
import GHC.Generics(Generic)
import NeSyPatterns.AS
import NeSyPatterns.ATC_Relation
import NeSyPatterns.Morphism
import NeSyPatterns.Morphism as Morphism
import NeSyPatterns.Print ()
import NeSyPatterns.Sign
import NeSyPatterns.Sign (ResolvedNode)
import NeSyPatterns.Sign as Sign
import NeSyPatterns.Symbol
import OWL2.AS
import OWL2.Pretty
import qualified Common.Id as Id
import qualified Common.Result as Result
import qualified Data.Bifunctor
import qualified Data.Map as Map
import qualified Data.Relation as Rel
import qualified Data.Set as Set
import qualified NeSyPatterns.Sign as Sign

{-! for NeSyPatterns.AS.Node derive : ShATermConvertible !-}
{-! for NeSyPatterns.AS.BASIC_SPEC derive : ShATermConvertible !-}
{-! for NeSyPatterns.AS.BASIC_ITEM derive : ShATermConvertible !-}
{-! for NeSyPatterns.AS.SYMB derive : ShATermConvertible !-}
{-! for NeSyPatterns.AS.SYMB_ITEMS derive : ShATermConvertible !-}
{-! for NeSyPatterns.AS.SYMB_MAP_ITEMS derive : ShATermConvertible !-}
{-! for NeSyPatterns.AS.SYMB_OR_MAP derive : ShATermConvertible !-}
{-! for NeSyPatterns.Symbol.Symbol derive : ShATermConvertible !-}
{-! for NeSyPatterns.Sign.ResolvedNode derive : ShATermConvertible !-}
{-! for NeSyPatterns.Sign.Sign derive : ShATermConvertible !-}
{-! for NeSyPatterns.Morphism.Morphism derive : ShATermConvertible !-}

{-! for NeSyPatterns.AS.Node derive : Json !-}
{-! for NeSyPatterns.AS.BASIC_SPEC derive : Json !-}
{-! for NeSyPatterns.AS.BASIC_ITEM derive : Json !-}
{-! for NeSyPatterns.AS.SYMB derive : Json !-}
{-! for NeSyPatterns.AS.SYMB_ITEMS derive : Json !-}
{-! for NeSyPatterns.AS.SYMB_MAP_ITEMS derive : Json !-}
{-! for NeSyPatterns.AS.SYMB_OR_MAP derive : Json !-}
{-! for NeSyPatterns.Symbol.Symbol derive : Json !-}
{-! for NeSyPatterns.Sign.ResolvedNode derive : Json !-}
{-! for NeSyPatterns.Sign.Sign derive : Json !-}
{-! for NeSyPatterns.Morphism.Morphism derive : Json !-}

-- Generated by DrIFT, look but don't touch!

instance ShATermConvertible NeSyPatterns.AS.Node where
  toShATermAux :: ATermTable -> Node -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Node
xv = case Node
xv of
    Node a :: IRI
a b :: Maybe IRI
b c :: Range
c -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> IRI -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 IRI
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Maybe IRI -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Maybe IRI
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Range
c
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Node" [Int
a', Int
b', Int
c'] []) ATermTable
att3
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Node)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Node" [a :: Int
a, b :: Int
b, c :: Int
c] _ ->
      case Int -> ATermTable -> (ATermTable, IRI)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: IRI
a') ->
      case Int -> ATermTable -> (ATermTable, Maybe IRI)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Maybe IRI
b') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Range
c') ->
      (ATermTable
att3, IRI -> Maybe IRI -> Range -> Node
Node IRI
a' Maybe IRI
b' Range
c') }}}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Node)
forall a. String -> ShATerm -> a
fromShATermError "NeSyPatterns.AS.Node" ShATerm
u

instance ShATermConvertible NeSyPatterns.AS.BASIC_SPEC where
  toShATermAux :: ATermTable -> BASIC_SPEC -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: BASIC_SPEC
xv = case BASIC_SPEC
xv of
    Basic_spec a :: [Annoted BASIC_ITEM]
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> [Annoted BASIC_ITEM] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 [Annoted BASIC_ITEM]
a
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Basic_spec" [Int
a'] []) ATermTable
att1
  fromShATermAux :: Int -> ATermTable -> (ATermTable, BASIC_SPEC)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Basic_spec" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, [Annoted BASIC_ITEM])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: [Annoted BASIC_ITEM]
a') ->
      (ATermTable
att1, [Annoted BASIC_ITEM] -> BASIC_SPEC
Basic_spec [Annoted BASIC_ITEM]
a') }
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, BASIC_SPEC)
forall a. String -> ShATerm -> a
fromShATermError "NeSyPatterns.AS.BASIC_SPEC" ShATerm
u

instance ShATermConvertible NeSyPatterns.AS.BASIC_ITEM where
  toShATermAux :: ATermTable -> BASIC_ITEM -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: BASIC_ITEM
xv = case BASIC_ITEM
xv of
    Path a :: [Node]
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> [Node] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 [Node]
a
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Path" [Int
a'] []) ATermTable
att1
  fromShATermAux :: Int -> ATermTable -> (ATermTable, BASIC_ITEM)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Path" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, [Node])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: [Node]
a') ->
      (ATermTable
att1, [Node] -> BASIC_ITEM
Path [Node]
a') }
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, BASIC_ITEM)
forall a. String -> ShATerm -> a
fromShATermError "NeSyPatterns.AS.BASIC_ITEM" ShATerm
u

instance ShATermConvertible NeSyPatterns.AS.SYMB where
  toShATermAux :: ATermTable -> SYMB -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: SYMB
xv = case SYMB
xv of
    Symb_id a :: Node
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Node -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Node
a
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Symb_id" [Int
a'] []) ATermTable
att1
  fromShATermAux :: Int -> ATermTable -> (ATermTable, SYMB)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Symb_id" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, Node)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Node
a') ->
      (ATermTable
att1, Node -> SYMB
Symb_id Node
a') }
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, SYMB)
forall a. String -> ShATerm -> a
fromShATermError "NeSyPatterns.AS.SYMB" ShATerm
u

instance ShATermConvertible NeSyPatterns.AS.SYMB_ITEMS where
  toShATermAux :: ATermTable -> SYMB_ITEMS -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: SYMB_ITEMS
xv = case SYMB_ITEMS
xv of
    Symb_items a :: [SYMB]
a b :: Range
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> [SYMB] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 [SYMB]
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Range
b
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Symb_items" [Int
a', Int
b'] []) ATermTable
att2
  fromShATermAux :: Int -> ATermTable -> (ATermTable, SYMB_ITEMS)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Symb_items" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, [SYMB])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: [SYMB]
a') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Range
b') ->
      (ATermTable
att2, [SYMB] -> Range -> SYMB_ITEMS
Symb_items [SYMB]
a' Range
b') }}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, SYMB_ITEMS)
forall a. String -> ShATerm -> a
fromShATermError "NeSyPatterns.AS.SYMB_ITEMS" ShATerm
u

instance ShATermConvertible NeSyPatterns.AS.SYMB_MAP_ITEMS where
  toShATermAux :: ATermTable -> SYMB_MAP_ITEMS -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: SYMB_MAP_ITEMS
xv = case SYMB_MAP_ITEMS
xv of
    Symb_map_items a :: [SYMB_OR_MAP]
a b :: Range
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> [SYMB_OR_MAP] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 [SYMB_OR_MAP]
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Range
b
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Symb_map_items" [Int
a', Int
b'] []) ATermTable
att2
  fromShATermAux :: Int -> ATermTable -> (ATermTable, SYMB_MAP_ITEMS)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Symb_map_items" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, [SYMB_OR_MAP])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: [SYMB_OR_MAP]
a') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Range
b') ->
      (ATermTable
att2, [SYMB_OR_MAP] -> Range -> SYMB_MAP_ITEMS
Symb_map_items [SYMB_OR_MAP]
a' Range
b') }}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, SYMB_MAP_ITEMS)
forall a. String -> ShATerm -> a
fromShATermError "NeSyPatterns.AS.SYMB_MAP_ITEMS" ShATerm
u

instance ShATermConvertible NeSyPatterns.AS.SYMB_OR_MAP where
  toShATermAux :: ATermTable -> SYMB_OR_MAP -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: SYMB_OR_MAP
xv = case SYMB_OR_MAP
xv of
    Symb a :: SYMB
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> SYMB -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 SYMB
a
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Symb" [Int
a'] []) ATermTable
att1
    Symb_map a :: SYMB
a b :: SYMB
b c :: Range
c -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> SYMB -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 SYMB
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> SYMB -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 SYMB
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Range
c
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Symb_map" [Int
a', Int
b', Int
c'] []) ATermTable
att3
  fromShATermAux :: Int -> ATermTable -> (ATermTable, SYMB_OR_MAP)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Symb" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, SYMB)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: SYMB
a') ->
      (ATermTable
att1, SYMB -> SYMB_OR_MAP
Symb SYMB
a') }
    ShAAppl "Symb_map" [a :: Int
a, b :: Int
b, c :: Int
c] _ ->
      case Int -> ATermTable -> (ATermTable, SYMB)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: SYMB
a') ->
      case Int -> ATermTable -> (ATermTable, SYMB)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: SYMB
b') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Range
c') ->
      (ATermTable
att3, SYMB -> SYMB -> Range -> SYMB_OR_MAP
Symb_map SYMB
a' SYMB
b' Range
c') }}}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, SYMB_OR_MAP)
forall a. String -> ShATerm -> a
fromShATermError "NeSyPatterns.AS.SYMB_OR_MAP" ShATerm
u

deriving instance GHC.Generics.Generic NeSyPatterns.AS.Node
instance Data.Aeson.ToJSON NeSyPatterns.AS.Node where
instance Data.Aeson.FromJSON NeSyPatterns.AS.Node where

deriving instance GHC.Generics.Generic NeSyPatterns.AS.BASIC_SPEC
instance Data.Aeson.ToJSON NeSyPatterns.AS.BASIC_SPEC where
instance Data.Aeson.FromJSON NeSyPatterns.AS.BASIC_SPEC where

deriving instance GHC.Generics.Generic NeSyPatterns.AS.BASIC_ITEM
instance Data.Aeson.ToJSON NeSyPatterns.AS.BASIC_ITEM where
instance Data.Aeson.FromJSON NeSyPatterns.AS.BASIC_ITEM where

deriving instance GHC.Generics.Generic NeSyPatterns.AS.SYMB
instance Data.Aeson.ToJSON NeSyPatterns.AS.SYMB where
instance Data.Aeson.FromJSON NeSyPatterns.AS.SYMB where

deriving instance GHC.Generics.Generic NeSyPatterns.AS.SYMB_ITEMS
instance Data.Aeson.ToJSON NeSyPatterns.AS.SYMB_ITEMS where
instance Data.Aeson.FromJSON NeSyPatterns.AS.SYMB_ITEMS where

deriving instance GHC.Generics.Generic NeSyPatterns.AS.SYMB_MAP_ITEMS
instance Data.Aeson.ToJSON NeSyPatterns.AS.SYMB_MAP_ITEMS where
instance Data.Aeson.FromJSON NeSyPatterns.AS.SYMB_MAP_ITEMS where

deriving instance GHC.Generics.Generic NeSyPatterns.AS.SYMB_OR_MAP
instance Data.Aeson.ToJSON NeSyPatterns.AS.SYMB_OR_MAP where
instance Data.Aeson.FromJSON NeSyPatterns.AS.SYMB_OR_MAP where

instance ShATermConvertible NeSyPatterns.Morphism.Morphism where
  toShATermAux :: ATermTable -> Morphism -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Morphism
xv = case Morphism
xv of
    Morphism a :: Sign
a b :: Sign
b c :: Map IRI IRI
c d :: Map ResolvedNode ResolvedNode
d -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Sign -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Sign
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Sign -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Sign
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Map IRI IRI -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Map IRI IRI
c
      (att4 :: ATermTable
att4, d' :: Int
d') <- ATermTable -> Map ResolvedNode ResolvedNode -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att3 Map ResolvedNode ResolvedNode
d
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Morphism" [Int
a', Int
b', Int
c', Int
d'] []) ATermTable
att4
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Morphism)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Morphism" [a :: Int
a, b :: Int
b, c :: Int
c, d :: Int
d] _ ->
      case Int -> ATermTable -> (ATermTable, Sign)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Sign
a') ->
      case Int -> ATermTable -> (ATermTable, Sign)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Sign
b') ->
      case Int -> ATermTable -> (ATermTable, Map IRI IRI)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Map IRI IRI
c') ->
      case Int -> ATermTable -> (ATermTable, Map ResolvedNode ResolvedNode)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
d ATermTable
att3 of
      { (att4 :: ATermTable
att4, d' :: Map ResolvedNode ResolvedNode
d') ->
      (ATermTable
att4, Sign
-> Sign -> Map IRI IRI -> Map ResolvedNode ResolvedNode -> Morphism
Morphism Sign
a' Sign
b' Map IRI IRI
c' Map ResolvedNode ResolvedNode
d') }}}}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Morphism)
forall a. String -> ShATerm -> a
fromShATermError "NeSyPatterns.Morphism.Morphism" ShATerm
u

deriving instance GHC.Generics.Generic NeSyPatterns.Morphism.Morphism
instance Data.Aeson.ToJSON NeSyPatterns.Morphism.Morphism where
instance Data.Aeson.FromJSON NeSyPatterns.Morphism.Morphism where

deriving instance GHC.Generics.Generic NeSyPatterns.Sign.Sign
instance Data.Aeson.ToJSON NeSyPatterns.Sign.Sign where
instance Data.Aeson.FromJSON NeSyPatterns.Sign.Sign where

deriving instance GHC.Generics.Generic NeSyPatterns.Sign.ResolvedNode
instance Data.Aeson.ToJSON NeSyPatterns.Sign.ResolvedNode where
instance Data.Aeson.FromJSON NeSyPatterns.Sign.ResolvedNode where

instance ShATermConvertible NeSyPatterns.Sign.Sign where
  toShATermAux :: ATermTable -> Sign -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Sign
xv = case Sign
xv of
    Sign a :: Set IRI
a b :: Relation IRI IRI
b c :: Set ResolvedNode
c d :: Relation ResolvedNode ResolvedNode
d e :: Map IRI IRI
e -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Set IRI -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Set IRI
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Relation IRI IRI -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Relation IRI IRI
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Set ResolvedNode -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Set ResolvedNode
c
      (att4 :: ATermTable
att4, d' :: Int
d') <- ATermTable
-> Relation ResolvedNode ResolvedNode -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att3 Relation ResolvedNode ResolvedNode
d
      (att5 :: ATermTable
att5, e' :: Int
e') <- ATermTable -> Map IRI IRI -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att4 Map IRI IRI
e
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Sign" [Int
a', Int
b', Int
c', Int
d', Int
e'] []) ATermTable
att5
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Sign)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Sign" [a :: Int
a, b :: Int
b, c :: Int
c, d :: Int
d, e :: Int
e] _ ->
      case Int -> ATermTable -> (ATermTable, Set IRI)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Set IRI
a') ->
      case Int -> ATermTable -> (ATermTable, Relation IRI IRI)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Relation IRI IRI
b') ->
      case Int -> ATermTable -> (ATermTable, Set ResolvedNode)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Set ResolvedNode
c') ->
      case Int
-> ATermTable -> (ATermTable, Relation ResolvedNode ResolvedNode)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
d ATermTable
att3 of
      { (att4 :: ATermTable
att4, d' :: Relation ResolvedNode ResolvedNode
d') ->
      case Int -> ATermTable -> (ATermTable, Map IRI IRI)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
e ATermTable
att4 of
      { (att5 :: ATermTable
att5, e' :: Map IRI IRI
e') ->
      (ATermTable
att5, Set IRI
-> Relation IRI IRI
-> Set ResolvedNode
-> Relation ResolvedNode ResolvedNode
-> Map IRI IRI
-> Sign
Sign Set IRI
a' Relation IRI IRI
b' Set ResolvedNode
c' Relation ResolvedNode ResolvedNode
d' Map IRI IRI
e') }}}}}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Sign)
forall a. String -> ShATerm -> a
fromShATermError "NeSyPatterns.Sign.Sign" ShATerm
u

instance ShATermConvertible NeSyPatterns.Sign.ResolvedNode where
  toShATermAux :: ATermTable -> ResolvedNode -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: ResolvedNode
xv = case ResolvedNode
xv of
    ResolvedNode a :: IRI
a b :: IRI
b c :: Range
c -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> IRI -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 IRI
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> IRI -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 IRI
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Range
c
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "ResolvedNode" [Int
a', Int
b', Int
c'] []) ATermTable
att3
  fromShATermAux :: Int -> ATermTable -> (ATermTable, ResolvedNode)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "ResolvedNode" [a :: Int
a, b :: Int
b, c :: Int
c] _ ->
      case Int -> ATermTable -> (ATermTable, IRI)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: IRI
a') ->
      case Int -> ATermTable -> (ATermTable, IRI)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: IRI
b') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Range
c') ->
      (ATermTable
att3, IRI -> IRI -> Range -> ResolvedNode
ResolvedNode IRI
a' IRI
b' Range
c') }}}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, ResolvedNode)
forall a. String -> ShATerm -> a
fromShATermError "NeSyPatterns.Sign.ResolvedNode" ShATerm
u

instance ShATermConvertible NeSyPatterns.Symbol.Symbol where
  toShATermAux :: ATermTable -> Symbol -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Symbol
xv = case Symbol
xv of
    Symbol a :: ResolvedNode
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> ResolvedNode -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 ResolvedNode
a
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Symbol" [Int
a'] []) ATermTable
att1
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Symbol)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Symbol" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, ResolvedNode)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: ResolvedNode
a') ->
      (ATermTable
att1, ResolvedNode -> Symbol
Symbol ResolvedNode
a') }
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Symbol)
forall a. String -> ShATerm -> a
fromShATermError "NeSyPatterns.Symbol.Symbol" ShATerm
u

deriving instance GHC.Generics.Generic NeSyPatterns.Symbol.Symbol
instance Data.Aeson.ToJSON NeSyPatterns.Symbol.Symbol where
instance Data.Aeson.FromJSON NeSyPatterns.Symbol.Symbol where