所以我正在为一个时间表系统做一个neo4j项目我为数据库创建了所有节点和关系
但是,一旦我尝试创建一个查询,例如某个特定讲师在某个特定时间某某房间获得某个讲座,就不会这样做
这是我用于创建节点和关系的密码文件
CREATE (ServerSideRad:Module{Name:"Server Side Rad"})
CREATE (MobileAppDevelopment:Module{Name:"Mobile APP Development"})
CREATE (GraphTheory:Module{Name:"Graph Theory"})
CREATE (DatabaseManagementSystems:Module{Name:"Database Management Systems"})
CREATE (SoftwareTesting:Module{Name:"Software Testing"})
CREATE (FinalYearProject:Module{Name:"Final Year Project"})
CREATE (GPrefab01:Rooms{Name:"G Prefab01"})
CREATE (GPrefab02:Rooms{Name:"G Prefab02"})
CREATE (GPrefab03:Rooms{Name:"G Prefab03"})
CREATE (GPrefab04:Rooms{Name:"G Prefab04"})
CREATE (GPrefab05:Rooms{Name:"G Prefab05"})
CREATE (GPrefab06:Rooms{Name:"G Prefab06"})
CREATE (GPrefab07:Rooms{Name:"G Prefab07"})
CREATE (GPrefab08:Rooms{Name:"G Prefab08"})
CREATE (GPrefab09:Rooms{Name:"G Prefab09"})
CREATE (GPrefab10:Rooms{Name:"G Prefab10"})
CREATE (GPrefab18:Rooms{Name:"G Prefab18"})
CREATE (GReceptionFoyerNewBuilding:Rooms{Name:"G Reception Foyer New Building"})
CREATE (G0130HydraulicsLab:Rooms{Name:"G0130 Hydraulics Lab"})
CREATE (G0131DissectionLab:Rooms{Name:"G0131 Dissection Lab"})
CREATE (G0141AMTLab:Rooms{Name:"G0141 AMT Lab"})
CREATE (G0143EngSciLab:Rooms{Name:"G0143 Eng Sci Lab"})
CREATE (G0145:Rooms{Name:"G0145"})
CREATE (G0148ConcreteLab:Rooms{Name:"G0148 Concrete Lab"})
CREATE (G0150CivilStructuresLab:Rooms{Name:"G0150 Civil Structures Lab"})
CREATE (G0152EnvironmentalLab:Rooms{Name:"G0152 Environmental Lab"})
CREATE (G0153:Rooms{Name:"G0153"})
CREATE (G0154:Rooms{Name:"G0154"})
CREATE (G0156:Rooms{Name:"G0156"})
CREATE (G0157:Rooms{Name:"G0157"})
CREATE (G0158:Rooms{Name:"G0158"})
CREATE (G0159:Rooms{Name:"G0159"})
CREATE (G0162:Rooms{Name:"G0162"})
CREATE (G0165:Rooms{Name:"G0165"})
CREATE (G0208:Rooms{Name:"G0208"})
CREATE (G0209:Rooms{Name:"G0209"})
CREATE (G0210NimbusLab:Rooms{Name:"G0210 Nimbus Lab"})
CREATE (G0213bBurrenLab:Rooms{Name:"G0213b Burren Lab"})
CREATE (G0215ArannLab:Rooms{Name:"G0215 Arann Lab"})
CREATE (G0217CorribLab:Rooms{Name:"G0217 Corrib Lab"})
CREATE (G0223:Rooms{Name:"G0223"})
CREATE (G0224ComputerandCADLab:Rooms{Name:"G0224 Computer and CAD Lab"})
CREATE (G0225CivilEngProjectRoom:Rooms{Name:"G0225 Civil Eng Project Room"})
CREATE (G0226ProjectRoom:Rooms{Name:"G0226 Project Room"})
CREATE (G0227ComputerandCADLab:Rooms{Name:"G0227 Computer and CAD Lab"})
CREATE (G0228ArchitectualStudio:Rooms{Name:"G0228 Architectual Studio"})
CREATE (G0229ProjectRoom:Rooms{Name:"G0229 Project Room"})
CREATE (G0230ProjectRoom:Rooms{Name:"G0230 Project Room"})
CREATE (G0231b:Rooms{Name:"G0231b"})
CREATE (G0301AquaticEcologyLab:Rooms{Name:"G0301 Aquatic Ecology Lab"})
CREATE (G0304CR6GeneralScienceLab:Rooms{Name:"G0304 CR6 General Science Lab"})
CREATE (G0306BiologyLab:Rooms{Name:"G0306 Biology Lab"})
CREATE (G0309BiologyLab:Rooms{Name:"G0309 Biology Lab"})
CREATE (G0310BiologyLab:Rooms{Name:"G0310 Biology Lab"})
CREATE (G0315aPhysicstLab:Rooms{Name:"G0315a Physicst Lab"})
CREATE (G0315bPhysicstLab:Rooms{Name:"G0315b Physicst Lab"})
CREATE (G0315cPhysicstLab:Rooms{Name:"G0315c Physicst Lab"})
CREATE (G0318AquaticScienceLab:Rooms{Name:"G0318 Aquatic Science Lab"})
CREATE (G0347ExamRoom:Rooms{Name:"G0347 Exam Room"})
CREATE (G0351:Rooms{Name:"G0351"})
CREATE (G0364:Rooms{Name:"G0364"})
CREATE (G0365:Rooms{Name:"G0365"})
CREATE (G0366:Rooms{Name:"G0366"})
CREATE (G0367a:Rooms{Name:"G0367a"})
CREATE (G0367b:Rooms{Name:"G0367b"})
CREATE (G0368:Rooms{Name:"G0368"})
CREATE (G0369:Rooms{Name:"G0369"})
CREATE (G0370:Rooms{Name:"G0370"})
CREATE (G0373:Rooms{Name:"G0373"})
CREATE (G0374:Rooms{Name:"G0374"})
CREATE (G0375:Rooms{Name:"G0375"})
CREATE (G0376:Rooms{Name:"G0376"})
CREATE (G0377:Rooms{Name:"G0377"})
CREATE (G0378:Rooms{Name:"G0378"})
CREATE (G0379:Rooms{Name:"G0379"})
CREATE (G0380:Rooms{Name:"G0380"})
CREATE (G0402BiochemistryLab:Rooms{Name:"G0402 Biochemistry Lab"})
CREATE (G0405BiochemChemistryLab:Rooms{Name:"G0405 BiochemChemistry Lab"})
CREATE (G0411ChromotographyLab:Rooms{Name:"G0411 Chromotography Lab"})
CREATE (G0422ElectroChemLab:Rooms{Name:"G0422 Electro Chem Lab"})
CREATE (G0436CR5:Rooms{Name:"G0436 CR5"})
CREATE (G0450GreyLab:Rooms{Name:"G0450 Grey Lab"})
CREATE (G0451MicrobiologyLab:Rooms{Name:"G0451 Microbiology Lab"})
CREATE (G0470ComputingPracticalLab:Rooms{Name:"G0470 Computing Practical Lab"})
CREATE (G0471MedLab:Rooms{Name:"G0471 Med Lab"})
CREATE (G0475MolecularBiologyLab:Rooms{Name:"G0475 Molecular Biology Lab"})
CREATE (G0476FoodScienceLabWineRoom:Rooms{Name:"G0476 Food Science LabWine Room"})
CREATE (G0478GreenLab:Rooms{Name:"G0478 Green Lab"})
CREATE (G0479BlueLab:Rooms{Name:"G0479 Blue Lab"})
CREATE (G0480CR7:Rooms{Name:"G0480 CR7"})
CREATE (G0481CR4:Rooms{Name:"G0481 CR4"})
CREATE (G0482CR3:Rooms{Name:"G0482 CR3"})
CREATE (G0483CR2:Rooms{Name:"G0483 CR2"})
CREATE (G0484CR1:Rooms{Name:"G0484 CR1"})
CREATE (G0501ElectronicCADLab:Rooms{Name:"G0501 Electronic CAD Lab"})
CREATE (G0502PhysicsLab:Rooms{Name:"G0502 Physics Lab"})
CREATE (G0506ComputerLab:Rooms{Name:"G0506 Computer Lab"})
CREATE (G0507ComputerLab:Rooms{Name:"G0507 Computer Lab"})
CREATE (G0508ComputerLab:Rooms{Name:"G0508 Computer Lab"})
CREATE (G0511Lab:Rooms{Name:"G0511 Lab"})
CREATE (G05267CityofGalwayTrainingRestAndampBar:Rooms{Name:"G05267 City of Galway Training Rest & Bar"})
CREATE (G05267IQBar:Rooms{Name:"G05267 IQ Bar"})
CREATE (G0550Unit6:Rooms{Name:"G0550 Unit 6"})
CREATE (G0552DemoTheatre:Rooms{Name:"G0552 Demo Theatre"})
CREATE (G0559Unit8PastryKitchen:Rooms{Name:"G0559 Unit 8 Pastry Kitchen"})
CREATE (G0560AccommodationandFrontOfficeSuite:Rooms{Name:"G0560 Accommodation and Front Office Suite"})
CREATE (G0602ChemistryLab:Rooms{Name:"G0602 Chemistry Lab"})
CREATE (G0603Lab:Rooms{Name:"G0603 Lab"})
CREATE (G0610OrganicChemistryLab:Rooms{Name:"G0610 Organic Chemistry Lab"})
CREATE (G0615Unit9:Rooms{Name:"G0615 Unit 9"})
CREATE (G0616Unit1:Rooms{Name:"G0616 Unit 1"})
CREATE (G0623Unit3:Rooms{Name:"G0623 Unit 3"})
CREATE (G0625Unit4:Rooms{Name:"G0625 Unit 4"})
CREATE (G0626Unit5:Rooms{Name:"G0626 Unit 5"})
CREATE (G0629MicrobiologyLab:Rooms{Name:"G0629 Microbiology Lab"})
CREATE (G0632RetailLab:Rooms{Name:"G0632 Retail Lab"})
CREATE (G0637Unit:Rooms{Name:"G0637 Unit"})
CREATE (G0701PhysicsLab:Rooms{Name:"G0701 Physics Lab"})
CREATE (G0702PhysicsLab:Rooms{Name:"G0702 Physics Lab"})
CREATE (G0703PhysicsLab:Rooms{Name:"G0703 Physics Lab"})
CREATE (G0704PhysicsLab:Rooms{Name:"G0704 Physics Lab"})
CREATE (G0707CADCAMLab:Rooms{Name:"G0707 CADCAM Lab"})
CREATE (G0724bWS:Rooms{Name:"G0724b WS"})
CREATE (G0724CWSCNCPenFactory:Rooms{Name:"G0724C WS CNCPen Factory"})
CREATE (G0724dEnergyFluidLab:Rooms{Name:"G0724d Energy Fluid Lab"})
CREATE (G0728aGarage:Rooms{Name:"G0728a Garage"})
CREATE (G0731WiringandMotorControlInstallationWorkshop:Rooms{Name:"G0731 Wiring and Motor Control Installation Workshop"})
CREATE (G0736ElectricalandElectronicProjectsLab:Rooms{Name:"G0736 Electrical and Electronic Projects Lab"})
CREATE (G0813ComputerLabPBL:Rooms{Name:"G0813 Computer LabPBL"})
CREATE (G0827ElectronicsLab:Rooms{Name:"G0827 Electronics Lab"})
CREATE (G0828ElectronicsLab:Rooms{Name:"G0828 Electronics Lab"})
CREATE (G0830ElectronicsLab:Rooms{Name:"G0830 Electronics Lab"})
CREATE (G0832ElectronicsLab:Rooms{Name:"G0832 Electronics Lab"})
CREATE (G0834ComputerLabPBL:Rooms{Name:"G0834 Computer LabPBL"})
CREATE (G0835InfoTechnologyComputerLab:Rooms{Name:"G0835 Info Technology Computer Lab"})
CREATE (G0837:Rooms{Name:"G0837"})
CREATE (G0841WineGeeseTrainingBar:Rooms{Name:"G0841 Wine Geese Training Bar"})
CREATE (G0842ConnemaraUpstairsTrainingRest:Rooms{Name:"G0842 Connemara Upstairs Training Rest"})
CREATE (G0843Unit:Rooms{Name:"G0843 Unit"})
CREATE (G0903:Rooms{Name:"G0903"})
CREATE (G0907LanguageLab:Rooms{Name:"G0907 Language Lab"})
CREATE (G0910LanguageLab:Rooms{Name:"G0910 Language Lab"})
CREATE (G0938:Rooms{Name:"G0938"})
CREATE (G0939:Rooms{Name:"G0939"})
CREATE (G0940:Rooms{Name:"G0940"})
CREATE (G0941:Rooms{Name:"G0941"})
CREATE (G0994:Rooms{Name:"G0994"})
CREATE (G0995:Rooms{Name:"G0995"})
CREATE (G0996:Rooms{Name:"G0996"})
CREATE (G0997:Rooms{Name:"G0997"})
CREATE (G1000BlueTheatre:Rooms{Name:"G1000 Blue Theatre"})
CREATE (G1031:Rooms{Name:"G1031"})
CREATE (G1032:Rooms{Name:"G1032"})
CREATE (G1033:Rooms{Name:"G1033"})
CREATE (G1034:Rooms{Name:"G1034"})
CREATE (G1035:Rooms{Name:"G1035"})
CREATE (G1036:Rooms{Name:"G1036"})
CREATE (G1039:Rooms{Name:"G1039"})
CREATE (G1041VideoConferenceRoom:Rooms{Name:"G1041 Video Conference Room"})
CREATE (Monday:Days{Name:"Monday"})
CREATE (Tuesday:Days{Name:"Tuesday"})
CREATE (Wednesday:Days{Name:"Wednesday"})
CREATE (Thursday:Days{Name:"Thursday"})
CREATE (Friday:Days{Name:"Friday"})
CREATE (SoftwareDevelopmentL7Yr3:Courses{Name:"Software Development L7 Yr3"})
CREATE (Slot1:Times{Name:"9am-10Am"})
CREATE (Slot2:Times{Name:"10am-11Am"})
CREATE (Slot3:Times{Name:"11am-12pm"})
CREATE (Slot4:Times{Name:"12pm-1pm"})
CREATE (Slot5:Times{Name:"1pm-2pm"})
CREATE (Slot6:Times{Name:"2pm-3pm"})
CREATE (Slot7:Times{Name:"3pm-4pm"})
CREATE (Slot8:Times{Name:"4pm-5pm"})
CREATE (Slot9:Times{Name:"5pm-6pm"})
CREATE (Slot10:Times{Name:"9am-11Am"})
CREATE (Slot11:Times{Name:"11am-1pm"})
CREATE (Slot12:Times{Name:"1pm-3pm"})
CREATE (Slot13:Times{Name:"3pm-5pm"})
CREATE (Slot14:Times{Name:"10am-12pm"})
CREATE (Slot15:Times{Name:"12pm-2pm"})
CREATE (Slot16:Times{Name:"2pm-4pm"})
CREATE (Slot17:Times{Name:"4pm-6pm"})
CREATE (MartinHynes:Lecturers{Name:"Martin Hynes"})
CREATE (IanMcLoughlin:Lecturers{Name:"Ian McLoughlin"})
CREATE (DamienCostello:Lecturers{Name:"Damien costello"})
CREATE (DeidreODonovan:Lecturers{Name:"Deidre O'Donovan"})
CREATE (GerardHarrison:Lecturers{Name:"Gerard Harrison"})
CREATE (GroupA:Groups{Name:"GroupA"})
CREATE (GroupB:Groups{Name:"GroupB"})
CREATE (GroupC:Groups{Name:"GroupC"})
CREATE (GroupAll:Groups{Name:"All Groups"})
CREATE (Lecture:Lesson{Name:"lecture"})
CREATE (Lab:Lesson{Name:"Lab"})
CREATE(IanMcLoughlin)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupA),
(Lab)-[:IN]->(GPrefab05),
(Lab)-[:AT]->(Slot6),
(Lab)-[:ON]->(Monday),
(Lab)-[:FOR]->(GraphTheory)
CREATE(DeidreODonovan)-[:TEACHES]->(Lecture),
(Lecture)-[:TO]->(GroupAll),
(Lecture)-[:IN]->(G0940),
(Lecture)-[:AT]->(Slot2),
(Lecture)-[:ON]->(Monday),
(Lecture)-[:FOR]->(DatabaseManagementSystems)
CREATE(DamienCostello)-[:TEACHES]->(Lecture),
(Lecture)-[:TO]->(GroupAll),
(Lecture)-[:IN]->(G0223),
(Lecture)-[:AT]->(Slot4),
(Lecture)-[:ON]->(Monday),
(Lecture)-[:FOR]->(MobileAppDevelopment)
CREATE(MartinHynes)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupA),
(Lab)-[:IN]->(G0481CR4),
(Lab)-[:FROM]->(Slot17),
(Lab)-[:ON]->(Monday),
(Lab)-[:FOR]->(SoftwareTesting)
CREATE(GerardHarrison)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupC),
(Lab)-[:IN]->(G0436CR5),
(Lab)-[:AT]->(Slot17),
(Lab)-[:ON]->(Monday),
(Lab)-[:FOR]->(ServerSideRad)
CREATE(MartinHynes)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupC),
(Lab)-[:IN]->(G0436CR5),
(Lab)-[:AT]->(Slot10),
(Lab)-[:ON]->(Tuesday),
(Lab)-[:FOR]->(SoftwareTesting)
CREATE(DeidreODonovan)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupA),
(Lab)-[:IN]->(G0940),
(Lab)-[:AT]->(Slot10),
(Lab)-[:ON]->(Tuesday),
(Lab)-[:FOR]->(DatabaseManagementSystems)
CREATE(DamienCostello)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupA),
(Lab)-[:IN]->(G0470ComputingPracticalLab),
(Lab)-[:AT]->(Slot11),
(Lab)-[:ON]->(Tuesday),
(Lab)-[:FOR]->(MobileAppDevelopment)
CREATE(DeidreODonovan)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupC),
(Lab)-[:IN]->(G0482CR3),
(Lab)-[:AT]->(Slot11),
(Lab)-[:ON]->(Tuesday),
(Lab)-[:FOR]->(DatabaseManagementSystems)
CREATE(IanMcLoughlin)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupB),
(Lab)-[:IN]->(G0379),
(Lab)-[:AT]->(Slot4),
(Lab)-[:ON]->(Tuesday),
(Lab)-[:FOR]->(GraphTheory)
CREATE(MartinHynes)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupB),
(Lab)-[:IN]->(G0436CR5),
(Lab)-[:AT]->(Slot16),
(Lab)-[:ON]->(Tuesday),
(Lab)-[:FOR]->(SoftwareTesting)
CREATE(GerardHarrison)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupC),
(Lab)-[:IN]->(G0436CR5),
(Lab)-[:At]->(Slot17),
(Lab)-[:ON]->(Tuesday),
(Lab)-[:FOR]->(ServerSideRad)
CREATE(IanMcLoughlin)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupC),
(Lab)-[:IN]->(G0162),
(Lab)-[:AT]->(Slot1),
(Lab)-[:ON]->(Wednesday),
(Lab)-[:FOR]->(GraphTheory)
CREATE(IanMcLoughlin)-[:TEACHES]->(Lecture),
(Lecture)-[:TO]->(GroupAll),
(Lecture)-[:IN]->(G0938),
(Lecture)-[:AT]->(Slot2),
(Lecture)-[:ON]->(Wednesday),
(Lecture)-[:FOR]->(GraphTheory)
CREATE(DamienCostello)-[:TEACHES]->(Lecture),
(Lecture)-[:TO]->(GroupAll),
(Lecture)-[:IN]->(G0208),
(Lecture)-[:AT]->(Slot3),
(Lecture)-[:ON]->(Wednesday),
(Lecture)-[:FOR]->(FinalYearProject)
CREATE(GerardHarrison)-[:TEACHES]->(Lecture),
(Lecture)-[:TO]->(GroupAll),
(Lecture)-[:IN]->(G0997),
(Lecture)-[:At]->(Slot5),
(Lecture)-[:ON]->(Wednesday),
(Lecture)-[:FOR]->(ServerSideRad)
CREATE(MartinHynes)-[:TEACHES]->(Lecture),
(Lecture)-[:TO]->(GroupAll),
(Lecture)-[:IN]->(G0939),
(Lecture)-[:AT]->(Slot7),
(Lecture)-[:ON]->(Wednesday),
(Lecture)-[:FOR]->(SoftwareTesting)
CREATE(DeidreODonovan)-[:TEACHES]->(Lecture),
(Lecture)-[:TO]->(GroupAll),
(Lecture)-[:IN]->(G0995),
(Lecture)-[:AT]->(Slot8),
(Lecture)-[:ON]->(Wednesday),
(Lecture)-[:FOR]->(DatabaseManagementSystems)
CREATE(DamienCostello)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupB),
(Lab)-[:IN]->(G0470ComputingPracticalLab),
(Lab)-[:AT]->(Slot10),
(Lab)-[:ON]->(Thursay),
(Lab)-[:FOR]->(MobileAppDevelopment)
CREATE(DamienCostello)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupC),
(Lab)-[:IN]->(G0470ComputingPracticalLab),
(Lab)-[:AT]->(Slot11),
(Lab)-[:ON]->(Thursay),
(Lab)-[:FOR]->(MobileAppDevelopment)
CREATE(DeidreODonovan)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupC),
(Lab)-[:IN]->(G0483CR2),
(Lab)-[:AT]->(Slot16),
(Lab)-[:ON]->(Thursay),
(Lab)-[:FOR]->(DatabaseManagementSystems)
CREATE(GerardHarrison)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupC),
(Lab)-[:IN]->(G0436CR5),
(Lab)-[:At]->(Slot16),
(Lab)-[:ON]->(Thursay),
(Lab)-[:FOR]->(ServerSideRad)
CREATE(DeidreODonovan)-[:TEACHES]->(Lab),
(Lab)-[:TO]->(GroupB),
(Lab)-[:IN]->(G0482CR3),
(Lab)-[:AT]->(Slot10),
(Lab)-[:ON]->(Friday),
(Lab)-[:FOR]->(DatabaseManagementSystems)
CREATE(IanMcLoughlin)-[:TEACHES]->(Lecture),
(Lecture)-[:TO]->(GroupAll),
(Lecture)-[:IN]->(G0208),
(Lecture)-[:AT]->(Slot3),
(Lecture)-[:ON]->(Friday),
(Lecture)-[:FOR]->(GraphTheory)
一旦我加载它。然后尝试查询其中一个关系 像这样
MATCH p=(n:Lecturers{ Name:"Deidre O'Donovan"})-[r:TEACHES]-
(l:Lesson{ Name:"Lab"})-[:ON]->(d:Days{Name:"Tuesday"})-[:IN]->
(h:Rooms{ Name:"G0482 CR3"}) RETURN p
但它会继续给空白屏幕说(没有变化,没有记录) 任何帮助都非常感激,因为我过去两天一直在这里。
答案 0 :(得分:3)
您的主要问题之一是数据创建查询使用的数据模型与您用于第二个查询的数据模型不同。所以,当然第二个查询与任何内容都不匹配。
您的数据创建查询(仅)有2个Lesson
个节点,并且每个关系直接连接到其中一个节点。
在第二个查询中,大多数关系不直接连接到2个Lesson
节点。但是该查询的数据模型也存在很大缺陷,因为每个Rooms
节点与5个Days
节点中的一个节点直接相关,这意味着一旦您遍历到Days
节点,您与当天相关的所有Rooms
个节点都有关系(适用于所有讲师和课程)。你无法分辨任何讲师用于任何课程的房间。
您的数据创建查询中也存在拼写错误。 " Thursay"应该是"星期四"。
因此,您需要确定可行的数据模型并始终如一地使用它。