"History&FiguresOfChina(2025)Neo4j Queries"의 두 판 사이의 차이
CNUDH
| 1번째 줄: | 1번째 줄: | ||
| + | __NOTOC__ | ||
<div style="text-align:justify"> | <div style="text-align:justify"> | ||
<font face="나눔바른고딕"> | <font face="나눔바른고딕"> | ||
| 8번째 줄: | 9번째 줄: | ||
</font> | </font> | ||
<br/><br/><br/><br/> | <br/><br/><br/><br/> | ||
| + | |||
| + | =='''<span style="color:#3CB371">생성</span>'''== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:10px; text-align:right; padding:2px 2px 2px;"></div> | ||
| + | <font face="나눔바른고딕 UltraLight"> | ||
| + | <div align="right">{{button|[[History&FiguresOfChina(2025)Neo4j Queries#목차|상단으로 이동]]}}</div><br/> | ||
| + | </font> | ||
| + | <big> | ||
| + | ==='''<span style="color:#3CB371">① 단일 노드 생성</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | [생성된 노드 확인 하기 위해서는 return a〕<br/> | ||
| + | -ex) create (a:label명{gid:'gid명', class:'class명', name:'대표명칭', refurl:'외부정보링크'})<br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''create (a:label명{property명:'property값'})'''</span></big></font> | ||
| + | </big><br/><br/> | ||
| + | |||
| + | ==='''<span style="color:#3CB371">② 특정 라벨(label)의 노드 속성(properties) 및 값(value)을 생성</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | |||
| + | :<font size="4"><big><span style="background:Lavender">'''match (a:label명) set a. property명=“property값”'''</span></big></font> | ||
| + | </big><br/><br/> | ||
| + | |||
| + | ==='''<span style="color:#3CB371">③ 엣지 데이터 생성</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | 〔생성된 엣지 데이터 확인 하기 위해서는 return a, r, b〕 | ||
| + | :<font size="4"><big><span style="background:Lavender">'''match (a{property명:'property값'}) match(b{property명:'property값'})'''</span></big></font><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''create (a) - [r:relation명] -> (b)'''</span></big></font> | ||
| + | </big><br/><br/> | ||
| + | |||
| + | ==='''<span style="color:#3CB371">④ 관계 속성을 지닌 엣지 데이터 생성</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | 〔생성된 엣지 데이터 확인 하기 위해서는 return a, r, b〕 | ||
| + | :<font size="4"><big><span style="background:Lavender">'''match (a{property명:'property값'}) match(b{property명:'property값'})'''</span></big></font><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''create (a) - [r:relation명{property명:'property값'}] -> (b)'''</span></big></font> | ||
| + | </big><br/><br/> | ||
| + | |||
| + | =='''<span style="color:#3CB371">출력:기초</span>'''== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:10px; text-align:right; padding:2px 2px 2px;"></div> | ||
| + | <font face="나눔바른고딕 UltraLight"> | ||
| + | <div align="right">{{button|[[History&FiguresOfChina(2025)Neo4j Queries#목차|상단으로 이동]]}}</div><br/> | ||
| + | </font> | ||
| + | <big> | ||
| + | ==='''<span style="color:#3CB371">① 모든 데이터를 출력</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | Desktop 버전에서는 모든 데이터가 출력되며, AuraDB에서는 Node 데이터만 출력됨.<br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''match (n) return n'''</span></big></font><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''= match (n) return * '''</span></big></font><br/><br/> | ||
| + | AuraDB에서 모든 데이터 출력 쿼리<br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''match (a) optional match (a)-[r]-(b) return a, r, b'''</span></big></font><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''= match (a) optional match (a)-[r]-(b) return *'''</span></big></font> | ||
| + | </big><br/><br/> | ||
| + | |||
| + | ==='''<span style="color:#3CB371">② 관계(relation)를 갖고 있는 모든 데이터를 출력</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''match (a)-[r]-(b) return a, r, b'''</span></big></font><br/> | ||
| + | </big><br/><br/> | ||
| + | |||
| + | ==='''<span style="color:#3CB371">③ 특정 라벨(label)에 속하는 데이터를 출력</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''match (a:label명) return a'''</span></big></font><br/> | ||
| + | </big><br/><br/> | ||
| + | |||
| + | ==='''<span style="color:#3CB371">④ 여러 관계(relation)를 가지고 있는 데이터 출력</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | relation명은 2개 이상 사용 가능 | ||
| + | :<font size="4"><big><span style="background:Lavender">'''match (a:label명)-[r:relation명①|relation명②]-(b) return a, r, b'''</span></big></font><br/> | ||
| + | </big><br/><br/> | ||
| + | |||
| + | =='''<span style="color:#3CB371">출력:관계</span>'''== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:10px; text-align:right; padding:2px 2px 2px;"></div> | ||
| + | <font face="나눔바른고딕 UltraLight"> | ||
| + | <div align="right">{{button|[[History&FiguresOfChina(2025)Neo4j Queries#목차|상단으로 이동]]}}</div><br/> | ||
| + | </font> | ||
| + | <big> | ||
| + | ==='''<span style="color:#3CB371">① 특정 관계(relation)를 갖고 있는 모든 데이터를 출력</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''match (a) -[r:relation명]- (b) return a, r, b'''</span></big></font><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''= match (a:label명)-[r]-(b) where type(r)="relation명" return a, r, b'''</span></big></font><br/><br/> | ||
| + | |||
| + | ==='''<span style="color:#3CB371">② 특정 관계 속성(properties) 값(value)을 기준으로 데이터를 출력</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''match (a) -[r:relation명{property명:'property값'}]- (b) return a, r, b'''</span></big></font><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''= match (a) -[r:relation명]- (b) where r.property명='property값' return a, r, b'''</span></big></font><br/><br/> | ||
| + | |||
| + | ==='''<span style="color:#3CB371">③ 특정 관계 속성(properties) 값(value)이 들어가는 데이터를 출력</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''match (a) -[r]- (b) where r.property명 contains 'property값' return a, r, b'''</span></big></font><br/> | ||
| + | |||
| + | ==='''<span style="color:#3CB371">④ 특정 관계(relation)를 가지지 않는 데이터 출력</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''match (a:label명)-[r]-(b) where not type(r)="relation명" return a, r, b'''</span></big></font><br/> | ||
| + | </big><br/><br/> | ||
| + | |||
| + | |||
| + | =='''<span style="color:#3CB371">출력: 간편하게!</span>'''== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:10px; text-align:right; padding:2px 2px 2px;"></div> | ||
| + | <font face="나눔바른고딕 UltraLight"> | ||
| + | <div align="right">{{button|[[History&FiguresOfChina(2025)Neo4j Queries#목차|상단으로 이동]]}}</div><br/> | ||
| + | </font> | ||
| + | <big> | ||
| + | ==='''<span style="color:#3CB371">① match문에 입력한 변수를 *으로 받기(*: 'all'을 뜻함)</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''match 쿼리 return *'''</span></big></font><br/> | ||
| + | </big><br/><br/> | ||
| + | |||
| + | |||
| + | =='''<span style="color:#3CB371">오름/내림차순</span>'''== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:10px; text-align:right; padding:2px 2px 2px;"></div> | ||
| + | <font face="나눔바른고딕 UltraLight"> | ||
| + | <div align="right">{{button|[[History&FiguresOfChina(2025)Neo4j Queries#목차|상단으로 이동]]}}</div><br/> | ||
| + | </font> | ||
| + | <big> | ||
| + | ==='''<span style="color:#3CB371">① 노드 개수를 오름/내림차순으로 보이기</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | -예시1-1) 교가에 언급된 산의 이름과 언급 횟수를 오름차순으로 출력하라.<br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''match (a:SchoolSong) -[r:mentions] -> (b:Mountain) '''</span></big></font><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''return b.name as 산이름, count(b) as 언급횟수 order by 언급횟수'''</span></big></font><br/><br/> | ||
| + | |||
| + | -예시1-1) 교가에 언급된 산의 이름과 언급 횟수를 오름차순으로 출력하라.<br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''match (a:SchoolSong) -[r:mentions] -> (b:Mountain) '''</span></big></font><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''return b.name as 산이름, count(b) as 언급횟수 order by 언급횟수 desc '''</span></big></font><br/><br/> | ||
| + | </big><br/><br/> | ||
| + | |||
| + | =='''<span style="color:#3CB371">삭제</span>'''== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:10px; text-align:right; padding:2px 2px 2px;"></div> | ||
| + | <font face="나눔바른고딕 UltraLight"> | ||
| + | <div align="right">{{button|[[History&FiguresOfChina(2025)Neo4j Queries#목차|상단으로 이동]]}}</div><br/> | ||
| + | </font> | ||
| + | <big> | ||
| + | ==='''<span style="color:#3CB371">① 특정 라벨(label)의 노드 속성(properties)을 삭제</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''Match (a:label명) remove a. property명 Return a'''</span></big></font><br/><br/> | ||
| + | |||
| + | ==='''<span style="color:#3CB371">② 모든 Node 삭제</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''Match (n) Delete n Return n'''</span></big></font><br/><br/> | ||
| + | |||
| + | ==='''<span style="color:#3CB371">③ 모든 Node와 Edge 삭제</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''Match (n) Detach Delete n Return n'''</span></big></font><br/><br/> | ||
| + | |||
| + | ==='''<span style="color:#3CB371">④ 특정 라벨(label)의 모든 Node 삭제</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''Match (a:label명) Delete a Return a'''</span></big></font><br/><br/> | ||
| + | |||
| + | ==='''<span style="color:#3CB371">⑤ 특정 Edge 삭제</span>'''=== | ||
| + | <div style="float:center; background:#3CB371; width:100%; height:1px; text-align:right; padding:2px 2px 2px;"></div><br/> | ||
| + | :<font size="4"><big><span style="background:Lavender">'''Match (a) – [r:relation명] – (b) Delete r '''</span></big></font><br/><br/> | ||
2025년 12월 8일 (월) 15:31 판
생성
① 단일 노드 생성
[생성된 노드 확인 하기 위해서는 return a〕
-ex) create (a:label명{gid:'gid명', class:'class명', name:'대표명칭', refurl:'외부정보링크'})
- create (a:label명{property명:'property값'})
② 특정 라벨(label)의 노드 속성(properties) 및 값(value)을 생성
- match (a:label명) set a. property명=“property값”
③ 엣지 데이터 생성
〔생성된 엣지 데이터 확인 하기 위해서는 return a, r, b〕
- match (a{property명:'property값'}) match(b{property명:'property값'})
- create (a) - [r:relation명] -> (b)
④ 관계 속성을 지닌 엣지 데이터 생성
〔생성된 엣지 데이터 확인 하기 위해서는 return a, r, b〕
- match (a{property명:'property값'}) match(b{property명:'property값'})
- create (a) - [r:relation명{property명:'property값'}] -> (b)
출력:기초
① 모든 데이터를 출력
Desktop 버전에서는 모든 데이터가 출력되며, AuraDB에서는 Node 데이터만 출력됨.
- match (n) return n
- = match (n) return *
AuraDB에서 모든 데이터 출력 쿼리
- match (a) optional match (a)-[r]-(b) return a, r, b
- = match (a) optional match (a)-[r]-(b) return *
② 관계(relation)를 갖고 있는 모든 데이터를 출력
- match (a)-[r]-(b) return a, r, b
③ 특정 라벨(label)에 속하는 데이터를 출력
- match (a:label명) return a
④ 여러 관계(relation)를 가지고 있는 데이터 출력
relation명은 2개 이상 사용 가능
- match (a:label명)-[r:relation명①|relation명②]-(b) return a, r, b
출력:관계
① 특정 관계(relation)를 갖고 있는 모든 데이터를 출력
- match (a) -[r:relation명]- (b) return a, r, b
- = match (a:label명)-[r]-(b) where type(r)="relation명" return a, r, b
② 특정 관계 속성(properties) 값(value)을 기준으로 데이터를 출력
- match (a) -[r:relation명{property명:'property값'}]- (b) return a, r, b
- = match (a) -[r:relation명]- (b) where r.property명='property값' return a, r, b
③ 특정 관계 속성(properties) 값(value)이 들어가는 데이터를 출력
- match (a) -[r]- (b) where r.property명 contains 'property값' return a, r, b
④ 특정 관계(relation)를 가지지 않는 데이터 출력
- match (a:label명)-[r]-(b) where not type(r)="relation명" return a, r, b
출력: 간편하게!
① match문에 입력한 변수를 *으로 받기(*: 'all'을 뜻함)
- match 쿼리 return *
오름/내림차순
① 노드 개수를 오름/내림차순으로 보이기
-예시1-1) 교가에 언급된 산의 이름과 언급 횟수를 오름차순으로 출력하라.
- match (a:SchoolSong) -[r:mentions] -> (b:Mountain)
- return b.name as 산이름, count(b) as 언급횟수 order by 언급횟수
-예시1-1) 교가에 언급된 산의 이름과 언급 횟수를 오름차순으로 출력하라.
- match (a:SchoolSong) -[r:mentions] -> (b:Mountain)
- return b.name as 산이름, count(b) as 언급횟수 order by 언급횟수 desc
삭제
① 특정 라벨(label)의 노드 속성(properties)을 삭제
- Match (a:label명) remove a. property명 Return a
② 모든 Node 삭제
- Match (n) Delete n Return n
③ 모든 Node와 Edge 삭제
- Match (n) Detach Delete n Return n
④ 특정 라벨(label)의 모든 Node 삭제
- Match (a:label명) Delete a Return a
⑤ 특정 Edge 삭제
- Match (a) – [r:relation명] – (b) Delete r