GraphGists

参加会议可以非常有趣,也是重要的交流机会和极佳的学习体验。但选择参加哪些研讨会也可能很难。会议手册可以通过提供详细的讲座描述和演讲者简介来帮助您选择。但它们通常只能提供一种线性的方式来查看选项:按日期和时间。Neo4j和图数据库让您可以轻松地按不同的类别类型、演讲者、公司、供应商、房间号等来探索会议。

LpaP8IJ

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

这是我们的领域模型

PsBNDs3

示例数据:加载与查看

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

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

结论

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

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

类别可以应用于公司,从而允许用户根据他们的特定需求或兴趣进行筛选。他们是否也在会议上有展位?这样您就可以更有针对性地参观展位。

© . All rights reserved.