Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-06-2021 03:33 AM
**Consider hotels in pune. Some hotels provide lodging facilities whereas some provide only restaurant facilities and some provide both.
Query is List the names of hotels having both lodging and restaurant facility
Solved! Go to Solution.
04-12-2021 04:22 AM
your cypher of
MATCH (c:Country)-[:Has]->(s:State),
(p:Product)-[r:produced_across]->(s:State)
where r.pper>r.cper return c.name,p.name
is going to do the following
match (c:Country)-[:Has]->(s:State)
will identify every path from a :Country node to a :State node. this for example might result on 150 paths.(p:Product)-[r:produced_across]->(s:State)
will identify every path from a :Product to a :StateI dont suspect you want step #3 above, though maybe I'm wrong.
Back to your original provided
match(p:Product),(s:State)
where p.name="Sugarcane" and s.name="Berlin"
create(p)-[:produced_across{pper:72,cper:50}]->(s) return p,s
i think your query should simply be
MATCH (p:Product)-[r:produced_across]->(s:State)-[:Has]-(c:Country)
where r.pper>r.cper return c.name,p.name
04-07-2021 02:20 AM
Hello,
More info on your graph model would help people to provide you with an answer.
My guess here would be something like :
MATCH (:Facility{type:"Lodging"})--(n:Hotel)--(:Facility{type:"Restaurant"})
RETURN n
But I could be completely wrong depending on your model.
04-07-2021 11:08 PM
fired above query but returned no rows. so kindly help me to find answer
04-07-2021 11:00 PM
node and relationships are like following
create (h:Hotel{name:"New Poona Cafe",address:"Camp"}) return h
create (h:Hotel{name:"Modern Cafe",address:"Camp"}) return h
create(f:Facility{name:"Lodging"}) return f
create(f:Facility{name:"Restaurant"}) return f
match(h:Hotel),(f:Facility) where h.name="New Poona Cafe" and f.name="Lodging"create (h)-[:provides]->(f) return h,f
match(h:Hotel),(f:Facility) where h.name="New Poona Cafe" and f.name="Restaurant"create (h)-[:provides]->(f) return h,f
match(h:Hotel),(f:Facility) where h.name="Modern Cafe" and f.name="Restaurant"create (h)-[:provides]->(f) return h,f
answer could be: New Poona Cafe
04-07-2021 11:09 PM
Thanks a lot now the query is working very fine I am so thankful to you
04-07-2021 11:20 PM
Kindly help me to find answer of following query
List the countries that do not import and export any product
The database is as follows:
Products are produced across different states in a country . Production of the products is measured in %.A product can be exported if its production exceeds 60%. A product needs to be imported if its consumption percentage is more than its production percentage in a country.
State node and country node are related with has relationship then state produces prodct. the relationship is as follows
match(p:Product),(s:State) where p.name="Sugarcane" and s.name="Berlin" create(p)-[:produced_across{pper:72,cper:50}]->(s) return p,s
Kindly help me to solve above query
04-08-2021 10:43 AM
2 issues
the last update regarding help for writing a query based upon countries and import/export appears to be different then the original problem description of 'How to find intersections'. Ideally each issue should be its own question and not one long never ending question.
you provide details of the relationship and thus
match(p:Product),(s:State) where p.name="Sugarcane" and s.name="Berlin" create(p)-[:produced_across{pper:72,cper:50}]->(s) return p,s
what does 'pper' and 'cper' represent. If I read the above it appears to be create a realtionshop from the Product node which has a name of 'Sugarcane' and the State node which has a name of 'Berlin' and set attributes on the relationship of pper and cper but there is no detail what these paraemters represent
What have you tried so far with reference to solving your query concern?
04-09-2021 12:49 AM
pper is the production percentage and cper is the consumption percentage taken while creating relationship.
04-09-2021 07:42 AM
do you have a base query that gets you for example 90% of the answer.
04-12-2021 12:22 AM
hello,
I have tried following query, Kindly check and help me out
MATCH (c:Country)-[:Has]->(s:State),(p:Product)-[r:produced_across]->(s:State) where r.pper>r.cper return c.name,p.name
04-12-2021 04:22 AM
your cypher of
MATCH (c:Country)-[:Has]->(s:State),
(p:Product)-[r:produced_across]->(s:State)
where r.pper>r.cper return c.name,p.name
is going to do the following
match (c:Country)-[:Has]->(s:State)
will identify every path from a :Country node to a :State node. this for example might result on 150 paths.(p:Product)-[r:produced_across]->(s:State)
will identify every path from a :Product to a :StateI dont suspect you want step #3 above, though maybe I'm wrong.
Back to your original provided
match(p:Product),(s:State)
where p.name="Sugarcane" and s.name="Berlin"
create(p)-[:produced_across{pper:72,cper:50}]->(s) return p,s
i think your query should simply be
MATCH (p:Product)-[r:produced_across]->(s:State)-[:Has]-(c:Country)
where r.pper>r.cper return c.name,p.name
05-19-2021 04:08 AM
Thanks a lot for the answer
All the sessions of the conference are now available online