在OrientDb中选择不同的顶点

时间:2016-03-31 12:38:16

标签: orientdb graph-databases nosql

我有一个包含以下数据的数据库:

#18:0   Residence Barberini   (direct from Italia)
#18:1   Santa Prisca          (traversing Roma)

我想提取意大利的所有酒店,可以直接在边缘或在边缘 PartOf 之后间接提取它们,并为每个元素提取PartOf 另一个跟在边缘 In

之后

基本上预期的结果是

select distinct(h) from 
(select in('in') as h from (traverse in('partOf') from #16:0))

我使用了以下查询

#18:0
#18:0, #18:1

我得到以下结果:

#18:0
#18:1   (instead of #18:0, #18:1)

如何才能有效地检索不同的酒店? 预期结果应为

# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log

# OS generated files #
######################
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db

# Editor Files #
################
*~
*.swp

# Gradle Files #
################
.gradle
.m2

# Build output directies #
##########################
/target
*/target
/build
*/build

# IntelliJ specific files/directories #
#######################################
out
.idea
*.ipr
*.iws
*.iml
atlassian-ide-plugin.xml

# Eclipse specific files/directories #
######################################
.classpath
.project
.settings
.metadata

# NetBeans specific files/directories #
#######################################
.nbattrs

谢谢!

1 个答案:

答案 0 :(得分:1)

您可以使用

select distinct(h) from 
(select in('in') as h from (traverse in('partOf') from #16:0) unwind h)