tiki-archive / pool-kgraph

TIKI's Anonymous Contextual Knowledge Graph
MIT License
0 stars 1 forks source link

Add support for running query needed to generate top subject lines insight #35

Closed NickkTMD closed 2 years ago

NickkTMD commented 2 years ago

Currently kgraph supports operations like traversals, shortestPath, and findByVertices. Many insights will need more complicated queries with more complex filters.

for top subject lines, we will want something like:

CORRECTED QUERY:

FOR v, e, p IN 2..2 ANY @company GRAPH "kgraph"
    FILTER (FOR v2, e2 IN 1..1 ANY p.vertices[1] GRAPH "kgraph" FILTER v2._id == "action/email" RETURN 1) == [1] 
    RETURN (FOR v2, e2 IN 1..1 ANY p.vertices[1] GRAPH "kgraph" FILTER IS_SAME_COLLECTION("subject", v2) RETURN {"subject": v2.subject, "occurrences": 1/e2.weight})

Where @company is the _key value of the company we are looking at, and @startingDate and @endingDate define a date range (dates are strings like 06/27/2022).

Acceptance Criteria:

  1. kgraph repo can be used to run query which returns json data from which top subjects insight can be calculated.
mike-audi commented 2 years ago

api works but either the query or the kgraph itself isn't working.

Image

mike-audi commented 2 years ago

ingest service is the issue.

NickkTMD commented 2 years ago

corrected query:

FOR v, e, p IN 2..2 ANY @company GRAPH "kgraph"
    FILTER (FOR v2, e2 IN 1..1 ANY p.vertices[1] GRAPH "kgraph" FILTER v2._id == "action/email" RETURN 1) == [1] 
    RETURN (FOR v2, e2 IN 1..1 ANY p.vertices[1] GRAPH "kgraph" FILTER IS_SAME_COLLECTION("subject", v2) RETURN {"subject": v2.subject, "occurrences": 1/e2.weight})

assuming the email has _id "action/email". v2.subject should be changed depending on subject line property name.