@faubulous/mentor-rdf-parsers
    Preparing search index...

    Class SparqlVariableParser

    Helper class for extracting variables from SPARQL query CST nodes.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Extracts the result variables from a SELECT query in the order they are defined.

      Handles:

      • Simple variable projections: SELECT ?x ?y
      • Projections with AS: SELECT (?x AS ?y)
      • Aggregates with AS: SELECT (COUNT(?x) AS ?count)
      • SELECT *: returns all variables from the WHERE clause in order of first appearance

      Parameters

      • cst: CstNode

        The concrete syntax tree from parsing a SPARQL query

      Returns string[]

      An array of variable names (without the ? or $ prefix) in projection order

      Error if the query is not a SELECT query