As a convenience, a predicate expression alone (without a Path Matching Pattern), like {isa:Imageable} is shorthand for //*{isa::Imageable} . That is, all prim paths match.
This doesn’t seem to be implemented in 24.05 and such an expression matches nothing. Adding // or //* to the front of the expression will cause it check all prims against the predicate. We’re wondering if this is a bug in the documentation or the implementation.
Following up on my own question, we’ve noticed another anomaly which is that the pattern //* matches all prims, but adding a predicate to it causes the root prim not to be matched. For example, with this USD file:
Hi Jerry – the current implementation differs from the proposal here. The expression {isa:Imageable} is a predicate on a relative prim path. E.g. Sdf.PathExpression('{pred}').MakeAbsolute('/foo/bar').GetText() -> '/foo/bar/{pred}'
The expression //{isa:Imageable} is the right way to match everything that is imageable.
Thanks for the lovely repro case, Jerry – this fails for me the same way. I confess I cheated yesterday by translating the repro into (what should be) an equivalent example at the SdfPathExpression-level, outside of the UsdCollectionAPI. That works fine, so there’s something going wrong between the two. I’ll investigate and report back. Sorry for the trouble!
Thanks for the confirmation. The reason we’re interested in this is because Nuke has its own implementation of CEL that was modified to use the same syntax as the Pattern-based Collections proposal. The intention was to throw this away when USD implemented SdfPathExpression so that we don’t confuse users with slightly different syntax or features. We can make workrounds for these bugs if we know they’re actual bugs and are going to be fixed in the future.
This is what’s intended – // and //* match the same here because // means “everything” and //* means “zero or more levels of hierarchy followed by any prim name”.
The bug was a problem in the evaluator where it would erroneously skip the first match in this case. Thanks again!
It looks like list based collections are not referenceable in pattern based collections.
My question, in line with Jerry’s, is whether this is by design or if it should be possible to reference list based collections in a path expression and both examples above should result in the same set of prim paths?
Hi Diego – it is by design that Relationship-Mode and Pattern-Based collections do not mix in this way. There’s a detailed description in the User Guide
There is a helper function, UsdComputePathExpressionFromCollectionMembershipQueryRuleMap() which takes a Relationship-Mode rule map from a UsdCollectionMembershipQuery and computes an equivalent SdfPathExpression. You can use this to help convert a Relationship-Mode collection to a Pattern-Based collection, so that other Pattern-Based collections can refer to it with the % syntax.