Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SfsApi

Class representing whole facet search API. It is the core class of this library.

Hierarchy

  • SfsApi

Index

Constructors

Properties

baseQuery: SelectQuery
endpointUrl: string
eventStream: EventStream

Sole event stream used in this library. Facets and API emit their events there and listen for other events.

facets: Facet<unknown>[]
fetcher: SparqlEndpointFetcher
isFetching: boolean = false

True if this class is currently fetching results.

language: string

Language used for filtering right labels for facets. Should be the same as used in baseQuery.

results: undefined | Results

Last fetched results;

searchPattern: string = ""
sparqlGenerator: SparqlGenerator

SPARQL Generator used to stringify {@link Query} structure to text query. prefixes passed to constructor of this class are used in this generator.

sparqlParser: SparqlParser

SPARQL Parser used for parsing text SPARQL queries to {@link Query} structure. prefixes passed to constructor of this class are passed used in this parser.

Methods

  • buildResultsQuery(): SelectQuery
  • fetchBindings(query: Query): Promise<ReadableStream>
  • Stringifies provided {@link query} and uses it to fetch bindings using fetcher.

    Parameters

    • query: Query

      used for fetching bindings

    Returns Promise<ReadableStream>

    promise of readable stream of fetched bindings

  • Builds results query from current state and fetches new results using it. Also streams events FETCH_RESULT_XXX to communicate its progress.

    Returns Promise<Results>

    Promise containing the Results

  • getAllConstraints(exceptFacetId?: string): undefined | Pattern[]
  • Used to get API and all active facet constraints. Optionally, all active facets except facet of provided facetId.

    Parameters

    • Optional exceptFacetId: string

      facet id of facet which should not be accounted in returned constraints.

    Returns undefined | Pattern[]

  • getBaseQuery(): SelectQuery
  • newSearch(searchPattern?: string): Promise<Results>
  • Initiates new search with provided searchPattern. Resets all facet states and returns new results via fetchResults.

    Parameters

    • searchPattern: string = ""

      ?_label variable in baseQuery has to contain this search pattern

    Returns Promise<Results>

    Promise containing the Results

Generated using TypeDoc