cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

n10s.inference.nodesInCategory: How to define multiple relationships for inCatRel?

Hi all,
I am working with neosemantics nodesInCategory algorithm to drive inferences. I have only seen examples where one relationship label for inCatRel was specified. My problem is, that I have two distinct relationship types that need to be considered for inCatRel (one relationship with label “is_a” and a second relationship with label “belongs_to”). I tried to list the two distinct relationship labels like this – but it doesn’t work:

MATCH (n:Resource {label: “test”}) 
CALL n10s.inference.nodesInCategory(n, {inCatRel, subCatRel: "subClassOf"}) WHERE inCatRel="is_a" XOR "belongs_to" yield node return node

Does anyone have an idea how multiple relationships can be defined for inCatRel? Thanks in advance!

2 REPLIES 2

Hi @johanna, I'm not sure I understand the structure of the graph you describe.
Is it something like this?

(instance1:Instance)-[:belongs_to]->(cat1:Category)-[:is_a]->(parentcat1:Category)-[]->(grandparentCat1:Category)

instances connecting to their class via belongs_to and classes organized hierarchically via is_a ?
Or am I getting it wrong?

Maybe you can post a cypher fragment to recreate a bit of your graph so we can try to reproduce it?

Cheers,

JB.

Hello @jesus.barrasa, it's no good, tha johanna did'nt respond to your question, but today I have the same inquiry. I would like to use n10s for search similar to what n10s documentation says, but more levels deeper then there.

I adopted the example so I have three labels in. I changed the labelNames from "LCSHTopic" which I did not understand to "ScienceTopic" and added "ArtTopic" and "MechTopic". I also changed the Edge-Types from NARROWER_THEN wich I understand neither to PART_OF and added two other (BELONGS_TO and USES).

When I would add some paper ("Work"), maybe called "the beautyness of diamonds... " and link it to the "Jewelry" node then I want to have an search parametrizable which cound list/find this even when one looks for "Crystals and life" if I allow more "hops" then one.

How to do this?
Regards
--jens