refactor: Decouple simple queries in db graph

from original *property rules by giving simple queries
their own rules. This allows simple queries to grow in functionality
and complexity without affecting other features. Also fixed
private-property rule wasn't working because deps weren't configured
This commit is contained in:
Gabriel Horner
2024-11-21 17:56:58 -05:00
parent 8864c3515f
commit ce18010b2b
6 changed files with 100 additions and 36 deletions

View File

@@ -334,18 +334,24 @@
(let [k (if db-graph? (->db-keyword-property (nth e 1)) (->file-keyword-property (nth e 1)))
v (nth e 2)
v' (if db-graph? (->db-property-value k v) (->file-property-value v))]
(if private-property?
{:query (list 'private-property '?b k v')
:rules [:private-property]}
(if db-graph?
(if private-property?
{:query (list 'private-simple-query-property '?b k v')
:rules [:private-simple-query-property]}
{:query (list 'simple-query-property '?b k v')
:rules [:simple-query-property]})
{:query (list 'property '?b k v')
:rules [:property]})))
(defn- build-property-one-arg
[e {:keys [db-graph? private-property?]}]
(let [k (if db-graph? (->db-keyword-property (nth e 1)) (->file-keyword-property (nth e 1)))]
(if private-property?
{:query (list 'has-private-property '?b k)
:rules [:has-private-property]}
(if db-graph?
(if private-property?
{:query (list 'has-private-simple-query-property '?b k)
:rules [:has-private-simple-query-property]}
{:query (list 'has-simple-query-property '?b k)
:rules [:has-simple-query-property]})
{:query (list 'has-property '?b k)
:rules [:has-property]})))