Proper @CatDistinct Syntax

Started by Darius1968, December 01, 2018, 10:19:45 AM

Previous topic - Next topic

Darius1968

Consider: 
"@CatDistinct[@All|'_Private Keywords\|_Interests|Photography;@All|'_Private Keywords\|_Interests]"

Outcome:
Nothing!

I'm trying to see all files that are ONLY assigned to the said "Photography" category - nothing in the children, nothing from any other tree.  This VERY SAME category tree structure also occurs within the IMatch "@Keywords" category.  I find that if I remove the category assignment from the branch inside the "@Keywords" category, then that particular file appears in my formula category.  What am I doing wrong?  They're not exactly the same category because one appears under "@All", and the other, under "@Keywords". 

Mario

See Functions and Keywords

@Catdistinct expects one regular expression. What do you want to achieve with the ; and the second category path?

Use two @CatDistinct instead and combine them via AND or OR.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

My quoting the following from the IMatch Help serves as my attempt to explain what I'm trying to achieve: 

""@CatDistinct[@All|Persons|Jenny]"

if Jenny is assigned to at least another category. Since Jenny has been assigned to the "Location|London" category, it is no longer distinctively (exclusively) assigned to "Person|Jenny". The above formula thus returns an empty result!

To overcome such situations, and to tell IMatch things like "Show me all files to which only Jenny is assigned under Persons",  you can add a second argument to the formula. The second argument tells IMatch where to look for categories to determine if a file is distinct.

"@CatDistinct[@All|Persons|Jenny;@All|Persons]"

The red part that follows the ; tells IMatch which categories to consider when determining categories to which Jenny is exclusively assigned. In this example, the expression will return all files under @All|Persons to which only Jenny is assigned. Files assigned to either Max, Abby or John will be removed from the result. If Jenny is assigned to other categories outside @All|Persons this has no influence on the result."

Mario

Have you tried each expression separately as I asked above?
Does your expression return the correct categories, e.g. when you use it with the @Categories formula?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

I've tried both cases for AND and OR , and still, get a zero result set: 
"@CatDistinct[@All|'_Private Keywords|_Interests|Photography]" AND "@CatDistinct[@All|@Keywords|'|'_Private Keywords|_Interests|Photography]"

"@CatDistinct[@All|'_Private Keywords|_Interests|Photography]" OR "@CatDistinct[@All|@Keywords|'|'_Private Keywords|_Interests|Photography]"

Yes, I do get a result set if I use the "@Category" function instead, but it's not what I'm trying to achieve.  There are files assigned to categories that are below "Photography", and I want those excluded, even if they are in addition, assigned to the "Photography" category, itself. 

Mario

Sorry, impossible to diagnose your formula remotely. Please show us your category tree.

Your original formula contains ' in several places. Is this ' part of the category name?

I've made a quick check, with a category hierarchy like this:

Private Keywords
|--_Interests
   |-- Photography

"@Category[@All|Private Keywords|_Interests|Photography]"

Returns all files assigned to that category.

"@CatDistinct[@All|Private Keywords|_Interests|Photography]"

Returns only files exclusively assigned to that category. Which rules out all files which are in one of the standard data-driven categories, e.g. ISO or lens.

"@CatDistinct[@All|Private Keywords|_Interests|Photography;@All|Private Keywords|_Interests|Photography]"

Shows all files exclusively assigned to the bottom category, considering only the "Private Keywords|_Interests|Photography" branch.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

Is there an app available that would let me select a certain node of my category tree, and then generate the tree in text form that I could copy/paste?

For the present, the tree you have generated is fine.  The only difference is that I have that tree also duplicated in my "@Keywords" Category, and that messes things up because IMatch no longer treats it as "CatDistinct", which it isn't, but help indicates that the second clause, after the ";" is what tells IMatch where in the tree structure to look, so that it doesn't even consider nodes outside of that range. 

Mario

QuoteIs there an app available that would let me select a certain node of my category tree, and then generate the tree in text form that I could copy/paste?

<Ctrl>+<C>

Copies the fully-qualified paths of all selected categories into the clipboard. See: Copy and Paste in the category help topic.
This also works int the Media & Folders tree, Collection Tree, the File Window, ...

QuoteFor the present, the tree you have generated is fine.  The only difference is that I have that tree also duplicated in my "@Keywords" Category, and that messes things up because IMatch no longer treats it as "CatDistinct", which it isn't, but help indicates that the second clause, after the ";" is what tells IMatch where in the tree structure to look, so that it doesn't even consider nodes outside of that range. 

The purpose of the @CatDistinct formula is to find files which are only assigned to a specific category, but to no other category. The second parameter allows you to restrict the operation scope of the formula to a specific part of your tree, like "Get files only assigned to this category, but limit the search to this sub-tree". This allows you to ignore @Keywords and other data-driven categories.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

Hopefully, this clarifies my tree structure a bit.  Branch I is the original IMatch category structure.  From this, I use a Metadata Template to copy this original IMatch Category structure to the file's hierarchical keywords, and hence, the special IMatch "@Keywords" Category is populated accordingly (Branch II). 

Branch I: 
@All
'_Private Keywords
'_Private Keywords|_Interests
'_Private Keywords|_Interests|Photography

Branch II: 
@All
@Keywords
@Keywords|'
@Keywords|'|'_Private Keywords
@Keywords|'|'_Private Keywords|_Interests
@Keywords|'|'_Private Keywords|_Interests|Photography

If the tree branch under "@Keywords" is not there, then "@CatDistinct" DOES work as it should, but I run into a problem, having the tree duplicated, under "@Keywords".  I know that "@CatDistinct" is for what it sounds like, finding files residing exclusively in only one category, but I was under the impression that "@CatDistinct[@All|'_Private Keywords|_Interests|Photography;@All|'_Private Keywords|_Interests]" would/should make IMatch think that the duplicate category under "@Keywords" simply does not exist because it wouldn't event consider categories in that/those branches. 


Mario

Do you really use ' in your keywords? Are you sure your regexp matches your actual tree?

As I said, the second regexp in @CatRecurse limits where it searches. It does not find @Keywords or data-driven categories in my test. Assuming the syntax is correct and matches the actual categories.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

Yes, I am indeed using ' at the top level, " '_Private Keywords".  I do this so that when I map it from the IMatch Categories to the @Keywords Category, it is placed at the top of "@Keywords". 

Mario

I suggest you try your regular expression against the category paths in the RegExp tester app to see if they work as intended.

I showed what I did in my test. I have several files assigned to "Photography" but the formula returns two files.
The first is only assigned to "Photography" and the second to "Photography" and "@Keywords|Colorsy|Red". Since I limit my @CatNoRecurse with the second regexp, this is not important and the file still matches the condition. When I assign the "red" file to another category under "Private Keywords|_Interests", in my case "Private Keywords|_Interests|Sport" it no longer matches.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook