-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #197 from wiltshirek/main
Neo4J integration.
- Loading branch information
Showing
15 changed files
with
5,150 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,8 @@ book.txt | |
lightrag-dev/ | ||
.idea/ | ||
dist/ | ||
env/ | ||
local_neo4jWorkDir/ | ||
neo4jWorkDir/ | ||
ignore_this.txt | ||
.venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
FROM debian:bullseye-slim | ||
ENV JAVA_HOME=/opt/java/openjdk | ||
COPY --from=eclipse-temurin:17 $JAVA_HOME $JAVA_HOME | ||
ENV PATH="${JAVA_HOME}/bin:${PATH}" \ | ||
NEO4J_SHA256=7ce97bd9a4348af14df442f00b3dc5085b5983d6f03da643744838c7a1bc8ba7 \ | ||
NEO4J_TARBALL=neo4j-enterprise-5.24.2-unix.tar.gz \ | ||
NEO4J_EDITION=enterprise \ | ||
NEO4J_HOME="/var/lib/neo4j" \ | ||
LANG=C.UTF-8 | ||
ARG NEO4J_URI=https://dist.neo4j.org/neo4j-enterprise-5.24.2-unix.tar.gz | ||
|
||
RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j | ||
|
||
COPY ./local-package/* /startup/ | ||
|
||
RUN apt update \ | ||
&& apt-get install -y curl gcc git jq make procps tini wget \ | ||
&& curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ | ||
&& echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ | ||
&& tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ | ||
&& mv /var/lib/neo4j-* "${NEO4J_HOME}" \ | ||
&& rm ${NEO4J_TARBALL} \ | ||
&& sed -i 's/Package Type:.*/Package Type: docker bullseye/' $NEO4J_HOME/packaging_info \ | ||
&& mv /startup/neo4j-admin-report.sh "${NEO4J_HOME}"/bin/neo4j-admin-report \ | ||
&& mv "${NEO4J_HOME}"/data /data \ | ||
&& mv "${NEO4J_HOME}"/logs /logs \ | ||
&& chown -R neo4j:neo4j /data \ | ||
&& chmod -R 777 /data \ | ||
&& chown -R neo4j:neo4j /logs \ | ||
&& chmod -R 777 /logs \ | ||
&& chown -R neo4j:neo4j "${NEO4J_HOME}" \ | ||
&& chmod -R 777 "${NEO4J_HOME}" \ | ||
&& chmod -R 755 "${NEO4J_HOME}/bin" \ | ||
&& ln -s /data "${NEO4J_HOME}"/data \ | ||
&& ln -s /logs "${NEO4J_HOME}"/logs \ | ||
&& git clone https://github.com/ncopa/su-exec.git \ | ||
&& cd su-exec \ | ||
&& git checkout 4c3bb42b093f14da70d8ab924b487ccfbb1397af \ | ||
&& echo d6c40440609a23483f12eb6295b5191e94baf08298a856bab6e15b10c3b82891 su-exec.c | sha256sum -c \ | ||
&& echo 2a87af245eb125aca9305a0b1025525ac80825590800f047419dc57bba36b334 Makefile | sha256sum -c \ | ||
&& make \ | ||
&& mv /su-exec/su-exec /usr/bin/su-exec \ | ||
&& apt-get -y purge --auto-remove curl gcc git make \ | ||
&& rm -rf /var/lib/apt/lists/* /su-exec | ||
|
||
|
||
ENV PATH "${NEO4J_HOME}"/bin:$PATH | ||
|
||
WORKDIR "${NEO4J_HOME}" | ||
|
||
VOLUME /data /logs | ||
|
||
EXPOSE 7474 7473 7687 | ||
|
||
ENTRYPOINT ["tini", "-g", "--", "/startup/docker-entrypoint.sh"] | ||
CMD ["neo4j"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import networkx as nx | ||
|
||
G = nx.read_graphml('./dickensTestEmbedcall/graph_chunk_entity_relation.graphml') | ||
|
||
def get_all_edges_and_nodes(G): | ||
# Get all edges and their properties | ||
edges_with_properties = [] | ||
for u, v, data in G.edges(data=True): | ||
edges_with_properties.append({ | ||
'start': u, | ||
'end': v, | ||
'label': data.get('label', ''), # Assuming 'label' is used for edge type | ||
'properties': data, | ||
'start_node_properties': G.nodes[u], | ||
'end_node_properties': G.nodes[v] | ||
}) | ||
|
||
return edges_with_properties | ||
|
||
# Example usage | ||
if __name__ == "__main__": | ||
# Assume G is your NetworkX graph loaded from Neo4j | ||
|
||
all_edges = get_all_edges_and_nodes(G) | ||
|
||
# Print all edges and node properties | ||
for edge in all_edges: | ||
print(f"Edge Label: {edge['label']}") | ||
print(f"Edge Properties: {edge['properties']}") | ||
print(f"Start Node: {edge['start']}") | ||
print(f"Start Node Properties: {edge['start_node_properties']}") | ||
print(f"End Node: {edge['end']}") | ||
print(f"End Node Properties: {edge['end_node_properties']}") | ||
print("---") |
Oops, something went wrong.