OrientDB:如何将嵌套层次结构展平为单个记录 [英] OrientDB: How to flatten nested heirarchy into a single record
问题描述
我有一个看起来像这样的结构:
I have a structure that looks something like this:
如何遍历我的页面并取回一个平面记录,以便每一行代表来自根节点及其边缘的所有数据.我的用例是我正在生成一个 csv 文件.
How can I traverse my Page and get back a flat record so that each row represents all of data from the root node and its edges. My use case is that I'm producing a csv file.
所以从上面的例子来看,我想为每个帖子创建一行.每条记录应包含来自帖子、语言名称、页面名称和网络名称的所有字段.
so from the example above, i would like to create a row for each post. Each record should contain all fields from post, the language name, the page name, and the network name.
据我所知,当你进行任何类型的遍历时,它只会给你最终顶点的结果,而不是中间顶点的任何数据.
From what I can tell, when you do any kind of traversal, it only gives you the result of the final vertex and not any data from the vertices in between.
推荐答案
试试这个查询:
select *,out('posted_to').name as page,out('posted_to').out('is_language').name as language,out('posted_to').out('is_network').name as network from <class Post> unwind page,language,network
这篇关于OrientDB:如何将嵌套层次结构展平为单个记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!