Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 如何查找其embeddedset包含值';x';?_Sql_Graph_Graph Theory_Orientdb_Traversal - Fatal编程技术网

Sql 如何查找其embeddedset包含值';x';?

Sql 如何查找其embeddedset包含值';x';?,sql,graph,graph-theory,orientdb,traversal,Sql,Graph,Graph Theory,Orientdb,Traversal,我有以下图形结构: CREATE CLASS Role EXTENDS V; CREATE CLASS Resource EXTENDS V; CREATE CLASS is_allowed EXTENDS E; CREATE PROPERTY is_allowed.actions EMBEDDEDSET STRING; CREATE EDGE is_allowed FROM #19:1 TO #22:33 CONTENT {'actions':['read', 'write', 'execu

我有以下图形结构:

CREATE CLASS Role EXTENDS V;
CREATE CLASS Resource EXTENDS V;
CREATE CLASS is_allowed EXTENDS E;
CREATE PROPERTY is_allowed.actions EMBEDDEDSET STRING;

CREATE EDGE is_allowed FROM #19:1 TO #22:33 CONTENT {'actions':['read', 'write', 'execute']}
我现在尝试查找具有特定权限的对象,因此我尝试:

SELECT inE('is_allowed')['read' in actions)] FROM Resource WHERE name = 'Some Resource'
SELECT expand(inE('is_allowed')[actions contains 'read']) FROM Resource
SELECT expand(inE('is_allowed')['read'=actions]) FROM Resource
但没有结果,为了检查我的精神是否正常:

SELECT expand(inE('is_allowed')) FROM Resource
我得到了两个显示入站边缘的结果


我查看了这个SO answer(),当它是单个字符串前缀时,可以很容易地过滤边缘,但不确定是否可能,或者在使用嵌入集时如何过滤。

您可以尝试嵌套的SELECT语句:

select from (
    SELECT expand(inE('is_allowed')) FROM Resource
  ) where actions contains "write"
编辑: 如果您需要角色或资源,您可以展开in和out

对于角色:

select expand(out) from (
    SELECT expand(inE('is_allowed')) FROM Resource
  ) where actions contains "read"
资源方面:

select expand(in) from (
    SELECT expand(inE('is_allowed')) FROM Resource
  ) where actions contains "read"

再见,您可以尝试嵌套的SELECT语句:

select from (
    SELECT expand(inE('is_allowed')) FROM Resource
  ) where actions contains "write"
编辑: 如果您需要角色或资源,您可以展开in和out

对于角色:

select expand(out) from (
    SELECT expand(inE('is_allowed')) FROM Resource
  ) where actions contains "read"
资源方面:

select expand(in) from (
    SELECT expand(inE('is_allowed')) FROM Resource
  ) where actions contains "read"

再见

是的,谢谢,这就是我最后要做的,遗憾的是没有扩展我就做不到:(是的,谢谢,这就是我最后要做的,遗憾的是没有扩展我就做不到:(