The Open Data Service provides a search interface over various types of entities in the triple store. Behind the scenes, search is provided by an ElasticSearch instance.
The search service only indexes certain classes of thing. These are:
The identifier in brackets can be used to filter results.
The indexes are built from SPARQL queries whose results are converted to JSON. We’ve made some judgement calls on what should and shouldn’t be indexed, and whether any of those fields should be weighted. If you need something added — either to an existing index, or a completely new index — contact us to request a change.
The simple search endpoint is at https://data.ox.ac.uk/search/, and implements the OpenSearch specification.
It minimally takes a q parameter, for providing a query in the Lucene query syntax. The query syntax is rather expressive, so it’s well worth familiarising yourself with it.
Pagination is handled using the page and page_size parameters.
The endpoint supports HTML, OpenSearch Atom, JSON and JSONP serializations. You can express a preference using content negotiation, or a format query parameter. The format identifiers are html, atom, json, and js, respectively.
By default, the endpoint will search for the conjunction of all search terms, so a search for ‘Keble College’ will not return things that only mention ‘Keble’ and not ‘College’. To change this behaviour, you can specifify a default_operator=or parameter.
You can restrict results to a particular type of thing using the type parameter. For example, https://data.ox.ac.uk/search/?q=computing&type=vacancy will search for computing vacancies.
Additional filtering can be achieved using prefixed query parameters. These take the form <filter name>.<field name>=<value>. Here are the current options:
Filter name | Meaning | Example |
---|---|---|
filter | Term match (i.e., not exact match) | filter.offeredBy.uri=http://oxpoints.oucs.ox.ac.uk/id/53505808 (courses and presentations offered by ITLP) |
not | Inverse term match | not.type.uri=oxp:Room (things that don’t have an rdf:type of room) |
lt | Less than (dates, numeric values) | lt.start.time=2013-08-09 (things that started before the 9th of August 2013) |
gt | Greater than | gt.salary.lower=40000 (vacancies with salaries of at least £40k) |
lte | Less than or equal to | |
gte | Greater than or equal to |
Filters with the same key are OR‘d, so you can use e.g. filter.label=keble&filter.label=merton to find things that mention either term in their label. Otherwise, the all filters are cumulative.
Here are some examples:
The Open Data Service exposes the raw ElasticSearch query endpoint for stores, linked from https://backstage.data.ox.ac.uk/stores/. This endpoint allows you to query using a very expressive JSON-based DSL, and returns results as JSON.
You can read more about the query language in the ElasticSearch documentation.