Knowledge graphs: identities, claims and evidence
知识图谱
Build a graph that preserves evidence and explains why a missing edge need not be false.
knowledge-graphsTwo people can have the same name
Imagine merging two laboratory directories. Both contain a person named Lin. One works at a laboratory in Harbor; the other works in Ridge. Merging by name creates a person with two jobs. Keeping separate identifiers avoids that mistake, but now we must explain which record supports each claim.
A knowledge graph represents entities and their relationships in a graph intended to convey knowledge. There is no universally agreed definition: Hogan and colleagues use an inclusive definition covering several graph data models. A knowledge graph need not be an RDF database, and storing a statement does not make it correct. Definition, PDF 2
Three questions belong together: What does a node identify? What does an edge assert? Why should a reader trust that assertion? A visually attractive network answers none of them by itself. Our small example keeps identifiers, display labels and source records separate. It then follows a two-edge path without turning that path into an unsupported claim about where a person lives.
Facts and their witnesses are different objects
For this example, let V be entity identifiers and R relation labels. We use a finite directed, edge-labeled graph:
A triple gives a subject, relation and object. Direction matters: a person working at a laboratory does not imply that the laboratory works at the person. More general data models also carry values, types and attributes. RDF, for example, distinguishes IRIs, blank nodes and literals, with different permitted triple positions. §3.1
An edge set cannot preserve two independent records of the same statement by storing the edge twice. Sets discard duplicates. Let S contain source identifiers, and represent supporting assertions separately:
This is our application’s evidence convention, not a complete provenance standard. Two sources may copy each other; counting them does not measure statistical independence or truth probability. A production record should also identify the source version, extraction process and relevant time. A current employment record and an old one may disagree because they describe different dates.
Suppose we ask which cities contain the laboratories where x works. Let W mean worksAt and L mean locatedIn. The query is a join through a shared laboratory identifier:
The variable y is a witness, not a word-matching trick. If two laboratories share a display label but have different identifiers, the join keeps them apart. The following set records every witness and source pair for the answer:
Here Q_y means that both displayed edges exist for that particular y. This expression records possible evidence paths; it does not multiply confidence scores. Two source choices for the first edge and one for the second produce two evidence paths to the same city.
There is still no livesIn edge. Under an open-world interpretation, absence need not mean false. A closed-world application may treat a specified table as complete, but that assumption must be declared. Hogan and colleagues distinguish these choices and locally closed portions of a graph. PDF 13 and 25 Our application optionally stores a separate set N of explicit negative assertions and reports:
These are database evidence states, not a proof that every source is truthful. The code raises an error for conflict. An RDF graph’s formal entailments instead depend on an interpretation and an entailment regime: every model of the premises must satisfy the conclusion. Merely finding a graph path is insufficient. §1.7
Keep the evidence when joining
Run this complete program with Python 3.12; it uses only the standard library. All names, identifiers and directory records are authored teaching data. The code treats strings as application identifiers and does not implement RDF parsing, identity inference or a general rule language.
"""Original finite graph/provenance example; Python 3.12 standard library.
Application identifiers and explicit negative assertions, not an RDF reasoner.
"""
import json
def ingest(rows):
evidence = {}
for s, p, o, source in rows:
if not all(isinstance(x, str) and x for x in (s, p, o, source)):
raise ValueError("Nonempty identifiers and source required")
evidence.setdefault((s, p, o), set()).add(source)
return {fact: frozenset(sources) for fact, sources in evidence.items()}
def answer(evidence, fact, negatives=frozenset()):
if fact in evidence and fact in negatives:
raise ValueError("Conflicting positive and negative assertions")
return "supported" if fact in evidence else "refuted" if fact in negatives else "unknown"
def path_answers(evidence, start, first, second):
"""Join two observed edges; retain each witness and source combination."""
index = {}
for s, p, o in evidence:
index.setdefault((s, p), []).append(o)
result = []
for middle in sorted(index.get((start, first), [])):
for end in sorted(index.get((middle, second), [])):
a, b = (start, first, middle), (middle, second, end)
for source_a in sorted(evidence[a]):
for source_b in sorted(evidence[b]):
result.append(dict(end=end, via=middle, sources=[source_a, source_b]))
return result
def demo():
rows = [("person:1", "worksAt", "lab:1", "roster-A"),
("person:1", "worksAt", "lab:1", "roster-B"),
("person:1", "worksAt", "lab:1", "roster-A"),
("lab:1", "locatedIn", "city:1", "directory"),
("person:2", "worksAt", "lab:2", "roster-C"),
("lab:2", "locatedIn", "city:2", "directory")]
labels = {"person:1": "Lin", "person:2": "Lin"}
evidence = ingest(rows)
missing = ("person:1", "livesIn", "city:1")
return dict(input_rows=len(rows), distinct_facts=len(evidence),
distinct_assertions=sum(map(len, evidence.values())),
same_label_ids=sorted(k for k, v in labels.items() if v == "Lin"),
paths=path_answers(evidence, "person:1", "worksAt", "locatedIn"),
residence=answer(evidence, missing),
explicit_negative=answer(evidence, missing, {missing}))
if __name__ == "__main__":
print(json.dumps(demo(), indent=2))
The six input rows become four distinct facts and five distinct source assertions. Repeating the same fact-source pair adds nothing. The two records about person:1’s job remain available, so the path query returns two source combinations ending at city:1. Both people display as Lin, but person:2 contributes no edge to person:1’s path. The residence query returns unknown; adding an explicit negative changes the evidence state to refuted.
Hash-based ingestion takes expected O(n) time and O(a) space for n input rows and a distinct assertions. The query first indexes m facts in O(m) expected time. Following the matching edges costs their traversal work plus emitted evidence combinations; sorting visited neighbors and source sets adds comparison-sorting cost. If each of two edges has s sources, a single witness can emit s² pairs. An evidence-preserving result can therefore be much larger than a city-only answer.
A graph is an organized claim about a domain
Identifiers require governance. Two different IDs can refer to the same real entity, while equal-looking labels can refer to different ones. Our code deliberately performs no entity merging. Entity linking addresses mentions and candidate identities; it does not remove the need to review a merge.
Relation meanings also matter. A worksAt–locatedIn path answers a question about a workplace location. Inferring residence needs another premise or an explicitly defeasible prediction. A model in knowledge graph completion may rank that prediction highly, but a learned score is not a logical entailment. Source reliability, conflicting records, temporal scope and missing coverage must remain visible.
Which claim has actually been established?
- May two people named Lin share one identifier automatically? Answer: No. A label match is evidence for investigation, not sufficient identity evidence. Merging can incorrectly combine jobs and locations.
- The first edge has two sources and the second has three. How many source pairs does one path emit? Answer: Six. Each first-edge source pairs with each second-edge source. They still support one path answer, not six independent facts.
- There is no livesIn edge. What does an open-world reading conclude? Answer: Unknown, unless other premises entail a result. Absence alone does not establish a negative assertion.
- A laboratory moves. What should an integration system preserve? Answer: Source versions and relevant dates, rather than silently treating both locations as current or deleting historical evidence. The small atemporal program would need an extended record model.
Data, deduction and prediction
Hogan’s survey connects graph models, schema, identity, deduction and extraction; this article uses only the recorded introductory and semantic sections. RDF Concepts supplies a more precise standard for one family of graph terms and entailments. Our evidence-pair join is original. To extend it, attach dates to both edges and decide whether the time intervals overlap before emitting a witness. The next article, RDF and SPARQL, examines a standardized data model and query patterns in more detail.
Make a prediction, then check
A person works at a laboratory in a city. Does this establish that they live there?
Learning objectives
- Separate identifiers, labels, claims and supporting records; retain witnesses through a graph join.
- Distinguish missing, refuted and conflicting claims, and explain why a workplace path does not establish residence.
Prerequisites & connections
Explore related knowledge →References
- Knowledge Graphs — arXiv v6
Aidan Hogan; Eva Blomqvist; Michael Cochez; Claudia d’Amato; Gerard de Melo; Claudio Gutierrez; José Emilio Labra Gayo; Sabrina Kirrane; Sebastian Neumaier; Axel Polleres; Roberto Navigli; Axel-Cyrille Ngonga Ngomo; Sabbir M. Rashid; Anisa Rula; Lukas Schmelzeisen; Juan Sequeda; Steffen Staab; Antoine Zimmermann · 2021 - RDF 1.1 Concepts and Abstract Syntax — 25 February 2014
W3C RDF Working Group · 2014
Version1 · Editorial status: Recorded technical checks completed
View technical check record (AI)
Codex · 2026-09-23 · Single AI author. Scoped reading: Read PDF1 identity/version date, PDF2,13,25,50–51 text: inclusive definition, schema, interpretation, open/closed world, extraction and entity linking. No full-survey reading, empirical reproduction or diagram reuse. Read extracted §1.7 entailment/equivalence/inconsistency, §3/3.1 terms and triples, §3.3 literal equality and §3.4 blank-node scope. Initial web opening also showed §1.1–1.5. Teaching core is not a complete parser, datatype validator or entailment implementation. 5 paired equations and four explained exercises. Checked distinct identities, fact/source deduplication, open-world unknowns, explicit negative conflicts and all provenance pairs in a two-edge join. Application model, not RDF entailment.
- Checked distinct identities, fact/source deduplication, open-world unknowns, explicit negative conflicts and all provenance pairs in a two-edge join. Application model, not RDF entailment.
- Four computed SVG variants per topic;14 numeric/geometry tests and36 responsive cases passed. Twelve selected current captures visually checked: seven identical to previously viewed images and five re-viewed final captures; TransE arrow revision retained. Full article acceptance recorded separately.
Source locations checked:
- Knowledge Graphs — arXiv v6 · Read PDF1 identity/version date, PDF2,13,25,50–51 text: inclusive definition, schema, interpretation, open/closed world, extraction and entity linking. No full-survey reading, empirical reproduction or diagram reuse.
- RDF 1.1 Concepts and Abstract Syntax — 25 February 2014 · Read extracted §1.7 entailment/equivalence/inconsistency, §3/3.1 terms and triples, §3.3 literal equality and §3.4 blank-node scope. Initial web opening also showed §1.1–1.5. Teaching core is not a complete parser, datatype validator or entailment implementation.
Related topics