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

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

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

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

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

文章目录

  • Neo4j 官方网站快速入门新手教精读
    • 1. Learn the basics 基础了解
    • 2. What is a graph? 图是什么?
    • 3. Nodes, properties, relationships 节点,属性,关系
      • 3.1 Nodes and properties 节点和属性
      • 3.2 Relationships 关系
    • 4. Re-imagining a classic (Northwind) 回顾经典图数据集(北风)
    • 5. Finish the Northwind import 完成北风数据集的导入
      • 5.1 Preview your data import 预览导入数据
      • 5.2 Explore your data 探索您的数据
    • 6. Explore your graph 探索你的图
      • 6.1 Searching for data in Explore 在Explore中搜索数据
    • 7. Advanced exploration 先进的展示
    • 8. Basic Querying 基础查询
    • 9. Writing your first query 写你的第一个查询
    • 10. A more advanced query更高级的查询
    • 11. Next steps 下一步
      • 11.1 Next steps with Cypher 关于Cypher语言的下一步
      • 11.2 Creating applications 创建应用
      • 11.3 Go further with GraphAcademy 在GraphAcademy上更近一步
  • 教程中给出的网站汇总
  • 结束

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/

结束

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/502905.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Docker与虚拟机比较

在对比Docker和虚拟机前&#xff0c;先简单了解下虚拟化&#xff0c;明确Docker和虚拟机分别对应的虚拟化级别&#xff0c;然后对Docker和虚拟机进行比较。需要注意的是&#xff0c;Docker和虚拟机并没有什么可比性&#xff0c;而是Docker使用的容器技术和虚拟机使用的虚拟化技…

idea 多模块A模块调用了B模块的Jar包,而非本地源码

1&#xff0c;问题描述 对于多模块的互相调用&#xff0c;比如模块A&#xff0c;模块B&#xff0c;模块C&#xff0c; 这在本地都是可以编辑进行开发的源码&#xff0c; 按理说是模块A可以直接点进模块B的本地源码&#xff0c; 但是不知道什么原因&#xff0c;导致模块A点进…

Java 学习和实践笔记(26):组合(component)的含义以及与继承(extends)的关系

组合的两个作用&#xff1a; 1&#xff09;通过将父类对象作为子类的属性 2&#xff09;通过第1点的作用&#xff0c;实现了代码复用。 示例代码&#xff1a; public class TestComponent {public static void main(String[] args) {Student2 s1 new Student2("jason&…

聚观早报 | 爱奇艺2023年Q4财报;苹果将加大AI投入

聚观早报每日整理最值得关注的行业重点事件&#xff0c;帮助大家及时了解最新行业动态&#xff0c;每日读报&#xff0c;就读聚观365资讯简报。 整理丨Cutie 3月1日消息 爱奇艺2023年Q4财报 苹果将加大AI投入 意大利正与多家车企谈判 多家企业与百度达成合作 比亚迪宋PL…

css 面试 px,rem,em 区别

一、px是决定单位&#xff0c;一旦设置了就无法因为适应页面大小而改变。 二、em和rem 是相对长度单位&#xff0c; 相对于px更具有灵活性&#xff0c;更适用于响应式布局。 三、em是相对于其父元素来设置字体大小的&#xff0c;一般都是以<body>的“font-size”为基准…

MATLAB练习题:排队论问题的模拟

​讲解视频&#xff1a;可以在bilibili搜索《MATLAB教程新手入门篇——数学建模清风主讲》。​ MATLAB教程新手入门篇&#xff08;数学建模清风主讲&#xff0c;适合零基础同学观看&#xff09;_哔哩哔哩_bilibili 下面我们来看一道排队论的题目。假设某银行工作时间内只有一个…

微信小程序 ---- 慕尚花坊 商品管理

商品管理 01. 配置商品管理分包 思路分析&#xff1a; 随着项目功能的增加&#xff0c;项目体积也随着增大&#xff0c;从而影响小程序的加载速度&#xff0c;影响用户的体验。 因此我们需要将 商品列表 和 商品详情 功能配置成一个分包&#xff0c; 当用户在访问设置页面…

labview数组精讲

题主经过写文章一段时间的发现,许多同学对该软件的理解和编程能力是不太一样的,有些知识相对一些同学较为简单,但是有些同学提问就比较困难。那么针对这个问题,题主打算出一期说白话系列的专栏,在该栏目中用最通俗的大白话和例子去让大家深刻了解这个软件的功能和摸透他的…

pikachu之特殊注入之搜索型注入、xx型注入、insert/update注入、delete注入、宽字节注入

一步一脚印&#xff01;&#xff01;&#xff01; 补充&#xff1a;此处为什么不写http请求头注入&#xff0c;因为该注入类型只是换了注入点&#xff0c;语句其他根本没有什么变化 1.搜索型 先尝试输入常用payload&#xff1a; 1 or 11 #。 已经有回显 我们在查看提示 我们…

SpringBoot+Vue+MySQL:装修管理新架构探索

✍✍计算机毕业编程指导师 ⭐⭐个人介绍&#xff1a;自己非常喜欢研究技术问题&#xff01;专业做Java、Python、微信小程序、安卓、大数据、爬虫、Golang、大屏等实战项目。 ⛽⛽实战项目&#xff1a;有源码或者技术上的问题欢迎在评论区一起讨论交流&#xff01; ⚡⚡ Java、…

Educational Codeforces Round 132 (Rated for Div. 2) E. XOR Tree(启发式合并+贪心)

题目 n(n<2e5)个点的树&#xff0c;点i权值ai&#xff08;1<ai<2^30&#xff09; 修改最少的点的权值&#xff0c;使得树上不存在异或和为0的简单路径&#xff0c;输出最少的点数 权值可以被修改成任意正整数&#xff08;可以是无限大&#xff09; 思路来源 官方…

剑指offer面试题28:对称的二叉树

#试题28&#xff1a;对称的二叉树 题目&#xff1a; 请设计一个函数判断一棵二叉树是否 轴对称 。 示例 1&#xff1a; 输入&#xff1a;root [6,7,7,8,9,9,8] 输出&#xff1a;true 解释&#xff1a;从图中可看出树是轴对称的。示例 2&#xff1a; 输入&#xff1a;root …