Announcement Announcement Module
Collapse
No announcement yet.
Cypher Query help Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cypher Query help

    Though the title may be incorrect, I need help with Spring Data.
    I have two entities Policy and City refer to the same NodeEntity 'State' as shown below:

    Code:
    	State riskState; //from Policy
    
    	@Indexed(indexName="cities", indexType=IndexType.SIMPLE, unique=true)
    	String city;
    	State state;
    The following cypher query returns me all the policies that belong to the State 'FL'
    Code:
    START n=node:states(code='FL')
    match n<-[:riskState]-policy
    RETURN policy.policyNumber;
    My understanding is that the relationship name is obtained from the property name - 'riskState' in Policy entity.
    If I apply the same logic for City, the following query did not return any data though I could see the relationships in the Data Browser.
    Code:
    START n=node:states(code='FL')
    match n<-[:state]-city
    RETURN city;
    Could you please explain the reason?
    Thanks

  • #2
    Found out the reason, the state line in Address has extra spaces.
    When I did the following query, it worked.
    START n=node:states(code='FL ')
    match n<-[:state]-city
    RETURN city;

    Have a related question: Is there any annotation available to override the relation name?
    In my case, both address and City have a reference to 'State' with the same property name 'state'. I still want to use the same property.

    Comment


    • #3
      Perhaps add a value.trim() before you store the fields from the UI ?

      You can add
      Code:
      @RelatedTo(type="STATE")
      .

      Thanks for posting the resolution.

      Comment

      Working...
      X