chemist-preprocessor-0.1.0.0: Chemist Raw Data Preprocessor
Safe HaskellSafe-Inferred
LanguageHaskell2010

Domain.Converter.Type

Description

This module defines types and functions for converting Bolt (Neo4j) elements and interactants into Haskell types.

Base

  • exact - Converts an Elem (such as nodes or relationships) into an Interactant (and can be extend with Explain or other interactant types). It handles errors by throwing a ParsingError if the conversion fails.

Additional

  • Data types for representing Neo4j elements and identities, where the Identity type is introduced to facilitate the mapping of Neo4j objects and building relationships.
  • Type classes for converting from database values and extracting interactants.
Synopsis

Documentation

data Elem #

The Elem data type represents various types of Bolt (Neo4j) elements that can be extracted from the database. It includes:

Constructors:

  • SNode - Represents nodes.
  • SRel - Represents relationships.
  • SURel - Represents universal (undirected) relationships.
  • SPath - Represents paths.

Instances

Instances details
Show Elem # 
Instance details

Defined in Domain.Converter.Type

Methods

showsPrec :: Int -> Elem -> ShowS #

show :: Elem -> String #

showList :: [Elem] -> ShowS #

Eq Elem # 
Instance details

Defined in Domain.Converter.Type

Methods

(==) :: Elem -> Elem -> Bool #

(/=) :: Elem -> Elem -> Bool #

data Identity #

The Identity data type represents various IDs that can be associated with nodes or relationships in the graph:

Constructors:

  • NodeId - Represents a node's unique identifier.
  • URelId - Represents a universal (undirected) relationship's unique identifier.
  • RelStartNodeId - Represents the starting node ID of a relationship.
  • RelTargetNodeId - Represents the target node ID of a relationship.

Instances

Instances details
Show Identity # 
Instance details

Defined in Domain.Converter.Type

Eq Identity # 
Instance details

Defined in Domain.Converter.Type

Ord Identity # 
Instance details

Defined in Domain.Converter.Type

ElemInteractant (ACCELERATE, Identity) #

Converts a Neo4j relationship of type ACCELERATE to a Haskell ACCELERATE and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (Catalyst, Identity) #

Converts a Neo4j node with label Catalyst to a Haskell Catalyst and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (Molecule, Identity) #

Converts a Neo4j node with label Molecule to a Haskell Molecule and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (PRODUCT_FROM, Identity) #

Converts a Neo4j relationship of type PRODUCT_FROM to a Haskell PRODUCT_FROM and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (REAGENT_IN, Identity) #

Converts a Neo4j relationship of type REAGENT_IN to a Haskell REAGENT_IN and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (Reaction, Identity) #

Converts a Neo4j node with label Reaction to a Haskell Reaction and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (Interactant, Identity) #

Converts a Neo4j node to a Haskell Interactant based on its label (if Node) or type (if URelationship).

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (FOLLOW, Identity) #

Converts a Neo4j relationship of type FOLLOW to a Haskell FOLLOW and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (Mechanism, Identity) #

Converts a Neo4j node with label Mechanism to a Haskell Mechanism and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (Stage, Identity) #

Converts a Neo4j node with label Stage to a Haskell Stage and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (INCLUDE, Identity, Identity) #

Converts a Neo4j relationship of type INCLUDE to a Haskell INCLUDE and its two Identity values.

Instance details

Defined in Domain.Converter.Instances

class FromValue a where #

The FromValue type class is used to convert a Value (from the Bolt database) into a specific Haskell type a.

Methods

fromValue :: Value -> Either ParsingError a #

Attempts to convert a Value to a specific Haskell type a.

This function takes a Value from the Bolt database and attempts to convert it to the desired type. If the conversion fails, it returns a ParsingError. Otherwise, it returns the converted value.

maybeFromValue :: Maybe Value -> Maybe a #

Attempts to convert a `Maybe Value` to a specific Haskell type a.

This function takes an optional Value and attempts to convert it to the desired type.

Instances

Instances details
FromValue String #

Converts a Bolt Value of type T (Text) to a Haskell String.

Instance details

Defined in Domain.Converter.Instances

FromValue Float #

Converts a Bolt Value of type F (Double) to a Haskell Float.

Instance details

Defined in Domain.Converter.Instances

FromValue Int #

Converts a Bolt Value of type I (Int) to a Haskell Int.

Instance details

Defined in Domain.Converter.Instances

FromValue a => FromValue (Maybe a) #

Converts a Bolt Value of type N (Null) to a Haskell Maybe type.

Instance details

Defined in Domain.Converter.Instances

FromValue a => FromValue [a] #

Converts a Bolt Value of type L (List) to a Haskell list of the specified type.

Instance details

Defined in Domain.Converter.Instances

class ElemInteractant a where #

The ElemInteractant type class defines how to extract an interactant from a Subject. It allows us to convert various database entities into interactants.

Usage:

This type class is used to read from the database.

Methods

exactInteractant :: Elem -> Either ParsingError a #

Converts an Elem to an interactant of type a.

This function takes an Elem (which can be a node, relationship, etc.) and attempts to extract an interactant of type a.

Instances

Instances details
ElemInteractant PathMask #

Converts a Neo4j path to a Haskell PathMask (Introduce PathMask instance to avoid introducing a new typeclass for a pseudo-collection of Interactant's).

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (ACCELERATE, Identity) #

Converts a Neo4j relationship of type ACCELERATE to a Haskell ACCELERATE and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (Catalyst, Identity) #

Converts a Neo4j node with label Catalyst to a Haskell Catalyst and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (Molecule, Identity) #

Converts a Neo4j node with label Molecule to a Haskell Molecule and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (PRODUCT_FROM, Identity) #

Converts a Neo4j relationship of type PRODUCT_FROM to a Haskell PRODUCT_FROM and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (REAGENT_IN, Identity) #

Converts a Neo4j relationship of type REAGENT_IN to a Haskell REAGENT_IN and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (Reaction, Identity) #

Converts a Neo4j node with label Reaction to a Haskell Reaction and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (Interactant, Identity) #

Converts a Neo4j node to a Haskell Interactant based on its label (if Node) or type (if URelationship).

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (FOLLOW, Identity) #

Converts a Neo4j relationship of type FOLLOW to a Haskell FOLLOW and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (Mechanism, Identity) #

Converts a Neo4j node with label Mechanism to a Haskell Mechanism and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (Stage, Identity) #

Converts a Neo4j node with label Stage to a Haskell Stage and its Identity.

Instance details

Defined in Domain.Converter.Instances

ElemInteractant (INCLUDE, Identity, Identity) #

Converts a Neo4j relationship of type INCLUDE to a Haskell INCLUDE and its two Identity values.

Instance details

Defined in Domain.Converter.Instances

class InteractantElem a where #

The InteractantElem type class defines how to extract an element from an Interactant. This allows specific parts of an Interactant to be converted into Masks.

Usage:

This function is used to write into the database.

Methods

exactElem :: Interactant -> Either ParsingError a #

Converts an Interactant to a specific type a.

This function takes an Interactant and attempts to extract a specific element of type a from it.

Instances

Instances details
InteractantElem NodeMask #

Converts a node interactant to a NodeMask.

Instance details

Defined in Domain.Converter.Instances

InteractantElem RelMask #

Converts a relation of Interactants to a RelMask.

Instance details

Defined in Domain.Converter.Instances

exact :: ElemInteractant a => Elem -> IO a #

exact converts a Subject to an interactant by using the exactInteractant function. It throws a ParsingError if the conversion fails; otherwise, it returns the result.

Usage:

This function is used to read from the database.

exactRaw :: InteractantElem a => Interactant -> IO a #

exactRaw converts an Interactant to a specific element using exactElem. Similar to exact, it throws a ParsingError if the conversion fails.

Usage:

This function is used to write into the database.