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.

Relationships with Properties

I have two labels with a relationship that has one property:

type Match @relation(name: "MATCH") {
from: Company
to: MasterOrg
type: String
}

type MasterOrg {
id: String
name: String
company: [Match]
}

type Company {
permId: Float
name: String
masterOrg: [Match]
entityLink: [EntityLink] @relation(name:"MATCH", direction:OUT)
orionOrg: [OrionOrg] @relation(name:"MATCH", direction:OUT)
iconaOrg: [IconaOrg] @relation(name:"MATCH", direction:OUT)
connectOrg: [ConnectOrg] @relation(name: "MATCH", direction:OUT)
}

I am trying to include the 'MATCH' type in the results. But the query being generated is wrong:

MATCH (company:Company)
WHERE company.name = "Exxon Mobil Corp"
RETURN graphql.labels(company) AS _labels,
company.permId AS permId,
company.name AS name,
head([ (company)-[:HAS_LEI]->(company_lei:Lei) | company_lei {_labels : graphql.labels(company_lei), .value}]) AS lei,
[ (company)-[:MATCH]->(company_entityLink:EntityLink) | company_entityLink {_labels : graphql.labels(company_entityLink), .ticker, .legalName}] AS entityLink,
[ (company)-[:masterOrg]->(company_masterOrg:Match) | company_masterOrg {_labels : graphql.labels(company_masterOrg), .type}] AS masterOrg,
[ (company)-[:MATCH]->(company_orionOrg:OrionOrg) | company_orionOrg {_labels : graphql.labels(company_orionOrg), .id, .name}] AS orionOrg,
[ (company)-[:MATCH]->(company_iconaOrg:IconaOrg) | company_iconaOrg {_labels : graphql.labels(company_iconaOrg), .id, .name}] AS iconaOrg,
[ (company)-[:MATCH]->(company_connectOrg:ConnectOrg) | company_connectOrg {_labels : graphql.labels(company_connectOrg), .id, .name}] AS connectOrg,
head([ (company)<-[:CANONICAL_NAME]-(company_canonical:CompanyName) | company_canonical {_labels : graphql.labels(company_canonical), .value}]) AS canonical,
[ (company)<-[:VARIANT_NAME]-(company_variant:CompanyName) | company_variant {_labels : graphql.labels(company_variant), .value}] AS variant,
head([ (company)-[:INCORPORATED_IN]->(company_countryOfIncorporation:Country) | company_countryOfIncorporation {_labels : graphql.labels(company_countryOfIncorporation), .name, .iso2}]) AS countryOfIncorporation

any insight is greatly appreciated.

1 REPLY 1

MuddyBootsCode
Graph Steward

Do you have the other types of organizations as their own types? That would be required to make this work. So you'd need to also have declared as a type your EntityLink, OrionOrg, etc. in order to return an array of those types.