Setting Metadata○Adding Aliases○Change Entry Type○Change Descendents Entry Type○Change Descendents URL Path○File Listing○Process with Javascript○Using search results
There are a number of other edit capabilities under the Edit->Extended Edit menu.
|
Setting Metadata
Adding Aliases
https://yourramadda.org/repository/a/mydataAn alias is a property and can be added with the entry menu->Add Alias: Alternatively, you can go to entry menu->Add Property and select Add Alias under the Thumbnails, Page Style, Etc., section: If you have a number of entries that you want to add an alias for you can do that through the Extended Edit page: Scroll down to the "Add aliases for children entries" section and provide the template with the ${name} macro. The name will be a cleaned up version (lower case, no spaces, no special characters) of each entry name: Initially no aliases will be added. Select the entries you want an alias for and press "Add aliases to selected entries". If an entry already has an alias then no new alias will be added. If an entry exists somewhere else that has the same alias then the alias won't be added. You can always go and edit any of these aliases through the entry's Edit Properties section.
Change Entry Type
Note: for entries that have special attributes (e.g., Project, Point Data) when you change the type to a different type the special attributes will be deleted.
|
Change Descendents Entry Type
It is best to first see what entries would be changed. Then when satisfied
check on the "Yes, change them" checkbox.
|
Change Descendents URL Path
File Listing
Process with Javascript
if(entry.getName()=='') { entry.setName('This entry has no name'); } else { ctx.print('entry has a name:' + entry.getName()); }
Basic Commands
if (entry.getName().matches('.*Mining Issues.*')) { entry.setName('Some text:' + entry.getName()); ctx.print('Processing: ' + entry.getName()); }The entry.getChildren() returns a list of the entry's children entries. This list can then be iterated on:
var children = entry.getChildren(); for(var i=0;i<children.size();i++) { var child = children.get(i); ctx.print("Child:" + child.getName()); }
Metadata Commands
var size = entry.getColumnValue('size'); if(size!=0) return; size=22; entry.setColumnValue('size',size); ctx.print(entry.getName() +" size:" + size);Here we check if the entry has metadata of a certain type. You can always list the available metadata types at - /repository/metadata/types.html
if(entry.hasMetadata('archive_note')) { ctx.print('Has metadata: '+ entry.getName()); }Here we check if the entry has metadata of a certain type that also has a value of "History" for its first element.
if(entry.hasMetadata('archive_note','History')) { ctx.print('Has metadata: '+ entry.getName()); }Here we are accessing the list of archive_note metadata with first value of "History"
var list = entry.findMetadata('archive_note','History'); ctx.print('Metadata count: '+ entry.getName() +' ' + list.size());Here we are finding the list of metadata and deleting the elements.
As noted this will delete the metadata so it is best to click off the
"Save changes to entries" checkbox first then evaluate the script to
ensure it is doing what you intend
|
var list = entry.findMetadata('archive_note','History'); //Be careful because this will actually delete the metadata //if the Save changes to entries is checked entry.deleteMetadata(list);
Image Commands
//Make a thumbnail and delete the existing one if(entry.isImage()) { entry.makeThumbnail(true); }
LLM Commands
entry.addLLMMetadata('metadata_type','prompt',check_if_exists)metadata_type: The metadata type can be found by going to the Add Properties, looking for the type and looking at the form URL for metadata_type="the type" prompt: The prompt has to be crafted to tell the LLM to only return the text that you desire for the metadata element. If there are multiple metadata elements specify that they should be separated by a semi-colon. You have to be stern sometimes. Something to the effect:
Extract no more than three keywords from the document. Only return the keywords in your response. Do not return anything else except the keyword. If there are multiple keywords then they must be separated by a semi-colon ;A good way of figuring out the prompt to use is to use the Document Chat facility on the entry. Go to the Entry Popup Menu and choose "Document Chat". This is an interactive facility where you can try out the prompt and see the result. Once you have a prompt that gives an acceptable result check_if_exists: true or false. If true check if there already is a metadata on the entry. If there is do not add a new one. For example there is a metadata type "tribe_name". The below call extracts the tribe name from the document
entry.addLLMMetadata('tribe_name', 'Extract the native american tribe names that are mentioned by the document. Only return the tribe names in your response. Do not return anything else except the names. If there are multiple names then they must be separated by a semi-colon ;',true)
Using LLM to add location
entry.addLLMGeo('')The default prompt if one is not given is:
Give the latitude and longitude of the area that this document describes. Just give the 2 numbers, nothing else. Give it in the form <latitude>,<longitude>
Using search results