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.

Problem with Relationship Property

I have Companies and Assets nodes with a relationship, HAS_ASSET that has a property 'workingInterest':
(c:Company)-[:HAS_ASSET]->(a:Asset)

if I define my schema like so:

Asset {
  assetId: Int
  name: String
  companies: [Company] @relation(name:"HAS_ASSET", direction: IN)
}

type Company {
  name: String
  assets: [Asset] @relation(name: "HAS_ASSET", direction:OUT)
}

all is well except I need the 'workingInterest', so I tried:

Asset {
  assetId: Int
  name: String
  companies: [AssetDetail] 
}

type Company {
  name: String
  assets: [AssetDetail]
}

type AssetDetail @relation(name: "HAS_ASSET") {
    from: Company
    to: Asset
    workingInterest: Float
}

I get an empty array for assets in Company and companies in Asset. Any suggestions on how to debug this would be appreciated.

4 REPLIES 4

William_Lyon
Graph Fellow

Is this with the database plugin or the neo4j-graphql.js library? Can you share the generated Cypher query (should be in the logs).

William,

I just realized I never followed up on this.

I am using the database plugin.

the details from the log:

MATCH (asset:Asset)
RETURN graphql.labels(asset) AS _labels,
asset.assetId AS assetId,
asset.name AS name,
[ (asset)-[:companies]->(asset_companies:AssetDetail) | asset_companies {_labels : graphql.labels(asset_companies), from : head([ (asset_companies)-[:from]->(asset_companies_from:Company) | asset_companies_from {_labels : graphql.labels(asset_companies_from), .name}]), .workingInterest}] AS companies
LIMIT 10

Hi Joshua,
Did you resolve this problem?
I'm facing to the same problem like you used to. Could you help me on this?

Hi, @quan.nguyen @William_Lyon,

We are facing the same issue but for the last two days, I am trying to find proper documentation, a blog, or any sample Github project.

Will you please let me know how you have resolved this issue.