GraphGists

参加会议既可以带来很多乐趣,也是一个重要的建立人脉的机会,更是一个绝佳的学习体验。但是,选择参加哪些研讨会也可能很困难。会议手册可以通过提供所提供演示文稿的详细描述和演示者的个人简介来帮助您做出选择。但它们也只提供了一种线性方式来查看您的选择:按日期和时间。Neo4j和图数据库允许您通过不同的类别类型、演示者、公司、供应商、房间号等轻松探索会议。

LpaP8IJ

在我们的示例中,我们将输入来自特定会议的数据:2015年年度MOSES有机园艺会议。这是美国关于有机和可持续农业的最大活动。它有160位演讲者、281家公司和135场研讨会和演示。这些活动分布在3天内,有16个房间和45个会议。

这是我们的领域模型

PsBNDs3

示例数据:加载和查看

这是一个MOSES会议演示的示例:“在牧场灌溉是否划算?”这个演示恰好有两位演讲者。其中一位演讲者为两家不同的公司工作。我们还加载了该演示的房间、会议时间、类别和演示类型。

Create (per154:Person {id:154, name:'Tom Kriegl', city:'', state:'', email1:'tskriegl@wisc.edu', email2:'', website:'cdp.wisc.edu', description:'Tom Kriegl recently officially retired as a Farm Financial Analyst at the University of Wisconsin Center For Dairy Profitability where he has been conducting research on the economic competitiveness of dairy systems. He has been the primary researcher in the Wisconsin Grazing Dairy Profitability Analysis and lead researcher in the Great Lakes Grazing Network Dairy Financial Summary.'}),
(per155:Person {id:155, name:'Paul Onan', city:'Amherst Junction', state:'WI', email1:'ponan@wi-net.com', email2:'', website:'', description:'Paul Onan has been dairy farming with grazing as the primary source of forage for his 100-cow milking herd for the past 20 years. He installed a K-line irrigation system in 2009 on his Amherst Junction, Wis. farm to irrigate 30 acres and participated in research to determine its economic feasibility.'}),
(pres19:Presentation {id:19, name:'Does it Pay to Irrigate Pasture Here?', description:'Many dairy and livestock operations use management intensive rotational grazing for controlling feed costs. Yet many believe the cost of irrigation can’t be justified for pasture. Considering that many pastures are dominated by grasses that are not drought tolerant, and we’ve seen a substantial increase in agricultural commodity and input prices since 2006, it’s worth looking at the economic feasibility of irrigating pasture in the Upper Midwest.'}),
(co34:Company {id:34, booth:'', exhibitor:'FALSE', sponsor:'FALSE', name:'Great Lakes Grazing Network Dairy Financial Summary', address:'', phone:'', email:'', website:'', description:''}),
(co99:Company {id:99, booth:'', exhibitor:'FALSE', sponsor:'FALSE', name:'University of Wisconsin Center for Dairy Profitability', address:'', phone:'', email:'', website:'', description:''}),
(co62:Company {id:62, booth:'', exhibitor:'FALSE', sponsor:'FALSE', name:'Onan Dairy Farm', address:'', phone:'', email:'', website:'', description:''}),
(prest2:PresentationType {id:2, name:'Workshops', description:''}),
(rm8:Room {id:8, Name:'Room K'}),
(presceu5:ContinuedEducationType {id:5, ShortName:'SW', name:'Soil & Water Management'}),
(press3:Symbol {id:3, name:'Research Forum', description:'The MOSES Conference will highlight several workshops where researchers, and often the organic farmers that assisted, will present the findings and implications of recent work.'}),
(presct2:CategoryType {id:2, name:'Livestock'}),
(ses10:Session {id:10, Name:'Saturday Session 3', Day:'S', TimeBegin:'3:00 PM', TimeEnd:'4:30 PM'}),
(per154-[:Works_For]->co34),
(per154-[:Works_For]->co99),
(per155-[:Works_For]->co62),
(pres19-[:Presented_By]->per154),
(pres19-[:Presented_By]->per155),
(pres19-[:Is_In_Room]->rm8),
(pres19-[:Is_Presentation_Type]->prest2),
(pres19-[:Is_In_Session]->ses10),
(pres19-[:Is_Category_Type]->presct2),
(pres19-[:Is_CEU_Type]->presceu5),
(pres19-[:Has_Symbol]->press3)

清除数据。

样本数据加载完成后,让我们清除数据以准备最终的数据加载。

清除关系

MATCH ()-[r]-() WITH r LIMIT 1000000 DELETE r

清除节点

MATCH (n) WITH n LIMIT 1000000 DELETE n

创建并加载数据库。(1,727行)

此创建文件太大,无法在此处显示,但您可以查看此处的完整文件。

结果:添加了663个标签,创建了663个节点,设置了6213个属性,创建了1064个关系。


参加您最喜欢的演示类别

假设您对牲畜非常感兴趣。也许您靠牲畜为生。以下是如何确保我们了解并尝试参加所有类别类型为“牲畜”的演示。

MATCH (p:Presentation)-[:Is_Category_Type]->(c:CategoryType {name:'Livestock'}),
      (p)-[:Is_In_Session]->(s:Session),
      (p)-[:Is_In_Room]->(r:Room)
RETURN c.name AS CategoryType, p.name as PresentationName, s.Name as Session, r.Name as Room

牛肉在哪里?

MATCH (p:Presentation)-[:Is_Category_Type]->(c:CategoryType {name:'Livestock'})
RETURN p, c

参加您最喜欢的作者/演讲者/朋友的演示

想象一下,您在会议上参加了第一个会议,演讲者非常棒,您想确保参加他们**所有**的研讨会和会议。也就是说,如果他们真的不止做一个!您疯狂地浏览会议手册,试图阅读每个演示描述底部列出的演讲者姓名。这是一个乏味且容易出错的过程。以下是在Neo4j中执行此操作的简单查询

MATCH (pr:Presentation)-[:Presented_By]->(p:Person {name:'John Jeavons'}),
      (pr)-[:Is_In_Session]->(s:Session),
      (pr)-[:Is_In_Room]->(r:Room)
RETURN p.name as PersonName, pr.name as PresentationName, s.Name as Session, r.Name as Room
Qe3rWF7

哪些演讲者从不闭嘴?

只是开玩笑!(我听说秘诀是穿舒适的鞋子!)
哪些演讲者在会议上需要站起来最多,因为他们提供了最多的**演示**?他们是会议名人,还是您所在行业的思想领袖?您已决定审查他们的**演示**以安排您的时间表。

此查询返回在会议上提供3次或更多**演示**的**人员**。我们还将返回他们工作的**公司**名称,如果他们为多家公司工作,则连接这些名称。

//Which presenters have the most presentations (TABLE)
MATCH (pr:Presentation)-[:Presented_By]->(p:Person)
WITH p, COUNT(*) as Count
WHERE Count > 2
MATCH (p)-[Works_For]->(c:Company)
WITH p, COLLECT(c) as Companies, Count
RETURN p.name as Name, Extract(c in Companies | c.name) as `Company Names`, Count
ORDER BY Count Desc
MATCH (:Presentation)-[:Presented_By]->(p:Person)
WITH p,  COUNT(*) as Count
WHERE Count > 2
MATCH (pr:Presentation)-[Presented_By]->(p)-[:Works_For]->(c:Company)
RETURN pr, p, c

我不知道我的邻居也在这里!

没有什么比旅行数百英里只是为了遇到一个与您住在同一个城镇的人更令人惊奇的了!突然间,您的行业或利基市场并没有您想象的那么小。发现来自您所在地区的供应商、公司和演讲者可以为您创造美好的未来机会。

MATCH (c:Company)
WITH c.city as NCity, c.state as NState, COUNT(*) AS Count
RETURN
   CASE NCity
     WHEN "" THEN "No City Listed"
     ELSE NCity
   END as City,
   CASE NState
      WHEN "" THEN "No State Listed"
      ELSE NState
   END as State, Count
ORDER BY Count DESC

结论

图数据库提供了查看数据的独特机会。

此“探索会议”数据集的未来工作将包括将城市/州数据分解成它们自己的节点。这将允许在图中进行更有趣的遍历,并为连接外部数据提供一个良好的插入点。例如,经度和纬度值将允许针对用户进行距离计算(此供应商离我有多远?),或针对会议位置进行距离计算(谁旅行最远?)。

类别可以应用于**公司**,这将允许用户根据其特定需求或兴趣进行筛选。他们是否还在会议上设有展位?然后您可以将目标定为您的展位访问。