Module xl

Interface Graph

All Known Implementing Classes:
Graph, Graph, Graph, GraphImpl, RGGGraph

public interface Graph
A Graph represents a single relational data source for XL's relational query and rewriting facilities within the context of a single thread (i.e., the methods are not thread-safe). While a RuntimeModel provides methods for obtaining information and performing operations which are common to a set of relational data sources with an equal structure, a Graph provides methods which operate on a single instance of these data sources within a fixed thread. E.g., a RuntimeModel could represent features of XML documents in general, while a Graph of this model represents a single XML document. Thus, a RuntimeModel provides a set of common operations, a Graph provides the data.
Author:
Ole Kniemeyer
  • Method Details

    • getModel

      RuntimeModel getModel()
      Returns this graph's run-time model.
      Returns:
      the run-time model
    • createQueryState

      QueryState createQueryState()
      Creates a query state to be used for queries which use this graph. The returned query state has to be an instance of the type defined by CompiletimeModel.getQueryStateType() of the corresponding compile-time model.
      Returns:
      a new query state
    • createProducer

      Producer createProducer(QueryState qs)
      Creates an instance of Producer. This factory method creates an instance of a subclass of Producer which will be exclusively used later on in the context of the current match represented by qs. The instance must be an instance of the class returned by CompiletimeModel.getProducerType() for the corresponding compile-time model.

      The usage of producers is specified by the XL programming language.

      Parameters:
      qs - query state which holds current match for which the producer shall produce a replacement
      Returns:
      a producer for use in the context of qs
    • createMatcher

      Pattern.Matcher createMatcher(Pattern pred, XBitSet providedConstants, IntList neededConstantsOut)
    • canEnumerateNodes

      boolean canEnumerateNodes(Type type)
      Can nodes of the specified type be enumerated? This method returns true iff this graph can enumerate nodes of the given type using the method enumerateNodes(de.grogra.reflect.Type, de.grogra.xl.query.QueryState, int, de.grogra.xl.query.MatchConsumer, int).
      Parameters:
      type - the type of nodes
      Returns:
      true iff nodes of type can be enumerated
    • enumerateNodes

      void enumerateNodes(Type type, QueryState qs, int tp, MatchConsumer consumer, int arg)
      This methods enumerates all nodes of this graph of the given type to the given MatchConsumer via the given query state. I.e., for every node c of this extent that has type type, the following statement is executed:
           qs.amatch (tp, c, consumer, arg);
       
      Parameters:
      type - the type of nodes
      qs - the query state on which the amatch-method has to be invoked
      tp - the index-parameter for the amatch-method
      consumer - the consumer-parameter for the amatch-method
      arg - the arg-parameter for the amatch-method
    • canEnumerateEdges

      boolean canEnumerateEdges(EdgeDirection dir, boolean constEdge, Serializable edge)
    • enumerateEdges

      void enumerateEdges(Object node, EdgeDirection dir, Type edgeType, QueryState qs, int toIndex, int patternIndex, Serializable pattern, int matchIndex, MatchConsumer consumer, int arg)
    • getRoot

      Object getRoot()
      Returns the root node of this graph.
      Returns:
      the root
    • getTypeRoot

      Object getTypeRoot()
      Returns the root node of the type graph for this graph
      Returns:
      the root of the type graph
    • enumerateSpaces

      void enumerateSpaces(Object node, EdgeDirection dir, Type edgeType, QueryState qs, int toIndex, int patternIndex, Serializable pattern, int matchIndex, MatchConsumer consumer, int arg)
      This method enumerates all edges that possibly related 2 nodes with a spacing pattern inbetween them.
      Parameters:
      node -
      dir -
      edgeType -
      qs -
      toIndex -
      patternIndex -
      pattern -
      matchIndex -
      consumer -
      arg -
    • sortedTypeGraph

      HashMap<Object,Integer> sortedTypeGraph()
      Returns the ordered scale values of the nodes in the type graph
      Returns:
      HashMap instance containing mappings from the type graph nodes to scale values