| Copyright | (c) Klaus Luettich, Christian Maeder, and Uni Bremen 2002-2006 |
|---|---|
| License | GPLv2 or higher, see LICENSE.txt |
| Maintainer | Christian.Maeder@dfki.de |
| Stability | provisional |
| Portability | portable |
| Safe Haskell | Safe-Inferred |
Common.AS_Annotation
Description
- data Annote_word
- data Annote_text
- = Line_anno String
- | Group_anno [String]
- data Display_format
- swapTable :: [(a, b)] -> [(b, a)]
- toTable :: Show a => [a] -> [(a, String)]
- display_format_table :: [(Display_format, String)]
- lookupDisplayFormat :: Display_format -> String
- data PrecRel
- data AssocEither
- data Semantic_anno
- = SA_cons
- | SA_def
- | SA_implies
- | SA_mono
- | SA_implied
- | SA_mcons
- | SA_ccons
- semantic_anno_table :: [(Semantic_anno, String)]
- lookupSemanticAnno :: Semantic_anno -> String
- data Annotation
- = Unparsed_anno Annote_word Annote_text Range
- | Display_anno Id [(Display_format, String)] Range
- | List_anno Id Id Id Range
- | Number_anno Id Range
- | Float_anno Id Id Range
- | String_anno Id Id Range
- | Prec_anno PrecRel [Id] [Id] Range
- | Assoc_anno AssocEither [Id] Range
- | Label [String] Range
- | Prefix_anno [(String, IRI)] Range
- | Semantic_anno Semantic_anno Range
- isLabel :: Annotation -> Bool
- isImplies :: Annotation -> Bool
- isImplied :: Annotation -> Bool
- isSemanticAnno :: Annotation -> Bool
- isComment :: Annotation -> Bool
- isAnnote :: Annotation -> Bool
- partPrefixes :: [Annotation] -> (Map String IRI, [Annotation])
- data Annoted a = Annoted {
- item :: a
- opt_pos :: Range
- l_annos :: [Annotation]
- r_annos :: [Annotation]
- annoRange :: (a -> [Pos]) -> Annoted a -> [Pos]
- notImplied :: Annoted a -> Bool
- data SenAttr s a = SenAttr {}
- makeNamed :: a -> s -> SenAttr s a
- type Named s = SenAttr s String
- markSen :: String -> Named s -> Named s
- unmark :: Named s -> Named s
- reName :: (a -> b) -> SenAttr s a -> SenAttr s b
- mapNamed :: (s -> t) -> SenAttr s a -> SenAttr t a
- mapNamedM :: Monad m => (s -> m t) -> Named s -> m (Named t)
- mapAnM :: Monad m => (a -> m b) -> [Annoted a] -> m [Annoted b]
- replaceAnnoted :: b -> Annoted a -> Annoted b
- appendAnno :: Annoted a -> [Annotation] -> Annoted a
- addLeftAnno :: [Annotation] -> a -> Annoted a
- emptyAnno :: a -> Annoted a
- getRLabel :: Annoted a -> String
- identAnno :: String -> Annotation -> Bool
- hasIdentAnno :: String -> Annoted a -> Bool
- makeNamedSen :: Annoted a -> Named a
- annoArg :: Annote_text -> String
- newtype Name = Name String
- getAnnoName :: Annoted a -> Name
Documentation
data Annote_word
start of an annote with its WORD or a comment
Constructors
| Annote_word String | |
| Comment_start |
data Display_format
formats to be displayed (may be extended in the future). Drop 3 from the show result to get the string for parsing and printing
swapTable :: [(a, b)] -> [(b, a)]
swap the entries of a lookup table
display_format_table :: [(Display_format, String)]
a lookup table for the textual representation of display formats
lookupDisplayFormat :: Display_format -> String
lookup the textual representation of a display format
in display_format_table
data PrecRel
precedence Lower means less and BothDirections means less and greater.
Higher means greater but this is syntactically not allowed in Prec_anno.
NoDirection can also not be specified explicitly,
but covers those ids that are not mentionend in precedences.
Constructors
| Higher | |
| Lower | |
| BothDirections | |
| NoDirection |
data AssocEither
either left or right associative
data Semantic_anno
semantic (line) annotations without further information.
Use the same drop-3-trick as for the Display_format.
Constructors
| SA_cons | |
| SA_def | |
| SA_implies | |
| SA_mono | |
| SA_implied | |
| SA_mcons | |
| SA_ccons |
semantic_anno_table :: [(Semantic_anno, String)]
a lookup table for the textual representation of semantic annos
lookupSemanticAnno :: Semantic_anno -> String
lookup the textual representation of a semantic anno
in semantic_anno_table
data Annotation
all possible annotations (without comment-outs)
Constructors
| Unparsed_anno Annote_word Annote_text Range | constructor for comments or unparsed annotes |
| Display_anno Id [(Display_format, String)] Range | known annotes |
| List_anno Id Id Id Range | |
| Number_anno Id Range | |
| Float_anno Id Id Range | |
| String_anno Id Id Range | |
| Prec_anno PrecRel [Id] [Id] Range | |
| Assoc_anno AssocEither [Id] Range | |
| Label [String] Range | |
| Prefix_anno [(String, IRI)] Range | |
| Semantic_anno Semantic_anno Range |
isLabel :: Annotation -> Bool
isLabel tests if the given Annotation is a label
(a Label typically follows a formula)
isImplies :: Annotation -> Bool
isImplied :: Annotation -> Bool
isSemanticAnno :: Annotation -> Bool
isSemanticAnno tests if the given Annotation is a semantic one
isComment :: Annotation -> Bool
isComment tests if the given Annotation is a comment line or a
comment group
isAnnote :: Annotation -> Bool
partPrefixes :: [Annotation] -> (Map String IRI, [Annotation])
separate prefix annotations and put them into a map
data Annoted a
an item wrapped in preceding (left l_annos)
and following (right r_annos) annotations.
opt_pos should carry the position of an optional semicolon
following a formula (but is currently unused).
Constructors
| Annoted | |
Fields
| |
Instances
| Functor Annoted | |
| Eq a => Eq (Annoted a) | |
| Data a => Data (Annoted a) | |
| Ord a => Ord (Annoted a) | |
| Show a => Show (Annoted a) | |
| ShATermConvertible a => ShATermConvertible (Annoted a) | |
| GetRange a => GetRange (Annoted a) | |
| Pretty a => Pretty (Annoted a) | |
| ListCheck a => ListCheck (Annoted a) | an instance of ListCheck for Annoted stuff |
| PrettyLG a => PrettyLG (Annoted a) | |
| ShATermLG a => ShATermLG (Annoted a) | |
| ATermConvertibleSML a => ATermConvertibleSML (Annoted a) | |
| Typeable (* -> *) Annoted |
notImplied :: Annoted a -> Bool
data SenAttr s a
naming or labelling sentences
Constructors
| SenAttr | |
Instances
| (Eq s, Eq a) => Eq (SenAttr s a) | |
| (Data s, Data a) => Data (SenAttr s a) | |
| (Ord s, Ord a) => Ord (SenAttr s a) | |
| (Show s, Show a) => Show (SenAttr s a) | |
| (ShATermConvertible s, ShATermConvertible a) => ShATermConvertible (SenAttr s a) | |
| (GetRange s, GetRange a) => GetRange (SenAttr s a) | |
| (ShATermLG s, ShATermLG a) => ShATermLG (SenAttr s a) | |
| Typeable (* -> * -> *) SenAttr |
mapNamed :: (s -> t) -> SenAttr s a -> SenAttr t a
extending sentence maps to maps on labelled sentences
mapNamedM :: Monad m => (s -> m t) -> Named s -> m (Named t)
extending sentence maybe-maps to maps on labelled sentences
mapAnM :: Monad m => (a -> m b) -> [Annoted a] -> m [Annoted b]
process all items and wrap matching annotations around the results
replaceAnnoted :: b -> Annoted a -> Annoted b
replace the item
appendAnno :: Annoted a -> [Annotation] -> Annoted a
add further following annotations
addLeftAnno :: [Annotation] -> a -> Annoted a
put together preceding annotations and an item
identAnno :: String -> Annotation -> Bool
check for an annotation starting with % and the input str (does not work for known annotation words)
hasIdentAnno :: String -> Annoted a -> Bool
test all anntotions for an item
makeNamedSen :: Annoted a -> Named a
annoArg :: Annote_text -> String
newtype Name
getAnnoName :: Annoted a -> Name