2 Replies Latest reply on Jan 21, 2013 4:53 AM by Billy~Verreynne

# oracle 查询算法是树结构的吗

在我的oracle rdf表中存有这样的关系：？（我就是想查询出三个点 （假设这三个点分别代表三篇文章或者三个人）这三个点之间的关系是a引用b，b引用c，c引用a的这种关系）

Emily is the sisterOf Cathy
Cathy is the sisterOf Jack
Jack is the brotherOf Emily’
其中：
brotherOf is a subproperty of siblingOf.
sisterOf is a subproperty of siblingOf.

SELECT x, y, z
FROM TABLE(SDO_RDF_MATCH(
'(?x:siblingOf ?y)(?y:siblingOf ?z)',
SDO_RDF_Models('family'),
SDO_RDF_Rulebases('RDFS'),
SDO_RDF_Aliases(SDO_RDF_Alias('','http://www.example.org/family/')),
null));
得到结果
x: http://www.example.org/family/Emily y: http://www.example.org/family/Cathy z:http://www.example.org/family/Jack

但这样查询：
SELECT x, y,z
FROM TABLE(SDO_RDF_MATCH(
'(?x:siblingOf ?y)(?y:siblingOf ?z)(?z:siblingOf ?x)',
SDO_RDF_Models('family'),
SDO_RDF_Rulebases('RDFS'),
SDO_RDF_Aliases(SDO_RDF_Alias('','http://www.example.org/family/')),
null));

结果是：
0 rows selected

我觉得可能与oracle的查询的算法有关，
可能它查询的算法是树结构的，不是图

但不知道猜测对不对，你们有遇到类似情况的吗

非常感谢
• ###### 1. Re: oracle 查询算法是树结构的吗
Please don't post junk in the forums.

If you have a question or issue provide your 4 digit Oracle version (result of SELECT * FROM V\$VERSION), describe the problem you are having, what you have tried so far to solve it and the DDL/DML necessary for someone to try to reproduce the problem.
• ###### 2. Re: oracle 查询算法是树结构的吗
There are far east versions of OTN such as:
- https://kr.forums.oracle.com
- https://cn.forums.oracle.com
etc.

Please use the appropriate forum. Thanks.