I have a question regarding FLWOR joins. Here's an overview of how my XMLs look like.
<user>
<user-id>...</user-id>
<username>...</username>
<password>...</password>
<!-- By schema file, there could be unbounded role-ids -->
<role-id>...</role-id>
<role-id>...</role-id>
<role-id>...</role-id>
</user>
<role>
<role-id>...</role-id>
<name>...</name>
<!-- By schema file, there could be unbounded permission-ids -->
<permission-id>...</permission-id>
<permission-id>...</permission-id>
<permission-id>...</permission-id>
</role>
<permission>
<permission-id>...</permission-id>
<resource-id>...</resource-id>
<operation-id>...</operation-id>
</permission>
I have a FLWOR expression, query, which should return a sequence of permissions for a given user. It should be simple enough, however I can't figure out why I'm getting an empty ResourceSet every time run the query.
for $i in collection("data/rbac/users")/user[user-id="..."]/role-id
for $j in collection("data/rbac/roles")/roles/role
for $k in collection("data/rbac/permissions")/permission
where $i = $j/role-id and exists($j/permission-id[. = $k/permission-id])
return $k
Any suggestion is much appreciated. Thanks,
Igor
It's hard to tell since the structure of the source XML data isn't completely clear. But there seems to be a small inconsistency - the second line of your XQuery assumes a node named
roles
inside your collectiondata/rbac/roles
. Maybe the second line should look like? Just guessing...