小编Lio*_*ero的帖子

按节点标签与关系查询

我有一个用例,我需要在一个大房间内对人们的轨迹进行分类。

在性能和最佳 Neo4j 实践方面,如果我想对这些数据进行分类以便以后能够使用这些分类的任何类型组合进行搜索/获取,那么哪种选择会更好?

不同的分类是:

  1. 性别男性女性)
  2. 人员类型(员工、客户)
  3. 年龄组(11-20、21-30、31-40 等)

轨迹包含一组点(时间、x、y、motion_type),基本上可以告诉人去了哪里。一个点告诉您在给定时间该人在房间中的确切位置,以及他是在居住、行走还是跑步(这是运动类型)。

例如,获取年龄在 21 到 30 岁之间的女性、客户的所有轨迹

选项1:

// Here I get the set of trajectories that fall within a certain time range (:Trajectory(at) is indexed)
MATCH (trajectory:Trajectory)
WHERE datetime("2020-01-01T00:00:00.000000+13:00") <= trajectory.at < datetime("2020-01-11T00:00:00.000000+13:00")

// Once I have all the trajectories I start filtering by the different criteria
MATCH (trajectory)-[:GENDER]->(:Female)
MATCH (trajectory)-[:PERSON_TYPE]->(:Customer)

// AgeGroup could have quite a lot of groups depending on how accurate the data is. At this stage we …
Run Code Online (Sandbox Code Playgroud)

neo4j graph-databases

6
推荐指数
1
解决办法
63
查看次数

Spring Rest Service @RequestParam required = true 仅当存在另一个 @RequestParam 时

我有以下代码:

@RequestMapping(value = "/test", method = RequestMethod.POST)
public void test(@RequestParam(required= false) String fromDate,
                 @RequestParam(required= false) String toDate) {
}
Run Code Online (Sandbox Code Playgroud)

“规则”是:

  • 如果 fromDate 和 toDate 为空 --> OK
  • 如果 fromDate 有一个值并且 toDate 为空 --> OK
  • 如果 fromDate 和 toDate 有值 --> OK
  • 如果 fromDate 为空并且 toDate 有一个值 --> 不正常

可以使用自定义 Spring 验证来做到这一点吗?

就像是...

@RequestParam(required = false)
@ValidateDependingOnAnotherField(field = "fromDate") String toDate
Run Code Online (Sandbox Code Playgroud)

谢谢!

java validation rest spring

5
推荐指数
0
解决办法
1255
查看次数

标签 统计

graph-databases ×1

java ×1

neo4j ×1

rest ×1

spring ×1

validation ×1