| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
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:
Pattern.Core- Core Pattern data type, construction functions, query functions, predicate functions, the unified scope abstractions (ScopeQuery,TrivialScope,ScopeDict), and typeclass instances (Functor, Applicative, Comonad, etc.)Pattern.Graph- Low-level graph structural operations (GraphLens,fromGraphLens, nodes, relationships, incidentRels, etc.) andGraphViewconstructortoGraphView.Pattern.Graph.GraphQuery- Portable graph query interface (GraphQuery,TraversalWeight, combinators)Pattern.Graph.Types-GraphViewandSubstitutiontypes (re-exported viaPattern.Graph)Pattern.Graph.Algorithms- Graph algorithms operating onGraphQuery(bfs, dfs, shortestPath, connectedComponents, etc.)Pattern.Graph.Transform- Bulk graph transformations:unfoldGraph,mapGraph,mapAllGraph,filterGraph,foldGraph,mapWithContext, the graph-scope reifierscopeDictFromGraphView,paraGraph, andparaGraphFixedPattern.PatternGraph- Typed graph container with O(log n) lookups;fromPatternGraph,materialize,toGraphViewPattern.Reconcile- Pattern reconciliation for normalizing duplicate identities
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 aGraphViewfrom aPatternGraphusePattern.PatternGraph.toGraphView;toGraphViewforGraphLensis re-exported fromPattern.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
- module Pattern.Core
- module Pattern.RepresentationMap
- module Pattern.Graph
- module Pattern.Graph.GraphQuery
- module Pattern.Graph.Transform
- data PatternGraph extra v = PatternGraph {}
- 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
- fromPatterns :: (GraphValue v, Eq v, Mergeable v, HasIdentity v (Id v), Refinable v) => GraphClassifier extra v -> [Pattern v] -> PatternGraph extra v
- fromPatternsWithPolicy :: (GraphValue v, Eq v, Mergeable v, HasIdentity v (Id v), Refinable v) => GraphClassifier extra v -> ReconciliationPolicy (MergeStrategy v) -> [Pattern v] -> PatternGraph extra v
- empty :: GraphValue v => PatternGraph extra v
- fromPatternGraph :: (GraphValue v, Eq v) => PatternGraph extra v -> GraphQuery v
- 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
- module Pattern.Reconcile
Core Pattern Type and Operations
module Pattern.Core
Representation Maps
module Pattern.RepresentationMap
Graph Operations and GraphView
module Pattern.Graph
Portable Graph Query Interface
module Pattern.Graph.GraphQuery
Graph Transformations
module Pattern.Graph.Transform
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 | |
Instances
| (Show (Id v), Show v, Show extra) => Show (PatternGraph extra v) Source # | |
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 # | |
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
module Pattern.Reconcile