trustgraph-flow 0.17.5__tar.gz → 0.17.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/PKG-INFO +2 -2
  2. trustgraph-flow-0.17.7/scripts/triples-query-memgraph +6 -0
  3. trustgraph-flow-0.17.7/scripts/triples-write-memgraph +6 -0
  4. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/setup.py +2 -0
  5. trustgraph-flow-0.17.7/trustgraph/flow_version.py +1 -0
  6. trustgraph-flow-0.17.7/trustgraph/query/triples/memgraph/service.py +357 -0
  7. trustgraph-flow-0.17.7/trustgraph/query/triples/neo4j/__init__.py +3 -0
  8. trustgraph-flow-0.17.7/trustgraph/query/triples/neo4j/__main__.py +7 -0
  9. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/triples/neo4j/service.py +3 -2
  10. trustgraph-flow-0.17.7/trustgraph/storage/triples/memgraph/write.py +252 -0
  11. trustgraph-flow-0.17.7/trustgraph/storage/triples/neo4j/__init__.py +3 -0
  12. trustgraph-flow-0.17.7/trustgraph/storage/triples/neo4j/__main__.py +7 -0
  13. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph_flow.egg-info/PKG-INFO +2 -2
  14. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph_flow.egg-info/SOURCES.txt +8 -0
  15. trustgraph-flow-0.17.5/trustgraph/flow_version.py +0 -1
  16. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/README.md +0 -0
  17. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/agent-manager-react +0 -0
  18. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/api-gateway +0 -0
  19. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/chunker-recursive +0 -0
  20. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/chunker-token +0 -0
  21. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/de-query-milvus +0 -0
  22. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/de-query-pinecone +0 -0
  23. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/de-query-qdrant +0 -0
  24. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/de-write-milvus +0 -0
  25. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/de-write-pinecone +0 -0
  26. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/de-write-qdrant +0 -0
  27. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/document-rag +0 -0
  28. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/embeddings-ollama +0 -0
  29. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/embeddings-vectorize +0 -0
  30. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/ge-query-milvus +0 -0
  31. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/ge-query-pinecone +0 -0
  32. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/ge-query-qdrant +0 -0
  33. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/ge-write-milvus +0 -0
  34. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/ge-write-pinecone +0 -0
  35. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/ge-write-qdrant +0 -0
  36. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/graph-rag +0 -0
  37. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/kg-extract-definitions +0 -0
  38. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/kg-extract-relationships +0 -0
  39. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/kg-extract-topics +0 -0
  40. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/metering +0 -0
  41. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/object-extract-row +0 -0
  42. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/oe-write-milvus +0 -0
  43. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/pdf-decoder +0 -0
  44. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/prompt-generic +0 -0
  45. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/prompt-template +0 -0
  46. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/rows-write-cassandra +0 -0
  47. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/run-processing +0 -0
  48. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/text-completion-azure +0 -0
  49. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/text-completion-azure-openai +0 -0
  50. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/text-completion-claude +0 -0
  51. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/text-completion-cohere +0 -0
  52. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/text-completion-googleaistudio +0 -0
  53. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/text-completion-llamafile +0 -0
  54. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/text-completion-ollama +0 -0
  55. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/text-completion-openai +0 -0
  56. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/triples-query-cassandra +0 -0
  57. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/triples-query-neo4j +0 -0
  58. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/triples-write-cassandra +0 -0
  59. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/triples-write-neo4j +0 -0
  60. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/scripts/wikipedia-lookup +0 -0
  61. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/setup.cfg +0 -0
  62. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/__init__.py +0 -0
  63. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/agent/__init__.py +0 -0
  64. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/agent/react/__init__.py +0 -0
  65. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/agent/react/__main__.py +0 -0
  66. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/agent/react/agent_manager.py +0 -0
  67. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/agent/react/service.py +0 -0
  68. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/agent/react/tools.py +0 -0
  69. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/agent/react/types.py +0 -0
  70. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/__init__.py +0 -0
  71. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/__init__.py +0 -0
  72. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/__main__.py +0 -0
  73. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/agent.py +0 -0
  74. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/auth.py +0 -0
  75. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/dbpedia.py +0 -0
  76. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/embeddings.py +0 -0
  77. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/encyclopedia.py +0 -0
  78. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/endpoint.py +0 -0
  79. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/graph_embeddings_load.py +0 -0
  80. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/graph_embeddings_stream.py +0 -0
  81. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/graph_rag.py +0 -0
  82. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/internet_search.py +0 -0
  83. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/prompt.py +0 -0
  84. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/publisher.py +0 -0
  85. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/running.py +0 -0
  86. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/serialize.py +0 -0
  87. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/service.py +0 -0
  88. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/socket.py +0 -0
  89. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/subscriber.py +0 -0
  90. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/text_completion.py +0 -0
  91. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/triples_load.py +0 -0
  92. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/triples_query.py +0 -0
  93. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/triples_stream.py +0 -0
  94. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/chunking/__init__.py +0 -0
  95. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/chunking/recursive/__init__.py +0 -0
  96. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/chunking/recursive/__main__.py +0 -0
  97. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/chunking/recursive/chunker.py +0 -0
  98. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/chunking/token/__init__.py +0 -0
  99. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/chunking/token/__main__.py +0 -0
  100. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/chunking/token/chunker.py +0 -0
  101. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/decoding/__init__.py +0 -0
  102. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/decoding/pdf/__init__.py +0 -0
  103. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/decoding/pdf/__main__.py +0 -0
  104. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/decoding/pdf/pdf_decoder.py +0 -0
  105. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/direct/__init__.py +0 -0
  106. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/direct/cassandra.py +0 -0
  107. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/direct/milvus_doc_embeddings.py +0 -0
  108. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/direct/milvus_graph_embeddings.py +0 -0
  109. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/direct/milvus_object_embeddings.py +0 -0
  110. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/document_rag.py +0 -0
  111. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/embeddings/__init__.py +0 -0
  112. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/embeddings/ollama/__init__.py +0 -0
  113. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/embeddings/ollama/__main__.py +0 -0
  114. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/embeddings/ollama/processor.py +0 -0
  115. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/embeddings/vectorize/__init__.py +0 -0
  116. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/embeddings/vectorize/__main__.py +0 -0
  117. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/embeddings/vectorize/vectorize.py +0 -0
  118. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/external/__init__.py +0 -0
  119. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/external/wikipedia/__init__.py +0 -0
  120. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/external/wikipedia/__main__.py +0 -0
  121. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/external/wikipedia/service.py +0 -0
  122. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/__init__.py +0 -0
  123. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/__init__.py +0 -0
  124. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/definitions/__init__.py +0 -0
  125. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/definitions/__main__.py +0 -0
  126. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/definitions/extract.py +0 -0
  127. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/relationships/__init__.py +0 -0
  128. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/relationships/__main__.py +0 -0
  129. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/relationships/extract.py +0 -0
  130. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/topics/__init__.py +0 -0
  131. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/topics/__main__.py +0 -0
  132. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/topics/extract.py +0 -0
  133. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/object/__init__.py +0 -0
  134. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/object/row/__init__.py +0 -0
  135. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/object/row/__main__.py +0 -0
  136. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/extract/object/row/extract.py +0 -0
  137. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/graph_rag.py +0 -0
  138. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/metering/__init__.py +0 -0
  139. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/metering/__main__.py +0 -0
  140. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/metering/counter.py +0 -0
  141. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/metering/pricelist.py +0 -0
  142. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/__init__.py +0 -0
  143. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/__init__.py +0 -0
  144. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/generic/__init__.py +0 -0
  145. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/generic/__main__.py +0 -0
  146. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/generic/prompts.py +0 -0
  147. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/generic/service.py +0 -0
  148. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/template/__init__.py +0 -0
  149. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/template/__main__.py +0 -0
  150. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/template/prompt_manager.py +0 -0
  151. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/template/service.py +0 -0
  152. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/__init__.py +0 -0
  153. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/azure/__init__.py +0 -0
  154. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/azure/__main__.py +0 -0
  155. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/azure/llm.py +0 -0
  156. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/azure_openai/__init__.py +0 -0
  157. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/azure_openai/__main__.py +0 -0
  158. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/azure_openai/llm.py +0 -0
  159. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/claude/__init__.py +0 -0
  160. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/claude/__main__.py +0 -0
  161. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/claude/llm.py +0 -0
  162. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/cohere/__init__.py +0 -0
  163. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/cohere/__main__.py +0 -0
  164. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/cohere/llm.py +0 -0
  165. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/googleaistudio/__init__.py +0 -0
  166. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/googleaistudio/__main__.py +0 -0
  167. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/googleaistudio/llm.py +0 -0
  168. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/llamafile/__init__.py +0 -0
  169. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/llamafile/__main__.py +0 -0
  170. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/llamafile/llm.py +0 -0
  171. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/ollama/__init__.py +0 -0
  172. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/ollama/__main__.py +0 -0
  173. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/ollama/llm.py +0 -0
  174. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/openai/__init__.py +0 -0
  175. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/openai/__main__.py +0 -0
  176. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/openai/llm.py +0 -0
  177. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/processing/__init__.py +0 -0
  178. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/processing/__main__.py +0 -0
  179. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/processing/processing.py +0 -0
  180. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/__init__.py +0 -0
  181. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/__init__.py +0 -0
  182. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/milvus/__init__.py +0 -0
  183. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/milvus/__main__.py +0 -0
  184. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/milvus/service.py +0 -0
  185. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/pinecone/__init__.py +0 -0
  186. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/pinecone/__main__.py +0 -0
  187. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/pinecone/service.py +0 -0
  188. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/qdrant/__init__.py +0 -0
  189. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/qdrant/__main__.py +0 -0
  190. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/qdrant/service.py +0 -0
  191. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/__init__.py +0 -0
  192. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/milvus/__init__.py +0 -0
  193. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/milvus/__main__.py +0 -0
  194. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/milvus/service.py +0 -0
  195. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/pinecone/__init__.py +0 -0
  196. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/pinecone/__main__.py +0 -0
  197. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/pinecone/service.py +0 -0
  198. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/qdrant/__init__.py +0 -0
  199. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/qdrant/__main__.py +0 -0
  200. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/qdrant/service.py +0 -0
  201. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/triples/__init__.py +0 -0
  202. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/triples/cassandra/__init__.py +0 -0
  203. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/triples/cassandra/__main__.py +0 -0
  204. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/query/triples/cassandra/service.py +0 -0
  205. {trustgraph-flow-0.17.5/trustgraph/query/triples/neo4j → trustgraph-flow-0.17.7/trustgraph/query/triples/memgraph}/__init__.py +0 -0
  206. {trustgraph-flow-0.17.5/trustgraph/query/triples/neo4j → trustgraph-flow-0.17.7/trustgraph/query/triples/memgraph}/__main__.py +0 -0
  207. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/retrieval/__init__.py +0 -0
  208. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/retrieval/document_rag/__init__.py +0 -0
  209. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/retrieval/document_rag/__main__.py +0 -0
  210. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/retrieval/document_rag/rag.py +0 -0
  211. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/retrieval/graph_rag/__init__.py +0 -0
  212. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/retrieval/graph_rag/__main__.py +0 -0
  213. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/retrieval/graph_rag/rag.py +0 -0
  214. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/__init__.py +0 -0
  215. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/__init__.py +0 -0
  216. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/milvus/__init__.py +0 -0
  217. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/milvus/__main__.py +0 -0
  218. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/milvus/write.py +0 -0
  219. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/pinecone/__init__.py +0 -0
  220. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/pinecone/__main__.py +0 -0
  221. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/pinecone/write.py +0 -0
  222. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/qdrant/__init__.py +0 -0
  223. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/qdrant/__main__.py +0 -0
  224. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/qdrant/write.py +0 -0
  225. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/__init__.py +0 -0
  226. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/milvus/__init__.py +0 -0
  227. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/milvus/__main__.py +0 -0
  228. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/milvus/write.py +0 -0
  229. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/pinecone/__init__.py +0 -0
  230. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/pinecone/__main__.py +0 -0
  231. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/pinecone/write.py +0 -0
  232. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/qdrant/__init__.py +0 -0
  233. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/qdrant/__main__.py +0 -0
  234. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/qdrant/write.py +0 -0
  235. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/object_embeddings/__init__.py +0 -0
  236. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/object_embeddings/milvus/__init__.py +0 -0
  237. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/object_embeddings/milvus/__main__.py +0 -0
  238. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/object_embeddings/milvus/write.py +0 -0
  239. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/rows/__init__.py +0 -0
  240. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/rows/cassandra/__init__.py +0 -0
  241. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/rows/cassandra/__main__.py +0 -0
  242. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/rows/cassandra/write.py +0 -0
  243. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/triples/__init__.py +0 -0
  244. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/triples/cassandra/__init__.py +0 -0
  245. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/triples/cassandra/__main__.py +0 -0
  246. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/triples/cassandra/write.py +0 -0
  247. {trustgraph-flow-0.17.5/trustgraph/storage/triples/neo4j → trustgraph-flow-0.17.7/trustgraph/storage/triples/memgraph}/__init__.py +0 -0
  248. {trustgraph-flow-0.17.5/trustgraph/storage/triples/neo4j → trustgraph-flow-0.17.7/trustgraph/storage/triples/memgraph}/__main__.py +0 -0
  249. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph/storage/triples/neo4j/write.py +0 -0
  250. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph_flow.egg-info/dependency_links.txt +0 -0
  251. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph_flow.egg-info/requires.txt +0 -0
  252. {trustgraph-flow-0.17.5 → trustgraph-flow-0.17.7}/trustgraph_flow.egg-info/top_level.txt +0 -0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trustgraph-flow
3
- Version: 0.17.5
3
+ Version: 0.17.7
4
4
  Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
5
5
  Home-page: https://github.com/trustgraph-ai/trustgraph
6
6
  Author: trustgraph.ai
7
7
  Author-email: security@trustgraph.ai
8
8
  License: UNKNOWN
9
- Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.17.5.tar.gz
9
+ Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.17.7.tar.gz
10
10
  Platform: UNKNOWN
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env python3
2
+
3
+ from trustgraph.query.triples.memgraph import run
4
+
5
+ run()
6
+
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env python3
2
+
3
+ from trustgraph.storage.triples.memgraph import run
4
+
5
+ run()
6
+
@@ -103,8 +103,10 @@ setuptools.setup(
103
103
  "scripts/text-completion-openai",
104
104
  "scripts/triples-query-cassandra",
105
105
  "scripts/triples-query-neo4j",
106
+ "scripts/triples-query-memgraph",
106
107
  "scripts/triples-write-cassandra",
107
108
  "scripts/triples-write-neo4j",
109
+ "scripts/triples-write-memgraph",
108
110
  "scripts/wikipedia-lookup",
109
111
  ]
110
112
  )
@@ -0,0 +1 @@
1
+ __version__ = "0.17.7"
@@ -0,0 +1,357 @@
1
+
2
+ """
3
+ Triples query service for memgraph.
4
+ Input is a (s, p, o) triple, some values may be null. Output is a list of
5
+ triples.
6
+ """
7
+
8
+ from neo4j import GraphDatabase
9
+
10
+ from .... schema import TriplesQueryRequest, TriplesQueryResponse, Error
11
+ from .... schema import Value, Triple
12
+ from .... schema import triples_request_queue
13
+ from .... schema import triples_response_queue
14
+ from .... base import ConsumerProducer
15
+
16
+ module = ".".join(__name__.split(".")[1:-1])
17
+
18
+ default_input_queue = triples_request_queue
19
+ default_output_queue = triples_response_queue
20
+ default_subscriber = module
21
+
22
+ default_graph_host = 'bolt://memgraph:7687'
23
+ default_username = 'memgraph'
24
+ default_password = 'password'
25
+ default_database = 'memgraph'
26
+
27
+ class Processor(ConsumerProducer):
28
+
29
+ def __init__(self, **params):
30
+
31
+ input_queue = params.get("input_queue", default_input_queue)
32
+ output_queue = params.get("output_queue", default_output_queue)
33
+ subscriber = params.get("subscriber", default_subscriber)
34
+ graph_host = params.get("graph_host", default_graph_host)
35
+ username = params.get("username", default_username)
36
+ password = params.get("password", default_password)
37
+ database = params.get("database", default_database)
38
+
39
+ super(Processor, self).__init__(
40
+ **params | {
41
+ "input_queue": input_queue,
42
+ "output_queue": output_queue,
43
+ "subscriber": subscriber,
44
+ "input_schema": TriplesQueryRequest,
45
+ "output_schema": TriplesQueryResponse,
46
+ "graph_host": graph_host,
47
+ }
48
+ )
49
+
50
+ self.db = database
51
+
52
+ self.io = GraphDatabase.driver(graph_host, auth=(username, password))
53
+
54
+ def create_value(self, ent):
55
+
56
+ if ent.startswith("http://") or ent.startswith("https://"):
57
+ return Value(value=ent, is_uri=True)
58
+ else:
59
+ return Value(value=ent, is_uri=False)
60
+
61
+ def handle(self, msg):
62
+
63
+ try:
64
+
65
+ v = msg.value()
66
+
67
+ # Sender-produced ID
68
+ id = msg.properties()["id"]
69
+
70
+ print(f"Handling input {id}...", flush=True)
71
+
72
+ triples = []
73
+
74
+ if v.s is not None:
75
+ if v.p is not None:
76
+ if v.o is not None:
77
+
78
+ # SPO
79
+
80
+ records, summary, keys = self.io.execute_query(
81
+ "MATCH (src:Node {uri: $src})-[rel:Rel {uri: $rel}]->(dest:Literal {value: $value}) "
82
+ "RETURN $src as src",
83
+ src=v.s.value, rel=v.p.value, value=v.o.value,
84
+ database_=self.db,
85
+ )
86
+
87
+ for rec in records:
88
+ triples.append((v.s.value, v.p.value, v.o.value))
89
+
90
+ records, summary, keys = self.io.execute_query(
91
+ "MATCH (src:Node {uri: $src})-[rel:Rel {uri: $rel}]->(dest:Node {uri: $uri}) "
92
+ "RETURN $src as src",
93
+ src=v.s.value, rel=v.p.value, uri=v.o.value,
94
+ database_=self.db,
95
+ )
96
+
97
+ for rec in records:
98
+ triples.append((v.s.value, v.p.value, v.o.value))
99
+
100
+ else:
101
+
102
+ # SP
103
+
104
+ records, summary, keys = self.io.execute_query(
105
+ "MATCH (src:Node {uri: $src})-[rel:Rel {uri: $rel}]->(dest:Literal) "
106
+ "RETURN dest.value as dest",
107
+ src=v.s.value, rel=v.p.value,
108
+ database_=self.db,
109
+ )
110
+
111
+ for rec in records:
112
+ data = rec.data()
113
+ triples.append((v.s.value, v.p.value, data["dest"]))
114
+
115
+ records, summary, keys = self.io.execute_query(
116
+ "MATCH (src:Node {uri: $src})-[rel:Rel {uri: $rel}]->(dest:Node) "
117
+ "RETURN dest.uri as dest",
118
+ src=v.s.value, rel=v.p.value,
119
+ database_=self.db,
120
+ )
121
+
122
+ for rec in records:
123
+ data = rec.data()
124
+ triples.append((v.s.value, v.p.value, data["dest"]))
125
+
126
+ else:
127
+
128
+ if v.o is not None:
129
+
130
+ # SO
131
+
132
+ records, summary, keys = self.io.execute_query(
133
+ "MATCH (src:Node {uri: $src})-[rel:Rel]->(dest:Literal {value: $value}) "
134
+ "RETURN rel.uri as rel",
135
+ src=v.s.value, value=v.o.value,
136
+ database_=self.db,
137
+ )
138
+
139
+ for rec in records:
140
+ data = rec.data()
141
+ triples.append((v.s.value, data["rel"], v.o.value))
142
+
143
+ records, summary, keys = self.io.execute_query(
144
+ "MATCH (src:Node {uri: $src})-[rel:Rel]->(dest:Node {uri: $uri}) "
145
+ "RETURN rel.uri as rel",
146
+ src=v.s.value, uri=v.o.value,
147
+ database_=self.db,
148
+ )
149
+
150
+ for rec in records:
151
+ data = rec.data()
152
+ triples.append((v.s.value, data["rel"], v.o.value))
153
+
154
+ else:
155
+
156
+ # S
157
+
158
+ records, summary, keys = self.io.execute_query(
159
+ "MATCH (src:Node {uri: $src})-[rel:Rel]->(dest:Literal) "
160
+ "RETURN rel.uri as rel, dest.value as dest",
161
+ src=v.s.value,
162
+ database_=self.db,
163
+ )
164
+
165
+ for rec in records:
166
+ data = rec.data()
167
+ triples.append((v.s.value, data["rel"], data["dest"]))
168
+
169
+ records, summary, keys = self.io.execute_query(
170
+ "MATCH (src:Node {uri: $src})-[rel:Rel]->(dest:Node) "
171
+ "RETURN rel.uri as rel, dest.uri as dest",
172
+ src=v.s.value,
173
+ database_=self.db,
174
+ )
175
+
176
+ for rec in records:
177
+ data = rec.data()
178
+ triples.append((v.s.value, data["rel"], data["dest"]))
179
+
180
+
181
+ else:
182
+
183
+ if v.p is not None:
184
+
185
+ if v.o is not None:
186
+
187
+ # PO
188
+
189
+ records, summary, keys = self.io.execute_query(
190
+ "MATCH (src:Node)-[rel:Rel {uri: $uri}]->(dest:Literal {value: $value}) "
191
+ "RETURN src.uri as src",
192
+ uri=v.p.value, value=v.o.value,
193
+ database_=self.db,
194
+ )
195
+
196
+ for rec in records:
197
+ data = rec.data()
198
+ triples.append((data["src"], v.p.value, v.o.value))
199
+
200
+ records, summary, keys = self.io.execute_query(
201
+ "MATCH (src:Node)-[rel:Rel {uri: $uri}]->(dest:Node {uri: $uri}) "
202
+ "RETURN src.uri as src",
203
+ uri=v.p.value, dest=v.o.value,
204
+ database_=self.db,
205
+ )
206
+
207
+ for rec in records:
208
+ data = rec.data()
209
+ triples.append((data["src"], v.p.value, v.o.value))
210
+
211
+ else:
212
+
213
+ # P
214
+
215
+ records, summary, keys = self.io.execute_query(
216
+ "MATCH (src:Node)-[rel:Rel {uri: $uri}]->(dest:Literal) "
217
+ "RETURN src.uri as src, dest.value as dest",
218
+ uri=v.p.value,
219
+ database_=self.db,
220
+ )
221
+
222
+ for rec in records:
223
+ data = rec.data()
224
+ triples.append((data["src"], v.p.value, data["dest"]))
225
+
226
+ records, summary, keys = self.io.execute_query(
227
+ "MATCH (src:Node)-[rel:Rel {uri: $uri}]->(dest:Node) "
228
+ "RETURN src.uri as src, dest.uri as dest",
229
+ uri=v.p.value,
230
+ database_=self.db,
231
+ )
232
+
233
+ for rec in records:
234
+ data = rec.data()
235
+ triples.append((data["src"], v.p.value, data["dest"]))
236
+
237
+ else:
238
+
239
+ if v.o is not None:
240
+
241
+ # O
242
+
243
+ records, summary, keys = self.io.execute_query(
244
+ "MATCH (src:Node)-[rel:Rel]->(dest:Literal {value: $value}) "
245
+ "RETURN src.uri as src, rel.uri as rel",
246
+ value=v.o.value,
247
+ database_=self.db,
248
+ )
249
+
250
+ for rec in records:
251
+ data = rec.data()
252
+ triples.append((data["src"], data["rel"], v.o.value))
253
+
254
+ records, summary, keys = self.io.execute_query(
255
+ "MATCH (src:Node)-[rel:Rel]->(dest:Node {uri: $uri}) "
256
+ "RETURN src.uri as src, rel.uri as rel",
257
+ uri=v.o.value,
258
+ database_=self.db,
259
+ )
260
+
261
+ for rec in records:
262
+ data = rec.data()
263
+ triples.append((data["src"], data["rel"], v.o.value))
264
+
265
+ else:
266
+
267
+ # *
268
+
269
+ records, summary, keys = self.io.execute_query(
270
+ "MATCH (src:Node)-[rel:Rel]->(dest:Literal) "
271
+ "RETURN src.uri as src, rel.uri as rel, dest.value as dest",
272
+ database_=self.db,
273
+ )
274
+
275
+ for rec in records:
276
+ data = rec.data()
277
+ triples.append((data["src"], data["rel"], data["dest"]))
278
+
279
+ records, summary, keys = self.io.execute_query(
280
+ "MATCH (src:Node)-[rel:Rel]->(dest:Node) "
281
+ "RETURN src.uri as src, rel.uri as rel, dest.uri as dest",
282
+ database_=self.db,
283
+ )
284
+
285
+ for rec in records:
286
+ data = rec.data()
287
+ triples.append((data["src"], data["rel"], data["dest"]))
288
+
289
+ triples = [
290
+ Triple(
291
+ s=self.create_value(t[0]),
292
+ p=self.create_value(t[1]),
293
+ o=self.create_value(t[2])
294
+ )
295
+ for t in triples
296
+ ]
297
+
298
+ print("Send response...", flush=True)
299
+ r = TriplesQueryResponse(triples=triples, error=None)
300
+ self.producer.send(r, properties={"id": id})
301
+
302
+ print("Done.", flush=True)
303
+
304
+ except Exception as e:
305
+
306
+ print(f"Exception: {e}")
307
+
308
+ print("Send error response...", flush=True)
309
+
310
+ r = TriplesQueryResponse(
311
+ error=Error(
312
+ type = "llm-error",
313
+ message = str(e),
314
+ ),
315
+ response=None,
316
+ )
317
+
318
+ self.producer.send(r, properties={"id": id})
319
+
320
+ self.consumer.acknowledge(msg)
321
+
322
+ @staticmethod
323
+ def add_args(parser):
324
+
325
+ ConsumerProducer.add_args(
326
+ parser, default_input_queue, default_subscriber,
327
+ default_output_queue,
328
+ )
329
+
330
+ parser.add_argument(
331
+ '-g', '--graph-host',
332
+ default=default_graph_host,
333
+ help=f'Graph host (default: {default_graph_host})'
334
+ )
335
+
336
+ parser.add_argument(
337
+ '--username',
338
+ default=default_username,
339
+ help=f'Memgraph username (default: {default_username})'
340
+ )
341
+
342
+ parser.add_argument(
343
+ '--password',
344
+ default=default_password,
345
+ help=f'Memgraph password (default: {default_password})'
346
+ )
347
+
348
+ parser.add_argument(
349
+ '--database',
350
+ default=default_database,
351
+ help=f'Memgraph database (default: {default_database})'
352
+ )
353
+
354
+ def run():
355
+
356
+ Processor.start(module, __doc__)
357
+
@@ -0,0 +1,3 @@
1
+
2
+ from . service import *
3
+
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env python3
2
+
3
+ from . hf import run
4
+
5
+ if __name__ == '__main__':
6
+ run()
7
+
@@ -1,7 +1,8 @@
1
1
 
2
2
  """
3
- Triples query service. Input is a (s, p, o) triple, some values may be
4
- null. Output is a list of triples.
3
+ Triples query service for neo4j.
4
+ Input is a (s, p, o) triple, some values may be null. Output is a list of
5
+ triples.
5
6
  """
6
7
 
7
8
  from neo4j import GraphDatabase
@@ -0,0 +1,252 @@
1
+
2
+ """
3
+ Graph writer. Input is graph edge. Writes edges to Cassandra graph.
4
+ """
5
+
6
+ import pulsar
7
+ import base64
8
+ import os
9
+ import argparse
10
+ import time
11
+
12
+ from neo4j import GraphDatabase
13
+
14
+ from .... schema import Triples
15
+ from .... schema import triples_store_queue
16
+ from .... log_level import LogLevel
17
+ from .... base import Consumer
18
+
19
+ module = ".".join(__name__.split(".")[1:-1])
20
+
21
+ default_input_queue = triples_store_queue
22
+ default_subscriber = module
23
+
24
+ default_graph_host = 'bolt://memgraph:7687'
25
+ default_username = 'memgraph'
26
+ default_password = 'password'
27
+ default_database = 'memgraph'
28
+
29
+ class Processor(Consumer):
30
+
31
+ def __init__(self, **params):
32
+
33
+ input_queue = params.get("input_queue", default_input_queue)
34
+ subscriber = params.get("subscriber", default_subscriber)
35
+ graph_host = params.get("graph_host", default_graph_host)
36
+ username = params.get("username", default_username)
37
+ password = params.get("password", default_password)
38
+ database = params.get("database", default_database)
39
+
40
+ super(Processor, self).__init__(
41
+ **params | {
42
+ "input_queue": input_queue,
43
+ "subscriber": subscriber,
44
+ "input_schema": Triples,
45
+ "graph_host": graph_host,
46
+ }
47
+ )
48
+
49
+ self.db = database
50
+
51
+ self.io = GraphDatabase.driver(graph_host, auth=(username, password))
52
+
53
+ with self.io.session(database=self.db) as session:
54
+ self.create_indexes(session)
55
+
56
+ def create_indexes(self, session):
57
+
58
+ print("Create indexes...", flush=True)
59
+
60
+ try:
61
+ session.run(
62
+ "CREATE INDEX ON :Node",
63
+ )
64
+ except Exception as e:
65
+ print(e, flush=True)
66
+ # Maybe index already exists
67
+ print("Index create failure ignored", flush=True)
68
+
69
+ try:
70
+ session.run(
71
+ "CREATE INDEX ON :Node(uri)"
72
+ )
73
+ except Exception as e:
74
+ print(e, flush=True)
75
+ # Maybe index already exists
76
+ print("Index create failure ignored", flush=True)
77
+
78
+ try:
79
+ session.run(
80
+ "CREATE INDEX ON :Literal",
81
+ )
82
+ except Exception as e:
83
+ print(e, flush=True)
84
+ # Maybe index already exists
85
+ print("Index create failure ignored", flush=True)
86
+
87
+ try:
88
+ session.run(
89
+ "CREATE INDEX ON :Literal(value)"
90
+ )
91
+ except Exception as e:
92
+ print(e, flush=True)
93
+ # Maybe index already exists
94
+ print("Index create failure ignored", flush=True)
95
+
96
+ print("Index creation done", flush=True)
97
+
98
+ def create_node(self, uri):
99
+
100
+ print("Create node", uri)
101
+
102
+ summary = self.io.execute_query(
103
+ "MERGE (n:Node {uri: $uri})",
104
+ uri=uri,
105
+ database_=self.db,
106
+ ).summary
107
+
108
+ print("Created {nodes_created} nodes in {time} ms.".format(
109
+ nodes_created=summary.counters.nodes_created,
110
+ time=summary.result_available_after
111
+ ))
112
+
113
+ def create_literal(self, value):
114
+
115
+ print("Create literal", value)
116
+
117
+ summary = self.io.execute_query(
118
+ "MERGE (n:Literal {value: $value})",
119
+ value=value,
120
+ database_=self.db,
121
+ ).summary
122
+
123
+ print("Created {nodes_created} nodes in {time} ms.".format(
124
+ nodes_created=summary.counters.nodes_created,
125
+ time=summary.result_available_after
126
+ ))
127
+
128
+ def relate_node(self, src, uri, dest):
129
+
130
+ print("Create node rel", src, uri, dest)
131
+
132
+ summary = self.io.execute_query(
133
+ "MATCH (src:Node {uri: $src}) "
134
+ "MATCH (dest:Node {uri: $dest}) "
135
+ "MERGE (src)-[:Rel {uri: $uri}]->(dest)",
136
+ src=src, dest=dest, uri=uri,
137
+ database_=self.db,
138
+ ).summary
139
+
140
+ print("Created {nodes_created} nodes in {time} ms.".format(
141
+ nodes_created=summary.counters.nodes_created,
142
+ time=summary.result_available_after
143
+ ))
144
+
145
+ def relate_literal(self, src, uri, dest):
146
+
147
+ print("Create literal rel", src, uri, dest)
148
+
149
+ summary = self.io.execute_query(
150
+ "MATCH (src:Node {uri: $src}) "
151
+ "MATCH (dest:Literal {value: $dest}) "
152
+ "MERGE (src)-[:Rel {uri: $uri}]->(dest)",
153
+ src=src, dest=dest, uri=uri,
154
+ database_=self.db,
155
+ ).summary
156
+
157
+ print("Created {nodes_created} nodes in {time} ms.".format(
158
+ nodes_created=summary.counters.nodes_created,
159
+ time=summary.result_available_after
160
+ ))
161
+
162
+ def create_triple(self, tx, t):
163
+
164
+ # Create new s node with given uri, if not exists
165
+ result = tx.run(
166
+ "MERGE (n:Node {uri: $uri})",
167
+ uri=t.s.value
168
+ )
169
+
170
+ if t.o.is_uri:
171
+
172
+ # Create new o node with given uri, if not exists
173
+ result = tx.run(
174
+ "MERGE (n:Node {uri: $uri})",
175
+ uri=t.o.value
176
+ )
177
+
178
+ result = tx.run(
179
+ "MATCH (src:Node {uri: $src}) "
180
+ "MATCH (dest:Node {uri: $dest}) "
181
+ "MERGE (src)-[:Rel {uri: $uri}]->(dest)",
182
+ src=t.s.value, dest=t.o.value, uri=t.p.value,
183
+ )
184
+
185
+ else:
186
+
187
+ # Create new o literal with given uri, if not exists
188
+ result = tx.run(
189
+ "MERGE (n:Literal {value: $value})",
190
+ value=t.o.value
191
+ )
192
+
193
+ result = tx.run(
194
+ "MATCH (src:Node {uri: $src}) "
195
+ "MATCH (dest:Literal {value: $dest}) "
196
+ "MERGE (src)-[:Rel {uri: $uri}]->(dest)",
197
+ src=t.s.value, dest=t.o.value, uri=t.p.value,
198
+ )
199
+
200
+ def handle(self, msg):
201
+
202
+ v = msg.value()
203
+
204
+ for t in v.triples:
205
+
206
+ # self.create_node(t.s.value)
207
+
208
+ # if t.o.is_uri:
209
+ # self.create_node(t.o.value)
210
+ # self.relate_node(t.s.value, t.p.value, t.o.value)
211
+ # else:
212
+ # self.create_literal(t.o.value)
213
+ # self.relate_literal(t.s.value, t.p.value, t.o.value)
214
+
215
+ with self.io.session(database=self.db) as session:
216
+ session.execute_write(self.create_triple, t)
217
+
218
+ @staticmethod
219
+ def add_args(parser):
220
+
221
+ Consumer.add_args(
222
+ parser, default_input_queue, default_subscriber,
223
+ )
224
+
225
+ parser.add_argument(
226
+ '-g', '--graph_host',
227
+ default=default_graph_host,
228
+ help=f'Graph host (default: {default_graph_host})'
229
+ )
230
+
231
+ parser.add_argument(
232
+ '--username',
233
+ default=default_username,
234
+ help=f'Memgraph username (default: {default_username})'
235
+ )
236
+
237
+ parser.add_argument(
238
+ '--password',
239
+ default=default_password,
240
+ help=f'Memgraph password (default: {default_password})'
241
+ )
242
+
243
+ parser.add_argument(
244
+ '--database',
245
+ default=default_database,
246
+ help=f'Memgraph database (default: {default_database})'
247
+ )
248
+
249
+ def run():
250
+
251
+ Processor.start(module, __doc__)
252
+
@@ -0,0 +1,3 @@
1
+
2
+ from . write import *
3
+
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env python3
2
+
3
+ from . write import run
4
+
5
+ if __name__ == '__main__':
6
+ run()
7
+