Skip to main content
. 2026 Sep 15;26(18):5846. doi: 10.3390/s26185846
Algorithm 1 RSP-QL Query Reuse Compatibility Check
  • Require: 

    Existing executing query Qe and candidate query Qc

  • Ensure: 

    Returns true only when the result stream of Qe can be reused for Qc

  •   1:

    procedure CanReuseQuery(Qe,Qc)

  •   2:

        Pe← ParseRSPQL (Qe)

  •   3:

        Pc← ParseRSPQL (Qc)

  •   4:

        if not SupportedQueryShape(Pe) or not SupportedQueryShape(Pc) then

  •   5:

              return false

  •   6:

        end if

  •   7:

        We← GetWindowDefinition(Pe)

  •   8:

        Wc← GetWindowDefinition(Pc)

  •   9:

        if We.stream≠Wc.stream then

  • 10:

              return false

  • 11:

        end if

  • 12:

        if We.range≠Wc.range or We.step≠Wc.step then

  • 13:

              return false

  • 14:

        end if

  • 15:

        if We.name≠Wc.name then

  • 16:

              return false

  • 17:

        end if

  • 18:

        Be← ExtractBasicGraphPattern(Pe)

  • 19:

        Bc← ExtractBasicGraphPattern(Pc)

  • 20:

        (matches,μ)← MatchGraphPatterns(Be, Bc)

  • 21:

        if not matches then

  • 22:

              return false

  • 23:

        end if

  • 24:

        if not SameResultSemantics(Pe,Pc,μ) then

  • 25:

              return false

  • 26:

        end if

  • 27:

        return true

  • 28:

    end procedure