I am new to Neo4j . I am trying to run simple Query but running into some issues which i am not able to figure out . Your help will be appreciated .
When I run following Query
Match(a:Procedure)-[n:PROFESSIONAL_RATE]->(b:RVU)Where NOT n.Modifer="All" RETURN *
why this query does not return any results . where as if I run below Query this will the result
Match(Procedure)-[n:PROFESSIONAL_RATE]->(RVU)Where NOT n.Modifer="All" RETURN *
But if I change return state like
Match(Procedure)-[n:PROFESSIONAL_RATE]->(RVU)Where NOT n.Modifer="All" RETURN Procedure.id
Match(a:Procedure)-[n:PROFESSIONAL_RATE]->(b:RVU)Where NOT n.Modifer="All" RETURN
says find me a node with a label of :Procedure which has a relationship named :PROFESSIONAL_RATE and this relationship is attached to another node which has a lable of :RVU
however the 2nd statement of
Match(Procedure)-[n:PROFESSIONAL_RATE]->(RVU)Where NOT n.Modifer="All" RETURN
says find me ANY node, regardless of label which has a relationship named :PROFESSIONAL_RATE and this relationship is attached to ANY other node, regardless of label.
Match(Procedure)-[n:PROFESSIONAL_RATE]->(RVU)Where NOT n.Modifer="All" RETURN properties(Procedure) return id(Procedure) limit 3
which will return 3 rows and return the internal Neo4j id for the 1st 3 nodes which have this relationship match. then using these 3 values if you then run
match (n) where id(n)= <one of the values of the 3 returned by the first query>
you can then use the Neo4j browser and see that this node does have a relationshi named PROFESSIONAL_RATE and this node has 0 properties.
But in general maybe we are chasing the wrong issue. As a matter of best practices and for best performance generally you should include a label in your match statement.
For example a match (Procedure)..... is going to perform a AllNodesScan which if you have 100 million nodes, we will thus traverse over these 100 million nodes. Whereas as a match (n:Procedure)..... where there are 100 million nodes but only 20k nodes with a label of :Procedure will perform a NodesByLabelScan and thus only interate over the 20k nodes, rather than the 100 million nodes
Then I run following query
match(n) where id(n)=33575 return n
and as you told I got a node with releationship but no properties . What is issue ? Does it mean I have duplicate nodes in DB where some has properties and some does not .
Yes
You have nodes, for example at internal id of 33575, 33577, and 33578 which have a relationship but the node has no properties.
How the nodes got there ??? ????
Dana
I am very new to neo4J less than a week old . I used import to load the data .
USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM "file:///OPTUM_HCPCS_BASE_2019_10_update.tab" AS line
FIELDTERMINATOR '\t'
MERGE(line.HCPCS_CODE:Procedure{id:line.HCPCS_CODE})
ON CREATE SET
p.Short_Desc =line.SHORT_DESCRIPTION,
p.Long_Desc=line.LONG_DESCRIPTION,
p.Full_Desc = line.FULL_DESCRIPTION,
p.Type="HCPCS",
p.Update_Date = Date(),
p.Created_Date = Date()
ON MATCH SET
p.Short_Desc =line.SHORT_DESCRIPTION,
p.Long_Desc=line.LONG_DESCRIPTION,
p.Full_Desc = line.FULL_DESCRIPTION,
p.Update_Date = Date()
I am trying to drop the node but looks like there is relationship created which I don't think it should have with blank node . This is what I have used to create relationship and RVU
USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM "file:///PPRRVU19_JUL.csv" AS line
MATCH(r:Procedure{id:line.HCPCS})
CREATE( p:RVU{
Work_RVU: toint(line.Work_RVU),
Non_FAC_PE_RVU:toint(line.Non_FAC_PE_RVU),
FAC_PE_RVU:toint(line.FAC_PE_RVU),
MP_RVU:toint(line.MP_RVU),
Non_Fac_Total:toint(line.Non_Fac_Total),
Fac_Total:toint(line.Fac_Total),
Status_Code : line.Status_Code,
Medicare_Ind : line.Medicare_Ind,
PCTC :line.PCTC,
Global_Days :line.Global_Days,
Multi_Proc:line.Multi_Proc,
Bilat_Proc:line.Bilat_Proc,
Asst_Surg:line.Asst_Surg,
Co_Surg:line.Co_Surg,
Team_Surg:line.Team_Surg,
Endo_Base:line.Endo_Base,
Cov_Factor:line.Cov_Factor,
Update_Date:Date(),
Created_Date:Date()
})
with p,line
MERGE(r)-[x:PROFESSIONAL_RATE{StartDate:Date(),Enddate:date("2999-12-31"),Modifer:coalesce(line.MOD,"All")}]->(p)
Once again thanks a lot to helping me out in this .