DEVSTORY #12: Using function as a service (faas) to retrieve data from a knowledge graph

A counterparty knowledge graph, implemented using a graph database – Neo4j, contains a graph covering all aspects of the organizational information required by a trading counterparty to facilitate transactions. A small subset of the information would include

  • organization structure ( organization, subsidiaries),
  • roles (settlements, accounting)
  • people at the organization who need to be contacted in case communications need to be sent

A trading firm stores its reference information in the Counterparty Knowledge Graph (CKG). Settlement contacts are one category of information of interest and queryable from the Counterparty Knowledge Graph (CKG). To expose the list of contacts related to the settlements role, for a particular commodity at the trading firm, there is a need to provide an endpoint that is manually or programmatically queryable.

The solution to this problem was a serverless function implemented OpenFAAS running on a bare metal Kubernetes cluster.

Using the command line interface (cli) a function was created using a python3-debian template. Using the neo4j python client and the Cypher query language the function queries the knowledge graph previous populated in the neo4j database as detailed in a separate DevStory. The function, deployed to a Kubernetes cluster, is exposed as an endpoint behind an NGINX reverse proxy.

Clients manually or programmatically using a HTTP GET can call the function with three parameters

  • the counterparty for which contacts are sought
  • the commodity
  • the role

The HTTP GET request is incident on the function which queries the neo4j graph database using Cypher and returns a list of contacts that match the query.

This provides a low code option to query the Counterparty Knowledge Graph (CKG).

Using this strategy additional useful queries can be implemented and deployed quickly around the Counterparty Knowledge Graph (CKG) as content in the graph grows.