pattern
Safe HaskellSafe-Inferred
LanguageHaskell2010

Pattern

Description

Main module for the Pattern library.

This module provides convenient access to all Pattern library functionality by re-exporting public APIs from core modules. Import this module to access all Pattern types, functions, and typeclass instances without needing to import individual modules.

Library Organization

The Pattern library is organized into several modules:

Usage

Import the main Pattern module to access all functionality:

>>> import Pattern
>>> let p = point "test"
>>> value p
"test"

For graph transformation pipelines:

import Pattern
import Pattern.Graph.Transform (mapAllGraph, filterGraph, mapWithContext)
import Pattern.PatternGraph (toGraphView, materialize)

For graph algorithms, import the algorithm modules directly:

import Pattern.Graph.GraphQuery (directed)
import qualified Pattern.Graph.Algorithms as Alg

All public functions, types, and typeclass instances from Pattern.Core are available through this module. See individual module documentation for detailed information about specific functionality.

Re-export Structure

This module re-exports:

  • All public exports from Pattern.Core (Pattern type, construction functions, query functions, predicate functions, helper functions, and all typeclass instances)
  • All public exports from Pattern.Graph (graph operations, GraphView, Substitution)
  • All public exports from Pattern.Graph.GraphQuery (portable graph query interface)
  • All public exports from Pattern.Graph.Transform (bulk transformations and iterative algorithms)
  • Selected exports from Pattern.PatternGraph (PatternGraph, mergeWithPolicy, fromPatterns, fromPatternsWithPolicy, empty, fromPatternGraph, materialize). For a GraphView from a PatternGraph use Pattern.PatternGraph.toGraphView; toGraphView for GraphLens is re-exported from Pattern.Graph.
  • All public exports from Pattern.Reconcile (reconciliation operations)

Internal implementation details and helper functions are not exported through this module, ensuring a clean public API.

Synopsis

Core Pattern Type and Operations

Representation Maps

Graph Operations and GraphView

Portable Graph Query Interface

Graph Transformations

Typed Graph Container

data PatternGraph extra v Source #

Container holding four categories of graph elements, each keyed by identity. All stored elements are 'Pattern v'; classification is via GraphValue.

Constructors

PatternGraph 

Fields

Instances

Instances details
(Show (Id v), Show v, Show extra) => Show (PatternGraph extra v) Source # 
Instance details

Defined in Pattern.PatternGraph

Methods

showsPrec :: Int -> PatternGraph extra v -> ShowS #

show :: PatternGraph extra v -> String #

showList :: [PatternGraph extra v] -> ShowS #

(Eq (Id v), Eq v, Eq extra) => Eq (PatternGraph extra v) Source # 
Instance details

Defined in Pattern.PatternGraph

Methods

(==) :: PatternGraph extra v -> PatternGraph extra v -> Bool #

(/=) :: PatternGraph extra v -> PatternGraph extra v -> Bool #

mergeWithPolicy :: (GraphValue v, Eq v, Mergeable v, HasIdentity v (Id v), Refinable v) => GraphClassifier extra v -> ReconciliationPolicy (MergeStrategy v) -> Pattern v -> PatternGraph extra v -> PatternGraph extra v Source #

Merge a single pattern using the given reconciliation policy for duplicate identities.

fromPatterns :: (GraphValue v, Eq v, Mergeable v, HasIdentity v (Id v), Refinable v) => GraphClassifier extra v -> [Pattern v] -> PatternGraph extra v Source #

Build a graph from a list of patterns (fold of merge).

fromPatternsWithPolicy :: (GraphValue v, Eq v, Mergeable v, HasIdentity v (Id v), Refinable v) => GraphClassifier extra v -> ReconciliationPolicy (MergeStrategy v) -> [Pattern v] -> PatternGraph extra v Source #

Build a graph from a list of patterns using the given reconciliation policy.

empty :: GraphValue v => PatternGraph extra v Source #

Empty graph (all five maps empty).

fromPatternGraph :: (GraphValue v, Eq v) => PatternGraph extra v -> GraphQuery v Source #

Construct a 'GraphQuery v' directly from a 'PatternGraph extra v'.

Reads from the typed maps (pgNodes, pgRelationships, pgWalks, pgAnnotations) without going through GraphLens. Provides O(log n) lookups for queryNodeById and queryRelationshipById.

Preferred over constructing a GraphLens for algorithm access.

materialize :: (GraphValue v, Eq v, Mergeable v, HasIdentity v (Id v), Refinable v) => GraphClassifier extra v -> ReconciliationPolicy (MergeStrategy v) -> GraphView extra v -> PatternGraph extra v Source #

Reconstruct a PatternGraph from a GraphView.

Folds all elements in viewElements through mergeWithPolicy, using the provided classifier and reconciliation policy. This is the finalizer for a lazy transformation pipeline.

Note: defined here (not in Pattern.Graph) to avoid a circular import.

Reconciliation Operations