Home  >  Q&A  >  body text

java - 树结构存储及服务技术选型

有这样一个需求,编写一个通用服务,用户存储树形结构,比如行政区划、商品分类、产业分类等,也可以存储比较大的树,可以查询出整个树、查询某一节点的所有父节点及子节点等。

数据处理方面有两个方向考虑:
一是利用RDBMS,利用邻接表或者路径模型或者更复杂的改进前序遍历模型。
二是使用graph database,相对于结构化的RDBMS更加容易扩展,有同事推荐neo4j。

我的想法是尽量不去使用结构化数据,担心日后修改耗费精力;但是使用NoSQL或者别的非结构化数据库,又缺乏经验。

大家有什么好的想法或者建议。

伊谢尔伦伊谢尔伦2717 days ago320

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 17:44:10

    Stored in elasticsearch, you can query it however you want

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 17:44:10

    Please see the solution at the following link: http://drinkjava2.iteye.com/b... or https://github.com/drinkjava2... Only two extra columns are needed, one column stores the line number and one column Store the depth value and add an end tag at the end, so you can easily use SQL to quickly query, delete, and insert.

    reply
    0
  • Cancelreply