Knowledge graphs

Updated at:

Knowledge graph is a concept proposed by Google in 2012. From the academic perspective, a knowledge graph is essentially a knowledge base of a semantic network. This is an abstract and theoretical definition. In a more practical and simple view, a knowledge graph can be considered as a multi-relational graph.

You can extract knowledge after data cleansing, and store the knowledge in Graph Database (GDB) for subsequent queries. A search engine presents you only the pages that are related to your desired search results. You must find the answer from those pages. However, a knowledge graph can directly tell you the answer. For example, a knowledge graph can directly tell you who are the siblings of the husband of Elia Targaryen from House Targaryen in Game of Thrones.

Use cases

Assume that you have extracted the information and relationships of the characters in Game of Thrones. House Targaryen is used in the following example:

Example application

Alibaba Cloud Graph Database (GDB) supports property graphs. In a property graph, the basic storage elements are vertices, edges, and properties. Each vertex or edge has a label to represent its type. In a knowledge graph trituple, the subject and object are stored as vertices, and the predicate is stored as an edge.

Examples

Assume that you have extracted the relationships of the characters in Game of Thrones and have written the data of the relationships to GDB.

What are the names of Rhaegar's siblings?

g.V().has("name", "Rhaegar").out("siblings").values("name")
  • g.V().has("name", "Rhaegar"): Finds the vertex named "Rhaegar" in GDB.

  • out("siblings").values("name"): Finds the destination vertices of all outgoing edges that are labeled "siblings" from the "Rhaegar" vertex and returns their names.

Query the name of the father of Elia's husband

g.V().has("name", "Elia").in("wife").in("children").values("name")
  • g.V().has("name", "Elia").in("wife"): Finds Elia's husband, Rhaegar.

  • in("children").values("name"): Finds Rhaegar's parents.