This discussion is archived
2 Replies Latest reply: Jan 20, 2013 8:53 PM by BillyVerreynne RSS

oracle 查询算法是树结构的吗

986020 Newbie
Currently Being Moderated
在我的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的查询的算法有关,
可能它查询的算法是树结构的,不是图

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

非常感谢

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points