初识知识图谱:你身边的“知识地图” / Meet Knowledge Graph: The "Knowledge Map" Around You
上周五放学你蹲在小区门口开黑,秒选本命妲己正准备蹲草秒脆皮,对面反手掏出一个盾山,你一套321扔过去全被盾牌挡得干干净净,气得你差点摔手机。你一边骂队友不ban盾山,一边脑子里自动冒出一堆乱糟糟的念头:盾山这老小子专克法师,尤其是妲己这种一套流的;那选安琪拉是不是能打他?哦对,上次我用安琪拉烧盾山的盾烧得他嗷嗷叫;还有狄仁杰那货能解李元芳的飞镖,李元芳又克孙尚香,孙尚香滚过来两炮就能把狄仁杰送走……你甚至还能顺便想到:上次我用李元芳打狄仁杰,被对面辅助张飞套了个盾,张飞又最怕貂蝉的真伤,那我要是选貂蝉是不是能打穿对面下路?
Last Friday, after school, you were squatting at the entrance of your community grinding *Honor of Kings*. You locked in your main mage Daji, ready to ambush a squishy target in the grass, when the enemy team first-picked a Dunshan (Mountain Shield). You threw out your full combo of 3-2-1, only for every skill to be blocked completely by his shield. You were so mad you almost smashed your phone. While cursing your teammates for not banning the shield, a messy string of thoughts popped up automatically in your head: That guy specializes in countering mages, especially combo-style ones like Daji; would picking Angela work against him? Oh right, last time I burned his shield so hard with Angela he was screaming; also, Di Renjie can dispel Li Yuanfang’s tracking dart, Li Yuanfang counters Sun Shangxiang, and Sun Shangxiang can send Di Renjie to the respawn point with two rolls of her rifle… You even thought further: Last time I used Li Yuanfang against Di Renjie, the enemy support Zhang Fei put a shield on him; Zhang Fei is most afraid of Diao Chan’s true damage, so if I pick Diao Chan, can I steamroll the enemy bot lane?
你有没有发现,你脑子里根本不是一堆零散的“妲己怕盾山”“安琪拉打盾山好打”的孤立知识点,而是一张把英雄、技能、克制关系全连在一起的网?你随便从“盾山”这个点出发,顺着线就能找到能打他的英雄,再从安琪拉出发,又能找到怕她的英雄,再从李元芳出发,又能找到他的天敌和克星——这张你早就有的、藏在脑子里的网,就是我们今天要讲的知识图谱(Knowledge Graph)。
Have you noticed that what’s in your head isn’t a bunch of isolated knowledge points like “Daji is afraid of Dunshan” or “Angela is good against Dunshan”, but a full network connecting heroes, skills, and counter relationships? No matter which point you start from—say, “Dunshan”—you can follow the connections to find heroes that can beat him; start from Angela, and you can find heroes she’s afraid of; start from Li Yuanfang, and you can find his natural counters and prey. This network, which has been hiding in your head all along, is exactly what we call a Knowledge Graph today.
---
1.1 别被名字吓到:知识图谱就是“带关系的知识地图” / Don’t Be Intimidated by the Name: A Knowledge Graph Is Just a “Knowledge Map with Relationships”
很多人一听到“知识图谱”这四个字,第一反应是“这是不是程序员叔叔阿姨才会用的高大上技术?和我有什么关系?” 我们先把这个名字拆成两部分看,你立刻就懂了。
First, let’s break down the name itself to eliminate the intimidation. Many people’s first reaction to the term “knowledge graph” is “Is this some fancy tech only programmers and scientists use? What does it have to do with me?” If we split the name into two parts, you’ll get it instantly.
1.1.1 “知识”就是你关心的所有信息点 / “Knowledge” Is Every Piece of Information You Care About
你脑子里装的所有东西都是“知识”:你记得妲己的技能是231,记得哈利波特的父母是被伏地魔杀的,记得你们班班长是数学课代表,记得光合作用是植物把二氧化碳变成氧气的过程——这些都是知识,每一个单独的信息点,我们技术圈里叫它实体(Entity),你可以把它理解成地图上的一个小标记点(Node)。
All the stuff stored in your head counts as “knowledge”: you remember Daji’s skill combo is 2-3-1, you remember Harry Potter’s parents were killed by Voldemort, you know the monitor of your class is the math representative, you know photosynthesis is the process where plants turn carbon dioxide into oxygen. All of these are knowledge. Each individual information point is called an Entity in tech terms—you can think of it as a small marker on a map, or a Node for short.
1.1.2 “图谱”就是把这些点用关系连起来的网 / “Graph” Is the Network Connecting These Points with Relationships
光有一堆标记点没用,你得知道这些点之间有什么关系:妲己和盾山是“被克制”的关系,哈利和詹姆是“父子”的关系,班长和学习委员是“同班同学”的关系,光合作用和呼吸作用是“相反过程”的关系——这些“点与点之间的关系”,我们叫它关系(Relation),你可以把它理解成地图上连接两个标记点的路线(Edge)。
Having a bunch of markers is useless if you don’t know how they connect. Daji and Dunshan have a “countered by” relationship; Harry and James Potter have a “father-son” relationship; the monitor and the study commissioner of your class are “classmates”; photosynthesis and respiration are “opposite processes”. These “relationships between points” are called Relations in tech terms—you can think of them as the routes (Edges) connecting two markers on a map.
1.1.3 每个点还有自己的特征 / Each Point Also Has Its Own Features
除了关系和别的点相连,每个标记点本身还有自己的特征:妲己的标签是“法师”“爆发高”“脆皮”,哈利的标签是“ Gryffindor学院”“大难不死的男孩”“擅长魁地奇”,班长的标签是“数学课代表”“性格开朗”“戴眼镜”——这些点本身的特征,我们叫它属性(Attribute),就像地图上每个标记点下面标的小字说明。
Besides being connected to other points, each marker has its own features: Daji’s tags are “Mage”, “High Burst”, “Squishy”; Harry’s tags are “Gryffindor House”, “The Boy Who Lived”, “Good at Quidditch”; the monitor’s tags are “Math Representative”, “Cheerful Personality”, “Wears Glasses”. These inherent features of each point are called Attributes, just like the small text notes under each marker on a map.
把这三部分拼起来:一堆带特征的标记点,用关系连成一张网,就是知识图谱。你可以把它理解成你手机里的高德/百度地图:每个地点是节点,连接地点的路是边,每个地点的名称、评分、营业时间是属性,你要找“学校附近奶茶店”,输入关键词就能立刻找到所有相关的点,还能看到它们和学校的距离、评分、路线,这就是知识图谱最基础的用法——只是以前这张地图藏在你脑子里,现在我们要把它画出来,变成你能看得见、摸得着的东西。
Put these three parts together: a bunch of feature-tagged markers connected by relationships into a network, and you get a Knowledge Graph. You can think of it as the map app on your phone: every location is a node, the roads connecting locations are edges, and each location’s name, rating, and opening hours are attributes. When you search for “bubble tea shops near school”, you can instantly find all related points, see their distance from school, ratings, and routes. That’s the most basic use of a knowledge graph—only before, this map was hidden in your head; now we’re going to draw it out so you can see and touch it.
为了让你更直观,我们用你最熟悉的王者荣耀英雄克制关系,画一张超迷你的知识图谱: ```mermaid graph TD A[妲己<br/><small>法师/爆发高/脆皮</small>] -->|被克制| B[盾山<br/><small>辅助/开团强/克法师</small>] A -->|克制| C[安琪拉<br/><small>法师/爆发高/怕贴脸</small>] C -->|克制| B D[狄仁杰<br/><small>射手/能解控/脆皮</small>] -->|克制| E[李元芳<br/><small>射手/爆发高/怕解控</small>] E -->|克制| F[孙尚香<br/><small>射手/灵活/怕爆发</small>] F -->|克制| D ``` 你看,这张小图里,每个英雄是带属性的节点,克制关系是连线,你要找“谁能打盾山”,顺着妲己的“被克制”连线找到盾山,再顺着安琪拉的“克制”连线就能找到答案,不用翻遍整个英雄列表。
---
1.2 别搞混:知识图谱 ≠ 思维导图 ≠ 普通笔记 / Don’t Mix Them Up: Knowledge Graph ≠ Mind Map ≠ Ordinary Notes
你肯定用过思维导图记笔记,也写过流水账式的普通笔记,那知识图谱和它们到底有什么区别?我们拿同一个例子来对比,你一眼就能看懂。
You’ve definitely used mind maps to take notes, and you’ve written linear, diary-style ordinary notes too. So what’s the difference between a knowledge graph and these two? Let’s use the same example for comparison, and you’ll see the difference at a glance.
1.2.1 普通笔记:散落一地的乐高积木 / Ordinary Notes: Lego Bricks Scattered All Over the Floor
普通笔记就是你平时记的流水账,比如你记哈利波特的笔记是这样的: > 1. 哈利·波特,1998年7月31日出生,父母是詹姆·波特和莉莉·伊万斯,1岁时父母被伏地魔杀害,额头上有闪电形伤疤。 > 2. 哈利的好朋友是罗恩·韦斯莱和赫敏·格兰杰,后来和罗恩的妹妹金妮结婚。 > 3. 斯内普是斯莱特林学院的院长,一直针对哈利,最后 revealed 是为了保护哈利。 > 4. 伏地魔是杀死哈利父母的黑魔头,想尽办法要杀死哈利,最后被哈利彻底消灭。
Ordinary notes are the linear, diary-style notes you usually write. For example, your notes on Harry Potter might look like this: > 1. Harry Potter, born July 31, 1998, parents are James Potter and Lily Evans, killed by Voldemort when he was 1 year old, has a lightning-bolt scar on his forehead. > 2. Harry’s best friends are Ron Weasley and Hermione Granger, later married Ron’s sister Ginny. > 3. Snape is the head of Slytherin House, always targeted Harry, later revealed to be protecting Harry. > 4. Voldemort is the dark wizard who killed Harry’s parents, tried every way to kill Harry, finally completely eliminated by Harry.
这些信息本身是对的,但它们是完全孤立的:你要找“斯内普为什么保护哈利”,得把4条笔记翻一遍,自己拼凑出“斯内普爱慕哈利的母亲莉莉→恨哈利的父亲詹姆→因为爱莉莉所以保护哈利”的关联,要是你记的笔记有10页、20页,找起来就像在散落一地的乐高积木里找一块特定的小方块,翻得你满头包。
This information is correct, but it’s completely isolated: if you want to find out “why Snape protected Harry”, you have to flip through all 4 notes and piece together the connection yourself: “Snape loved Lily, Harry’s mother → hated James, Harry’s father → protected Harry because he loved Lily”. If your notes are 10 or 20 pages long, finding this information is like looking for a specific small Lego brick among bricks s