├── .gitignore ├── README.md ├── babel.config.js ├── package-lock.json ├── package.json ├── public ├── favicon.ico └── index.html ├── src ├── .DS_Store ├── App.vue ├── assets │ └── .DS_Store ├── components │ ├── Charts.vue │ ├── Keywords.vue │ ├── KnowledgeGraph.vue │ └── mock.js └── main.js └── vue.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | __MACOSX 2 | __MACOSX/* -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # knowledgeGraph 2 | 基于echarts关系图的知识图谱 3 | 4 | 仿思知实现的知识图谱功能,基于echarts关系图graph实现的知识图谱功能 5 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "echartsdemo", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.20.0", 12 | "core-js": "^2.6.5", 13 | "echarts": "^4.9.0", 14 | "vue": "^2.6.10" 15 | }, 16 | "devDependencies": { 17 | "@vue/cli-plugin-babel": "^3.7.0", 18 | "@vue/cli-plugin-eslint": "^3.7.0", 19 | "@vue/cli-service": "^3.7.0", 20 | "babel-eslint": "^10.0.1", 21 | "eslint": "^5.16.0", 22 | "eslint-plugin-vue": "^5.0.0", 23 | "vue-template-compiler": "^2.6.10" 24 | }, 25 | "eslintConfig": { 26 | "root": true, 27 | "env": { 28 | "node": true 29 | }, 30 | "extends": [ 31 | "plugin:vue/essential", 32 | "eslint:recommended" 33 | ], 34 | "rules": {}, 35 | "parserOptions": { 36 | "parser": "babel-eslint" 37 | } 38 | }, 39 | "postcss": { 40 | "plugins": { 41 | "autoprefixer": {} 42 | } 43 | }, 44 | "browserslist": [ 45 | "> 1%", 46 | "last 2 versions" 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jeff-Bee/knowledgeGraph/17414ad018bf41b186ea5a079fdca324f9023d9e/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 知识图谱 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jeff-Bee/knowledgeGraph/17414ad018bf41b186ea5a079fdca324f9023d9e/src/.DS_Store -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 17 | 18 | 49 | -------------------------------------------------------------------------------- /src/assets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jeff-Bee/knowledgeGraph/17414ad018bf41b186ea5a079fdca324f9023d9e/src/assets/.DS_Store -------------------------------------------------------------------------------- /src/components/Charts.vue: -------------------------------------------------------------------------------- 1 | 6 | 266 | -------------------------------------------------------------------------------- /src/components/Keywords.vue: -------------------------------------------------------------------------------- 1 | 18 | 167 | -------------------------------------------------------------------------------- /src/components/KnowledgeGraph.vue: -------------------------------------------------------------------------------- 1 | 24 | 81 | -------------------------------------------------------------------------------- /src/components/mock.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 图谱数据源 3 | */ 4 | export const data = [ 5 | { 6 | id:10000, 7 | name:'盗墓笔记重启[南派三叔所著小说]', 8 | categary:'百科', 9 | children:[ 10 | { 11 | id:2, 12 | name:'盗墓笔记重启', 13 | categary:'中文名称', 14 | }, 15 | { 16 | id:3, 17 | name:'南派三叔', 18 | categary:'作者', 19 | children:[ 20 | { 21 | id:301, 22 | name:'企业家', 23 | categary:'职业', 24 | children:[ 25 | { 26 | id:30101, 27 | name:'冒险家,创新者', 28 | categary:'特征', 29 | }, 30 | { 31 | id:30102, 32 | name:'掌控者,领导者', 33 | categary:'企业角色', 34 | }, 35 | { 36 | id:30103, 37 | name:'entrepreneur', 38 | categary:'外文名', 39 | } 40 | ] 41 | }, 42 | { 43 | id:302, 44 | name:'南派三叔', 45 | categary:'别名', 46 | }, 47 | { 48 | id:303, 49 | name:'浙江省嘉兴市嘉善县', 50 | categary:'出生地', 51 | }, 52 | { 53 | id:304, 54 | name:'第七届中国作家富豪榜最佳冒险小说奖', 55 | categary:'主要成就', 56 | } 57 | ], 58 | }, 59 | { 60 | id:4, 61 | name:'悬疑', 62 | categary:'类型', 63 | }, 64 | { 65 | id:5, 66 | name:'悬疑', 67 | categary:'连载状态', 68 | }, 69 | { 70 | id:6, 71 | name:'连载平台', 72 | categary:'个人微信公众号和互联网上', 73 | }, 74 | { 75 | id:7, 76 | name:'最新章节', 77 | categary:'重启·极海听雷第两百二十四章结局了', 78 | }, 79 | { 80 | id:8, 81 | name:'小说主角', 82 | categary:'吴邪、胖子、张起灵', 83 | }, 84 | { 85 | id:9, 86 | name:'连载状态', 87 | categary:'连载中', 88 | } 89 | ] 90 | }, 91 | { 92 | id:20000, 93 | name:'人工智能[计算机科学的一个分支]', 94 | categary:'百科', 95 | children: [{ 96 | "id": 1599811251651, 97 | "name": "人工智能", 98 | "categary": "中文名" 99 | }, { 100 | "id": 1599811251652, 101 | "name": "ARTIFICIALINTELLIGENCE", 102 | "categary": "外文名" 103 | }, { 104 | "id": 1599811251653, 105 | "name": "AI", 106 | "categary": "简称" 107 | }, { 108 | "id": 1599811251654, 109 | "name": "1956年", 110 | "categary": "提出时间" 111 | }, { 112 | "id": 1599811251655, 113 | "name": "DARTMOUTH学会", 114 | "categary": "提出地点" 115 | }, { 116 | "id": 1599811251656, 117 | "name": "雨果·德·加里斯的著作", 118 | "categary": "名称来源" 119 | }] 120 | }, 121 | { 122 | id:30000, 123 | name:'姚明[亚洲篮球联合会主席、中国篮球协会主席]', 124 | categary:'百科', 125 | children: [{ 126 | "id": 1599811494936, 127 | "name": "YaoMing", 128 | "categary": "外文名" 129 | }, { 130 | "id": 1599811494937, 131 | "name": "明王", 132 | "categary": "别名" 133 | }, { 134 | "id": 1599811494938, 135 | "name": "移动长城", 136 | "categary": "别名" 137 | }, { 138 | "id": 1599811494939, 139 | "name": "小巨人", 140 | "categary": "别名" 141 | }, { 142 | "id": 1599811494930, 143 | "name": "大姚", 144 | "categary": "别名" 145 | }, { 146 | "id": 1599811494931, 147 | "name": "中国", 148 | "categary": "国籍" 149 | }, { 150 | "id": 1599811494932, 151 | "name": "汉族", 152 | "categary": "民族" 153 | }] 154 | }, 155 | { 156 | id:40000, 157 | name:'知识图谱', 158 | categary:'百科', 159 | children: [{ 160 | "id": 1599813559392, 161 | "name": "知识图谱", 162 | "categary": "中文名" 163 | }, { 164 | "id": 1599813559393, 165 | "name": "KnowledgeGraph/Vault", 166 | "categary": "外文名" 167 | }, { 168 | "id": 1599813559394, 169 | "name": "科学知识图谱", 170 | "categary": "也称" 171 | }, { 172 | "id": 1599813559395, 173 | "name": "理论与方法与计量学引文分析", 174 | "categary": "应用" 175 | }] 176 | }, 177 | { 178 | id:50000, 179 | name:'刘德华[中国香港男演员、歌手、制片人、填词人]', 180 | categary:'百科', 181 | children: [{ 182 | "id": 1599813694131, 183 | "name": "AndyLau,LauTakWah", 184 | "categary": "外文名" 185 | }, { 186 | "id": 1599813694132, 187 | "name": "华仔,华Dee,华哥等", 188 | "categary": "别名" 189 | }, { 190 | "id": 1599813694133, 191 | "name": "中国", 192 | "categary": "国籍" 193 | }, { 194 | "id": 1599813694134, 195 | "name": "汉族", 196 | "categary": "民族" 197 | }, { 198 | "id": 1599813694135, 199 | "name": "天秤座", 200 | "categary": "星座" 201 | }, { 202 | "id": 1599813694136, 203 | "name": "AB型", 204 | "categary": "血型" 205 | }, { 206 | "id": 1599813694137, 207 | "name": "174cm", 208 | "categary": "身高" 209 | }, { 210 | "id": 1599813694138, 211 | "name": "63kg", 212 | "categary": "体重" 213 | }] 214 | }, 215 | { 216 | id:60000, 217 | name:'番茄[茄科茄属植物]', 218 | categary:'百科', 219 | children: [{ 220 | "id": 1599813839207, 221 | "name": "Solanumlycopersicum", 222 | "categary": "拉丁学名" 223 | }, { 224 | "id": 1599813839208, 225 | "name": "蕃柿、西红柿、洋柿子", 226 | "categary": "别称" 227 | }, { 228 | "id": 1599813839209, 229 | "name": "植物界", 230 | "categary": "界" 231 | }, { 232 | "id": 1599813839210, 233 | "name": "被子植物门", 234 | "categary": "门" 235 | }, { 236 | "id": 1599813839211, 237 | "name": "双子叶植物纲", 238 | "categary": "纲" 239 | }, { 240 | "id": 1599813839212, 241 | "name": "合瓣花亚纲", 242 | "categary": "亚纲" 243 | }, { 244 | "id": 1599813839213, 245 | "name": "管状花目", 246 | "categary": "目" 247 | }, { 248 | "id": 1599813839214, 249 | "name": "茄科", 250 | "categary": "科" 251 | }] 252 | }, 253 | { 254 | id:70000, 255 | name:'周杰伦', 256 | categary:'百科', 257 | children: [{ 258 | "id": 1599813927218, 259 | "name": "JayChou", 260 | "categary": "外文名" 261 | }, { 262 | "id": 1599813927219, 263 | "name": "周董", 264 | "categary": "别名" 265 | }, { 266 | "id": 1599813927220, 267 | "name": "中国", 268 | "categary": "国籍" 269 | }, { 270 | "id": 1599813927221, 271 | "name": "汉族", 272 | "categary": "民族" 273 | }, { 274 | "id": 1599813927222, 275 | "name": "摩羯座", 276 | "categary": "星座" 277 | }, { 278 | "id": 1599813927223, 279 | "name": "O型", 280 | "categary": "血型" 281 | }, { 282 | "id": 1599813927224, 283 | "name": "175cm", 284 | "categary": "身高" 285 | }, { 286 | "id": 1599813927225, 287 | "name": "台湾省新北市", 288 | "categary": "出生地" 289 | }] 290 | }, 291 | { 292 | id:80000, 293 | name:'苏州大学', 294 | categary:'百科', 295 | children: [{ 296 | "id": 1599813971854, 297 | "name": "SoochowUniversity", 298 | "categary": "外文名" 299 | }, { 300 | "id": 1599813971855, 301 | "name": "苏大", 302 | "categary": "简称" 303 | }, { 304 | "id": 1599813971856, 305 | "name": "1900年5月18日(清光绪二十六年)", 306 | "categary": "创办时间" 307 | }, { 308 | "id": 1599813971857, 309 | "name": "公立大学", 310 | "categary": "类别" 311 | }, { 312 | "id": 1599813971858, 313 | "name": "综合类", 314 | "categary": "类型" 315 | }, { 316 | "id": 1599813971859, 317 | "name": "211工程", 318 | "categary": "属性" 319 | }, { 320 | "id": 1599813971860, 321 | "name": "省部共建大学", 322 | "categary": "属性" 323 | }, { 324 | "id": 1599813971861, 325 | "name": "卓越工程师教育培养计划", 326 | "categary": "属性" 327 | }] 328 | }, 329 | { 330 | id:90000, 331 | name:'机器人[自动执行工作的机器装置]', 332 | categary:'百科', 333 | children: [{ 334 | "id": 1599814026913, 335 | "name": "Robot", 336 | "categary": "外文名" 337 | }, { 338 | "id": 1599814026914, 339 | "name": "自动执行工作的机器装置", 340 | "categary": "定义" 341 | }, { 342 | "id": 1599814026915, 343 | "name": "人工智能技术", 344 | "categary": "技术" 345 | }, { 346 | "id": 1599814026916, 347 | "name": "微型计算机", 348 | "categary": "驱动装置" 349 | }, { 350 | "id": 1599814026917, 351 | "name": "电能", 352 | "categary": "驱动能源" 353 | }] 354 | } 355 | 356 | ] 357 | 358 | /** 359 | * 模糊查询大类 360 | * @param {*} name 361 | */ 362 | export const search = (name)=>{ 363 | return new Promise((resolve,reject)=>{ 364 | let result = [] 365 | let list = data.filter(item=>item.name.indexOf(name)>=0) 366 | if(list&&list.length>0){ 367 | result = list||[] 368 | } 369 | if(result.length>0){ 370 | resolve(result) 371 | }else{ 372 | reject() 373 | } 374 | }) 375 | } 376 | 377 | /** 378 | * 点击节点展开 379 | * @param {*} id 380 | */ 381 | export const expendNodes = (id)=>{ 382 | return new Promise((resolve,reject)=>{ 383 | let totalList = [] 384 | //拆除来所有的children到第一层 385 | data.forEach(item=>{ 386 | getDeepChildrens(totalList,item,0) 387 | }) 388 | 389 | let list = [] 390 | for(let item of totalList){ 391 | if(item.parentId.toString() === id){ 392 | const {children,...reset} = item 393 | list.push({ 394 | ...reset 395 | }) 396 | } 397 | } 398 | if(list.length>0){ 399 | resolve(list) 400 | }else{ 401 | reject() 402 | } 403 | 404 | }) 405 | 406 | } 407 | 408 | /** 409 | * 递归数组,把所有children都拆出来到第一层 410 | * @param {*} list 411 | * @param {*} item 412 | */ 413 | function getDeepChildrens(list,item,parentId){ 414 | const {children,...reset} = item 415 | list.push( 416 | { 417 | ...reset, 418 | parentId, 419 | } 420 | ) 421 | if(children&&children.length>0){ 422 | children.forEach(child=>{ 423 | getDeepChildrens(list,child,item.id) 424 | }) 425 | } 426 | } 427 | 428 | /** 429 | * 分类数据 430 | */ 431 | export const categarys = ["人工智能","知识图谱","姚明","刘德华","机器人","周杰伦","苏州大学","番茄","盗墓笔记","机器人","人工智能","知识图谱","姚明","刘德华","机器人","人工智能","知识图谱","姚明","刘德华","机器人","人工智能","知识图谱","姚明","刘德华","机器人","人工智能","知识图谱","姚明","刘德华","机器人"] -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | 4 | Vue.config.productionTip = false 5 | 6 | new Vue({ 7 | render: h => h(App), 8 | }).$mount('#app') 9 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | publicPath: '/', 3 | outputDir: 'dist', 4 | assetsDir: 'static', 5 | runtimeCompiler: true, 6 | lintOnSave: false, // eslint-loader 是否在保存的时候检查 7 | 8 | devServer: { 9 | disableHostCheck: true, 10 | port: 8080, 11 | } 12 | } --------------------------------------------------------------------------------