Getting values of properties one level down of current note - useful for papers

I continue building my knowledge base for papers.
One of the powerful things while learning a new scientific subject is experimentation. There are papers that are good at theory and others that are strong on the experiments. Fruit of that are plots.

When I detect a good plot that could serve for a field trial, I capture that plot in the source note of the paper with a link. Then open a new note with the title of the plot, and a link that I call “essential plots”, which is another note that only collects “essential plots”. The “essential plot” note has a dataview table which just show a collection of those notes. Additionally, the plot note has a property called cover where I insert the link to the plot image. These notes with an attached image serve me later to generate a “Gallery of Essential Plots”.

What this script does is showing the “essential plots” related to the paper, and the number of plots that that paper contributes. The related property is where you label the plot note as “essential plot”:

function getPropertyValue1LD(page, propText) {
// get a property value of inlinks one level 
// down of current page
	let meta = page.file.inlinks.values
		.filter(f => dv.func.contains(dv.page(f.path).related,
			 dv.func.link(propText)))
	return meta
}

let pages = dv.pages('"Sources"')
const propVal = "essential plots"

dv.table(
	["Paper", "Plot name", "NumPlots"],
	pages
		.where(page => page.type == "paper")
		.sort(page => page.file.name, 'asc')
		.map(page => [
				page.file.link, 
				getPropertyValue1LD(page, propVal),
				getPropertyValue1LD(page, propVal).length]
		 )
)

There is only thing that I don’t like about this script: calling the function getPropertyValue1LD twice; once for getting the plot note, and a second time to show the count of essential plots per paper.