Neo4j aura 官方网站快速入门新手教精读-从官方教程学习知识图谱

Neo4j 官方网站快速入门新手教精读

       本文旨在为Neo4j新手提供一份全面的入门指南。除了基础的文本解释,我在里面还插入了每一步骤的详细截图或者自己画的图,从官方了解知识肯定比自己乱看要权威一些,有看不懂的不要纠结了解大概意思即可,随着知识的积累最后会顿悟的,这里面的内容好多机翻不出来的或者不好理解的我根据对相关知识的了解人工进行了润色,如果有表达不准确或者不清楚的地方,非常欢迎批评指正,共同进步。

Neo4j Aura 是一个完全托管的图形数据库服务,它提供了一个高度可扩展、安全和操作简便的环境,使用户能够轻松构建和维护基于图形的数据模型和应用程序。

https://neo4j.com/cloud/platform/aura-graph-database/?ref=neo4j-home-hero
在这里插入图片描述

1. Learn the basics 基础了解

       This guide teaches you about the power of graph databases. It is the recommended starting place for all new users as it touches upon the concepts and tools you need to work with graphs.
       本指南将向您介绍图数据库的强大功能。它是所有新用户的推荐入门指南,因为它设计到使用图所需要的概念和工具。

在这里插入图片描述

What you will learn
你将会学到什么
This guide takes around 10 minutes and by the end of it you will able to:
本指南大约需要十分钟,在结束时候您能够学到

  • Understand the graph property model and what problems it can help you solve.
    明白图的性质以及它能帮助你解决什么问题
  • Convert an understanding of relational database model to a graph
    将对一个关系数据库的理解转化为一个图
  • Import and model data from CSV file and map them to a graph.
    把CSV格式的文件导入图数据库,并将其建模成一个图
  • Visually explore that data, without code, in a graph.
    在图中直观的查看这些数据,且不需要代码
  • Write your first simple graph queries using Cypher
    使用Cypher命令,来进行一个简单的图数据库的查询

Get started!

让我们开始

       You are going to use the classic relational dataset known as Northwind and bring the fictional company into graph-enabled future.
       你将使用名为NotrhWind的经典关系数据库,并将一个虚拟公司带入一个图使能的未来。

2. What is a graph? 图是什么?

在这里插入图片描述

Concepts 图的概念

       A graph database stores nodes(Supplier, Product, etc) and their relationship(e,g, Supplier SUPPLIES Product).
       一个图数据库存包含着两种元素,节点(供应商,产品,等等) 以及他们的关系 (供应商供应产品)

       Other types of databases may use tables and documents, but in a graph, data is stored in the same way as you may sketch ideas on a whiteborad.
       其他类型的数据库可以能使用的是表格和文档,但是在图数据库存储数据的方式和您在白板上勾画想法的方式相同。

在这里插入图片描述

In a graph, where the relationships are stored, many powerful operations are faster and simpler.
在一个图数据库中,在存储一些关时,很多操作更加快速和便捷

Schema-free形式自由

       In a relational database, you must define your schema (the structure of the data). In a graph, your data is managed without restricting it to a predefined schema. This allows more flexibility in thinking about the data and in evolving it.
       在一个关系数据库中,你必须定义一个数据格式,在一个图数据库中,你的数据并没有需要严格遵守的格式限制,因此在考虑数据的时候可以更灵活和发散。

3. Nodes, properties, relationships 节点,属性,关系

       The nodes and relationships in your graph can have types and properties.
       在我们的图数据库中的节点和关系可以有类别属性

3.1 Nodes and properties 节点和属性

       Nodes can be tagged with labels, representing their different roles in your dataset (e.g. Supplier, Employee, Customer). They can also have any number of key-value pairs as properties (e.g. name:"Camembert Pierrot").
       节点可以用标签来标记,表示他们在数据集中的不同角色例如(供应商员工客户),节点也可以包含任意数量的键值对作为属性例如(名字:Camembert Pierrot)

3.2 Relationships 关系

       Relationships provide directed, typed, or attributed, connections between two node entities (e.g. Shipper SHIPS Order).
       关系提供了两个节点之间的指向,类型,所属关系,例如(托运人的船舶订单)

       Relationships always have a direction, a type, a start node, and an end node. They can also have properties, just like nodes.
       关系包包含一个指向一个类型一个起始节点一个指向节点,且关系和节点一样依然包含一些属性。

       Nodes can have any number of relationships without sacrificing performance.
       节点可以包含任何数量的关系且不用牺牲任何的已经表现出的信息。

       Although relationships are always directed, they can be navigated efficiently in any direction. In this example, you can find who shipped an order and you can also reverse that and find what orders were shipped.
       尽管关系总是有方向的,但是他可以沿着任何方向进行有效的查找。在这个例子中,你可以查找谁发了一个订单,也也可以反向查找这个订单是由谁发送的

4. Re-imagining a classic (Northwind) 回顾经典图数据集(北风)

在这里插入图片描述
The classic Northwind dataset represents an online shop.
北风数据集表示的是一个在线商店

product category supplier

You are now going to transform this relational database into a graph database
现在你要把这个关系数据集转换成图数据集

product graph

       You can see the CSV files from Northwind’s tables represented as a graph model. The mappings for these files are already prepared for you.
       你可以看到北风数据集中的CSV文件表示的图,里面的映射关系文件当中都已经为你准备好了。

       Notice the relationships connecting the nodes, e.g. a Customer PURCHASED an Order and the Order ORDERS Products.
       注意链接节点的这些关系,例如:顾客购买了订单,订单订购了产品

在这里插入图片描述

5. Finish the Northwind import 完成北风数据集的导入

在这里插入图片描述

       For each node and relationship in the model you can see which parts of the CSV file are mapped to which properties
       对生成的图中的节点和关系,你可以看到哪部分的CSV文件映射到了哪种属性

       Source and target IDs from the original join tables or foreign keys are used to create relationships to connect nodes
       原始连接表或外键中的源ID和目标ID被用来创建关系以连接节点(白话就说用是CSV中有节点和关系还有属性读出来之后生成了图)

       The model is interactive; you can click around and explore its nodes and relationships.
       该模型是交互式的;您可以单击并探索其节点和关系。

5.1 Preview your data import 预览导入数据

       You can see a preview of the data import by clicking the Preview button.
可以点右上的预览按钮来查看数据导入的预览

在这里插入图片描述

       This allows you to check node labels, the property names and values, and the relationship types and directions.
       通过点击这个按键,可以检查导入的文件的节点标签、属性名称和值,以及关系类型和方向。(点里面的Preview all)

在这里插入图片描述

       If you’re satisfied, click the Run import button to load your data into your graph.
如果你满意的话,点击Run import按钮去把你的数据加载到图里

在这里插入图片描述
在这里插入图片描述

       If something goes wrong, keep in mind that the tool can import the same data multiple times and you can reset your database to blank in the AuraDB Console.
       如果报错了的话,注意这个工具(指 Run Import 按钮)可以多次导入相同数据 然后你可以把你的数据库在AuraDB Console中清空。

5.2 Explore your data 探索您的数据

       After you have imported the Northwind dataset, click the Start Exploring button in the report popup or switch to the Explore tab.
       导入北风数据集后,单击报告弹出框中的开始探索按钮或切换到探索选项卡。

在这里插入图片描述
       Next you are going to see the power of graph visualization.
       之后你会看到图可视化的力量。

6. Explore your graph 探索你的图

With the data in a graph, it is time to get familiar with the Explore tab.
有了图表中的数据,是时候熟悉Explore选项卡了。

       The Show me a graph Search Phrase runs automatically to show an example subset of the data. The visualized graph represents the relationships in the data in an intuitive way.
       (刚点击完 Explore results 之后)Show me a graph 搜索短语会自动运行,以显示数据的一个示例子集。可视化图以直观的方式表示数据之间的关系。

       You can also run the Show me a graph example Search Phrase yourself by typing the Show me a graph in the top-left search bar.
       你也可以自己在左上角的搜索栏里自己手动输入Show me a graph 然后运行。

在这里插入图片描述

6.1 Searching for data in Explore 在Explore中搜索数据

       You can use simple search phrases based on your node labels and relationship types to visualize your graph. If you ran the example Search Phrase, you should clear the scene before you continue. Right-click anywhere on the canvas and select Clear Scene or Ctrl+Bksp/Cmd+Bksp.
       你可以基于你自己的节点标签和关系来用一个简单的搜索词可视化你的图,如果你运行一个示例搜索词,在你进行操作之前要把屏幕情况,右键(我实际操作下来应该是左键点击)随便点击图显示框中的任何一个位置然后按住Ctrl+Bksp/Cmd+Bksp删除。

       If you enter Category<tab> and then press return; it fetches and displays all categories. You can now explore and expand the graph visualization.
       如果你先按<tab>然后安enter就能获取和显示所有类别。现在你可以继续探索和延申图的可视化。

       This is a great way to discover interesting relationships and formulate questions about your data.
       这是发现你的数据中有趣的联系和规范化问题的一个好的方式(说实话这句没太明白)。

       Another useful feature is to select two nodes (Ctrl-Click/Cmd-Click) and select Paths → Shortest Path from the right-click context menu on one of them.
       另一个有用的特性是按住ctrl选择两个节点,然后后右键的菜单中选择path,然后选择Shortest Path最短路径。(右键的时候鼠标要在节点上,然后点了Shortest Path其实也无事发生,就闪了两下比较鸡肋)

在这里插入图片描述
在这里插入图片描述

       You can select all Categories by clicking on their box in the right side legend and then choose Expand → All in the context menu to see all the products contained in these categories.
       你可以用过右侧的框内看到所有类别,然后点击这个类别就可以看到这个类别的提示。
在这里插入图片描述

       The context menu also offers many more options like editing, partial expansion, clearing the scene, or dismissing (un-)selected nodes.
       上下文菜单还提供了许多选项,如编辑、部分展开、清除场景或取消(取消)所选节点。(我理解他指的上下文菜单应该是这里,右上角可以删除节点)

在这里插入图片描述

7. Advanced exploration 先进的展示

       In the bottom-right of Explore you can switch between the default force-based layout and a hierarchical layout.
       在Explore的右下角,您可以在默认的布局和分层布局之间切换。

在这里插入图片描述
在这里插入图片描述

       You can style your data in the right legend using colors, icons, sizes, and captions, and even apply rules for these.
       你可以在右侧的列表框章设置颜色图标标题,甚至应用的一些规则。

       Click on Category in the legend panel and pick a different color, icon, and/or size for your nodes.
       点击图例面板中的Category,为你的节点选择不同的颜色、图标和/或大小。
在这里插入图片描述

       Selected nodes and relationships are highlighted and counted in the legend panel and shown in the card view in the lower left corner. There you can explore your data structurally.
       选择了节点和关系之后可以高亮对应的元素且后面有计数(只有点后面有数字的它才亮,这句我直接总结归纳了)

在这里插入图片描述
       Explore also offers options to filter your on-screen nodes with a advanced filter menu, and even rudimentary user programming by storing Cypher phrases to reuse later.
       Explore还提供了使用高级过滤菜单过滤屏幕节点的选项,甚至还提供了通过存储Cypher短语以供以后重用的基本用户编程。

8. Basic Querying 基础查询

Switch to the Query tab, if you haven’t already done so.
切回查询页面Query,如果你还没切换的话。
在这里插入图片描述

       In the first entry (database) in the left column, you can see the count of nodes and relationship types. Click on “(Product)” - the database uses a minimal query to get several elements labeled “Product”.
       在左侧栏的第一个条目(数据库)中,可以看到节点和关系类型的计数。点击“(Product)”——数据库使用一个最小的查询获取带有“Product”标签的几个元素。

在这里插入图片描述

MATCH (n:Product)
RETURN n
LIMIT 25

       The result nodes are visualized in the graph view, and you can double-click nodes to see their neighbors.
       结果节点显示在Graph中,可以通过双击节点来查看它们的临近的节点。

       In the right properties side-panel you can inspect more properties. You can also style nodes (size, color, caption) by clicking on the (Product) label on top.
       在右侧是属性滑动窗口中,你可以查看更多的属性,也可以通过点击窗口中的Pruduct自定义节点的尺寸颜色标题

在这里插入图片描述

       Results can also be shown in a tabular view by clicking the table view option. Nodes and relationships are visualized in a JSON structure. That view is shown by default if you return only scalar values.
       还可以通过单击table view选项在表格视图中显示结果。节点和关系在JSON结构中可视化。如果只返回标量值,则默认显示该视图。

在这里插入图片描述

9. Writing your first query 写你的第一个查询

       Like any other database, Neo4j can be queried with a query language.
       就像其他数据库一样,Neo4j依旧有一个查询语言。

       Neo4j’s graph query language is called Cypher and is very well-suited for finding patterns. Unlike SQL, there is no reliance on writing complex joins
       Neo4j’s 图查询语言叫 Cypher 并且其非常合适用于寻找模型。不像SQL,其并不依赖于编写复杂链接。

       In Cypher, you represent the graph patterns that you’ve seen in Import and Explore with ascii-art.
       在 Cypher 中, 你可以用ascii-art表示你在ImportExplore中看到的图形模式。

ASCII艺术是一种利用ASCII字符集中的字符进行创作,通过排列组合这些字符来构造出图像或文本视觉表现的计算机艺术形式。

       Parentheses (p:Product {name:'Camembert Pierrot'}) form “circles” around nodes and arrows -[:SUPPLIES]-> depicts relationships.
       圆括号(p:Product {name:'Camembert Pierrot'})在节点周围形成“圆圈”,箭头-[:SUPPLIES]->表示关系。

       You draw in text what you would draw on the whiteboard.
       用文本画图和你在白板上画图一样。

       These patterns are used to find, create, and update graph data.
       这种模式被用于取创造更新和查找数据。

       You’ve already seen the MATCH (n:Product) RETURN n LIMIT 25 statement that was run previously.
       你以及看过MATCH (n:Product) RETURN n LIMIT 25指令之前跑出来的效果

       Now click on the statement to edit it and change the pattern and result to:
       现在点击语句进行编辑,并将模式和结果更改为:

MATCH (n:Product)<-[r:SUPPLIES]-(s:Supplier)
RETURN n,r,s
LIMIT 25

Congratulations, you’ve written and run your first Cypher query!
恭喜你你完成了第一个Cypher 查询。

10. A more advanced query更高级的查询

For the last part of this guide you get the opportunity to try some more powerful queries.
最后一部分会知道你有机会去尝试一些更高级的查询。

First, this query finds all products ordered by a customer and who supplies them.
首先,该查询查找客户订购的所有产品及其供应商。

MATCH path=(c:Customer)-[:PURCHASED]->()-[:ORDERS]->(:Product)<-[:SUPPLIES]-(:Supplier)
WHERE c.companyName = 'Blauer See Delikatessen'
RETURN path;

在这里插入图片描述

example

you can also see how many products in the Produce category each customer ordered.
您还可以看到每个客户订购了“农产品”类别中的产品数量。

在这里插入图片描述

11. Next steps 下一步

Congratulations on completing this tutorial.
祝贺你完成了本教程

       You can do more with the Northwind dataset or you can reset your instance in AuraDB Console and import your own data.
       您可以使用Northwind数据集做更多的事情,或者您可以在AuraDB Console中重置实例并导入您自己的数据。

       For your next steps, a suggestion is to look at furthering your Cypher knowledge or building an application using Neo4j’s popular language drivers.
       对于接下来的步骤,建议您进一步了解Cypher知识或使用Neo4j的流行语言驱动程序构建应用程序。

11.1 Next steps with Cypher 关于Cypher语言的下一步

To learn more about Cypher, check out the interactive GraphAcademy course
为了进一步了解Cypher,可以看一下这个图学术课程

https://graphacademy.neo4j.com/categories/beginners/

在这里插入图片描述

and have a look at the Cypher Cheat Sheet
还有这个 Cypher Cheat Sheet

在这里插入图片描述

11.2 Creating applications 创建应用

       As you get more familiar with Cypher, you can use the
       如果你已经熟悉了Cypher,你可以使用 C#, Go, Java, JavaScript, and Python 语言构建您的应用
在这里插入图片描述

or use our GraphQL or Spring Data Neo4j integrations for building APIs.
或者使用我们的GraphQL或Spring Data Neo4j集成来构建APIs。

https://docs.spring.io/spring-data/neo4j/reference/

在这里插入图片描述

11.3 Go further with GraphAcademy 在GraphAcademy上更近一步

       GraphAcademy is provided by Neo4j and offers in-depth courses on many aspects of graph databases. Check out the GraphAcademy website
       GraphAcademy由Neo4j提供,提供关于图数据库许多方面的深入课程。请查看 GraphAcademy网站

https://graphacademy.neo4j.com/

在这里插入图片描述

教程中给出的网站汇总

GraphAcademy course https://graphacademy.neo4j.com/categories/beginners/
Cypher Cheat Sheet https://neo4j.com/docs/cypher-cheat-sheet/5/auradb-enterprise/
Neo4jAPI https://neo4j.com/docs/getting-started/languages-guides/
GraphQLhttps://neo4j.com/product/graphql-library/
Spring Data Neo4jhttps://docs.spring.io/spring-data/neo4j/reference/
GraphAcademyhttps://graphacademy.neo4j.com/

结束

       反正知识图谱这个东西了解基本概念不难,学起来反正不是很容易,也希望各位不要灰心,看了半天啥也不明白是非常正常的情况,接下来一段时间内我应该会更新大模型和知识图谱的相关内容,积极分享。

neo4j api neo4j学习资料 neo4j教程neo4j官方API(官方各种API的文档整理).7z │ neo4j数据迁移--初探(一).htm │ neo4j笔记.docx │ neo4j错误码状态码.html │ └─01.neo4j学习博客汇总 │ index.html └─neo4j_cypher │ Cypher(神奇的WITH).html │ cypher_index.html │ Cypher查询语言--Neo4j 综合(四) - divenswu - 博客园.html │ Cypher查询语言--Neo4j中的SQL - 爱上包子 - 博客园.html │ DETACH DELETE n 删除node n ,并删除所有与n相关的关系.html │ Neo4j - NOT IN query.html │ Neo4j CQL - (11)- REMOVE删除 DELETE.html │ Neo4j Cypher 复杂查询详解在之With - 何源浩的博客 - CSDN博客.html │ neo4j 中使用sparql查询.html │ Neo4j 中文社区,致力于 Neo4j 的技术研究。.html │ Neo4j 使用cypher语言进行查询 - MHL - 博客园.html │ Neo4j 第一篇:在Windows环境中安装Neo4j - 悦光阴 - 博客园.html │ Neo4j 第三篇:Cypher查询入门 - 悦光阴 - 博客园.html │ Neo4j 第二篇:图形数据库 - 悦光阴 - 博客园.html │ Neo4j 第五篇:批量更新数据 - 悦光阴 - 博客园.html │ Neo4j 第四篇:使用C更新和查询Neo4j - 悦光阴 - 博客园.html │ Neo4J(Cypher语句)初识.html │ Neo4J(Cypher语句)学习 - 赵晓雷的专栏 - CSDN博客.html │ Neo4j_事务&深度遍历.html │ neo4j中的分组查询.html │ Neo4j之Cypher学习总结.html │ NEO4J亿级数据导入导出以及数据更新 - 耶和华靠近伤心的人,拯救灵性痛悔的人 - CS.html │ Neo4j入门点滴(一):Cypher.html │ Neo4j入门点滴(三):用Cypher完善图.html │ Neo4j入门点滴(二):模式与模式匹配.html │ Neo4j入门点滴(五):Windows Shell for Cypher.html │ Neo4j入门点滴(四):Cypher查询优化.html │ Neo4J几种数据导入方式的效率对比 - 何源浩的博客 - CSDN博客.html │ Neo4j模糊查询及分页查询 - c1052981766的专栏 - CSDN博客.html │ neo4j笔记 - Neo4j 中文社区.html │ Neo4j语句 - zhuweiba_321的博客 - CSDN博客.html │ Neo4j语句 - 阿里云.html │ 【程裕强的专栏】大数据学习笔记(1.01^365=37.78,0.99^365=0.025.html │ 五岳之巅-Neo4j入门点滴-博文目录.html │ 关于Neo4j和Cypher批量更新和批量插入优化的5个建议 - 逆水行舟 - CSDN博.html │ 图数据库-Neo4j介绍与Cypher入门.html │ 图数据库之Cypher语言 - 活的洒脱怪我咯的专栏 - CSDN博客.html │ 图数据库之neo4j-jdbc的使用 - 活的洒脱怪我咯的专栏 - CSDN博客.html │ 数据分页处理系列之三:Neo4j图数据分页处理.html │ 暖暖动听.html │ 飘涯 - 简书.html
### Neo4j 课程体系与知识图谱教程 #### 构建基于Neo4j知识图谱系统概述 为了满足育需求,一套完整的基于Neo4j的课程资源生成性知识图谱已经被设计出来。该系统旨在通过知识图谱形式将各类育资源、具体知识点以及学习路径紧密结合在一起[^1]。 #### 技术栈介绍 此系统的底层技术依赖于Neo4j图数据库来处理复杂的关系结构,并辅以SQLite用于管理传统的关系型数据。这种组合使得师能够更加便捷地创建并维护学材料中的逻辑关联;对于学生而言,则提供了更清晰的学习框架和支持工具,有助于提高理解效率和记忆效果。 #### 实现细节说明 当涉及到具体的实现方式时,在医疗领域有一个很好的例子——即利用Flask框架配合Neo4j构建了一个大数据背景下的专业知识问答平台。这个项目包含了详细的源代码及其解释文档等内容,展示了如何有效地导入数据至Neo4j中形成可视化图形表示的方法[^2]。 #### Python环境配置指南 针对希望快速上手的朋友来说,可以参照一篇有关Python编程语言下搭建医学专用版知识图谱的文章来进行初步尝试。文中给出了连接本地安装好的Neo4j实例所需的参数设定示例: ```python from py2neo import Graph g = Graph( host="127.0.0.1", # 替换为实际服务器IP地址 http_port=7474, # 默认端口无需修改除非另有指定 user="neo4j", # 初始用户名通常是'neo4j' password="your_password"# 设置自己的密码 ) ``` 上述代码片段展示了怎样初始化一个Graph对象以便后续操作,如查询节点间关系等[^3]。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

浩浩的科研笔记

这我为您答疑发送资源的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值