What is a knowledge graph?
Appendix A.3 "Knowledge Graphs": 2012 Onwards of the survey Knowledge Graphs (which is probably the most extensive survey on KGs) states that knowledge graphs have been defined in different ways in recent years. Each of these definitions raises questions about the relationship between KGs and other related concepts, like graph databases, knowledge bases, and ontologies.
One definition of a KG is
a graph where nodes represent entities, and edges represent relationships between those entities. Often a directed edge labelled graph is assumed (or analogously, a set of binary relations, or a set of triples)
The question here is: what's the difference between KGs and graph databases (like Neo4j)? Graph databases have been used to build KGs, but is there any actual difference between these 2 terms?
Another definition of a KG is
a knowledge graph is a graph-structured knowledge base
So, according to this definition, a KG would be a type of knowledge base (KB).
What is a knowledge base?
In the same appendix, the authors write
The phrase "knowledge base" was popularised in the 70's (possibly earlier) in the context of rule-based expert systems [72], and later were used in the context of ontologies and other logical formalisms [68]
They conclude that a KB has also been defined in ambiguous ways in the past.
Norvig and Russell, in chapter 7 (p. 235) of their AIMA book (3rd edition), define a KB as a set of sentences/facts, for example, expressed in propositional logic. You then use inference techniques to derive new knowledge from this knowledge base. The programming language PROLOG is based on this definition of a KB.
What is the difference between a KG and KB?
So, there is not a single answer to your question because knowledge graphs (KGs) and knowledge bases (KBs) have been defined in multiple (often ambiguous) ways in the past. Some people say that KGs are different from KBs, while other people use the term KG as a synonym for KB or define it as a type of KB.
One possible answer
However, if we define a KG as a graph with nodes that represent entities (like city and country) and edges that represent the relations between those entities (which is a common definition of a KG), we can view a KG as a visual representation of a KB, defined as a set of sentences/facts (for example, expressed in propositional logic). To see why this is the case, consider the following simple KG.
Let's denote this KG by $K = \{E, R\}$, where $E = \{ \text{Santiago}, \text{Chile}, \text{Perú}\} = \{ S, C, P\}$ is the set of entities (with a property) and $R = \{ \text{capital}, \text{borders}\} = \{ c, b \}$ is the set of relations. In $K$, we have the following relations
- Santiago is the capital of Chile: $(S, c, C)$
- Chile borders Perú: $(C, b, P)$
- Perú borders Chile: $(P, b, C)$
which can be put into a set of facts $F = \{(S, c, C), (C, b, P), (P, b, C) \}$, which is the KB associated with this specific KG.
In the context of KGs, we also have a task/problem similar to the inference (or knowledge reasoning) one in the context of KBs, which is known graph completion, which can be divided into other subtasks, like entity prediction, relation prediction and triple classification, which use knowledge graph embeddings.
Further reading
You should really read Appendix A and successive appendices of the mentioned survey to get more information about the issues concerning the history and definition of knowledge graphs and knowledge bases, and other related concepts, like schemas. You can also read chapter 7 (p. 235) of the AIMA book, 3rd edition to know more about knowledge bases.