This document describes the reconciliation service API, a protocol edited by the W3C Entity Reconciliation Community Group. It is intended as a comprehensive and definitive specification of this API in its given state. Various aspects of this API need to be improved, as hinted by notes throughout this document.
Members of the Community Group are encouraged to contribute to this document by documenting the current behaviour of the reconciliation API. The ReSpec Editor's Guide can be used to learn more about the markup to use in this document.
Integrating data from sources which do not share common unique identifiers often requires matching (or
Various mechanisms exist to state the equivalence between two URIs: for instance, such a correspondence can be stated with the owl:sameAs property [[owl-features]], or using looser notions equivalences defined in SKOS [[skos-primer]]. But such statements must in turn be themselves findable.
One can aggregate owl:sameAs statements from various sources to infer identities by transitivity, but this is a subtle art as some data sources can erroneously equate different concepts [[beek-2018]].
After all, any quest towards building a universal identifier system which avoids duplicates is necessarily doomed.
Data publishers use different granularities to model the world. Concepts have fluctuating boundaries across languages, cultures and time.
In practice, we can determine if two database records refer to the same entity by comparing their attributes. For instance, two entries about cities bearing the same name, in the same country and with the same mayor are likely to refer to the same city. The reconciliation API that we present here makes it easier to discover such matches. It is a protocol that a data provider can implement, enabling its consumers to efficiently match their own data to the entities represented by the provider.
By nature, reconciliation is a heuristic process. Different entities can have many identical characteristics, leading to false positives. The same entity can be represented in different ways by two databases, for instance by spelling names differently, leading to false negatives. This problem has been extensively studied and many heuristics have been proposed to tackle it [[christen-2012]]. The reconciliation API is agnostic about the particulars of the heuristics involved: it lets data providers choose how they want to determine which of their entities are good candidates for a particular query. What it provides is a web API to let users obtain these candidate entities without having to implement the underlying reconciliation heuristics themselves, nor download the entire contents of the target database.
This API was originally designed by Metaweb as a protocol used between Freebase and Gridworks (now known as OpenRefine).
Freebase was a free crowdsourced knowledge graph, storing data about a broad range of topics and exposed on the web as linked data.
OpenRefine is tool which was originally designed to help populate this knowledge graph by importing data into it.
It supports a range of operations which help the user reshape their data to prepare it for ingestion in a data model such as Freebase's.
One of these operations is
The reconciliation API was then turned into a generic protocol that any database could implement.
This made it possible to register such a database into OpenRefine by adding it as a
This API was documented on OpenRefine's wiki as a living document which evolved gradually, as OpenRefine improved. In addition to its core feature, fetching reconciliation candidates matching a given query, services are optionally able to implement additional endpoints which ease the integration of the service in OpenRefine's UI, by providing previews for entities (with a Preview Service) and auto-completion for various inputs (with Suggest Services). In 2018, a Data Extension Service was added, letting consumers pull data from the target database once they have reconciled their records.
In 2019 the W3C Entity Reconciliation Community Group was formed, with the intention of promoting and improving this API outside the strict scope of the OpenRefine project. This document is an attempt to better specify this API.
A list of known public endpoints is maintained by the community, where they can also be tried out interactively. OpenRefine's wiki also hosts a list of reconciliable data source which also includes non-hosted or discontinued services. Existing clients to the API, such as OpenRefine or Cocoda can be used to interact with reconciliation services.
This section summarizes the differences between successive versions of the API.
Initial documentation of the reconciliation API as supported by OpenRefine 3.0 to 3.2.
Initial improvements to the specifications made by our Community Group. Most of them are backwards-compatible, except for the requirement to support CORS for cross-origin access.
Collection of changes which make the API conform to the REST principles and follow the W3C's guidelines around accessibility, localization and security.
documentation, serviceVersion and logo fields to the manifesttype and remove the type_strict parameterscore field of reconciliation optionalidentifierSpace and schemaSpace and make view templates mandatoryquery field of reconciliation queries inside properties to allow for queries which do not provide entity namesstandardizedScore field to the manifestlimit parameter to suggest queries and rename cursor to offsetThis section documents the data model behind the reconciliation API. A reconciliation service lets users match their data against entities exposed by the service. Matching can be refined by filtering by type or properties with property values. The purpose of this section is to define these notions.
The following concepts are used and borrowed from JSON [[RFC8259]]:
{"name":"value"} pair in a JSON object.
Or more loosely, a "key" in JSON data. The typical convention when dealing with APIs or programmatic querying of
records is to use the term "fields" rather than "keys", so we have chosen to use that term in this specification
when speaking of objects to query/request or respond with.
true or false.
An entity is a record in the data source exposed by the service. It comprises the following fields:
idnamedescriptionimagetype
Reconciliation services MUST define in their service manifest a URI template for entities,
as defined by [[RFC6570]]. This URI template builds a view URI for each entity, and has id as only variable.
For each entity, expanding the template with id being set to the entity's identifier
MUST result in a valid URI.
For example, a service which uses Wikidata identifiers for its entities could use http://www.wikidata.org/entity/{id}
as URI template for entities. For an entity with identifier Q5, this would expand to http://www.wikidata.org/entity/Q5.
Services for which the entity's identifier is already a full URI can use the {+id} template, which disables the escaping of some characters
when inserting the identifier in the template.
See [[RFC6570]] for more examples of URI templates.
Similarly, it is possible to associate to each matching feature a URL where documentation about the feature is provided, by means of a URI template. Inserting any feature identifier in this template generates the URL for the feature.
A type represents a category of entities. It comprises the following fields:
idnamebroaderA property represents a type of attribute that entities can have in the data source. It comprises the following fields:
idnameA property value can be any of the following:
This section documents how reconciliation services are exposed as HTTP(S) services and how they can announce the features of the API they implement.
The endpoint of a reconciliation service is a URL from which the reconciliation service is offered.
When the reconciliation service endpoint is queried with a HTTP GET query without parameters, the service manifest MUST be returned.
A service manifest consists of the following {{fields}}:
versions["0.1", "0.2", "1.0-draft"]. Since this field did not exist in version 0.1, services which do not declare a versions field are expected to only support version 0.1.namedefaultTypesdocumentationlogoserviceVersionversions which is about the versions of the reconciliation API supported by the service;viewfeatureViewpreviewsuggestextendbatchSizeauthenticationlangdirstandardizedScorescore field of reconciliation candidates. This enables clients to process and display candidates accordingly, e.g. with score percentages or visualizations.For instance, a service could expose the following minimal service manifest:
A more complete example, with some optional services implemented:
We give here an overview of the routes that reconciliation services MUST and MAY implement. They are all relative to the root endpoint, which we assume here to be /.
//match/suggest/entity/suggest/property/suggest/type/preview/extend/extend/proposeIn the interest of protecting the data sent as reconciliation queries, all endpoints of reconciliation services SHOULD be available over HTTPS [[RFC7230]] [[SECURING-WEB]]. This does not apply to locally hosted services.
All HTTP(S) endpoints exposed by the service MUST enable access by CORS [[cors]] to enable web-based clients to access the service from a different domain without exposing themselves to untrusted third-party code.
Some clients might only require cross-origin access on some particular endpoints, which are called directly by a web UI. Since this depends on the architecture of the client, this cannot be relied upon and cross-origin access MUST be implemented for all endpoints in a uniform way.
Services SHOULD use the broad spectrum of HTTP status codes [[RFC2616]] [[RFC6585]] to expose errors, for instance due to malformed or too frequent queries.
The response body of such error responses is not specified so far.
Services MAY request users to provide an authentication token when making queries. They can do so by adding a security scheme to their manifest. Security schemes are defined in [[OPENAPIS]] and support authentication by API key, HTTP Authentication [[RFC7617]], OAuth 2 [[RFC6749]] and OpenID Connect.
For instance, the following security scheme indicates that basic HTTP authentication is required on this endpoint:
Requiring an API key passed as a query parameter can be expressed as follows:
If a security scheme is provided in the service manifest, all queries to the service MUST provide the corresponding credentials, except for retrieving the service manifest itself. When invalid authentication is supplied in any HTTP request, the service MUST return an HTTP 401 error.
This section specifies how clients can send reconciliation queries to the match service and how the match service responds to them.
A reconciliation query consists of the following fields.
conditionstypelimitA condition specifies a constraint that should be matched by the entities to return. It is used to filter the set of candidates (similar to a WHERE clause in SQL), by allowing clients to specify an attribute of entities that should match. It consists of:
matchTypename or property, depending on whether the condition relates to entity names or their properties.propertyIdmatchType is property) a property identifier.propertyValuematchType is name, then this value is to
be matched to entity names, otherwise to the property values via the supplied propertyId. The specifics of how this similarity
is defined are determined by the service.requiredfalse;matchQuantifierpropertyValue to match. MUST be any (equivalent to boolean OR), all (equivalent to boolean AND), or none (equivalent to boolean NOT). If omitted, the service SHOULD assume the requested value to be any;matchQualifierpropertyValue.
This can be used for general matching relations like "skos:exactMatch", "skos:closeMatch", etc. or for specific features like spatial matching with geo data
(e.g. containment search with "schema:containsPlace" etc.) or custom matching on date fields (e.g. services supporting the [[EDTF]] specification could use "EDTF:Level-0" etc.
To allow discovery of supported qualifiers by clients, services that support matchQualifier MUST return the supported matchQualifiers for each property
in their property suggest responses. If omitted, the matching behavior is up to the service.A reconciliation query batch is an array of reconciliation queries.
Minimal example of a reconciliation query batch with mandatory fields only:
Full example of a reconciliation query batch with all optional fields:
For a single property it is possible to provide multiple values as an array. The values provided do not need to have the same type. In the following example a string and a reconciled value are provided as values for the same property.
A JSON schema to validate the serialization of a query batch is available.
A reconciliation candidate represents an entity as a response to a reconciliation query. It is proposed to the client as a potential matching entity for this query. It contains the following fields:
idnamedescriptiontypescorestandardizedScore is set to true in the service manifest, this value MUST be between 0 and 100 (inclusive);
featuresmatch
To propose multi-lingual candidates to the client, the reconciliation service MAY return multiple candidates with identical id, but different names, text processing languages or text directions.
The client MAY render these candidates as a single entity, but SHOULD include details from all candidates, so users can comprehend why the entity is being proposed.
A matching feature is a numerical or boolean value which can be used to determine how likely it is for the candidate to be the correct entity. It contains the following fields:
id"name_tfidf" or "pagerank". This id must be unique among all the matching features returned for a given candidate;namevaluescore field). By exposing individual features in their responses, services make it possible for clients
to compute matching scores which fit their use cases better.
Example of a reconciliation candidate with all possible fields:
A reconciliation result is a set of reconciliation candidates. It is serialized in JSON
as an object containing in the field candidates an array of such reconciliation candidate objects.
A reconciliation result batch is an array of reconciliation results given in the same order as in the corresponding reconciliation query batch.
When serialized in JSON, it is wrapped in an object under the results field.
Full example of a reconciliation result batch:
A JSON schema to validate the serialization of a reconciliation result batch is available.
The match service translates reconciliation query batches to reconciliation result batches over HTTP.
The match service MUST support HTTP POST requests at the route /match (relative to its endpoint) with
application/json bodies containing a
reconciliation query batch.
POST /match <reconciliation query batch>
The match service returns the corresponding query batch serialized in JSON.
The way candidates are retrieved from the underlying database and scored against the query is left
entirely at the discretion of the service.
However services should retrieve and score the candidates of each query in a batch independently
of the other queries in the same batch, or in previous ones.
It is also expected that reconciliation queries where query matches exactly the name
of an entity in the database and with no other constraint should return at least this entity, unless
it is hidden by many namesakes. Similarly, supplying an entity identifier as query
should return the corresponding entity as a candidate, with a high score.
Deciding on a scoring method is one of the main difficulties in developing a reconciliation service. Depending on the use case, we might not want a score at all: in cases like geo containment (a place should be inside a specific area) or date ranges (a point in time should be inside a specific time range) the score is irrelevant, as candidates are either in or out. Thus the score attribute is optional. Services are encouraged to expose as many matching features as they deem useful, in particular features which require knowledge of global statistics on the database or other attributes. Examples include:
Many open source reconciliation services are available and these might provide some inspiration concerning indexing and scoring methods when developing new services. See External Resources for some examples.
This section specifies how reconciliation services can provide embeddable HTML previews of their entities, which clients can display in their user interface.
Reconciliation services MAY offer a preview service by providing the preview metadata as an object stored in the service manifest under the key preview. It consists of the following fields, all mandatory:
widthheightFor instance, a service may expose the following preview metadata:
A preview service is queried by resolving the URI template /preview?id={id} relative to the reconciliation endpoint, where id is subsituted by the entity identifier. The URL must resolve to an HTML document,
which MUST be viewable in an HTML viewport whose dimensions are determined by the preview metadata.
For instance, assuming that the reconciliation API is running at /api and serves the example preview metadata above, the service could respond to a preview request as follows:
This section specifies how reconciliation services can provide auto-complete endpoints for their entities, properties and types. A reconciliation service can offer a suggest service for any of these three classes. For instance, a service which only exposes a single type might not want to expose a suggest service for types. These suggest services can be used by clients to let users select an entity, property or type manually, at various stages of their reconciliation workflows.
Suggest services for entities, properties and types are declared independently in the suggest field of the service manifest, using the following fields:
entitypropertytypeWhen supported, the suggest endpoints are located at the following URIs, relative to the service's root endpoint:
/suggest/entity/suggest/property/suggest/typeA suggest service MUST accept GET queries with the following URL-encoded parameters:
prefixlimitoffset
GET /suggest/entity?prefix=cumulo&limit=3
A response to a suggest query consists of the following fields:
resultidnamedescriptionname;imagename and description;notableid and name field which represent the type.matchQualifiersid and name field, which represent the property's matchQualifiers supported in reconciliation queries.
The key notable comes from a notion of notable types that existed in Freebase.
For instance, a suggest service for entities could return the following response:
A suggest service for properties could return the following response:
And a suggest service for types could return the following response:
JSON schemas to validate suggest responses are available for entities, for properties and for types.
It is generally expected by users that an entity suggest query where prefix is the name of an entity SHOULD return this entity in the suggest response, unless that entity is hidden behind many other namesakes.
Similarly, supplying an entity identifier as prefix MUST return this entity in the suggest response.
Analogous expectations apply for property and type suggest services.
As the prefix name suggests, suggest services are expected to perform prefix search on their database of records, such that a suggest service can be used to provide auto-completion as users type names or identifiers in a field.
This section specifies how reconciliation services can let clients fetch the values of some properties on a selection of entities.
A data extension service MUST support data extension query requests.
A data extension service SHOULD provide data extension property proposals.
A data extension service MAY support data extension property settings.
The data extension metadata is an object stored in the service manifest in the extend field. It consists of the following settings:
proposePropertiespropertySettingsA data extension property setting consists of:
idnametype"number", "text", "checkbox", or "select". This determines which type of value the property setting is expected to store: clients SHOULD render this setting with the corresponding HTML element;
defaulttype, required) a default value for the setting, when not provided or left untouched by the user;helpTextchoicestype is select) the property setting choices.Example of data extension metadata with all optional fields:
A data extension property proposal service returns properties for a given type identifier.
If the reconciliation service supports data extension property proposals, it MUST support HTTP GET requests to the endpoint /extend/propose (relative to the reconciliation endpoint) with a type query parameter
containing a type identifier.
The service SHOULD support an optional limit query parameter to control the number of proposed properties.
GET /extend/propose?type=<type identifier>[&limit=<limit>]
A data extension property proposal response consists of:
propertiestypelimitExample of a data extension property proposal response:
A data extension query request lets clients fetch the values of some properties on a selection of entities.
The fact that a reconciliation service offers data extension MUST be announced by including a data extension metadata in the extend field of the service manifest.
A data extension service MUST support HTTP POST requests at /extend (relative to the reconciliation endpoint) with
application/json bodies containing a data extension query.
POST /extend <data extension query>
A data extension query consists of:
idspropertiesExample of a data extension query:
A data extension response consists of metadata and rows:
metarowsmeta section the endpoint of another reconciliation service for which the entity identifiers are valid, i.e., inserting them into the entity view template of that other service yields valid URIs.
This endpoint is specified on a column-per-column basis.Response example for the data extension query from the previous example:
The following sections rely on terminology from the W3C internationalization best practices for spec developers, in particular on the distinction of two types of language declaration:
The language of the intended audience, also referred to as language metadata, is used to describe the language(s) of the intended audience of resources as a whole. In the context of reconciliation, this is relevant e.g. for setting the user interface language in a reconciliation client, providing user-facing text in the user's preferred language.
The text-processing language on the other hand declares the single language in which a specific range of text is actually written in, to support features like text-to-speech, spell checking, or hyphenation. In the context of reconciliation, this distinction is importat since the actual data being reconciled will often be in a different language than the client's user interface.
Following [[RFC9110]], services SHOULD support the Accept-Language header to let clients specify the language of the intended audience in which user-facing text is returned.
If clients set the Accept-Language header, the requested language(s) MUST be provided as well-formed [[BCP 47]] language tags.
Services MAY use the Content-Language header in their responses to expose the language(s) of the intended audience(s) of each response.
If services set the Content-Language header, they MUST use valid (i.e. found in the [[IANA Language Subtag Registry]]) [[BCP 47]] tags.
Examples of user-facing text in service responses are: the name of the service and the name of property configuration fields in the manifest, the name and description of entities, types and properties, the contents of the entity preview pages, and the documentation linked in the manifest.
All objects used in this protocol (entities, types, properties, queries, candidates, features, etc.) MAY declare an explicit text-processing language in a lang field.
The lang value MUST be a single valid (i.e. found in the [[IANA Language Subtag Registry]]) [[BCP 47]] language tag. This text-processing language applies to the natural language fields of the object: name, description,
query (for reconciliation queries), propertyValue and str (for property values), helpText (for data extension property settings). Nested objects inherit the text-processing language of their parent, and can override it by setting their own lang value
(see example below). A default text-processing language for any natural language string returned or processed by a service MAY be set in the lang field of the service manifest.
Client and service implementors SHOULD consider the text-processing language to ensure correct processing of natural language content.
In the following example, we first set the text-processing language for a reconciliation query to en, which is inherited by the first property, and overridden in the second property with zh-Hant:
All objects returned by reconciliation services (entities, types, properties, candidates, features, etc.) MAY declare an explicit text
base direction in a dir field. The dir value MUST be ltr for left-to-right, rtl for right-to-left, or auto for determining the direction by examining the content of each JSON field.
This base direction applies to the natural language fields of the object: name and description (for candidates etc.), propertyValue and str (for property values), helpText (for data extension property settings).
Nested objects inherit the base direction of their parent, and can override it by setting their own dir value. A default base direction for any natural language string returned or processed by a service MAY be set in the dir field of the
service manifest. If no explicit base direction is given, left-to-right is considered the default base direction. Clients SHOULD consider the base direction to ensure correct rendering of content, e.g. by setting corresponding dir attributes when rendering JSON responses in HTML.
For instance, rendering a Persian label for 'Yahoo!' like یاهو! right-to-left will correctly display as یاهو!.
In the following example, we first set the base direction for a data extension response row to ltr, which is inherited by the first property, and overridden in the second property with rtl:
Reconciliation clients provide user interfaces for creating reconciliation queries and reviewing reconciliation candidates, including preview and suggest services, as well as for interacting with data extension services, including property proposals and configuration of property settings. These user interfaces SHOULD be implemented ensuring [[accessibility]] for all people, whatever their hardware, software, language, location, or ability.
The preview service provides HTML content to reconciliation clients. Using HTML allows services to provide non-text alternatives for text content, as well as semantically rich content (structure, styled text, hyperlinks, etc). Reconciliation services SHOULD ensure [[accessibility]] of this HTML content (avoid fixed font sizes, provide alternative text for images etc). The service's preview metadata contains the suggested width and height to display the preview content. Reconciliation clients SHOULD consider adjusting these values as required for supporting accessibility features like UI scaling.
Except for the preview content and size, all data involved in the reconciliation and data extension process is text-based and contains no specifics about visual rendering. Reconciliation clients SHOULD ensure [[accessibility]] for this text content (font resizing, screen reader support etc.) based on the technology of the underlying platform, which will typically implement the details of visual text rendering and user interface customization.
The main content presented to users is provided in reconciliation results and data extension responses. Both support name fields for all identifiable objects, in particular
entities, types, properties, and matching features. These SHOULD be used by reconciliation clients to provide useful labels for displaying and linking identifiable entities.
The structural semantics of the content provided by reconciliation services allows different presentations (as pages, tables, etc.) in reconciliation clients. Being fully text- and JSON-based, content can
be modified by third-party tools to enhance accessibility.
eval(), since requests could contain malicious code.This appendix provides JSON schemas [[json-schema]] which can be used to validate the JSON serialization of various elements as specified by these specifications.
The manifest schema can be used to validate a service manifest.
The reconciliation query batch schema can be used to validate the JSON serialization of any reconciliation query batch, i.e. the payload of a GET/POST to the reconciliation endpoint.
The reconciliation result batch schema can be used to validate the JSON serialization of any reconciliation result batch.
The suggest entities response schema can be used to validate the JSON serialization of any suggest response for entities.
The suggest properties response schema can be used to validate the JSON serialization of any suggest response for properties.
The suggest types response schema can be used to validate the JSON serialization of any suggest response for types.
The data extension query schema validates data extension property proposal responses.
The data extension query schema validates data extension queries.
The data extension response schema validates data extension responses.