cypher - Why Neo4j query is not returning wright data with first query? -


I have a strange problem I do not understand why the Neo4j query is returning different results.

  with Shipper Match (Shipar) & lt; - [: SHIPPED_BY] - (Shipment: activivism) - [: SHIP_TO_CITY] - & gt; (Tocity) & lt; - [: HAS_CITY] - (Toastate: State), ** ((Frames: Vehicles) & lt; - [: HAS_VEHICLE_TYPE] - (Shipment) - [: SHIP_FROM_CITY] - & gt; (FMCT: City) & lt; - [: HAS_CITY] - (FMTT: STATE) ** Returns Shipments, Broken, FMCTI, FrmState, veh  

But doing a little bit change on the query gives me the right result:

< Pre> with Shipper Match (Shipper) - [: SHIPPED_BY] - (Shipment: (Shipment): - [: SHIP_TO_CITY] - & gt; (tocity) & lt; - [: HAS_CITY] - ( Toastate: R JY), (vehicle: vehicle) & lt; - [: HAS_VEHICLE_TYPE] - (shipment) ** MATCH (SHIPMENT) - [: SHIP_FROM_CITY] - & gt; (frmCity: City) & lt; - [: HAS_CITY] - ( FMTT: state) ** REUTUrn shipment, broken, FMCT, FMTT, air

which looks like this

The only difference between the shippers not returned from any returned part is that their purpose is to whistle and Scytis is similar.

UPDATE

It is easy to reproduce,

: ST: State {name: 'ABC'}) - [: HAS_CITY] - & gt; (C: city {name: 'xyz'}) & lt; - [: SHIPPED_FROM] - (Shipment {InternalId: 1}} - [: HAS_VEHICLE_TYPE] - & gt; (VH: Vehicle {name: 'Wahil 1'}), (sh) - [: SHIPPED_TO] - & gt;

Now if I add this question then it will fail

MATCH (shipment: shipment) - [: SHIPPED_TO] - (Tocity) & lt; - [: HAS_CITY] - (Toastate: State) (vehicle: vehicle) & lt; - [: HAS_VEHICLE_TYPE] - (Shipment) - [: SHIPPED_FROM] - & gt; (FMCT: City ) & Lt; - [: HAS_CITY] - (FMTT: State) Return Shipment, Tootty, FMCT, Tiger

I think the problem is that the same state has been repeated twice If I remove it, then it is faster to do the work.

Regards Ray

>

The same city having the same relation with the same state,

Because it is only additional information, you can also pull it out

MATCH (shipments: shipment) - [: SHIPPED_TO] -> (tocity) <- [: HAS_CITY] (toastate: state), (vehicle: vehicle) and [- HAS_VEHICLE_TYPE] - (Shipment) - [: SHIPPED_FROM] - & gt; (FrmCity: City) MATCH (FRMCity) & lt; - [: HAS_CITY] - (frmState: state) Return Shipment, Broken, FMCT, Air

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -