Algorithm filtered on relationship key

Hi,
This is my starting point on my patent database and it works as expected

CALL algo.betweenness.stream("patent", "Reads_On")
YIELD nodeId, centrality
RETURN algo.getNodeById(nodeId).PatNum AS patnum, centrality
ORDER BY centrality DESC

Now I would like to rerun the algorithm but using only a subset of the relationships. The Reads_On was a key property "who" with two possible values "examiner" and "applicant". I am interested in studying the only the cases were the "who" value is "examiner"

My attempt was to include the key filter similar to other cypher commands but that didn't work (I tried variations of quote market around examiner). Always returns an error.

CALL algo.betweenness.stream("patent", "Reads_On{who:examiner}")
YIELD nodeId, centrality
RETURN algo.getNodeById(nodeId).PatNum AS patnum, centrality
ORDER BY centrality DESC

How should this be done?
Thank you in advance.
Andy

You'll need to use a cypher projection to filter on a relationship property:

CALL algo.betweenness.stream(
   'MATCH (p:Patent) return id(p) as id',
   'MATCH (p1:Patent)-[:Reads_On {who:'examiner'}]->(p2:Patent) RETURN id(p1) as source, id(p2) as target',
   {graph:'cypher'})

Hi,
I tried your suggestion, but it returned an error.

Invalid input 'x': expected 'n/N' (line 3, column 41 (offset: 112))
" 'MATCH (p1:Patent)-[:Reads_On {who:'examiner'}]->(p2:Patent) RETURN id(p1) as source, id(p2) as target',"

Andy

I don't know your graph schema -- my snippet was a best guess based on what you had posted; likely there's that there's something funky going on with copy pasting (specifically the ' character) or there's a schema mismatch.

I would work on getting the second query to run on your database and return results, then paste it into the algo call.

Hi Aicia,

I think I got it working with your clue about ' character. I noticed the color coding within Neo Desktop that it was showing examiner in black type surrounded by brown type normal for strings. I changed the ' to " around examiner. As a side note I had already changed patent to all lower case.

Now I need to study it a bit so I understand why it worked.
Thanks
Andy