You can query for resources by a special property values. Before that we we will check the schema of the properties tables.
REG_PROPERTY |
||
---|---|---|
REG_ID |
REG_NAME |
REG_VALUE |
REG_RESOURCE_PROPERTY |
|||
---|---|---|---|
REG_PROPERTY_ID |
REG_VERSION |
REG_PATH_ID |
REG_RESOURCE_NAME |
There are two modes that properties are stored.
1. If the properties versioning is set true
(which is the default), the foreign key relationship happens in the following way.
For example, the following query returns one or more resources that have a given property.
SELECT R.REG_PATH_ID, R.REG_NAME FROM REG_RESOURCE R, REG_PROPERTY PP, REG_RESOURCE_PROPERTY RP WHERE R.REG_VERSION=RP.REG_VERSION AND RP.REG_PROPERTY_ID=PP.REG_ID AND PP.REG_NAME=? AND PP.REG_VALUE=?
2. If the versioning properties is set to false
, then the foreign key in focus are:
In this mode, you should write separate queries to retrieve collections and non-collections.
For example, the query below returns one or more non-collections that have a given property.
SELECT R.REG_PATH_ID, R.REG_NAME FROM REG_RESOURCE R, REG_PROPERTY PP, REG_RESOURCE_PROPERTY RP WHERE R.REG_PATH_ID=RP.REG_PATH_ID AND R.REG_NAME=RP.REG_RESOURCE_NAME AND RP.REG_PROPERTY_ID=PP.REG_ID AND PP.REG_NAME=? AND PP.REG_VALUE=?
The following query returns one or more collections that have a given property.
SELECT R.REG_PATH_ID, R.REG_NAME FROM REG_RESOURCE R, REG_PROPERTY PP, REG_RESOURCE_PROPERTY RP WHERE R.REG_PATH_ID=RP.REG_PATH_ID AND R.REG_NAME IS NULL AND RP.REG_RESOURCE_NAME IS NULL AND RP.REG_PROPERTY_ID=PP.REG_ID AND PP.REG_NAME=? AND PP.REG_VALUE=?