Improve this doc View source

FacetResultHandler
service in module seco.facetedSearch

Description

Service for retrieving SPARQL results based on facet selections.

Usage

new FacetResultHandler(endpointConfig, resultOptions);

Parameters

ParamTypeDetails
endpointConfigstring

The URL of the SPARQL endpoint, or a configuration object as taken by AdvancedSparqlService. See the angular-paging-sparql-service package.

resultOptionsObject

Configuration object. The object has the following properties:

  • queryTemplate - {string} - The result query with a <RESULT_SET> placeholder for the facet selections. The variable ?id should be used for the result resources. The query should not restrict the results in any way (outside of the facet selections), or the results will not reflect the facets. The best way to insure this is to wrap each result value in an OPTIONAL block. For example:
       SELECT * WHERE {
           <RESULT_SET>
           OPTIONAL {
               ?id rdfs:label ?name .
               FILTER(langMatches(lang(?name), "en"))
           }
       }
       
  • [prefixes] - {string} - Any prefixes used in the queryTemplate. Required if the query uses any other prefixes than rdf, rdfs, or skos.
  • [paging] - {boolean} - If truthy, results will be paged. Default is true.
  • [resultsPerPage] - {number} - The number of results per page. Default is 10.
  • [pagesPerQuery] - {number} - The number of pages to retrieve per query. Default is 1.
  • [mapper] - {Object} - Mapper service for the results. The default is objectMapperService. See the angular-paging-sparql-service package for more information.

Methods