- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是一系列新问题,以回应 Kenny 对我之前关于如何围绕 24/7 赌场名册建模数据库的问题的回答。
Database model for a 24/7 Staff roster at a casino
仍然试图让我了解图表以及数据是如何遍历/连接的。使用肯尼回答中图像上半部分的时间图,每年是否有 12 个月的节点指向一排日节点,其中有多个日节点,其中第一天的值为 1月?我会为每年构建这些子图,还是会使用特定的查询来添加随着时间的推移不存在的节点?我知道有一个查询可以做到这一点,但它需要考虑月份节点中的最后一天并创建正确的结束关系?我会遇到闰年或夏令时的问题吗?
答案图片的下半部分是游戏节点,他们是否只有一个员工和位置关系?我不确定如何判断哪个员工被分配到哪个表(不向关系边添加属性),我应该向边添加属性还是应该为每对使用单独的节点?
我制作了一个粗略的图像来显示笔/纸花名册的样子,它可能在某种程度上有所帮助。
我也试过用一些问题(红框)来计划一个图表,它是在 illustrator 中完成的,有点凌乱,我很想知道 Kenny 的图形图像是否是在特定应用程序中完成的,如果是,是哪个,虽然我认为图表在视觉上往往会变得困惑和困惑。
您似乎无法单击图像以获取文本可读的直接链接,您可以在此处查看:http://i.imgur.com/FMfJx6G.png
如果有帮助,我可以在此处添加问题文本或使用建议的软件重新创建图表。
最佳答案
这是来自 24/7 Staff roster at a casino 的数据库模型的原始图像:
With the time graph at the top half of the image in Kenny's answer, does each year have 12 month nodes that then point to a row of day nodes where there is more then one day node with a value of 1 for the 1st day in a month?
Would I build these subgraphs for each year or would I use a specific query that adds a node(s) that does not exist as time progresses? I understand there is a query that can do such but it would need to account for the last day in the month node and create the end relationship correct?
// Enter the day you would like to create
WITH { day: 18, month: 1, year: 2014 } as dayMap
// Merge hours in a day
MERGE (thisDay:Day
{
day: dayMap.day,
month: dayMap.month,
year: dayMap.year
})
// Get the first hour in the day (hour 1)
MERGE (firstHour:Hour
{
day: dayMap.day,
month: dayMap.month,
year: dayMap.year,
hour: 1
})
// Connect this day to first hour
CREATE (thisDay)-[:FIRST]->(firstHour)
// For each i in (2-24)
FOREACH (i IN tail(range(1, 24)) |
// Get this hour
MERGE (thishour:Hour
{
day: dayMap.day,
month: dayMap.month,
year: dayMap.year,
hour: i
})
// Get the hour before this hour
MERGE (lasthour:Hour
{
day: dayMap.day,
month: dayMap.month,
year: dayMap.year,
hour: i - 1
})
// Link the hours
CREATE (lasthour)-[:NEXT]->(thishour))
// Get the last hour in the sequence (hour 24)
MERGE (lastHour:Hour
{
day: dayMap.day,
month: dayMap.month,
year: dayMap.year,
hour: 24
})
// Connect this day to the last hour
CREATE (thisDay)-[:LAST]->(lastHour)
Will I have any issues with leap years or daylight savings?
On the lower half of the answer image are the game nodes, do they only have one employee and location relationship? I'm not sure how I could tell which employee is assigned to which table(without adding properties to the relationship edges), should I be adding properties to the edges or should I be using a separate node for each pair?
I've also tried to plan out a graph with some questions(red boxes), it was done in illustrator and got a bit messy, I'd love to know if Kenny's graph image was done in a particular application and if so which one, though I take it graphs visually tend to get tangled and messy.
What staff have been on the floor for 80 minutes or more on a specific day?
// What staff have been on the floor for 80 minutes or more on a specific day?
WITH { day: 18, month: 1, year: 2014 } as dayMap
// The dayMap field acts as a parameter for this script
MATCH (day:Day { day: dayMap.day, month: dayMap.month, year: dayMap.year }),
(day)-[:FIRST|NEXT*]->(hours:Hour),
(hours)<-[:BEGINS]-(game:Game),
(game)<-[:DEALS]-(employee:Employee)
WITH game, employee
ORDER BY game.timestamp DESC
WITH employee, head(collect(game)) as game
MATCH (game)<-[:CONTINUE*]-(games)
WITH employee.firstname as first_name,
employee.lastname as last_name,
SUM(games.interval) as time_on_floor
// Only return results for staff on the floor more than 80 minutes
WHERE time_on_floor > 80
RETURN first_name, last_name, time_on_floor
关于Neo4j - 24/7 赌场名册,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21203743/
我正在构建一个 ejabberd 模块,用于将消息的副本发送到外部 RESTful API。一切正常,对该 API 的请求正在发送带有发件人、收件人和消息正文的 POST 参数。 我为此触发了 use
我正在使用此代码获取用户的在线状态 Roster roster = connection.getRoster(); Presence userPresence = roster.getPr
我是一名优秀的程序员,十分优秀!