Load the CSV to my Neo4j graph and turn every row to a node.
Build relationship between nodes based on a cosine similarity(above some threshold alpha).
Here is what I have already done for (1):
WITH "https://drive.google.com/u/0/uc?id=1FRi5YmWNQJZ2xeTKNO4b12xYGOTWk1jL&export=download" AS data_url
LOAD CSV WITH HEADERS FROM data_url AS requests
But it returns me an error "Query cannot conclude with LOAD CSV (must be RETURN or an update clause)"
Should I transform the data to be in a long format (with data_key and data_value columns) and use the following:
// For each request (request_id), collect it's attributes into key-value pairs
WITH requests.request_id AS request_id,
COLLECT([requests.data_key, requests.data_value]) AS keyValuePairs
WITH request_id,
apoc.map.fromPairs(keyValuePairs) AS map
// Each request converts to a node with it's attributes:
MERGE (r:Requests {request_id:request_id})
SET r += map
// Show all nodes:
MATCH (n) RETURN n
LOAD CSV returns only the imported data in the output variable.
You need at least a MERGE or CREATE to create nodes. But your suggestion seems a bit too complicated.
The following example shows the minimum needed to merge nodes. But as @ameyasoft mentioned, your column names are very long and since they contain periods and minus signs, they cannot be used directly as property names in your node. It is better to shorten them beforehand and remove the characters that are not allowed. Moreover, the first column should also be given a title or removed if it is not needed.
(You can use these special characters in property names if you encapsulate them with `, but this must then also be used in this way in all subsequent queries and would be too laborious for me).
LOAD CSV WITH HEADERS FROM data_url AS line
MERGE (r:Request { request_id:line.request_id })
SET r = line