Query to find the assets that are missing metadata | Adobe Higher Education
Skip to main content
Det här ämnet har stängts för svar.
Bästa svar av MukeshYadav_

Hi @rahulmohan ,

Please find the below query for finding the asset which are not having a specified metadata properties.

 

type=dam:Asset
path=/content/dam/your-project-folder-name
1_property.operation:exists
1_property=jcr:content/metadata/dam:ColorSpace
1_property.value:false
p.limit=-1

 

Above query will fetch all the asset which does not have property dam:ColorSpace  as metadata fields.

 

As you have mentioned you want to search for 10 metadata fields you may use group mechanism. Below is just a reference you may modify as per your requirement. Below query checks for three properties(if any of the three not present it will fetch in the result,  you may twist with or / and  as per requirements)

 

type=dam:Asset
path=/content/dam/your-project-folder-name
group.p.or=true
group.1_property.operation:exists
group.1_property=jcr:content/metadata/dam:ColorSpace
group.1_property.value:false
group.2_property.operation:exists
group.2_property=jcr:content/metadata/dam:Fileformat
group.2_property.value:false
group.3_property.operation:exists
group.3_property=jcr:content/metadata/dc:format
group.3_property.value:false
p.limit=-1

 

Hope this help!

Thanks,

3 svar

diksha_mishra
Community Advisor
Community Advisor
June 13, 2024

@rahulmohan There are 2 ways to achieve this:

1. Create a metadata export by selecting specific folder. This will generate a CSV file of all assets and their metadata. You can filter out blanks.

2. Or run the following query for your folder path containing the assets:

{
"path": "/content/dam/your-folder-path",
"type": "dam:Asset",
"property.operation": "exists",
"property": "jcr:content/metadata",
"property.value": "false",
"p.limit": "-1",
"p.guessTotal": "true"
}

 

Hope this helps.

Adobe Employee
June 14, 2024

Hi ,

If you are looking for assets missing mandatory metadata then :-

I don't think 2 way is correct as when you upload an asset , it extracts embedded metadata in file like dc:title etc , and also some OOTB generated metadata like dam:size , dc:format , dam:sha etc

For checking missing mandatory metadata - > you will need to write a custom logic .

RahulMohanSkribent
Level 3
June 14, 2024

Hi @digarg17 ,
Thanks for the response. If there is a missing metadata, the card shows a 'Required Metadata Missing' flag in the card view. And this is OOB. Do we know how that works? It should be using some property to determine that. Even if we need to write custom logic, would like to know what should be the best way to do it. We have around 10 mandatory fields in our schema and that's where I'm looking for any property that denotes missing metadata rather than checking all the 10 fields.
Thanks,
Rahul

MukeshYadav_
Community Advisor
Community Advisor
June 17, 2024

Hi @rahulmohan ,

Please find the below query for finding the asset which are not having a specified metadata properties.

 

type=dam:Asset
path=/content/dam/your-project-folder-name
1_property.operation:exists
1_property=jcr:content/metadata/dam:ColorSpace
1_property.value:false
p.limit=-1

 

Above query will fetch all the asset which does not have property dam:ColorSpace  as metadata fields.

 

As you have mentioned you want to search for 10 metadata fields you may use group mechanism. Below is just a reference you may modify as per your requirement. Below query checks for three properties(if any of the three not present it will fetch in the result,  you may twist with or / and  as per requirements)

 

type=dam:Asset
path=/content/dam/your-project-folder-name
group.p.or=true
group.1_property.operation:exists
group.1_property=jcr:content/metadata/dam:ColorSpace
group.1_property.value:false
group.2_property.operation:exists
group.2_property=jcr:content/metadata/dam:Fileformat
group.2_property.value:false
group.3_property.operation:exists
group.3_property=jcr:content/metadata/dc:format
group.3_property.value:false
p.limit=-1

 

Hope this help!

Thanks,

MukeshYadav_
Community Advisor
Community Advisor
June 19, 2024

Hi @rahulmohan ,

There can be following two scenario.

  1. Find all images which are missing some property field in the metadata(that property might be custom or added later so some asset might not have those fields(property) in metadata node

For this scenario above reply (in this thread)perfectly match and you can easily fetch the list.

 

      2. Find all the asset with properties fields are present but having empty value (which are not set).

We cannot search for empty property from query builder console so we can write custom java code for query builder and check the length( 0 or empty / blank/ boolean whatever applicable).

However with the help of xPath we can search for empty field

PFA

Example1.

Example 2

Above results are for asset shown shown below

 

Queries:-

/jcr:root/content/dam//*[fn:name()="metadata" and @customproperties= ""]

or 

/jcr:root/content/dam//*[jcr:content/metadata/@customproperties= ""]

or

/jcr:root/content/dam//*[@customproperties= ""]

 

However you can use your project structure path to narrow down the result / query execution time

/jcr:root/content/dam/path-to-projectfolder//*[jcr:content/metadata/@customproperties= ""]

 

Reference:- https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-query-for-property-with-no-value/m-p/294166

 

abhishekanand_
Community Advisor
Community Advisor
June 19, 2024

Hi @rahulmohan 

please specify if there's any metadata property which you are searching for that you don't want to be available because in general if you don't have metadata node for image then that would cause error(at least in my case).

can you specify then probably i can help you with the exact query for the meantime i am posting a query assuming you are searching for a asset which is having a metadata property dc:title and value is exampleAsset

type=dam:Asset
path=/content/dam
property=jcr:content/metadata/dc:title
property.value=exampleAsset

if you are searching for images which don't have a metadata node that would not make much sense.

Abhishek Anand