Neo4j: Unterschied zwischen den Versionen

Aus Claimbase (Testinstanz)
Zur Navigation springen Zur Suche springen
Tinghui Duan (Diskussion | Beiträge)
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 11: Zeile 11:
   -e NEO4J_apoc_import_file_use__neo4j__config=true \
   -e NEO4J_apoc_import_file_use__neo4j__config=true \
   neo4j:latest
   neo4j:latest
</syntaxhighlight>import data in json format<syntaxhighlight lang="cypher">
</syntaxhighlight>import data from json file<syntaxhighlight lang="cypher">
CALL apoc.load.json("file:///locations.json") YIELD value
CALL apoc.load.json("file:///locations.json") YIELD value



Version vom 11. Juni 2025, 19:11 Uhr

run neo4j

docker run \
  --name neo4j \
  -p 7474:7474 -p 7687:7687 \
  -v $HOME/neo4j/data:/data \
  -v $HOME/neo4j/import:/import \
  -e NEO4J_AUTH=neo4j/password \
  -e NEO4JLABS_PLUGINS='["apoc", "graph-data-science"]' \
  -e NEO4J_dbms_security_procedures_unrestricted=gds.*,apoc.* \
  -e NEO4J_apoc_import_file_enabled=true \
  -e NEO4J_apoc_import_file_use__neo4j__config=true \
  neo4j:latest

import data from json file

CALL apoc.load.json("file:///locations.json") YIELD value

// Create the Location node
MERGE (l:Location {id: value.id})
  SET l.name = value.name

// Create Regest nodes and relationships
WITH l, value
UNWIND value.lemmaID AS regestId
MERGE (r:Regest {id: regestId})
MERGE (l)-[:MENTIONED_IN]->(r);