Skip to content

Commit

Permalink
Updating
Browse files Browse the repository at this point in the history
  • Loading branch information
Paula Gearon committed Sep 4, 2020
2 parents cfd8158 + 30be1f5 commit 70e9a3e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 31 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## [Unreleased]

## [1.2.3] - 2020-09-03
### Added
- Supporting empty arrays in entities (via Zuko update)

### Changed
- Change to internal APIs for improved transactions

## [1.2.2] - 2020-08-27
### Fixed
- Fixed use of macro as a value in CLJS
Expand Down Expand Up @@ -58,7 +65,8 @@
### Added
- Introduced Update Annotations

[Unreleased]: https://github.com/threatgrid/asami/compare/1.2.2...HEAD
[Unreleased]: https://github.com/threatgrid/asami/compare/1.2.3...HEAD
[1.2.3]: https://github.com/threatgrid/asami/compare/1.2.2...1.2.3
[1.2.2]: https://github.com/threatgrid/asami/compare/1.2.1...1.2.2
[1.2.1]: https://github.com/threatgrid/asami/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/threatgrid/asami/compare/1.1.0...1.2.0
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Asami can be made available to clojure by adding the following to a `deps.edn` f
```clojure
{
:deps {
org.clojars.quoll/asami {:mvn/version "1.2.2"}
org.clojars.quoll/asami {:mvn/version "1.2.3"}
}
}
```
Expand All @@ -37,7 +37,7 @@ This makes Asami available to a repl that is launched with the `clj` or `clojure

Alternatively, Asami can be added for the Leiningen build tool by adding this to the `:dependencies` section of the `project.clj` file:
```clojure
[org.clojars.quoll/asami "1.2.1"]
[org.clojars.quoll/asami "1.2.3"]
```

### Running
Expand Down
4 changes: 2 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject org.clojars.quoll/asami "1.2.2"
(defproject org.clojars.quoll/asami "1.2.3"
:description "An in memory graph store for Clojure and ClojureScript"
:url "http://github.com/threatgrid/asami"
:license {:name "Eclipse Public License"
Expand All @@ -7,7 +7,7 @@
[org.clojure/clojurescript "1.10.773"]
[prismatic/schema "1.1.12"]
[org.clojure/core.cache "0.8.2"]
[org.clojars.quoll/zuko "0.2.4"]]
[org.clojars.quoll/zuko "0.3.0"]]
:plugins [[lein-cljsbuild "1.1.7"]
[cider/cider-nrepl "0.24.0"]]
:cljsbuild {
Expand Down
16 changes: 0 additions & 16 deletions src/asami/common_index.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,6 @@ and multigraph implementations."
:cljs [schema.core :as s :include-macros true]))
#?(:clj (:import [clojure.lang ITransientCollection])))

(defn tr
"Converts collections to transients"
[x]
(if (or (map? x) (set? x)) (transient x) x))

(defn transient?
"Tests if a value is a transient collection"
[x]
#?(:clj (instance? ITransientCollection x)
:cljs (implements? ITransientCollection x)))

(defn pt!
"Converts transient collections back to persistent collections"
[x]
(if (transient? x) (persistent! x) x))

(defprotocol NestedIndex
(lowest-level-fn [this] "Returns a function for handling the lowest index level retrieval")
(lowest-level-sets-fn [this] "Returns a function retrieving all lowest level values as sets")
Expand Down
13 changes: 3 additions & 10 deletions src/asami/index.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
[asami.common-index :as common :refer [? NestedIndex tr pt!]]
[asami.analytics :as analytics]
[zuko.node :refer [NodeAPI]]
[clojure.walk :refer [prewalk postwalk]]
#?(:clj [schema.core :as s]
:cljs [schema.core :as s :include-macros true])))

Expand Down Expand Up @@ -106,15 +105,8 @@
(graph-transact [this tx-id assertions retractions]
(as-> this graph
(reduce (fn [acc [s p o]] (graph-delete acc s p o)) graph retractions)
(assoc graph
:spo (postwalk tr (:spo graph))
:pos (postwalk tr (:pos graph))
:osp (postwalk tr (:osp graph)))
(reduce (fn [acc [s p o]] (graph-add! acc s p o)) graph assertions)
(assoc graph
:spo (prewalk pt! (:spo graph))
:pos (prewalk pt! (:pos graph))
:osp (prewalk pt! (:osp graph)))))
(reduce (fn [acc [s p o]] (graph-add acc s p o)) graph assertions)))

(graph-diff [this other]
(let [s-po (remove (fn [[s po]] (= po (get (:spo other) s)))
spo)]
Expand All @@ -137,3 +129,4 @@
(find-triple [this [e a v]] (resolve-triple this e a v)))

(def empty-graph (->GraphIndexed {} {} {}))

0 comments on commit 70e9a3e

Please sign in to comment.