Cypher Queries
Cypher Queries
Cypher Queries
REQUIRES Blockchain
Ethereum Developer
id: 1001
description: ‘Ethereum is …
embedding: […,…,….]
Vector Index
About the data
• File: titles_and_skills.csv
• Columns: Title, Skills
• File: skills_details.csv
• Columns: ID, Skill, Description, Category
• File: embeddings.csv
• Columns: name, embedding /name of the skill and embedding of a description/
Skill
SpecializedSkill File: skills_details.csv Title
Columns: Category
REQUIRES Blockchain
Ethereum Developer
File: titles_and_skills.csv
Columns: Skills
(connection between Titles and
Skills)
name: ‘Ethereum’
File: skills_details.csv File: titles_and_skills.csv
Columns: ID, Skill, Description id: 1001 Columns: Title
description: ‘Ethereum is …
Cypher Queries
Check import of CSV iles
LOAD CSV WITH HEADERS Load csv ile that has headers
LOAD CSV WITH HEADERS Load csv ile that has headers
MidnightSkyUniverse/udemyNeo4j/master/data/
skills_details.csv'
Assign rows to variable called ‘row’
AS row
Return data from ile for all columns
RETURN row Limit output to 15 elements
LIMIT 15
f
f
f
f
Create Constraints
CREATE CONSTRAINT skillUnique Create constraint with given name
LOAD CSV WITH HEADERS Load csv ile that has headers
MERGE (t:Title {name: row.Title}) Create if not existing nodes with property
‘name’ equal to values in column Title
f
f
Create ‘Skill’ nodes
LOAD CSV WITH HEADERS Load csv ile that has headers
MERGE (s:Skill {name: row.Skill}) Create if not existing nodes with ‘name’ property
SET
SET additional properties for each node:
s.id = row.ID, ‘id’ equals ‘ID’ column
‘description’ equals ‘Description’ column
s.description = row.Description, ‘category’ equals ‘Category’ column
LOAD CSV WITH HEADERS Load csv ile that has headers
SET t.skills = split(row.Skills, '|') For nodes you matched, create property ‘skills’
and store there list of strings. We use split()
command to split one string into a list of strings
where ‘|’ is our separator
f
f
Create relationship between Title and Skill
MERGE (s:Skill {name: skill}) Find all nodes with label ‘Skill’ which property
‘name’ equals elements stored in variable ‘skill’
MERGE (t)-[:REQUIRES]->(s) Create relationship between matched Title and Skill
nodes
MATCH
(s:Skill{category:'SpecializedSkill'})
SET s:Skill:SpecializedSkill
RETURN s.name, labels(s)
LOAD CSV WITH HEADERS Load CSV ile with columns ‘Skill’ and
‘Embedding’ where column
FROM 'https://raw.githubusercontent.com/MidnightSkyUniverse/ ‘Embedding’ contains embeddings of
udemyNeo4j/master/data/embeddings.csv' property ‘description’ of each skill
from our database.
AS row
Search for particular skill among Skill
MATCH (s:Skill {name: row.Skill}) nodes
SHOW INDEXES YIELD id, name, type, state, Check status of the index
INTEGER,
query :: LIST<FLOAT>
) YIELD node, score
THE END