Interface RPQ

All Superinterfaces:
OutputFormal, OutputSQL, OutputXML, QueryFragment, QueryLanguageSyntax
All Known Implementing Classes:
ConcatRPQ, DisjunctionRPQ, EdgeRPQ, KleeneRPQ

public interface RPQ extends QueryLanguageSyntax
Interface for regular path queries (RPQs).
See Also:
  • Method Details

    • getQueryLanguage

      default QueryLanguage getQueryLanguage()
      Description copied from interface: QueryLanguageSyntax
      Gets the concrete query language used to defined this query.
      Specified by:
      getQueryLanguage in interface QueryLanguageSyntax
      Returns:
      The query language for this query.
    • kleene

      static RPQ kleene(RPQ rpq)
      Returns an RPQ representing the transitive closure of the given RPQ.
      Parameters:
      rpq - The RPQ for the transitive closure.
      Returns:
      The transitive closure of the given RPQ.
    • disjunct

      static RPQ disjunct(RPQ... rpqs)
      Returns an RPQ representing the disjunction of the given RPQs from left to right. For example ((q1 ∪ q2) ∪ q3).
      Parameters:
      rpqs - The RPQs for the disjunction.
      Returns:
      The disjunction of the given RPQs.
      Throws:
      IllegalArgumentException - When less than 2 RPQs are provided.
    • disjunct

      static RPQ disjunct(List<RPQ> rpqs)
      Returns an RPQ representing the disjunction of the given RPQs from left to right. For example ((q1 ∪ q2) ∪ q3). Note that the given list is not copied.
      Parameters:
      rpqs - The RPQs for the disjunction.
      Returns:
      The disjunction of the given RPQs.
      Throws:
      IllegalArgumentException - When less than 2 RPQs are provided.
    • concat

      static RPQ concat(RPQ... rpqs) throws IllegalArgumentException
      Returns an RPQ representing the concatenation in order of the given RPQs.
      Parameters:
      rpqs - The RPQs to concatenate (in order).
      Returns:
      The concatenation of the given RPQs.
      Throws:
      IllegalArgumentException - When the given list of RPQs is empty.
    • concat

      static RPQ concat(List<RPQ> rpqs) throws IllegalArgumentException
      Returns an RPQ representing the concatenation in order of the given RPQs. Note that the given list is not copied.
      Parameters:
      rpqs - The RPQs to concatenate (in order).
      Returns:
      The concatenation of the given RPQs.
      Throws:
      IllegalArgumentException - When the given list of RPQs is empty.
    • label

      static RPQ label(Predicate label)
      Returns an RPQ representing a single labelled edge traversal.
      Parameters:
      label - The label of the traversed edge.
      Returns:
      The label traversal RPQ.
    • labels

      static RPQ labels(Predicate... labels)
      Returns an RPQ representing a chain of labelled edge traversals.
      Parameters:
      labels - The labels of the traversed edges.
      Returns:
      The label traversal RPQ.
    • labels

      static RPQ labels(List<Predicate> labels)
      Returns an RPQ representing a chain of labelled edge traversals.
      Parameters:
      labels - The labels of the traversed edges.
      Returns:
      The label traversal RPQ.
    • generatePlainRPQ

      static RPQ generatePlainRPQ(int ruleApplications, int labels) throws IllegalArgumentException
      Generates a random RPQ created by applying the disjunction, Kleene and concatenation steps from the RPQ grammar the given number of times. A set of labels of the given size is automatically generated together with corresponding inverse labels for each label. It is worth noting that concatenation will be generated at double the rate of the relatively more expensive Kleene and disjunction operations.
      Parameters:
      ruleApplications - The number of times the disjunction, Kleene, and concatenation steps are allowed to be applied.
      labels - The number of distinct labels to use (upper limit).
      Returns:
      The randomly generated RPQ.
      Throws:
      IllegalArgumentException - When the given number of labels is 0 or less.
      See Also:
    • parse

      static RPQ parse(String query) throws IllegalArgumentException
      Parses the given RPQ in string form to an RPQ instance. The input is assumed to use brackets where possible and to use the ''\u222a'', ''\u25e6'', ''*'' and ''\u207b'' symbols to denote operations. Example input: (0◦(((1◦0) ∪ (1◦1))◦1⁻)).
      Parameters:
      query - The RPQ to parse.
      Returns:
      The parsed RPQ.
      Throws:
      IllegalArgumentException - When the given string is not a valid RPQ.
      See Also:
    • parse

      static RPQ parse(QueryTree ast) throws IllegalArgumentException
      Attempts to parse the given AST to an RPQ.
      Parameters:
      ast - The AST to parse to a RPQ.
      Returns:
      The RPQ represented by the given AST.
      Throws:
      IllegalArgumentException - When the given AST does not represent a valid RPQ.
      See Also: