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

    Function extractFromClauseGraphUris

    • Extracts the graph IRIs declared in FROM and FROM NAMED dataset clauses of a SPARQL query by walking the token stream produced by SparqlLexer.

      Dataset clauses appear at the top of every SPARQL query form and satisfy the grammar productions:

      DatasetClause ::= FROM ( DefaultGraphClause | NamedGraphClause ) DefaultGraphClause ::= SourceSelector NamedGraphClause ::= NAMED SourceSelector SourceSelector ::= iri

      The function:

      • Handles both FROM <iri> and FROM NAMED <iri> forms.
      • Strips the surrounding angle brackets from IRIREF tokens.
      • Deduplicates the returned list while preserving order of first occurrence.
      • Returns an empty array for undefined / empty input or when no clauses exist.

      Parameters

      • Optionalquery: string

        The raw SPARQL query text.

      Returns string[]

      An ordered, deduplicated array of graph IRI strings.