Adding Custom Search Engines to Firefox: Virtuoso's SPARQL Query and Faceted Browsing Services

In this post, I will cover the creation of Custom Search Services for Firefox using both Virtuoso’s SPARQL Query and Faceted Browsing Services.

Why is this important?

Firefox’s basic Web Search functionality is limited to typical web-indexing search engines, which are based primarily on keyword occurrences. More focused searches would save users time, effort, and, ultimately, money.

How is it done?

Built-in Open Search API Compliant Service Approach

Open Search API compliant services support the following text-search pattern:
https://dbpedia.org/fct/facet.vsp?q={search-keyword-or-phrase}

Using DBpedia as the custom search service example, installation boils down to the following steps:

  1. Place the URL https://dbpedia.org/fct/facet.vsp?q=China in your browser’s address bar
  2. Click on the Search input field (situated just after the address bar, when visible)
  3. Select the newly discovered DBpedia Custom Search Engine

The steps above are illustrated in the screenshot that follows.

Custom Search Browser Extension Approach

Simply perform the following few steps:

  1. Install the Custom Search Browser Extension
  2. Configure a Template URL
  3. Test

Faceted Search Service Example

https://dbpedia.org/fct/facet.vsp?q=China

Live Link to Search Results Page

In each case (Basic SPARQL Query and Faceted Search Query), you can replace the “China” text pattern with “%s”, the Custom Search Marker used by the Mozilla Custom Search Browser Extension, to get the following templates for use with your Custom Search Services.

Faceted Search Template for Custom Search Engine

https://dbpedia.org/fct/facet.vsp?q=%s

Usage Example – Faceted Search Service based Custom Search Engine

Using SPARQL

You can also create a Custom Search Engine using SPARQL Queries, courtesy of the SPARQL Protocol and its URL-patterns.

Here’s a basic Virtuoso Full-Text SPARQL Query Example that can be used to create a Custom Search Engine.

SELECT DISTINCT  * 
WHERE
  {
    ?s  rdfs:label    ?o      . 
    ?o  bif:contains  'China'
  }

Live Link to Query Results Page.

Custom Search Engine using Basic SPARQL Full-Text Query Template

https://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=select+distinct+*+where+%7B%3Fs+rdfs%3Alabel+%3Fo.+%3Fo+bif%3Acontains+%27%s%27%7D&format=text%2Fhtml&timeout=30000&signal_void=on&signal_unconnected=on

Custom Basic SPARQL Query Usage Example

Complementary Tools and Services

The OpenLink Structured Data Sniffer (OSDS) Browser Extension provides an easy way to deconstruct URLs that can ultimately serve as query templates.

You can use any Virtuoso Query Service Endpoint to create Custom Search Services using SPARQL Queries or Faceted Browsing Search Patterns.

Related