{-# LANGUAGE DeriveDataTypeable #-}
{- |
Module      :  ./Syntax/AS_Structured.der.hs
Description :  abstract syntax of DOL OMS and CASL structured specifications
Copyright   :  (c) Klaus Luettich, Uni Bremen 2002-2016
License     :  GPLv2 or higher, see LICENSE.txt
Maintainer  :  till@informatik.uni-bremen.de
Stability   :  provisional
Portability :  non-portable(Grothendieck)

Abstract syntax of HetCASL (heterogeneous) structured specifications
   Follows Sect. II:2.2.3 of the CASL Reference Manual.
Abstract syntax of DOL OMS and networks
   Follows the DOL OMG standard, clauses 9.4, 9.5, M.2 and M.3
-}

module Syntax.AS_Structured where

-- DrIFT command:
{-! global: GetRange !-}

import Common.Id
import Common.IRI
import Common.AS_Annotation

import Data.Typeable
import qualified Data.Set as Set

import Logic.Logic
import Logic.Grothendieck
    ( G_basic_spec
    , G_symb_items_list
    , G_symb_map_items_list
    , LogicGraph
    , setCurLogic
    , setSyntax )

-- for spec-defn and view-defn see AS_Library

data SPEC = Basic_spec G_basic_spec Range
          | EmptySpec Range
          | Extraction (Annoted SPEC) EXTRACTION
          | Translation (Annoted SPEC) RENAMING
          | Reduction (Annoted SPEC) RESTRICTION
          | Approximation (Annoted SPEC) APPROXIMATION
          | Minimization (Annoted SPEC) MINIMIZATION
          | Filtering (Annoted SPEC) FILTERING
          | Bridge (Annoted SPEC) [RENAMING] (Annoted SPEC) Range
          | Union [Annoted SPEC] Range
            -- pos: "and"s
          | Intersection [Annoted SPEC] Range
            -- pos: "intersect"s
          | Extension [Annoted SPEC] Range
            -- pos: "then"s
          | Free_spec (Annoted SPEC) Range
            -- pos: "free"
          | Cofree_spec (Annoted SPEC) Range
            -- pos: "cofree"
          | Minimize_spec (Annoted SPEC) Range
            -- pos: "minimize", "closed-world"
          | Local_spec (Annoted SPEC) (Annoted SPEC) Range
            -- pos: "local", "within"
          | Closed_spec (Annoted SPEC) Range
            -- pos: "closed"
          | Group (Annoted SPEC) Range
            -- pos: "{","}"
          | Spec_inst SPEC_NAME [Annoted FIT_ARG] (Maybe IRI) Range
            {- pos: many of "[","]"; one balanced pair per FIT_ARG
            an optional ImpName for DOL -}
          | Qualified_spec LogicDescr (Annoted SPEC) Range
            -- pos: "logic", Logic_name,":"
          | Data AnyLogic AnyLogic (Annoted SPEC) (Annoted SPEC) Range
            -- pos: "data"
          | Combination Network Range
            -- pos: "combine"
          | Apply IRI G_basic_spec Range
            -- pos: "apply", use a basic spec parser to parse a sentence
            deriving (Int -> SPEC -> ShowS
[SPEC] -> ShowS
SPEC -> String
(Int -> SPEC -> ShowS)
-> (SPEC -> String) -> ([SPEC] -> ShowS) -> Show SPEC
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SPEC] -> ShowS
$cshowList :: [SPEC] -> ShowS
show :: SPEC -> String
$cshow :: SPEC -> String
showsPrec :: Int -> SPEC -> ShowS
$cshowsPrec :: Int -> SPEC -> ShowS
Show, Typeable)

data Network = Network [LABELED_ONTO_OR_INTPR_REF] [IRI] Range
  deriving (Int -> Network -> ShowS
[Network] -> ShowS
Network -> String
(Int -> Network -> ShowS)
-> (Network -> String) -> ([Network] -> ShowS) -> Show Network
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Network] -> ShowS
$cshowList :: [Network] -> ShowS
show :: Network -> String
$cshow :: Network -> String
showsPrec :: Int -> Network -> ShowS
$cshowsPrec :: Int -> Network -> ShowS
Show, Network -> Network -> Bool
(Network -> Network -> Bool)
-> (Network -> Network -> Bool) -> Eq Network
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Network -> Network -> Bool
$c/= :: Network -> Network -> Bool
== :: Network -> Network -> Bool
$c== :: Network -> Network -> Bool
Eq, Typeable)

data FILTERING = FilterBasicSpec Bool G_basic_spec Range
               | FilterSymbolList Bool  G_symb_items_list Range
  deriving (Int -> FILTERING -> ShowS
[FILTERING] -> ShowS
FILTERING -> String
(Int -> FILTERING -> ShowS)
-> (FILTERING -> String)
-> ([FILTERING] -> ShowS)
-> Show FILTERING
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FILTERING] -> ShowS
$cshowList :: [FILTERING] -> ShowS
show :: FILTERING -> String
$cshow :: FILTERING -> String
showsPrec :: Int -> FILTERING -> ShowS
$cshowsPrec :: Int -> FILTERING -> ShowS
Show, FILTERING -> FILTERING -> Bool
(FILTERING -> FILTERING -> Bool)
-> (FILTERING -> FILTERING -> Bool) -> Eq FILTERING
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FILTERING -> FILTERING -> Bool
$c/= :: FILTERING -> FILTERING -> Bool
== :: FILTERING -> FILTERING -> Bool
$c== :: FILTERING -> FILTERING -> Bool
Eq, Typeable)

data EXTRACTION = ExtractOrRemove Bool [IRI] Range
  deriving (Int -> EXTRACTION -> ShowS
[EXTRACTION] -> ShowS
EXTRACTION -> String
(Int -> EXTRACTION -> ShowS)
-> (EXTRACTION -> String)
-> ([EXTRACTION] -> ShowS)
-> Show EXTRACTION
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EXTRACTION] -> ShowS
$cshowList :: [EXTRACTION] -> ShowS
show :: EXTRACTION -> String
$cshow :: EXTRACTION -> String
showsPrec :: Int -> EXTRACTION -> ShowS
$cshowsPrec :: Int -> EXTRACTION -> ShowS
Show, EXTRACTION -> EXTRACTION -> Bool
(EXTRACTION -> EXTRACTION -> Bool)
-> (EXTRACTION -> EXTRACTION -> Bool) -> Eq EXTRACTION
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EXTRACTION -> EXTRACTION -> Bool
$c/= :: EXTRACTION -> EXTRACTION -> Bool
== :: EXTRACTION -> EXTRACTION -> Bool
$c== :: EXTRACTION -> EXTRACTION -> Bool
Eq, Typeable)

data APPROXIMATION = ForgetOrKeep Bool [G_hiding] (Maybe IRI) Range
  deriving (Int -> APPROXIMATION -> ShowS
[APPROXIMATION] -> ShowS
APPROXIMATION -> String
(Int -> APPROXIMATION -> ShowS)
-> (APPROXIMATION -> String)
-> ([APPROXIMATION] -> ShowS)
-> Show APPROXIMATION
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [APPROXIMATION] -> ShowS
$cshowList :: [APPROXIMATION] -> ShowS
show :: APPROXIMATION -> String
$cshow :: APPROXIMATION -> String
showsPrec :: Int -> APPROXIMATION -> ShowS
$cshowsPrec :: Int -> APPROXIMATION -> ShowS
Show, APPROXIMATION -> APPROXIMATION -> Bool
(APPROXIMATION -> APPROXIMATION -> Bool)
-> (APPROXIMATION -> APPROXIMATION -> Bool) -> Eq APPROXIMATION
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: APPROXIMATION -> APPROXIMATION -> Bool
$c/= :: APPROXIMATION -> APPROXIMATION -> Bool
== :: APPROXIMATION -> APPROXIMATION -> Bool
$c== :: APPROXIMATION -> APPROXIMATION -> Bool
Eq, Typeable)

data MINIMIZATION = Mini Token [IRI] [IRI] Range
  deriving (Int -> MINIMIZATION -> ShowS
[MINIMIZATION] -> ShowS
MINIMIZATION -> String
(Int -> MINIMIZATION -> ShowS)
-> (MINIMIZATION -> String)
-> ([MINIMIZATION] -> ShowS)
-> Show MINIMIZATION
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MINIMIZATION] -> ShowS
$cshowList :: [MINIMIZATION] -> ShowS
show :: MINIMIZATION -> String
$cshow :: MINIMIZATION -> String
showsPrec :: Int -> MINIMIZATION -> ShowS
$cshowsPrec :: Int -> MINIMIZATION -> ShowS
Show, MINIMIZATION -> MINIMIZATION -> Bool
(MINIMIZATION -> MINIMIZATION -> Bool)
-> (MINIMIZATION -> MINIMIZATION -> Bool) -> Eq MINIMIZATION
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MINIMIZATION -> MINIMIZATION -> Bool
$c/= :: MINIMIZATION -> MINIMIZATION -> Bool
== :: MINIMIZATION -> MINIMIZATION -> Bool
$c== :: MINIMIZATION -> MINIMIZATION -> Bool
Eq, Typeable)


data RENAMING = Renaming [G_mapping] Range
                -- pos: "with", list of comma pos
                 deriving (Int -> RENAMING -> ShowS
[RENAMING] -> ShowS
RENAMING -> String
(Int -> RENAMING -> ShowS)
-> (RENAMING -> String) -> ([RENAMING] -> ShowS) -> Show RENAMING
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RENAMING] -> ShowS
$cshowList :: [RENAMING] -> ShowS
show :: RENAMING -> String
$cshow :: RENAMING -> String
showsPrec :: Int -> RENAMING -> ShowS
$cshowsPrec :: Int -> RENAMING -> ShowS
Show, RENAMING -> RENAMING -> Bool
(RENAMING -> RENAMING -> Bool)
-> (RENAMING -> RENAMING -> Bool) -> Eq RENAMING
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RENAMING -> RENAMING -> Bool
$c/= :: RENAMING -> RENAMING -> Bool
== :: RENAMING -> RENAMING -> Bool
$c== :: RENAMING -> RENAMING -> Bool
Eq, Typeable)

data RESTRICTION = Hidden [G_hiding] Range
                   -- pos: "hide", list of comma pos
                 | Revealed G_symb_map_items_list Range
                   -- pos: "reveal", list of comma pos
                   deriving (Int -> RESTRICTION -> ShowS
[RESTRICTION] -> ShowS
RESTRICTION -> String
(Int -> RESTRICTION -> ShowS)
-> (RESTRICTION -> String)
-> ([RESTRICTION] -> ShowS)
-> Show RESTRICTION
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RESTRICTION] -> ShowS
$cshowList :: [RESTRICTION] -> ShowS
show :: RESTRICTION -> String
$cshow :: RESTRICTION -> String
showsPrec :: Int -> RESTRICTION -> ShowS
$cshowsPrec :: Int -> RESTRICTION -> ShowS
Show, RESTRICTION -> RESTRICTION -> Bool
(RESTRICTION -> RESTRICTION -> Bool)
-> (RESTRICTION -> RESTRICTION -> Bool) -> Eq RESTRICTION
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RESTRICTION -> RESTRICTION -> Bool
$c/= :: RESTRICTION -> RESTRICTION -> Bool
== :: RESTRICTION -> RESTRICTION -> Bool
$c== :: RESTRICTION -> RESTRICTION -> Bool
Eq, Typeable)

{- Renaming and Hiding can be performend with intermediate Logic
   mappings / Logic projections.
-}

data G_mapping = G_symb_map G_symb_map_items_list
               | G_logic_translation Logic_code
                 deriving (Int -> G_mapping -> ShowS
[G_mapping] -> ShowS
G_mapping -> String
(Int -> G_mapping -> ShowS)
-> (G_mapping -> String)
-> ([G_mapping] -> ShowS)
-> Show G_mapping
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [G_mapping] -> ShowS
$cshowList :: [G_mapping] -> ShowS
show :: G_mapping -> String
$cshow :: G_mapping -> String
showsPrec :: Int -> G_mapping -> ShowS
$cshowsPrec :: Int -> G_mapping -> ShowS
Show, G_mapping -> G_mapping -> Bool
(G_mapping -> G_mapping -> Bool)
-> (G_mapping -> G_mapping -> Bool) -> Eq G_mapping
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: G_mapping -> G_mapping -> Bool
$c/= :: G_mapping -> G_mapping -> Bool
== :: G_mapping -> G_mapping -> Bool
$c== :: G_mapping -> G_mapping -> Bool
Eq, Typeable)

data G_hiding = G_symb_list G_symb_items_list
               | G_logic_projection Logic_code
                 deriving (Int -> G_hiding -> ShowS
[G_hiding] -> ShowS
G_hiding -> String
(Int -> G_hiding -> ShowS)
-> (G_hiding -> String) -> ([G_hiding] -> ShowS) -> Show G_hiding
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [G_hiding] -> ShowS
$cshowList :: [G_hiding] -> ShowS
show :: G_hiding -> String
$cshow :: G_hiding -> String
showsPrec :: Int -> G_hiding -> ShowS
$cshowsPrec :: Int -> G_hiding -> ShowS
Show, G_hiding -> G_hiding -> Bool
(G_hiding -> G_hiding -> Bool)
-> (G_hiding -> G_hiding -> Bool) -> Eq G_hiding
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: G_hiding -> G_hiding -> Bool
$c/= :: G_hiding -> G_hiding -> Bool
== :: G_hiding -> G_hiding -> Bool
$c== :: G_hiding -> G_hiding -> Bool
Eq, Typeable)

data FIT_ARG = Fit_spec (Annoted SPEC) [G_mapping] Range
               -- pos: opt "fit"
             | Fit_view IRI [Annoted FIT_ARG] Range
               -- annotations before the view keyword are stored in Spec_inst
               deriving (Int -> FIT_ARG -> ShowS
[FIT_ARG] -> ShowS
FIT_ARG -> String
(Int -> FIT_ARG -> ShowS)
-> (FIT_ARG -> String) -> ([FIT_ARG] -> ShowS) -> Show FIT_ARG
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FIT_ARG] -> ShowS
$cshowList :: [FIT_ARG] -> ShowS
show :: FIT_ARG -> String
$cshow :: FIT_ARG -> String
showsPrec :: Int -> FIT_ARG -> ShowS
$cshowsPrec :: Int -> FIT_ARG -> ShowS
Show, Typeable)

type SPEC_NAME = IRI

-- | a logic with serialization or a DOL qualification
data LogicDescr = LogicDescr Logic_name (Maybe IRI) Range
  -- pos: "serialization"
  | SyntaxQual IRI
  | LanguageQual IRI
  deriving (Int -> LogicDescr -> ShowS
[LogicDescr] -> ShowS
LogicDescr -> String
(Int -> LogicDescr -> ShowS)
-> (LogicDescr -> String)
-> ([LogicDescr] -> ShowS)
-> Show LogicDescr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogicDescr] -> ShowS
$cshowList :: [LogicDescr] -> ShowS
show :: LogicDescr -> String
$cshow :: LogicDescr -> String
showsPrec :: Int -> LogicDescr -> ShowS
$cshowsPrec :: Int -> LogicDescr -> ShowS
Show, Typeable)

data Logic_code = Logic_code (Maybe String)
                             (Maybe Logic_name)
                             (Maybe Logic_name) Range
                 {- pos: "logic",<encoding>,":",<src-logic>,"->",<targ-logic>
                 one of <encoding>, <src-logic> or <targ-logic>
                 must be given (by Just)
                 "logic bla"    => <encoding> only
                 "logic bla ->" => <src-logic> only
                 "logic -> bla" => <targ-logic> only
                 "logic bla1 -> bla2" => <src-logic> and <targ-logic>
                 -- "logic bla1:bla2"    => <encoding> and <src-logic>
                 this notation is not very useful and is not maintained
                 "logic bla1:bla2 ->" => <encoding> and <src-logic> (!)
                 "logic bla1: ->bla2" => <encoding> and <targ-logic> -}
                  deriving (Int -> Logic_code -> ShowS
[Logic_code] -> ShowS
Logic_code -> String
(Int -> Logic_code -> ShowS)
-> (Logic_code -> String)
-> ([Logic_code] -> ShowS)
-> Show Logic_code
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Logic_code] -> ShowS
$cshowList :: [Logic_code] -> ShowS
show :: Logic_code -> String
$cshow :: Logic_code -> String
showsPrec :: Int -> Logic_code -> ShowS
$cshowsPrec :: Int -> Logic_code -> ShowS
Show, Logic_code -> Logic_code -> Bool
(Logic_code -> Logic_code -> Bool)
-> (Logic_code -> Logic_code -> Bool) -> Eq Logic_code
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Logic_code -> Logic_code -> Bool
$c/= :: Logic_code -> Logic_code -> Bool
== :: Logic_code -> Logic_code -> Bool
$c== :: Logic_code -> Logic_code -> Bool
Eq, Typeable)

data Logic_name = Logic_name
  String -- looked-up logic name
  (Maybe Token) -- sublogic part
  (Maybe SPEC_NAME) -- for a sublogic based on the given theory
  deriving (Int -> Logic_name -> ShowS
[Logic_name] -> ShowS
Logic_name -> String
(Int -> Logic_name -> ShowS)
-> (Logic_name -> String)
-> ([Logic_name] -> ShowS)
-> Show Logic_name
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Logic_name] -> ShowS
$cshowList :: [Logic_name] -> ShowS
show :: Logic_name -> String
$cshow :: Logic_name -> String
showsPrec :: Int -> Logic_name -> ShowS
$cshowsPrec :: Int -> Logic_name -> ShowS
Show, Logic_name -> Logic_name -> Bool
(Logic_name -> Logic_name -> Bool)
-> (Logic_name -> Logic_name -> Bool) -> Eq Logic_name
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Logic_name -> Logic_name -> Bool
$c/= :: Logic_name -> Logic_name -> Bool
== :: Logic_name -> Logic_name -> Bool
$c== :: Logic_name -> Logic_name -> Bool
Eq, Typeable)

data LABELED_ONTO_OR_INTPR_REF = Labeled (Maybe Token) IRI
  deriving (Int -> LABELED_ONTO_OR_INTPR_REF -> ShowS
[LABELED_ONTO_OR_INTPR_REF] -> ShowS
LABELED_ONTO_OR_INTPR_REF -> String
(Int -> LABELED_ONTO_OR_INTPR_REF -> ShowS)
-> (LABELED_ONTO_OR_INTPR_REF -> String)
-> ([LABELED_ONTO_OR_INTPR_REF] -> ShowS)
-> Show LABELED_ONTO_OR_INTPR_REF
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LABELED_ONTO_OR_INTPR_REF] -> ShowS
$cshowList :: [LABELED_ONTO_OR_INTPR_REF] -> ShowS
show :: LABELED_ONTO_OR_INTPR_REF -> String
$cshow :: LABELED_ONTO_OR_INTPR_REF -> String
showsPrec :: Int -> LABELED_ONTO_OR_INTPR_REF -> ShowS
$cshowsPrec :: Int -> LABELED_ONTO_OR_INTPR_REF -> ShowS
Show, LABELED_ONTO_OR_INTPR_REF -> LABELED_ONTO_OR_INTPR_REF -> Bool
(LABELED_ONTO_OR_INTPR_REF -> LABELED_ONTO_OR_INTPR_REF -> Bool)
-> (LABELED_ONTO_OR_INTPR_REF -> LABELED_ONTO_OR_INTPR_REF -> Bool)
-> Eq LABELED_ONTO_OR_INTPR_REF
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LABELED_ONTO_OR_INTPR_REF -> LABELED_ONTO_OR_INTPR_REF -> Bool
$c/= :: LABELED_ONTO_OR_INTPR_REF -> LABELED_ONTO_OR_INTPR_REF -> Bool
== :: LABELED_ONTO_OR_INTPR_REF -> LABELED_ONTO_OR_INTPR_REF -> Bool
$c== :: LABELED_ONTO_OR_INTPR_REF -> LABELED_ONTO_OR_INTPR_REF -> Bool
Eq, Typeable)

nameToLogicDescr :: Logic_name -> LogicDescr
nameToLogicDescr :: Logic_name -> LogicDescr
nameToLogicDescr n :: Logic_name
n = Logic_name -> Maybe IRI -> Range -> LogicDescr
LogicDescr Logic_name
n Maybe IRI
forall a. Maybe a
Nothing Range
nullRange

setLogicName :: LogicDescr -> LogicGraph -> LogicGraph
setLogicName :: LogicDescr -> LogicGraph -> LogicGraph
setLogicName ld :: LogicDescr
ld = case LogicDescr
ld of
  LogicDescr (Logic_name lid :: String
lid _ _) s :: Maybe IRI
s _ -> Maybe IRI -> LogicGraph -> LogicGraph
setSyntax Maybe IRI
s (LogicGraph -> LogicGraph)
-> (LogicGraph -> LogicGraph) -> LogicGraph -> LogicGraph
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> LogicGraph -> LogicGraph
setCurLogic String
lid
  _ -> LogicGraph -> LogicGraph
forall a. a -> a
id

makeSpec :: G_basic_spec -> Annoted SPEC
makeSpec :: G_basic_spec -> Annoted SPEC
makeSpec gbs :: G_basic_spec
gbs = SPEC -> Annoted SPEC
forall a. a -> Annoted a
emptyAnno (SPEC -> Annoted SPEC) -> SPEC -> Annoted SPEC
forall a b. (a -> b) -> a -> b
$ G_basic_spec -> Range -> SPEC
Basic_spec G_basic_spec
gbs Range
nullRange

makeSpecInst :: SPEC_NAME -> Annoted SPEC
makeSpecInst :: IRI -> Annoted SPEC
makeSpecInst n :: IRI
n = SPEC -> Annoted SPEC
forall a. a -> Annoted a
emptyAnno (SPEC -> Annoted SPEC) -> SPEC -> Annoted SPEC
forall a b. (a -> b) -> a -> b
$ IRI -> [Annoted FIT_ARG] -> Maybe IRI -> Range -> SPEC
Spec_inst IRI
n [] Maybe IRI
forall a. Maybe a
Nothing Range
nullRange

addImports :: [SPEC_NAME] -> Annoted SPEC -> Annoted SPEC
addImports :: [IRI] -> Annoted SPEC -> Annoted SPEC
addImports is :: [IRI]
is bs :: Annoted SPEC
bs = case (IRI -> Annoted SPEC) -> [IRI] -> [Annoted SPEC]
forall a b. (a -> b) -> [a] -> [b]
map IRI -> Annoted SPEC
makeSpecInst [IRI]
is of
  [] -> Annoted SPEC
bs
  js :: [Annoted SPEC]
js@(i :: Annoted SPEC
i : rs :: [Annoted SPEC]
rs) -> SPEC -> Annoted SPEC
forall a. a -> Annoted a
emptyAnno (SPEC -> Annoted SPEC) -> SPEC -> Annoted SPEC
forall a b. (a -> b) -> a -> b
$ [Annoted SPEC] -> Range -> SPEC
Extension
    [ if [Annoted SPEC] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [Annoted SPEC]
rs then Annoted SPEC
i else
          SPEC -> Annoted SPEC
forall a. a -> Annoted a
emptyAnno (SPEC -> Annoted SPEC) -> SPEC -> Annoted SPEC
forall a b. (a -> b) -> a -> b
$ [Annoted SPEC] -> Range -> SPEC
Union [Annoted SPEC]
js Range
nullRange, Annoted SPEC
bs] Range
nullRange

data CORRESPONDENCE = Correspondence_block
                        (Maybe RELATION_REF)
                        (Maybe CONFIDENCE)
                        [CORRESPONDENCE]
                    | Single_correspondence
                        (Maybe Annotation)
                        G_symb_items_list -- was ENTITY_REF
                        G_symb_items_list -- was TERM_OR_ENTITY_REF
                        (Maybe RELATION_REF)
                        (Maybe CONFIDENCE)
                    | Default_correspondence
                      deriving (Int -> CORRESPONDENCE -> ShowS
[CORRESPONDENCE] -> ShowS
CORRESPONDENCE -> String
(Int -> CORRESPONDENCE -> ShowS)
-> (CORRESPONDENCE -> String)
-> ([CORRESPONDENCE] -> ShowS)
-> Show CORRESPONDENCE
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CORRESPONDENCE] -> ShowS
$cshowList :: [CORRESPONDENCE] -> ShowS
show :: CORRESPONDENCE -> String
$cshow :: CORRESPONDENCE -> String
showsPrec :: Int -> CORRESPONDENCE -> ShowS
$cshowsPrec :: Int -> CORRESPONDENCE -> ShowS
Show, CORRESPONDENCE -> CORRESPONDENCE -> Bool
(CORRESPONDENCE -> CORRESPONDENCE -> Bool)
-> (CORRESPONDENCE -> CORRESPONDENCE -> Bool) -> Eq CORRESPONDENCE
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CORRESPONDENCE -> CORRESPONDENCE -> Bool
$c/= :: CORRESPONDENCE -> CORRESPONDENCE -> Bool
== :: CORRESPONDENCE -> CORRESPONDENCE -> Bool
$c== :: CORRESPONDENCE -> CORRESPONDENCE -> Bool
Eq, Typeable)

data RELATION_REF = Subsumes | IsSubsumed | Equivalent | Incompatible
                  | HasInstance | InstanceOf | DefaultRelation
                  | Iri IRI
                    deriving (Int -> RELATION_REF -> ShowS
[RELATION_REF] -> ShowS
RELATION_REF -> String
(Int -> RELATION_REF -> ShowS)
-> (RELATION_REF -> String)
-> ([RELATION_REF] -> ShowS)
-> Show RELATION_REF
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RELATION_REF] -> ShowS
$cshowList :: [RELATION_REF] -> ShowS
show :: RELATION_REF -> String
$cshow :: RELATION_REF -> String
showsPrec :: Int -> RELATION_REF -> ShowS
$cshowsPrec :: Int -> RELATION_REF -> ShowS
Show, RELATION_REF -> RELATION_REF -> Bool
(RELATION_REF -> RELATION_REF -> Bool)
-> (RELATION_REF -> RELATION_REF -> Bool) -> Eq RELATION_REF
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RELATION_REF -> RELATION_REF -> Bool
$c/= :: RELATION_REF -> RELATION_REF -> Bool
== :: RELATION_REF -> RELATION_REF -> Bool
$c== :: RELATION_REF -> RELATION_REF -> Bool
Eq, Typeable)

refToRel :: RELATION_REF -> REL_REF
refToRel :: RELATION_REF -> REL_REF
refToRel Subsumes = REL_REF
Subs
refToRel IsSubsumed = REL_REF
IsSubs
refToRel Equivalent = REL_REF
Equiv
refToRel Incompatible = REL_REF
Incomp
refToRel HasInstance = REL_REF
HasInst
refToRel InstanceOf = REL_REF
InstOf
refToRel DefaultRelation = REL_REF
DefRel
refToRel (Iri i :: IRI
i) = IRI -> REL_REF
RelName IRI
i

type CONFIDENCE = Double -- NOTE: will be revised

instance GetRange Double where
  getRange :: Double -> Range
getRange = Range -> Double -> Range
forall a b. a -> b -> a
const Range
nullRange

getSpecNames :: SPEC -> Set.Set SPEC_NAME
getSpecNames :: SPEC -> Set IRI
getSpecNames sp :: SPEC
sp = let f :: Annoted SPEC -> Set IRI
f = SPEC -> Set IRI
getSpecNames (SPEC -> Set IRI)
-> (Annoted SPEC -> SPEC) -> Annoted SPEC -> Set IRI
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Annoted SPEC -> SPEC
forall a. Annoted a -> a
item in case SPEC
sp of
  Translation as :: Annoted SPEC
as _ -> Annoted SPEC -> Set IRI
f Annoted SPEC
as
  Reduction as :: Annoted SPEC
as _ -> Annoted SPEC -> Set IRI
f Annoted SPEC
as
  Approximation as :: Annoted SPEC
as _ -> Annoted SPEC -> Set IRI
f Annoted SPEC
as
  Minimization as :: Annoted SPEC
as _ -> Annoted SPEC -> Set IRI
f Annoted SPEC
as
  Filtering as :: Annoted SPEC
as _ -> Annoted SPEC -> Set IRI
f Annoted SPEC
as
  Union as :: [Annoted SPEC]
as _ -> [Set IRI] -> Set IRI
forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a
Set.unions ([Set IRI] -> Set IRI) -> [Set IRI] -> Set IRI
forall a b. (a -> b) -> a -> b
$ (Annoted SPEC -> Set IRI) -> [Annoted SPEC] -> [Set IRI]
forall a b. (a -> b) -> [a] -> [b]
map Annoted SPEC -> Set IRI
f [Annoted SPEC]
as
  Intersection as :: [Annoted SPEC]
as _ -> [Set IRI] -> Set IRI
forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a
Set.unions ([Set IRI] -> Set IRI) -> [Set IRI] -> Set IRI
forall a b. (a -> b) -> a -> b
$ (Annoted SPEC -> Set IRI) -> [Annoted SPEC] -> [Set IRI]
forall a b. (a -> b) -> [a] -> [b]
map Annoted SPEC -> Set IRI
f [Annoted SPEC]
as
  Extraction as :: Annoted SPEC
as _ -> Annoted SPEC -> Set IRI
f Annoted SPEC
as
  Extension as :: [Annoted SPEC]
as _ -> [Set IRI] -> Set IRI
forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a
Set.unions ([Set IRI] -> Set IRI) -> [Set IRI] -> Set IRI
forall a b. (a -> b) -> a -> b
$ (Annoted SPEC -> Set IRI) -> [Annoted SPEC] -> [Set IRI]
forall a b. (a -> b) -> [a] -> [b]
map Annoted SPEC -> Set IRI
f [Annoted SPEC]
as
  Free_spec as :: Annoted SPEC
as _ -> Annoted SPEC -> Set IRI
f Annoted SPEC
as
  Cofree_spec as :: Annoted SPEC
as _ -> Annoted SPEC -> Set IRI
f Annoted SPEC
as
  Minimize_spec as :: Annoted SPEC
as _ -> Annoted SPEC -> Set IRI
f Annoted SPEC
as
  Local_spec s1 :: Annoted SPEC
s1 s2 :: Annoted SPEC
s2 _ -> Set IRI -> Set IRI -> Set IRI
forall a. Ord a => Set a -> Set a -> Set a
Set.union (Annoted SPEC -> Set IRI
f Annoted SPEC
s1) (Set IRI -> Set IRI) -> Set IRI -> Set IRI
forall a b. (a -> b) -> a -> b
$ Annoted SPEC -> Set IRI
f Annoted SPEC
s2
  Closed_spec as :: Annoted SPEC
as _ -> Annoted SPEC -> Set IRI
f Annoted SPEC
as
  Group as :: Annoted SPEC
as _ -> Annoted SPEC -> Set IRI
f Annoted SPEC
as
  Spec_inst sn :: IRI
sn fas :: [Annoted FIT_ARG]
fas _ _ -> IRI -> Set IRI -> Set IRI
forall a. Ord a => a -> Set a -> Set a
Set.insert IRI
sn
    (Set IRI -> Set IRI)
-> ([Annoted SPEC] -> Set IRI) -> [Annoted SPEC] -> Set IRI
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Set IRI] -> Set IRI
forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a
Set.unions ([Set IRI] -> Set IRI)
-> ([Annoted SPEC] -> [Set IRI]) -> [Annoted SPEC] -> Set IRI
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Annoted SPEC -> Set IRI) -> [Annoted SPEC] -> [Set IRI]
forall a b. (a -> b) -> [a] -> [b]
map Annoted SPEC -> Set IRI
f ([Annoted SPEC] -> Set IRI) -> [Annoted SPEC] -> Set IRI
forall a b. (a -> b) -> a -> b
$ (Annoted FIT_ARG -> [Annoted SPEC])
-> [Annoted FIT_ARG] -> [Annoted SPEC]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (FIT_ARG -> [Annoted SPEC]
getSpecs (FIT_ARG -> [Annoted SPEC])
-> (Annoted FIT_ARG -> FIT_ARG)
-> Annoted FIT_ARG
-> [Annoted SPEC]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Annoted FIT_ARG -> FIT_ARG
forall a. Annoted a -> a
item) [Annoted FIT_ARG]
fas
  Qualified_spec _ as :: Annoted SPEC
as _ -> Annoted SPEC -> Set IRI
f Annoted SPEC
as
  Data _ _ s1 :: Annoted SPEC
s1 s2 :: Annoted SPEC
s2 _ -> Set IRI -> Set IRI -> Set IRI
forall a. Ord a => Set a -> Set a -> Set a
Set.union (Annoted SPEC -> Set IRI
f Annoted SPEC
s1) (Set IRI -> Set IRI) -> Set IRI -> Set IRI
forall a b. (a -> b) -> a -> b
$ Annoted SPEC -> Set IRI
f Annoted SPEC
s2
  _ -> Set IRI
forall a. Set a
Set.empty

getSpecs :: FIT_ARG -> [Annoted SPEC]
getSpecs :: FIT_ARG -> [Annoted SPEC]
getSpecs fa :: FIT_ARG
fa = case FIT_ARG
fa of
  Fit_spec as :: Annoted SPEC
as _ _ -> [Annoted SPEC
as]
  Fit_view _ fas :: [Annoted FIT_ARG]
fas _ -> (Annoted FIT_ARG -> [Annoted SPEC])
-> [Annoted FIT_ARG] -> [Annoted SPEC]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (FIT_ARG -> [Annoted SPEC]
getSpecs (FIT_ARG -> [Annoted SPEC])
-> (Annoted FIT_ARG -> FIT_ARG)
-> Annoted FIT_ARG
-> [Annoted SPEC]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Annoted FIT_ARG -> FIT_ARG
forall a. Annoted a -> a
item) [Annoted FIT_ARG]
fas

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

instance GetRange SPEC where
  getRange :: SPEC -> Range
getRange x :: SPEC
x = case SPEC
x of
    Basic_spec _ p :: Range
p -> Range
p
    EmptySpec p :: Range
p -> Range
p
    Extraction _ _ -> Range
nullRange
    Translation _ _ -> Range
nullRange
    Reduction _ _ -> Range
nullRange
    Approximation _ _ -> Range
nullRange
    Minimization _ _ -> Range
nullRange
    Filtering _ _ -> Range
nullRange
    Bridge _ _ _ p :: Range
p -> Range
p
    Union _ p :: Range
p -> Range
p
    Intersection _ p :: Range
p -> Range
p
    Extension _ p :: Range
p -> Range
p
    Free_spec _ p :: Range
p -> Range
p
    Cofree_spec _ p :: Range
p -> Range
p
    Minimize_spec _ p :: Range
p -> Range
p
    Local_spec _ _ p :: Range
p -> Range
p
    Closed_spec _ p :: Range
p -> Range
p
    Group _ p :: Range
p -> Range
p
    Spec_inst _ _ _ p :: Range
p -> Range
p
    Qualified_spec _ _ p :: Range
p -> Range
p
    Data _ _ _ _ p :: Range
p -> Range
p
    Combination _ p :: Range
p -> Range
p
    Apply _ _ p :: Range
p -> Range
p
  rangeSpan :: SPEC -> [Pos]
rangeSpan x :: SPEC
x = case SPEC
x of
    Basic_spec a :: G_basic_spec
a b :: Range
b -> [[Pos]] -> [Pos]
joinRanges [G_basic_spec -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan G_basic_spec
a, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
b]
    EmptySpec a :: Range
a -> [[Pos]] -> [Pos]
joinRanges [Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
a]
    Extraction a :: Annoted SPEC
a b :: EXTRACTION
b -> [[Pos]] -> [Pos]
joinRanges [Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
a, EXTRACTION -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan EXTRACTION
b]
    Translation a :: Annoted SPEC
a b :: RENAMING
b -> [[Pos]] -> [Pos]
joinRanges [Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
a, RENAMING -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan RENAMING
b]
    Reduction a :: Annoted SPEC
a b :: RESTRICTION
b -> [[Pos]] -> [Pos]
joinRanges [Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
a, RESTRICTION -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan RESTRICTION
b]
    Approximation a :: Annoted SPEC
a b :: APPROXIMATION
b -> [[Pos]] -> [Pos]
joinRanges [Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
a, APPROXIMATION -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan APPROXIMATION
b]
    Minimization a :: Annoted SPEC
a b :: MINIMIZATION
b -> [[Pos]] -> [Pos]
joinRanges [Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
a, MINIMIZATION -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan MINIMIZATION
b]
    Filtering a :: Annoted SPEC
a b :: FILTERING
b -> [[Pos]] -> [Pos]
joinRanges [Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
a, FILTERING -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan FILTERING
b]
    Bridge a :: Annoted SPEC
a b :: [RENAMING]
b c :: Annoted SPEC
c d :: Range
d -> [[Pos]] -> [Pos]
joinRanges [Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
a, [RENAMING] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [RENAMING]
b,
                                  Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
c, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
d]
    Union a :: [Annoted SPEC]
a b :: Range
b -> [[Pos]] -> [Pos]
joinRanges [[Annoted SPEC] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [Annoted SPEC]
a, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
b]
    Intersection a :: [Annoted SPEC]
a b :: Range
b -> [[Pos]] -> [Pos]
joinRanges [[Annoted SPEC] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [Annoted SPEC]
a, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
b]
    Extension a :: [Annoted SPEC]
a b :: Range
b -> [[Pos]] -> [Pos]
joinRanges [[Annoted SPEC] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [Annoted SPEC]
a, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
b]
    Free_spec a :: Annoted SPEC
a b :: Range
b -> [[Pos]] -> [Pos]
joinRanges [Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
a, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
b]
    Cofree_spec a :: Annoted SPEC
a b :: Range
b -> [[Pos]] -> [Pos]
joinRanges [Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
a, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
b]
    Minimize_spec a :: Annoted SPEC
a b :: Range
b -> [[Pos]] -> [Pos]
joinRanges [Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
a, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
b]
    Local_spec a :: Annoted SPEC
a b :: Annoted SPEC
b c :: Range
c -> [[Pos]] -> [Pos]
joinRanges [Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
a, Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
b,
                                    Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
c]
    Closed_spec a :: Annoted SPEC
a b :: Range
b -> [[Pos]] -> [Pos]
joinRanges [Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
a, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
b]
    Group a :: Annoted SPEC
a b :: Range
b -> [[Pos]] -> [Pos]
joinRanges [Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
a, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
b]
    Spec_inst a :: IRI
a b :: [Annoted FIT_ARG]
b c :: Maybe IRI
c d :: Range
d -> [[Pos]] -> [Pos]
joinRanges [IRI -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan IRI
a, [Annoted FIT_ARG] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [Annoted FIT_ARG]
b,
                                     Maybe IRI -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Maybe IRI
c, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
d]
    Qualified_spec a :: LogicDescr
a b :: Annoted SPEC
b c :: Range
c -> [[Pos]] -> [Pos]
joinRanges [LogicDescr -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan LogicDescr
a, Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
b,
                                        Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
c]
    Data a :: AnyLogic
a b :: AnyLogic
b c :: Annoted SPEC
c d :: Annoted SPEC
d e :: Range
e -> [[Pos]] -> [Pos]
joinRanges [AnyLogic -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan AnyLogic
a, AnyLogic -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan AnyLogic
b,
                                  Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
c, Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
d, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
e]
    Combination a :: Network
a b :: Range
b -> [[Pos]] -> [Pos]
joinRanges [Network -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Network
a, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
b]
    Apply a :: IRI
a b :: G_basic_spec
b c :: Range
c -> [[Pos]] -> [Pos]
joinRanges [IRI -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan IRI
a, G_basic_spec -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan G_basic_spec
b, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
c]

instance GetRange Network where
  getRange :: Network -> Range
getRange x :: Network
x = case Network
x of
    Network _ _ p :: Range
p -> Range
p
  rangeSpan :: Network -> [Pos]
rangeSpan x :: Network
x = case Network
x of
    Network a :: [LABELED_ONTO_OR_INTPR_REF]
a b :: [IRI]
b c :: Range
c -> [[Pos]] -> [Pos]
joinRanges [[LABELED_ONTO_OR_INTPR_REF] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [LABELED_ONTO_OR_INTPR_REF]
a, [IRI] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [IRI]
b, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
c]

instance GetRange FILTERING where
  getRange :: FILTERING -> Range
getRange x :: FILTERING
x = case FILTERING
x of
    FilterBasicSpec _ _ p :: Range
p -> Range
p
    FilterSymbolList _ _ p :: Range
p -> Range
p
  rangeSpan :: FILTERING -> [Pos]
rangeSpan x :: FILTERING
x = case FILTERING
x of
    FilterBasicSpec a :: Bool
a b :: G_basic_spec
b c :: Range
c -> [[Pos]] -> [Pos]
joinRanges [Bool -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Bool
a, G_basic_spec -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan G_basic_spec
b,
                                         Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
c]
    FilterSymbolList a :: Bool
a b :: G_symb_items_list
b c :: Range
c -> [[Pos]] -> [Pos]
joinRanges [Bool -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Bool
a, G_symb_items_list -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan G_symb_items_list
b,
                                          Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
c]

instance GetRange EXTRACTION where
  getRange :: EXTRACTION -> Range
getRange x :: EXTRACTION
x = case EXTRACTION
x of
    ExtractOrRemove _ _ p :: Range
p -> Range
p
  rangeSpan :: EXTRACTION -> [Pos]
rangeSpan x :: EXTRACTION
x = case EXTRACTION
x of
    ExtractOrRemove a :: Bool
a b :: [IRI]
b c :: Range
c -> [[Pos]] -> [Pos]
joinRanges [Bool -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Bool
a, [IRI] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [IRI]
b,
                                         Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
c]

instance GetRange APPROXIMATION where
  getRange :: APPROXIMATION -> Range
getRange x :: APPROXIMATION
x = case APPROXIMATION
x of
    ForgetOrKeep _ _ _ p :: Range
p -> Range
p
  rangeSpan :: APPROXIMATION -> [Pos]
rangeSpan x :: APPROXIMATION
x = case APPROXIMATION
x of
    ForgetOrKeep a :: Bool
a b :: [G_hiding]
b c :: Maybe IRI
c d :: Range
d -> [[Pos]] -> [Pos]
joinRanges [Bool -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Bool
a, [G_hiding] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [G_hiding]
b,
                                        Maybe IRI -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Maybe IRI
c, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
d]

instance GetRange MINIMIZATION where
  getRange :: MINIMIZATION -> Range
getRange x :: MINIMIZATION
x = case MINIMIZATION
x of
    Mini _ _ _ p :: Range
p -> Range
p
  rangeSpan :: MINIMIZATION -> [Pos]
rangeSpan x :: MINIMIZATION
x = case MINIMIZATION
x of
    Mini a :: Token
a b :: [IRI]
b c :: [IRI]
c d :: Range
d -> [[Pos]] -> [Pos]
joinRanges [Token -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Token
a, [IRI] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [IRI]
b, [IRI] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [IRI]
c,
                                Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
d]

instance GetRange RENAMING where
  getRange :: RENAMING -> Range
getRange x :: RENAMING
x = case RENAMING
x of
    Renaming _ p :: Range
p -> Range
p
  rangeSpan :: RENAMING -> [Pos]
rangeSpan x :: RENAMING
x = case RENAMING
x of
    Renaming a :: [G_mapping]
a b :: Range
b -> [[Pos]] -> [Pos]
joinRanges [[G_mapping] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [G_mapping]
a, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
b]

instance GetRange RESTRICTION where
  getRange :: RESTRICTION -> Range
getRange x :: RESTRICTION
x = case RESTRICTION
x of
    Hidden _ p :: Range
p -> Range
p
    Revealed _ p :: Range
p -> Range
p
  rangeSpan :: RESTRICTION -> [Pos]
rangeSpan x :: RESTRICTION
x = case RESTRICTION
x of
    Hidden a :: [G_hiding]
a b :: Range
b -> [[Pos]] -> [Pos]
joinRanges [[G_hiding] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [G_hiding]
a, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
b]
    Revealed a :: G_symb_map_items_list
a b :: Range
b -> [[Pos]] -> [Pos]
joinRanges [G_symb_map_items_list -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan G_symb_map_items_list
a, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
b]

instance GetRange G_mapping where
  getRange :: G_mapping -> Range
getRange = Range -> G_mapping -> Range
forall a b. a -> b -> a
const Range
nullRange
  rangeSpan :: G_mapping -> [Pos]
rangeSpan x :: G_mapping
x = case G_mapping
x of
    G_symb_map a :: G_symb_map_items_list
a -> [[Pos]] -> [Pos]
joinRanges [G_symb_map_items_list -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan G_symb_map_items_list
a]
    G_logic_translation a :: Logic_code
a -> [[Pos]] -> [Pos]
joinRanges [Logic_code -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Logic_code
a]

instance GetRange G_hiding where
  getRange :: G_hiding -> Range
getRange = Range -> G_hiding -> Range
forall a b. a -> b -> a
const Range
nullRange
  rangeSpan :: G_hiding -> [Pos]
rangeSpan x :: G_hiding
x = case G_hiding
x of
    G_symb_list a :: G_symb_items_list
a -> [[Pos]] -> [Pos]
joinRanges [G_symb_items_list -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan G_symb_items_list
a]
    G_logic_projection a :: Logic_code
a -> [[Pos]] -> [Pos]
joinRanges [Logic_code -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Logic_code
a]

instance GetRange FIT_ARG where
  getRange :: FIT_ARG -> Range
getRange x :: FIT_ARG
x = case FIT_ARG
x of
    Fit_spec _ _ p :: Range
p -> Range
p
    Fit_view _ _ p :: Range
p -> Range
p
  rangeSpan :: FIT_ARG -> [Pos]
rangeSpan x :: FIT_ARG
x = case FIT_ARG
x of
    Fit_spec a :: Annoted SPEC
a b :: [G_mapping]
b c :: Range
c -> [[Pos]] -> [Pos]
joinRanges [Annoted SPEC -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Annoted SPEC
a, [G_mapping] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [G_mapping]
b,
                                  Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
c]
    Fit_view a :: IRI
a b :: [Annoted FIT_ARG]
b c :: Range
c -> [[Pos]] -> [Pos]
joinRanges [IRI -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan IRI
a, [Annoted FIT_ARG] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [Annoted FIT_ARG]
b,
                                  Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
c]

instance GetRange LogicDescr where
  getRange :: LogicDescr -> Range
getRange x :: LogicDescr
x = case LogicDescr
x of
    LogicDescr _ _ p :: Range
p -> Range
p
    SyntaxQual _ -> Range
nullRange
    LanguageQual _ -> Range
nullRange
  rangeSpan :: LogicDescr -> [Pos]
rangeSpan x :: LogicDescr
x = case LogicDescr
x of
    LogicDescr a :: Logic_name
a b :: Maybe IRI
b c :: Range
c -> [[Pos]] -> [Pos]
joinRanges [Logic_name -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Logic_name
a, Maybe IRI -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Maybe IRI
b,
                                    Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
c]
    SyntaxQual a :: IRI
a -> [[Pos]] -> [Pos]
joinRanges [IRI -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan IRI
a]
    LanguageQual a :: IRI
a -> [[Pos]] -> [Pos]
joinRanges [IRI -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan IRI
a]

instance GetRange Logic_code where
  getRange :: Logic_code -> Range
getRange x :: Logic_code
x = case Logic_code
x of
    Logic_code _ _ _ p :: Range
p -> Range
p
  rangeSpan :: Logic_code -> [Pos]
rangeSpan x :: Logic_code
x = case Logic_code
x of
    Logic_code a :: Maybe String
a b :: Maybe Logic_name
b c :: Maybe Logic_name
c d :: Range
d -> [[Pos]] -> [Pos]
joinRanges [Maybe String -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Maybe String
a, Maybe Logic_name -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Maybe Logic_name
b,
                                      Maybe Logic_name -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Maybe Logic_name
c, Range -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Range
d]

instance GetRange Logic_name where
  getRange :: Logic_name -> Range
getRange = Range -> Logic_name -> Range
forall a b. a -> b -> a
const Range
nullRange
  rangeSpan :: Logic_name -> [Pos]
rangeSpan x :: Logic_name
x = case Logic_name
x of
    Logic_name a :: String
a b :: Maybe Token
b c :: Maybe IRI
c -> [[Pos]] -> [Pos]
joinRanges [String -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan String
a, Maybe Token -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Maybe Token
b,
                                    Maybe IRI -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Maybe IRI
c]

instance GetRange LABELED_ONTO_OR_INTPR_REF where
  getRange :: LABELED_ONTO_OR_INTPR_REF -> Range
getRange = Range -> LABELED_ONTO_OR_INTPR_REF -> Range
forall a b. a -> b -> a
const Range
nullRange
  rangeSpan :: LABELED_ONTO_OR_INTPR_REF -> [Pos]
rangeSpan x :: LABELED_ONTO_OR_INTPR_REF
x = case LABELED_ONTO_OR_INTPR_REF
x of
    Labeled a :: Maybe Token
a b :: IRI
b -> [[Pos]] -> [Pos]
joinRanges [Maybe Token -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Maybe Token
a, IRI -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan IRI
b]

instance GetRange CORRESPONDENCE where
  getRange :: CORRESPONDENCE -> Range
getRange = Range -> CORRESPONDENCE -> Range
forall a b. a -> b -> a
const Range
nullRange
  rangeSpan :: CORRESPONDENCE -> [Pos]
rangeSpan x :: CORRESPONDENCE
x = case CORRESPONDENCE
x of
    Correspondence_block a :: Maybe RELATION_REF
a b :: Maybe Double
b c :: [CORRESPONDENCE]
c -> [[Pos]] -> [Pos]
joinRanges [Maybe RELATION_REF -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Maybe RELATION_REF
a, Maybe Double -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Maybe Double
b,
                                              [CORRESPONDENCE] -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan [CORRESPONDENCE]
c]
    Single_correspondence a :: Maybe Annotation
a b :: G_symb_items_list
b c :: G_symb_items_list
c d :: Maybe RELATION_REF
d e :: Maybe Double
e -> [[Pos]] -> [Pos]
joinRanges [Maybe Annotation -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Maybe Annotation
a,
                                                   G_symb_items_list -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan G_symb_items_list
b, G_symb_items_list -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan G_symb_items_list
c, Maybe RELATION_REF -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Maybe RELATION_REF
d,
                                                   Maybe Double -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan Maybe Double
e]
    Default_correspondence -> []

instance GetRange RELATION_REF where
  getRange :: RELATION_REF -> Range
getRange = Range -> RELATION_REF -> Range
forall a b. a -> b -> a
const Range
nullRange
  rangeSpan :: RELATION_REF -> [Pos]
rangeSpan x :: RELATION_REF
x = case RELATION_REF
x of
    Subsumes -> []
    IsSubsumed -> []
    Equivalent -> []
    Incompatible -> []
    HasInstance -> []
    InstanceOf -> []
    DefaultRelation -> []
    Iri a :: IRI
a -> [[Pos]] -> [Pos]
joinRanges [IRI -> [Pos]
forall a. GetRange a => a -> [Pos]
rangeSpan IRI
a]