Package dev.metaschema.core.metapath


package dev.metaschema.core.metapath
Provides the core Metapath expression language implementation.

Metapath is an XPath 3.1-based expression language for querying and navigating Metaschema-based data models. This package provides the primary API for compiling and evaluating Metapath expressions against Metaschema content.

Key interfaces and classes:

  • IMetapathExpression - Main interface for compiled Metapath expressions with methods for compilation and evaluation
  • StaticContext - XPath 3.1 static context containing namespace bindings, function resolver, and other compile-time information
  • DynamicContext - XPath 3.1 dynamic context containing runtime state such as focus items, variables, and current date/time
  • MetapathException - Base exception type for all Metapath evaluation errors

Typical usage pattern:


 // Compile a Metapath expression
 IMetapathExpression expr = IMetapathExpression.compile("//assembly[@name='foo']");

 // Evaluate against a document node
 ISequence<?> results = expr.evaluate(documentNode);

 // Or evaluate with type conversion
 Boolean result = expr.evaluateAs(documentNode, ResultType.BOOLEAN);
 

This package also contains subpackages for:

  • antlr - ANTLR4-based parser infrastructure
  • cst - Concrete syntax tree expression implementations
  • format - Path formatting utilities
  • function - Metapath function library
  • item - Metapath item types (atomic values, nodes, sequences)
  • type - Metapath type system
See Also: