threatgrid / asami

A graph store for Clojure and ClojureScript
Eclipse Public License 1.0
634 stars 29 forks source link

transitive attributes not returning chain ends #182

Closed quoll closed 3 years ago

quoll commented 3 years ago

Looking for transitive closures across a group of chains is not returning the ends of those chains:

(q '[:find ?x
     :where
     [?y :attribute+ ?x]]
   db)

The values in ?x are not including the ends of chains. i.e. each value of:

(q '[:find ?x
     :where
     [_ :attribute ?x]]
   db)

Is not showing up in the final result set of the first query.

Develop some sample data for this, and figure out the bug. (Large scale sample data is available within the org)

quoll commented 3 years ago

Note: local system at ~/data/issue-182

quoll commented 3 years ago

Found the bug and fixed. Also noted that chained transitive edges with a fixed end are extremely slow. Applying the log(n) transitive calculation to these as well