trustgraph-flow 0.17.6__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.
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/PKG-INFO +2 -2
- trustgraph-flow-0.17.7/scripts/triples-query-memgraph +6 -0
- trustgraph-flow-0.17.7/scripts/triples-write-memgraph +6 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/setup.py +2 -0
- trustgraph-flow-0.17.7/trustgraph/flow_version.py +1 -0
- trustgraph-flow-0.17.7/trustgraph/query/triples/memgraph/service.py +357 -0
- trustgraph-flow-0.17.7/trustgraph/query/triples/neo4j/__init__.py +3 -0
- trustgraph-flow-0.17.7/trustgraph/query/triples/neo4j/__main__.py +7 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/triples/neo4j/service.py +3 -2
- trustgraph-flow-0.17.7/trustgraph/storage/triples/memgraph/write.py +252 -0
- trustgraph-flow-0.17.7/trustgraph/storage/triples/neo4j/__init__.py +3 -0
- trustgraph-flow-0.17.7/trustgraph/storage/triples/neo4j/__main__.py +7 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph_flow.egg-info/PKG-INFO +2 -2
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph_flow.egg-info/SOURCES.txt +8 -0
- trustgraph-flow-0.17.6/trustgraph/flow_version.py +0 -1
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/README.md +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/agent-manager-react +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/api-gateway +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/chunker-recursive +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/chunker-token +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/de-query-milvus +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/de-query-pinecone +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/de-query-qdrant +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/de-write-milvus +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/de-write-pinecone +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/de-write-qdrant +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/document-rag +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/embeddings-ollama +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/embeddings-vectorize +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/ge-query-milvus +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/ge-query-pinecone +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/ge-query-qdrant +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/ge-write-milvus +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/ge-write-pinecone +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/ge-write-qdrant +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/graph-rag +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/kg-extract-definitions +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/kg-extract-relationships +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/kg-extract-topics +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/metering +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/object-extract-row +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/oe-write-milvus +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/pdf-decoder +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/prompt-generic +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/prompt-template +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/rows-write-cassandra +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/run-processing +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/text-completion-azure +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/text-completion-azure-openai +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/text-completion-claude +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/text-completion-cohere +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/text-completion-googleaistudio +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/text-completion-llamafile +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/text-completion-ollama +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/text-completion-openai +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/triples-query-cassandra +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/triples-query-neo4j +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/triples-write-cassandra +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/triples-write-neo4j +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/scripts/wikipedia-lookup +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/setup.cfg +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/agent/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/agent/react/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/agent/react/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/agent/react/agent_manager.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/agent/react/service.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/agent/react/tools.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/agent/react/types.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/agent.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/auth.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/dbpedia.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/embeddings.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/encyclopedia.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/endpoint.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/graph_embeddings_load.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/graph_embeddings_stream.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/graph_rag.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/internet_search.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/prompt.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/publisher.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/running.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/serialize.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/service.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/socket.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/subscriber.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/text_completion.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/triples_load.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/triples_query.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/api/gateway/triples_stream.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/chunking/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/chunking/recursive/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/chunking/recursive/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/chunking/recursive/chunker.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/chunking/token/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/chunking/token/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/chunking/token/chunker.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/decoding/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/decoding/pdf/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/decoding/pdf/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/decoding/pdf/pdf_decoder.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/direct/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/direct/cassandra.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/direct/milvus_doc_embeddings.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/direct/milvus_graph_embeddings.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/direct/milvus_object_embeddings.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/document_rag.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/embeddings/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/embeddings/ollama/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/embeddings/ollama/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/embeddings/ollama/processor.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/embeddings/vectorize/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/embeddings/vectorize/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/embeddings/vectorize/vectorize.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/external/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/external/wikipedia/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/external/wikipedia/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/external/wikipedia/service.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/definitions/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/definitions/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/definitions/extract.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/relationships/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/relationships/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/relationships/extract.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/topics/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/topics/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/kg/topics/extract.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/object/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/object/row/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/object/row/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/extract/object/row/extract.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/graph_rag.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/metering/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/metering/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/metering/counter.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/metering/pricelist.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/generic/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/generic/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/generic/prompts.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/generic/service.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/template/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/template/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/template/prompt_manager.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/prompt/template/service.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/azure/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/azure/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/azure/llm.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/azure_openai/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/azure_openai/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/azure_openai/llm.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/claude/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/claude/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/claude/llm.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/cohere/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/cohere/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/cohere/llm.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/googleaistudio/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/googleaistudio/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/googleaistudio/llm.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/llamafile/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/llamafile/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/llamafile/llm.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/ollama/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/ollama/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/ollama/llm.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/openai/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/openai/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/model/text_completion/openai/llm.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/processing/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/processing/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/processing/processing.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/milvus/service.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/pinecone/service.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/doc_embeddings/qdrant/service.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/milvus/service.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/pinecone/service.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/graph_embeddings/qdrant/service.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/triples/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/triples/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/triples/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/query/triples/cassandra/service.py +0 -0
- {trustgraph-flow-0.17.6/trustgraph/query/triples/neo4j → trustgraph-flow-0.17.7/trustgraph/query/triples/memgraph}/__init__.py +0 -0
- {trustgraph-flow-0.17.6/trustgraph/query/triples/neo4j → trustgraph-flow-0.17.7/trustgraph/query/triples/memgraph}/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/retrieval/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/retrieval/document_rag/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/retrieval/document_rag/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/retrieval/document_rag/rag.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/retrieval/graph_rag/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/retrieval/graph_rag/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/retrieval/graph_rag/rag.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/pinecone/write.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/doc_embeddings/qdrant/write.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/pinecone/write.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/graph_embeddings/qdrant/write.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/object_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/object_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/object_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/object_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/rows/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/rows/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/rows/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/rows/cassandra/write.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/triples/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/triples/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/triples/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/triples/cassandra/write.py +0 -0
- {trustgraph-flow-0.17.6/trustgraph/storage/triples/neo4j → trustgraph-flow-0.17.7/trustgraph/storage/triples/memgraph}/__init__.py +0 -0
- {trustgraph-flow-0.17.6/trustgraph/storage/triples/neo4j → trustgraph-flow-0.17.7/trustgraph/storage/triples/memgraph}/__main__.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph/storage/triples/neo4j/write.py +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph_flow.egg-info/dependency_links.txt +0 -0
- {trustgraph-flow-0.17.6 → trustgraph-flow-0.17.7}/trustgraph_flow.egg-info/requires.txt +0 -0
- {trustgraph-flow-0.17.6 → 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.
|
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.
|
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+)
|
@@ -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
|
+
|
@@ -1,7 +1,8 @@
|
|
1
1
|
|
2
2
|
"""
|
3
|
-
Triples query service
|
4
|
-
null. Output is a list of
|
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
|
+
|