From 61a4d15a35cb26f00e4bd16361785f0c26faebb5 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 26 Oct 2018 10:35:22 +0200 Subject: [PATCH 01/47] Update docker-compose for newest DBAS --- .env | 6 ------ docker-compose.yml | 20 +++++++++----------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.env b/.env index 090969c..23bfcab 100644 --- a/.env +++ b/.env @@ -6,12 +6,6 @@ DATABASE_PASSWORD=kI1BtN@rCbh2i6wg7EiEO*FwcdugST7s HOSTNAME=hhu.de -DBAS_AUTHN_SECRET=89#s3cr3t_15 -DBAS_DB_HOST=db -DBAS_DB_PORT=5432 -DBAS_DB_USER=postgres -DBAS_DB_NAME=discussion -DBAS_DB_PW=DXxCNtfnt!MOo!f8LY1!P%sw3KGzt@s! AUTHN_SECRET=89#s3cr3t_15 DB_PORT=5432 DB_USER=postgres diff --git a/docker-compose.yml b/docker-compose.yml index 2888dbb..82568fb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: "3.1" +version: "3.2" services: broker: @@ -62,18 +62,16 @@ services: ports: - "4284:4284" links: - - dbas-db:db - env_file: - - dbas/development.env -# environment: -# - "DBAS_DB_USER=${DBAS_DB_USER}" -# - "DBAS_DB_PW=${DBAS_DB_PW}" -# - "DBAS_DB_HOST=${DBAS_DB_HOST}" -# - "DBAS_DB_PORT=${DBAS_DB_PORT}" -# - "DBAS_AUTHN_SECRET=${DBAS_AUTHN_SECRET}" + - dbas-db:db + environment: + - "DB_USER=${DB_USER}" + - "DB_PW=${DB_PW}" + - "DB_PORT=${DB_PORT}" + - "DB_NAME=${DB_NAME}" + - "DB_HOST=${DB_HOST}" + - "AUTHN_SECRET=${AUTHN_SECRET}" volumes: - ./dbas:/dbas - - ./dbas_development.env:/dbas/development.env dbas-db: build: dbas/docker/db/ From d5635f771cad710021580b71056654abb84165ec Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 26 Oct 2018 11:00:50 +0200 Subject: [PATCH 02/47] Update dbas-connector to use newer format --- aggregator/src/aggregator/graphql/dbas_connector.clj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aggregator/src/aggregator/graphql/dbas_connector.clj b/aggregator/src/aggregator/graphql/dbas_connector.clj index 5ee04fb..0413910 100644 --- a/aggregator/src/aggregator/graphql/dbas_connector.clj +++ b/aggregator/src/aggregator/graphql/dbas_connector.clj @@ -67,7 +67,7 @@ "Use the strange structure of D-BAS-arguments to create links. Needs a connection to the local dbas instance. Returned links in EDEN format." [argument] - (let [group-uid (:premisesgroupUid argument) + (let [group-uid (:premisegroupUid argument) premises (query-db (format "query {premises(premisegroupUid: %d) {statementUid}}" group-uid)) @@ -99,4 +99,3 @@ (let [result (query-db "query {arguments {uid conclusionUid, isSupportive, authorUid, argumentUid, premisegroupUid}}") return-val (mapcat links-from-argument (:arguments result))] return-val)) - From da7046e905de84750e6ff883233571e81f319a88 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 26 Oct 2018 13:34:54 +0200 Subject: [PATCH 03/47] . --- dbas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbas b/dbas index a76cb46..1642e5a 160000 --- a/dbas +++ b/dbas @@ -1 +1 @@ -Subproject commit a76cb46963436be183f1b799d587b9900082affa +Subproject commit 1642e5a8c7f34a4e9fdb6f467df36b9c05ccfe56 From bed60834a818f31bfb39ec3bb801a189e6807022 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 26 Oct 2018 15:34:17 +0200 Subject: [PATCH 04/47] Update docker compose to expect more variables --- docker-compose.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 82568fb..9fd4253 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,7 +37,7 @@ services: - "DBAS_HOST=dbas" - "ELASTICSEARCH_HOST=search" - "DB_HOST=dbas-db" - - "AGGREGATOR_NAME=aggregator:8888" + - AGGREGATOR_NAME search: build: elasticsearch/ @@ -70,6 +70,14 @@ services: - "DB_NAME=${DB_NAME}" - "DB_HOST=${DB_HOST}" - "AUTHN_SECRET=${AUTHN_SECRET}" + - HHU_LDAP_SERVER + - HHU_LDAP_BASE + - HHU_LDAP_ACCOUNT_SCOPE + - HHU_LDAP_ACCOUNT_FILTER + - HHU_LDAP_ACCOUNT_FIRSTNAME + - HHU_LDAP_ACCOUNT_LAST + - HHU_LDAP_ACCOUNT_TITLE + - HHU_LDAP_ACCOUNT_EMAIL volumes: - ./dbas:/dbas From 91714a2ef357b597ab34d0da95862b18cc3257eb Mon Sep 17 00:00:00 2001 From: Christian Meter Date: Sat, 27 Oct 2018 15:27:20 +0200 Subject: [PATCH 05/47] Add ring-middleware to set CORS settings --- aggregator/project.clj | 1 + aggregator/src/aggregator/api/routes.clj | 56 +++++++++++++----------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/aggregator/project.clj b/aggregator/project.clj index 6b8683d..ba8b13c 100644 --- a/aggregator/project.clj +++ b/aggregator/project.clj @@ -17,6 +17,7 @@ [ring/ring-json "0.4.0"] [ring/ring-mock "0.3.2"] [ring/ring-jetty-adapter "1.6.3"] + [ring-cors "0.1.12"] [clj-http "3.7.0"] [codox-theme-rdash "0.1.2"] [metosin/compojure-api "2.0.0-alpha19"] diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index 104e8fe..b36c62f 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -6,7 +6,8 @@ [spec-tools.spec :as spec] [clojure.spec.alpha :as s] [aggregator.specs :as eden-specs] - [ring.util.http-response :refer [ok not-found]])) + [ring.util.http-response :refer [ok not-found]] + [ring.middleware.cors :as ring-cors])) (s/def ::welcome-message spec/string?) (s/def ::statements (s/coll-of ::eden-specs/statement)) @@ -103,31 +104,36 @@ (ok {:link link}) (not-found nil))))) -(def app - (api {:coercion :spec - :swagger - {:ui "/swagger" - :spec "/swagger.json" - :data {:info {:title "EDEN Aggregator API" - :description "An API to request statements and links from the EDEN instance."} - :tags [{:name "statements" :description "Retrieve Statements"} - {:name "links" :description "Retrieve Links"} - {:name "statement" :description "Retrieve single specific statement"} - {:name "link" :description "Retrieve single specific link"}]}}} - - statement-routes - statements-routes - link-routes - links-routes - - (GET "/" [] - :summary "Test whether the api is online" - :query-params [] - :return ::welcome-message - (ok "Hello!")) +(def ^:private hello-route + (GET "/" [] + :summary "Test whether the api is online" + :query-params [] + :return ::welcome-message + (ok "Hello!"))) - (undocumented - (compojure.route/not-found (not-found {:not "found"}))))) +(def app + (-> + (api {:coercion :spec + :swagger + {:ui "/swagger" + :spec "/swagger.json" + :data {:info {:title "EDEN Aggregator API" + :description "An API to request statements and links from the EDEN instance."} + :tags [{:name "statements" :description "Retrieve Statements"} + {:name "links" :description "Retrieve Links"} + {:name "statement" :description "Retrieve single specific statement"} + {:name "link" :description "Retrieve single specific link"}]}}} + + statement-routes + statements-routes + link-routes + links-routes + hello-route + + (undocumented + (compojure.route/not-found (not-found {:not "found"})))) + (ring-cors/wrap-cors :access-control-allow-origin #".*" + :access-control-allow-methods [:get :put :post :delete]))) (comment (use 'ring.adapter.jetty) From b2d626fffcc406281f3bb915da760ef4636a151c Mon Sep 17 00:00:00 2001 From: Christian Meter Date: Sat, 27 Oct 2018 15:39:09 +0200 Subject: [PATCH 06/47] Add cache to gitlab ci --- .gitlab-ci.yml | 4 ++-- aggregator/project.clj | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e455518..cbc2468 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,9 +5,9 @@ stages: - deploy cache: + key: "$CI_JOB_NAME" paths: - - ~/.m2 - - /root/.m2 + - .m2 untracked: true variables: diff --git a/aggregator/project.clj b/aggregator/project.clj index ba8b13c..592ef89 100644 --- a/aggregator/project.clj +++ b/aggregator/project.clj @@ -47,5 +47,7 @@ :main ^:skip-aot aggregator.core :target-path "target/%s" + :local-repo ".m2/repo" + :codox {:metadata {:doc/format :markdown} :themes [:rdash]}) From f938f8bb87601fe47883c7643b8d12916c57e10b Mon Sep 17 00:00:00 2001 From: Christian Meter Date: Sat, 27 Oct 2018 15:41:04 +0200 Subject: [PATCH 07/47] Replace threading macro --- .gitlab-ci.yml | 2 +- aggregator/src/aggregator/api/routes.clj | 44 ++++++++++++------------ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cbc2468..fff9dda 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,7 @@ stages: cache: key: "$CI_JOB_NAME" paths: - - .m2 + - aggregator/.m2 untracked: true variables: diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index b36c62f..b7ff424 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -112,28 +112,28 @@ (ok "Hello!"))) (def app - (-> - (api {:coercion :spec - :swagger - {:ui "/swagger" - :spec "/swagger.json" - :data {:info {:title "EDEN Aggregator API" - :description "An API to request statements and links from the EDEN instance."} - :tags [{:name "statements" :description "Retrieve Statements"} - {:name "links" :description "Retrieve Links"} - {:name "statement" :description "Retrieve single specific statement"} - {:name "link" :description "Retrieve single specific link"}]}}} - - statement-routes - statements-routes - link-routes - links-routes - hello-route - - (undocumented - (compojure.route/not-found (not-found {:not "found"})))) - (ring-cors/wrap-cors :access-control-allow-origin #".*" - :access-control-allow-methods [:get :put :post :delete]))) + (let [compojure-api-handler + (api {:coercion :spec + :swagger + {:ui "/swagger" + :spec "/swagger.json" + :data {:info {:title "EDEN Aggregator API" + :description "An API to request statements and links from the EDEN instance."} + :tags [{:name "statements" :description "Retrieve Statements"} + {:name "links" :description "Retrieve Links"} + {:name "statement" :description "Retrieve single specific statement"} + {:name "link" :description "Retrieve single specific link"}]}}} + statement-routes + statements-routes + link-routes + links-routes + hello-route + (undocumented + (compojure.route/not-found (not-found {:not "found"}))))] + (ring-cors/wrap-cors + compojure-api-handler + :access-control-allow-origin #".*" + :access-control-allow-methods [:get :put :post :delete]))) (comment (use 'ring.adapter.jetty) From 95f52e9f99d391c99d7ab95f468b4176f199168b Mon Sep 17 00:00:00 2001 From: Christian Meter Date: Sun, 28 Oct 2018 11:02:08 +0100 Subject: [PATCH 08/47] Add .m2 to gitignore --- aggregator/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/aggregator/.gitignore b/aggregator/.gitignore index c53038e..230ec18 100644 --- a/aggregator/.gitignore +++ b/aggregator/.gitignore @@ -9,3 +9,4 @@ pom.xml.asc /.nrepl-port .hgignore .hg/ +.m2/ From 0e77f50d37708193fce5edf9fdca4c073c626cfa Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Mon, 5 Nov 2018 14:14:09 +0100 Subject: [PATCH 09/47] Highten queue sunscribe rate and stringify entity and author --- aggregator/src/aggregator/query/query.clj | 4 +++- aggregator/src/aggregator/utils/pg_listener.clj | 11 +++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/aggregator/src/aggregator/query/query.clj b/aggregator/src/aggregator/query/query.clj index 1b270f0..5478572 100644 --- a/aggregator/src/aggregator/query/query.clj +++ b/aggregator/src/aggregator/query/query.clj @@ -138,7 +138,7 @@ (defn starter-set "Retrieve a set of starting arguments, which can be used by remote aggregators to bootstrap the connection. This particular implementation just takes a random set of arguments from the cache or database." [] - (db/random-statements 10)) + (db/random-statements 100)) (defn remote-starter-set "Retrieve remote starter sets and put them into the cache and db." @@ -161,6 +161,7 @@ (all-remote-statements aggregator)))) ([aggregator] (let [results (:statements (get-data (str config/protocol aggregator "/statements")))] + (subscribe-to-queue "statements" aggregator) (doseq [statement results] (up/update-statement statement))))) @@ -177,6 +178,7 @@ (all-remote-links aggregator)))) ([aggregator] (let [results (get-data (str config/protocol aggregator "/links"))] + (subscribe-to-queue "links" aggregator) (doseq [link results] (up/update-link link))))) diff --git a/aggregator/src/aggregator/utils/pg_listener.clj b/aggregator/src/aggregator/utils/pg_listener.clj index 8b20acb..ad7ee12 100644 --- a/aggregator/src/aggregator/utils/pg_listener.clj +++ b/aggregator/src/aggregator/utils/pg_listener.clj @@ -14,11 +14,11 @@ "Handle changes in the textversions. They belong to the statements." [textversion] (log/debug (format "Received new textversion from D-BAS: %s" (:data textversion))) - (let [statement {:content {:author (get-in textversion [:data :author_uid]) + (let [statement {:content {:author (str (get-in textversion [:data :author_uid])) :content-string (get-in textversion [:data :content]) :created nil} :identifier {:aggregate-id config/aggregate-name - :entity-id (get-in textversion [:data :uid]) + :entity-id (str (get-in textversion [:data :uid])) :version 1} :delete-flag false :predecessors []} @@ -26,13 +26,12 @@ (if origin (update/update-statement (assoc-in (assoc statement - :identifier {:aggregate-id (:aggregate_id origin) - :entity-id (:entity_id origin) + :identifier {:aggregate-id (str (:aggregate_id origin)) + :entity-id (str (:entity_id origin)) :version (:version origin)}) - [:content :author] (:author origin))) + [:content :author] (str (:author origin)))) (update/update-statement statement)))) - (defn- handle-arguments "Handle changes in arguments and update links correspondingly." [argument] From b5985855bf548e5928fa8fa28a101aafb838b003 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Mon, 5 Nov 2018 15:27:14 +0100 Subject: [PATCH 10/47] Force a more unhealthy but reliable exchange between the aggregators --- aggregator/src/aggregator/broker/subscriber.clj | 1 - aggregator/src/aggregator/query/retriever.clj | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/aggregator/src/aggregator/broker/subscriber.clj b/aggregator/src/aggregator/broker/subscriber.clj index b6c7785..22688f1 100644 --- a/aggregator/src/aggregator/broker/subscriber.clj +++ b/aggregator/src/aggregator/broker/subscriber.clj @@ -64,7 +64,6 @@ (lib/return-error (:queue-ex exceptions))))) ([queue broker] (subscribe to-query queue broker))) - ;; ----------------------------------------------------------------------------- ;; Specs diff --git a/aggregator/src/aggregator/query/retriever.clj b/aggregator/src/aggregator/query/retriever.clj index 8a998af..5f1e76e 100644 --- a/aggregator/src/aggregator/query/retriever.clj +++ b/aggregator/src/aggregator/query/retriever.clj @@ -50,7 +50,14 @@ (Thread/sleep 60000) (log/debug "[retriever] Automatic search waking up.") (query/remote-starter-set) - (recur (rand-nth (keys (cache/get-cached-statements))))))) + (recur (rand-nth (keys (cache/get-cached-statements)))))) + (future + (loop [whitelisted config/whitelist] + (log/debug "Pulling all whitelisted information at once.") + (dorun (map query/all-remote-statements whitelisted)) + (dorun (map query/all-remote-links whitelisted)) + (Thread/sleep 120000) + (recur whitelisted)))) (defn bootstrap "Call this method when the aggregator starts. Pulls the whitelisted aggregators From 70facb83cc5a64238e06132944beae8fa85dc8a7 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Tue, 6 Nov 2018 14:33:57 +0100 Subject: [PATCH 11/47] Open ports for rabbitmq --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9fd4253..02ea5c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: image: rabbitmq:3.6-management-alpine ports: - "15672:15672" # web-access to management console - # - "5671-5672:5671-5672" # for debugging, exposes RabbitMQs port to connect from localhost + - "5671-5672:5671-5672" # for debugging, exposes RabbitMQs port to connect from localhost environment: - "RABBITMQ_DEFAULT_USER=${BROKER_USER}" - "RABBITMQ_DEFAULT_PASS=${BROKER_PASS}" From 8268b5e54d348273273a539010a50f8eb9a64c4d Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Tue, 6 Nov 2018 14:52:06 +0100 Subject: [PATCH 12/47] FIx broken subscription method --- aggregator/src/aggregator/query/query.clj | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/aggregator/src/aggregator/query/query.clj b/aggregator/src/aggregator/query/query.clj index 5478572..8cf59fa 100644 --- a/aggregator/src/aggregator/query/query.clj +++ b/aggregator/src/aggregator/query/query.clj @@ -24,9 +24,8 @@ "Uses the broker module to subscribe to a queue for updates. Sanitizes the host if a port is appended. Example: example.com:8888 is treated as example.com." [queue host] - (let [queue-name (get-in queue [:data :queue-name]) - cleaned-host (first (str/split host #":"))] - (sub/subscribe queue-name {:host cleaned-host}))) + (let [cleaned-host (first (str/split host #":"))] + (sub/subscribe queue {:host cleaned-host}))) (defn exact-statement "Return the exact statement from cache or db" From 0b43f4b26ff0c19255ad67b16a5bb2cb2678de32 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Wed, 7 Nov 2018 14:34:17 +0100 Subject: [PATCH 13/47] Add declare statement to queues --- aggregator/src/aggregator/broker/subscriber.clj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aggregator/src/aggregator/broker/subscriber.clj b/aggregator/src/aggregator/broker/subscriber.clj index 22688f1..f08367a 100644 --- a/aggregator/src/aggregator/broker/subscriber.clj +++ b/aggregator/src/aggregator/broker/subscriber.clj @@ -2,11 +2,13 @@ (:require [langohr.core :as rmq] [langohr.channel :as lch] [langohr.consumers :as lcons] + [langohr.queue :as lq] [taoensso.timbre :as log] [aggregator.utils.common :as lib] [aggregator.query.update :as qupd] [aggregator.specs :as gspecs] - [clojure.spec.alpha :as s]) + [clojure.spec.alpha :as s] + [aggregator.broker.subscriber :as sub]) (:import [com.rabbitmq.client AuthenticationFailureException])) (def exceptions @@ -50,6 +52,7 @@ :username (or user (System/getenv "BROKER_USER")) :password (or password (System/getenv "BROKER_PASS"))}) ch (lch/open conn)] + (lq/declare ch queue {:exclusive false :auto-delete true}) (lcons/subscribe ch queue (partial message-handler f) {:auto-ack true}) (log/debug (format "Connected to queue %s. Channel id: %s" queue (.getChannelNumber ch))) (lib/return-ok "Connection to message queue established.")) From f0237969ebdc0a95511022dc5b93bcc1504aeaff Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Wed, 7 Nov 2018 14:53:27 +0100 Subject: [PATCH 14/47] Fix dumb import --- aggregator/src/aggregator/broker/subscriber.clj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aggregator/src/aggregator/broker/subscriber.clj b/aggregator/src/aggregator/broker/subscriber.clj index f08367a..7bacfe7 100644 --- a/aggregator/src/aggregator/broker/subscriber.clj +++ b/aggregator/src/aggregator/broker/subscriber.clj @@ -7,8 +7,7 @@ [aggregator.utils.common :as lib] [aggregator.query.update :as qupd] [aggregator.specs :as gspecs] - [clojure.spec.alpha :as s] - [aggregator.broker.subscriber :as sub]) + [clojure.spec.alpha :as s]) (:import [com.rabbitmq.client AuthenticationFailureException])) (def exceptions From 9a870b4edef589aecda4221c0bc1227ca89c1b43 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Wed, 7 Nov 2018 15:34:53 +0100 Subject: [PATCH 15/47] Create queues at the initialize phase instead of at runtime --- aggregator/src/aggregator/broker/subscriber.clj | 1 - aggregator/src/aggregator/core.clj | 2 ++ aggregator/src/aggregator/query/retriever.clj | 4 ++-- aggregator/test/aggregator/broker/connector_test.clj | 3 ++- aggregator/test/aggregator/broker/subscriber_test.clj | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/aggregator/src/aggregator/broker/subscriber.clj b/aggregator/src/aggregator/broker/subscriber.clj index 7bacfe7..26f85f4 100644 --- a/aggregator/src/aggregator/broker/subscriber.clj +++ b/aggregator/src/aggregator/broker/subscriber.clj @@ -51,7 +51,6 @@ :username (or user (System/getenv "BROKER_USER")) :password (or password (System/getenv "BROKER_PASS"))}) ch (lch/open conn)] - (lq/declare ch queue {:exclusive false :auto-delete true}) (lcons/subscribe ch queue (partial message-handler f) {:auto-ack true}) (log/debug (format "Connected to queue %s. Channel id: %s" queue (.getChannelNumber ch))) (lib/return-ok "Connection to message queue established.")) diff --git a/aggregator/src/aggregator/core.clj b/aggregator/src/aggregator/core.clj index 62a95c2..6646f03 100644 --- a/aggregator/src/aggregator/core.clj +++ b/aggregator/src/aggregator/core.clj @@ -36,6 +36,8 @@ (search/entrypoint) (when-not (broker/connected?) (broker/init-connection!)) + (broker/create-queue "statements") + (broker/create-queue "links") (load-test-data) (bootstrap-dgep-data) (pg-listener/start-listeners) diff --git a/aggregator/src/aggregator/query/retriever.clj b/aggregator/src/aggregator/query/retriever.clj index 5f1e76e..0ac887c 100644 --- a/aggregator/src/aggregator/query/retriever.clj +++ b/aggregator/src/aggregator/query/retriever.clj @@ -54,8 +54,8 @@ (future (loop [whitelisted config/whitelist] (log/debug "Pulling all whitelisted information at once.") - (dorun (map query/all-remote-statements whitelisted)) - (dorun (map query/all-remote-links whitelisted)) + (run! query/all-remote-statements whitelisted) + (run! query/all-remote-links whitelisted) (Thread/sleep 120000) (recur whitelisted)))) diff --git a/aggregator/test/aggregator/broker/connector_test.clj b/aggregator/test/aggregator/broker/connector_test.clj index b8f2dda..c75c591 100644 --- a/aggregator/test/aggregator/broker/connector_test.clj +++ b/aggregator/test/aggregator/broker/connector_test.clj @@ -21,7 +21,8 @@ (is (= :ok (:status (-> (connector/open-channel) connector/close-channel))))) (deftest create-queue-test - (is (= :ok (:status (connector/create-queue "i.am.groot"))))) + (is (= :ok (:status (connector/create-queue "i.am.groot")))) + (connector/delete-queue "i.am.groot")) (deftest delete-queue-test (let [queue (str (lib/uuid))] diff --git a/aggregator/test/aggregator/broker/subscriber_test.clj b/aggregator/test/aggregator/broker/subscriber_test.clj index 751fcea..9d228f5 100644 --- a/aggregator/test/aggregator/broker/subscriber_test.clj +++ b/aggregator/test/aggregator/broker/subscriber_test.clj @@ -60,7 +60,7 @@ (testing "Wrong password also returns an :error" (is (= :error (:status (sub/subscribe handler queue - (assoc broker :user "The wrong password you have.")))))) + (assoc broker :password "The wrong password you have.")))))) (testing "Can't subscribe to a non-existent queue" (is (= :error (:status (sub/subscribe handler From 682b976eb9670ca6dbf0be09661d99b631011061 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 9 Nov 2018 11:03:12 +0100 Subject: [PATCH 16/47] Refactor/broker connections --- .../src/aggregator/broker/connector.clj | 133 +++++++++++------- aggregator/src/aggregator/broker/publish.clj | 4 +- .../src/aggregator/broker/subscriber.clj | 31 ++-- aggregator/src/aggregator/core.clj | 5 +- .../test/aggregator/api/routes_test.clj | 4 +- .../test/aggregator/broker/connector_test.clj | 14 +- .../test/aggregator/broker/publish_test.clj | 4 +- .../aggregator/broker/subscriber_test.clj | 13 +- 8 files changed, 122 insertions(+), 86 deletions(-) diff --git a/aggregator/src/aggregator/broker/connector.clj b/aggregator/src/aggregator/broker/connector.clj index 321d514..e747836 100644 --- a/aggregator/src/aggregator/broker/connector.clj +++ b/aggregator/src/aggregator/broker/connector.clj @@ -5,15 +5,24 @@ [langohr.channel :as lch] [langohr.queue :as lq] [aggregator.broker.config :as bconf] + [aggregator.config :as config] [aggregator.utils.common :as lib])) -(def ^:private conn (atom nil)) +(defn broker-data + "Helper shortcut to get the broker-data from the state." + [name] + (get-in @config/app-state [:broker-info name])) (defn connected? - "Check if connection to broker is established." - [] (if (and @conn (not (rmq/closed? @conn))) true false)) - -(defmacro with-connection + "Check if connection to broker is established. When no broker-name is given, the local broker is checked. If connection is established return connection, otherwise nil." + ([broker-name] + (:conn (broker-data broker-name))) + ([] + (connected? (System/getenv "BROKER_HOST")))) + +#_(defmacro with-connection + "Executes the body if the local connection is established. + Returns the error message otherwise." [error-msg & body] `(if (connected?) (do ~@body) @@ -26,42 +35,70 @@ (defn- create-connection! "Read variables from environment and establish connection to the message broker." - [] (reset! conn (rmq/connect {:host (System/getenv "BROKER_HOST") - :username (System/getenv "BROKER_USER") - :password (System/getenv "BROKER_PASS")}))) - -(defn init-connection! - "Initializes connection to broker and creates an exchange." + [hostname] (rmq/connect {:host hostname + :username (System/getenv "BROKER_USER") + :password (System/getenv "BROKER_PASS")})) + +(defn get-connection! + "Opens a connection to a remote broker. If the connection is already opened, returns the opened connection. + Connections are stored within the app-state inside the config-module." + ([broker-name] + (let [conn (:conn (broker-data broker-name))] + (or conn + (let [new-conn (create-connection! broker-name)] + (swap! config/app-state assoc-in [:broker-info broker-name :conn] new-conn) + new-conn)))) + ([] + (get-connection! (System/getenv "BROKER_HOST")))) + +(defn init-local-connection! + "Initializes connection to local broker and creates an exchange." [] - (create-connection!) + (get-connection! (System/getenv "BROKER_HOST")) (log/debug "Connection to Message Broker established.") (lib/return-ok "Connection established.")) +(declare close-all-channels!) (defn close-connection! - "Close connection to message broker." + "Closes a connection for a given broker and returns :ok. If the connection is already closed, return nil." + [broker-name] + (when-let [conn (:conn (broker-data broker-name))] + (close-all-channels! broker-name) + (rmq/close conn) + (swap! config/app-state assoc-in [:broker-info broker-name :conn] nil) + :ok)) + +(defn close-local-connection! + "Close connection to the local message broker." [] - (with-connection "Connection could not be closed." - (rmq/close @conn) - (reset! conn nil) - (lib/return-ok "Connection closed."))) + (close-connection! (System/getenv "BROKER_HOST")) + (lib/return-ok "Connection closed.")) ;; ----------------------------------------------------------------------------- ;; For the communication with the broker -(defn open-channel - "Opens a channel for an existing connection to the broker." - [] - (with-connection "Could not create channel." - (lch/open @conn))) +(defn open-channel! + "Opens a channel returns it. + Keep in mind that you need to close this connection when finished." + ([broker-name] + (when-let [connection (get-connection! broker-name)] + (lch/open connection))) + ([] (open-channel! (System/getenv "BROKER_HOST")))) -(defn close-channel +(defn close-channel! "Given a channel, close it!" [ch] - (with-connection "Could not close channel." - (when-not (lch/closed? ch) - (lch/close ch) - (lib/return-ok "Channel closed.")))) + (when-not (lch/closed? ch) + (lch/close ch) + (lib/return-ok "Channel closed."))) + +(defn close-all-channels! + "Closes all known channels for a certain broker." + [broker-name] + (let [channels (:subscriptions (broker-data broker-name))] + (run! (fn [[_ chan]] (lch/close chan)) channels) + (swap! config/app-state assoc-in [:broker-info broker-name :subscriptions] {}))) (defn create-queue "Creates a queue for a given aggregator. Uses aggregator as the queue name and @@ -71,49 +108,47 @@ Example: (create-queue \"statements\")" ([queue-name exchange] - (with-connection "Could not create queue." + (let [ch (open-channel!)] (try - (let [ch (open-channel) - queue-name queue-name - expires-in-ms (* 30 60 1000)] - (lq/declare ch queue-name {:arguments {"x-expires" expires-in-ms}}) - (lq/bind ch queue-name exchange {:routing-key queue-name}) - (close-channel ch) - (log/debug "Created queue:" queue-name) - (lib/return-ok "Queue created." {:queue-name queue-name :expires-in-ms expires-in-ms})) + (lq/declare ch queue-name {:durable true + :auto-delete false}) + (lq/bind ch queue-name exchange {:routing-key queue-name}) + (log/debug "Created queue:" queue-name) + (lib/return-ok "Queue created." {:queue-name queue-name}) (catch java.io.IOException _e (log/error "Could not create queue" queue-name) - (lib/return-error "Could not create queue, caught IOException."))))) + (lib/return-error "Could not create queue, caught IOException.")) + (finally (close-channel! ch))))) ([queue-name] (create-queue queue-name bconf/exchange))) (defn queue-exists? "Check if queue exists. Returns a Boolean when connection is established." [queue] - (with-connection (format "Can't query existence of queue '%s'." queue) + (let [_ (get-connection!) + ch (open-channel!)] (try - (let [ch (open-channel)] - (lq/status ch queue) - (close-channel ch) - true) - (catch java.io.IOException _e false)))) + (lq/status ch queue) + true + (catch java.io.IOException _e false) + (finally (close-channel! ch))))) (defn delete-queue "Given a queue-name, delete it!" [queue] - (with-connection "Could not delete queue." + (let [_ (get-connection!) + ch (open-channel!)] (when queue-exists? - (let [ch (open-channel)] - (lq/delete ch queue) - (close-channel ch) - (lib/return-ok "Queue deleted."))))) + (lq/delete ch queue) + (close-channel! ch) + (lib/return-ok "Queue deleted.")))) ;; ----------------------------------------------------------------------------- ;; Entrypoint (defn entrypoint [] - (init-connection!) + (init-local-connection!) (create-queue "statements") (create-queue "links")) ;;(entrypoint) diff --git a/aggregator/src/aggregator/broker/publish.clj b/aggregator/src/aggregator/broker/publish.clj index 1026c5c..9742852 100644 --- a/aggregator/src/aggregator/broker/publish.clj +++ b/aggregator/src/aggregator/broker/publish.clj @@ -11,12 +11,12 @@ (defn- publish "Create queue for entity and publish it on this queue." [payload routing-key entity-type] - (let [ch (connector/open-channel)] + (let [ch (connector/open-channel!)] (try (lb/publish ch bconf/exchange routing-key (json/write-str payload) {:content-type "application/json" :type (name entity-type)}) (catch Throwable t (.printStackTrace t)) - (finally (connector/close-channel ch))))) + (finally (connector/close-channel! ch))))) (defn publish-statement "Put a statement to the correct queue. Statement must conform spec to be diff --git a/aggregator/src/aggregator/broker/subscriber.clj b/aggregator/src/aggregator/broker/subscriber.clj index 26f85f4..4b5a706 100644 --- a/aggregator/src/aggregator/broker/subscriber.clj +++ b/aggregator/src/aggregator/broker/subscriber.clj @@ -2,11 +2,12 @@ (:require [langohr.core :as rmq] [langohr.channel :as lch] [langohr.consumers :as lcons] - [langohr.queue :as lq] [taoensso.timbre :as log] [aggregator.utils.common :as lib] [aggregator.query.update :as qupd] [aggregator.specs :as gspecs] + [aggregator.broker.connector :as conn] + [aggregator.config :as config] [clojure.spec.alpha :as s]) (:import [com.rabbitmq.client AuthenticationFailureException])) @@ -38,21 +39,33 @@ (log/debug "Received a valid link. Passing it to query-module...") (qupd/update-link nlink)))) +(defn save-sub-to-state! + "Adds a subscription and the corresponding channel to the app-state." + [broker sub-name channel] + (swap! config/app-state + assoc-in [:broker-info broker :subscriptions sub-name] channel)) + (defn subscribe "Subscribe to queue and call a function f with meta-information and payload. Example: (subscribe (fn [meta payload] [meta payload]) \"statements\" {:host \"broker\" :user \"groot\" :password \"iamgroot\"}) (subscribe \"statements\" {:host \"broker\"})" - ([f queue {:keys [host user password]}] + ([f queue {:keys [host]}] (try - (let [conn (rmq/connect - {:host host - :username (or user (System/getenv "BROKER_USER")) - :password (or password (System/getenv "BROKER_PASS"))}) - ch (lch/open conn)] - (lcons/subscribe ch queue (partial message-handler f) {:auto-ack true}) - (log/debug (format "Connected to queue %s. Channel id: %s" queue (.getChannelNumber ch))) + (let [current-subs (:subscriptions (conn/broker-data host)) + connection (conn/get-connection! host) + channel (if-not (contains? current-subs queue) + (do + (log/debug (format + "The queue %s has no open channel for it." + queue)) + (lch/open connection)) + (get current-subs queue))] + (lcons/subscribe channel queue (partial message-handler f) {:auto-ack true}) + (save-sub-to-state! host queue channel) + (log/debug (format "Connected to queue %s. Channel id: %s" + queue (.getChannelNumber channel))) (lib/return-ok "Connection to message queue established.")) (catch AuthenticationFailureException e (log/debug (:auth-ex exceptions)) diff --git a/aggregator/src/aggregator/core.clj b/aggregator/src/aggregator/core.clj index 6646f03..9720354 100644 --- a/aggregator/src/aggregator/core.clj +++ b/aggregator/src/aggregator/core.clj @@ -34,10 +34,7 @@ [& args] (load-config) (search/entrypoint) - (when-not (broker/connected?) - (broker/init-connection!)) - (broker/create-queue "statements") - (broker/create-queue "links") + (broker/entrypoint) (load-test-data) (bootstrap-dgep-data) (pg-listener/start-listeners) diff --git a/aggregator/test/aggregator/api/routes_test.clj b/aggregator/test/aggregator/api/routes_test.clj index d1b53eb..45fcfa6 100644 --- a/aggregator/test/aggregator/api/routes_test.clj +++ b/aggregator/test/aggregator/api/routes_test.clj @@ -6,9 +6,9 @@ [cheshire.core :as cheshire])) (defn fixtures [f] - (connector/init-connection!) + (connector/init-local-connection!) (f) - (connector/close-connection!)) + (connector/close-local-connection!)) (use-fixtures :once fixtures) (defn- parse-body [body] diff --git a/aggregator/test/aggregator/broker/connector_test.clj b/aggregator/test/aggregator/broker/connector_test.clj index c75c591..48dd9a8 100644 --- a/aggregator/test/aggregator/broker/connector_test.clj +++ b/aggregator/test/aggregator/broker/connector_test.clj @@ -5,9 +5,9 @@ ;; Test preparation (defn fixtures [f] - (connector/init-connection!) + (connector/init-local-connection!) (f) - (connector/close-connection!)) + (connector/close-local-connection!)) (use-fixtures :once fixtures) @@ -15,10 +15,10 @@ ;; Tests (deftest open-channel-test - (is (not (nil? (connector/open-channel))))) + (is (not (nil? (connector/open-channel!))))) (deftest close-channel-test - (is (= :ok (:status (-> (connector/open-channel) connector/close-channel))))) + (is (= :ok (:status (-> (connector/open-channel!) connector/close-channel!))))) (deftest create-queue-test (is (= :ok (:status (connector/create-queue "i.am.groot")))) @@ -37,8 +37,8 @@ (is (not (connector/queue-exists? queue))))) (deftest connected? - (connector/init-connection!) + (connector/init-local-connection!) (is (connector/connected?)) - (connector/close-connection!) + (connector/close-local-connection!) (is (not (connector/connected?))) - (connector/init-connection!)) + (connector/init-local-connection!)) diff --git a/aggregator/test/aggregator/broker/publish_test.clj b/aggregator/test/aggregator/broker/publish_test.clj index e1307be..2c6cf2d 100644 --- a/aggregator/test/aggregator/broker/publish_test.clj +++ b/aggregator/test/aggregator/broker/publish_test.clj @@ -22,9 +22,9 @@ ;; Test preparation (defn fixtures [f] - (connector/init-connection!) + (connector/init-local-connection!) (f) - (connector/close-connection!)) + (connector/close-local-connection!)) (use-fixtures :once fixtures) diff --git a/aggregator/test/aggregator/broker/subscriber_test.clj b/aggregator/test/aggregator/broker/subscriber_test.clj index 9d228f5..d32320c 100644 --- a/aggregator/test/aggregator/broker/subscriber_test.clj +++ b/aggregator/test/aggregator/broker/subscriber_test.clj @@ -26,7 +26,7 @@ ;; Test preparation (defn fixtures [f] - (connector/init-connection!) + (connector/init-local-connection!) (connector/create-queue queue) (connector/create-queue queue-two) (pub/publish-statement statement) @@ -34,7 +34,7 @@ (f) (connector/delete-queue queue) (connector/delete-queue queue-two) - (connector/close-connection!)) + (connector/close-local-connection!)) (use-fixtures :once fixtures) @@ -52,15 +52,6 @@ (is (= :error (:status (sub/subscribe handler queue (assoc broker :host "deathstar#4")))))) - (testing "Wrong user gives status :error" - (deftest subscribe-wrong-user - (is (= :error (:status - (sub/subscribe handler queue - (assoc broker :user "yoda"))))))) - (testing "Wrong password also returns an :error" - (is (= :error (:status - (sub/subscribe handler queue - (assoc broker :password "The wrong password you have.")))))) (testing "Can't subscribe to a non-existent queue" (is (= :error (:status (sub/subscribe handler From 107126881c99094429625c12fd8d7e87b3850ecc Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 9 Nov 2018 11:10:59 +0100 Subject: [PATCH 17/47] Remove periodic pulling now that channels work --- aggregator/src/aggregator/query/retriever.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aggregator/src/aggregator/query/retriever.clj b/aggregator/src/aggregator/query/retriever.clj index 0ac887c..c244abc 100644 --- a/aggregator/src/aggregator/query/retriever.clj +++ b/aggregator/src/aggregator/query/retriever.clj @@ -51,7 +51,7 @@ (log/debug "[retriever] Automatic search waking up.") (query/remote-starter-set) (recur (rand-nth (keys (cache/get-cached-statements)))))) - (future + #_(future (loop [whitelisted config/whitelist] (log/debug "Pulling all whitelisted information at once.") (run! query/all-remote-statements whitelisted) From c952e8b4fca4796226551df5ed0f820930fd8d0b Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Mon, 12 Nov 2018 11:19:16 +0100 Subject: [PATCH 18/47] Enhance/retriever --- .../src/aggregator/graphql/dbas_connector.clj | 30 +++---- aggregator/src/aggregator/query/db.clj | 11 +-- aggregator/src/aggregator/query/query.clj | 5 +- aggregator/src/aggregator/query/retriever.clj | 79 +++++++++---------- 4 files changed, 61 insertions(+), 64 deletions(-) diff --git a/aggregator/src/aggregator/graphql/dbas_connector.clj b/aggregator/src/aggregator/graphql/dbas_connector.clj index 0413910..7bf8308 100644 --- a/aggregator/src/aggregator/graphql/dbas_connector.clj +++ b/aggregator/src/aggregator/graphql/dbas_connector.clj @@ -73,23 +73,19 @@ group-uid)) link-type-val (link-type argument)] (map (fn [premise] - (let [prepared-link - {:author (str "author#: " - (:authorUid argument)) - :created nil ;; nil until we solve the graphql problem - :type link-type-val - :source {:aggregate-id config/aggregate-name - :entity-id (:statementUid premise) - :version 1} - :destination {:aggregate-id config/aggregate-name} - :identifier {:aggregate-id config/aggregate-name - :entity-id (:uid argument) - :version 1}}] - (if (not= link-type-val :undercut) - (assoc prepared-link :destination {:aggregate-id config/aggregate-name - :version 1 - :entity-id (:conclusionUid argument)}) - (assoc-in prepared-link [:destination :entity-id] (:argumentUid argument))))) + {:author (str "author#: " + (:authorUid argument)) + :created nil ;; nil until we solve the graphql problem + :type link-type-val + :source {:aggregate-id config/aggregate-name + :entity-id (:statementUid premise) + :version 1} + :destination {:aggregate-id config/aggregate-name + :version 1 + :entity-id (:conclusionUid argument)} + :identifier {:aggregate-id config/aggregate-name + :entity-id (:uid argument) + :version 1}}) (:premises premises)))) diff --git a/aggregator/src/aggregator/query/db.clj b/aggregator/src/aggregator/query/db.clj index 1a96462..73f3f56 100644 --- a/aggregator/src/aggregator/query/db.clj +++ b/aggregator/src/aggregator/query/db.clj @@ -93,15 +93,16 @@ "Returns all undercuts that point to target aggregator and entity-id." [target-aggregator target-entity-id] (keywordize-types (unpack-elastic (elastic/search :links {:type "undercut" - :destination.aggregate-id target-aggregator - :destination.entity-id target-entity-id})))) + :destination.aggregate-id target-aggregator + :destination.entity-id target-entity-id})))) (defn links-by-target "Return all links with the corresponding target." [target-aggregator target-entity target-version] - (keywordize-types (unpack-elastic (elastic/search :links {:destination.aggregate-id target-aggregator - :destination.entity-id target-entity - :destination.version target-version})))) + (keywordize-types (unpack-elastic + (elastic/search :links {:destination.aggregate-id target-aggregator + :destination.entity-id target-entity + :destination.version target-version})))) (defn random-statements "Return *num* random statements from the db." diff --git a/aggregator/src/aggregator/query/query.clj b/aggregator/src/aggregator/query/query.clj index 8cf59fa..6d31e7a 100644 --- a/aggregator/src/aggregator/query/query.clj +++ b/aggregator/src/aggregator/query/query.clj @@ -93,10 +93,13 @@ [aggregate-id entity-id version] (if-let [possible-links (links-by-target aggregate-id entity-id version)] possible-links - (let [request-url (str config/protocol aggregate-id "/link/to/") + (let [request-url (str config/protocol aggregate-id "/links/to/") results (get-data request-url {:aggregate-id aggregate-id :entity-id entity-id :version version})] + (log/debug (format "Pulled %s downstream links for %s/%s/%s" + (count results) + aggregate-id entity-id version)) (doseq [link results] (up/update-link link)) results))) diff --git a/aggregator/src/aggregator/query/retriever.clj b/aggregator/src/aggregator/query/retriever.clj index c244abc..9de5c60 100644 --- a/aggregator/src/aggregator/query/retriever.clj +++ b/aggregator/src/aggregator/query/retriever.clj @@ -5,59 +5,56 @@ [taoensso.timbre :as log])) (defn whitelisted? - "Return whether the source of a link is whitelisted." + "Return whether the aggregator of an entity is whitelisted." [link] - (some #{(get-in link [:source :aggregate-id])} config/whitelist)) + (some #{(get-in link [:identifier :aggregate-id])} config/whitelist)) -(defn next-entity - "Accepts a list and retrieves the statement the head-link is sourced by if its provider is whitelisted. Then retrieves all links connected to it and queues them. Returns the updated list." - [queue] - (if (whitelisted? (first queue)) - (let [link (first queue) - aggregate (get-in link [:source :aggregate-id]) - entity-id (get-in link [:source :entity-id]) - version (get-in link [:source :link]) - undercuts (query/retrieve-undercuts aggregate entity-id) - additional-links (query/links-to aggregate entity-id version)] - (concat (rest queue) undercuts additional-links)) - (rest queue))) +(defn- statement? + "Is the argument a statement?" + [entity] + (when (contains? entity :content) + true)) -(defn loop-next - "Loop the next function with the queue until its empty." - [queue] - (loop [q queue] - (let [next-step (next-entity q)] - (when (seq next-step) - (recur next-step))))) - -(defn- lookup-related - "Lookup all related links and statements 'downstream' from the starting statement." - [statement] - (log/debug (format "[retriever] Starting to pull related data for %s" statement)) - (let [aggregate-id (get-in statement [:identifier :aggregate-id]) - entity-id (get-in statement [:identifier :entity-id]) - version (get-in statement [:identifier :version]) - startlinks (query/links-to aggregate-id entity-id version)] - (loop-next startlinks))) +(defn lookup-related-breadth-first + [entity] + (loop [[head & rest] [entity]] + ;; Sleep half a second to not hog many resources + (Thread/sleep 500) + (log/debug (format "Continuing background retrieval with head %s" head)) + (let [aggregate-id (get-in head [:identifier :aggregate-id]) + entity-id (get-in head [:identifier :entity-id]) + version (get-in head [:identifier :version])] + (if (whitelisted? head) + (if (statement? head) + ;; Head is a statement - Continue with rest + all links to head + (let [links-to (query/links-to aggregate-id entity-id version) + continue-queue (concat rest links-to)] + (some-> (seq continue-queue) recur)) + ;; Head is a link - Get all undercuts to it and the links source if possible + (let [undercuts-to (query/retrieve-undercuts aggregate-id entity-id) + source-aggregator (get-in head [:source :aggregate-id]) + source-entity-id (get-in head [:source :entity-id]) + source-version (get-in head [:source :version]) + ; Put the statement in a vector for easier concat + source-statement [(query/retrieve-exact-statement source-aggregator + source-entity-id + source-version)] + continue-queue (concat rest undercuts-to source-statement)] + (some-> (seq continue-queue) recur))) + ;; Aggregator not whitelisted - Recur with rest when there are elements left + (some-> (seq rest) recur))))) (defn automatic-retriever "Starts an automatic retriever that looks up statements and links related to things contained in the cache." [] (future - (loop [starter (rand-nth (keys (cache/get-cached-statements)))] - (lookup-related starter) + (loop [starter (rand-nth (vals (cache/get-cached-statements)))] + (lookup-related-breadth-first starter) (log/debug "[retriever] sleeping") (Thread/sleep 60000) (log/debug "[retriever] Automatic search waking up.") (query/remote-starter-set) - (recur (rand-nth (keys (cache/get-cached-statements)))))) - #_(future - (loop [whitelisted config/whitelist] - (log/debug "Pulling all whitelisted information at once.") - (run! query/all-remote-statements whitelisted) - (run! query/all-remote-links whitelisted) - (Thread/sleep 120000) - (recur whitelisted)))) + (recur (rand-nth (vals (cache/get-cached-statements))))))) (defn bootstrap "Call this method when the aggregator starts. Pulls the whitelisted aggregators From 21e5322a411fee7072a55d58b97cfb97b1ec3ce9 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Tue, 13 Nov 2018 15:16:38 +0100 Subject: [PATCH 19/47] Add routes to post a statement and link --- aggregator/src/aggregator/api/routes.clj | 34 ++++++++++++++++++---- aggregator/src/aggregator/query/update.clj | 12 +++++--- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index b7ff424..07535b3 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -1,13 +1,16 @@ (ns aggregator.api.routes "Define and expose the routes for the REST API in this file." (:require [compojure.route] - [compojure.api.sweet :refer [GET api context resource undocumented]] + [compojure.api.sweet :refer [GET POST api context resource undocumented]] [aggregator.query.query :as query] + [aggregator.utils.common :as utils] + [aggregator.query.update :as update] [spec-tools.spec :as spec] [clojure.spec.alpha :as s] [aggregator.specs :as eden-specs] [ring.util.http-response :refer [ok not-found]] - [ring.middleware.cors :as ring-cors])) + [ring.middleware.cors :as ring-cors] + [taoensso.timbre :as log])) (s/def ::welcome-message spec/string?) (s/def ::statements (s/coll-of ::eden-specs/statement)) @@ -87,7 +90,19 @@ :return ::statement-map (if-let [statement (query/exact-statement aggregate-id entity-id version)] (ok {:statement statement}) - (not-found nil))))) + (not-found nil))) + + (POST "/add" [] + :summary "Add a statement to the EDEN database" + :body [statement ::eden-specs/statement] + :return ::statement-map + (ok {:statement (update/update-statement (utils/json->edn statement))})))) + +(defn wrap-link-type [handler] + (fn [request] + (if-let [type (-> request :body-params :type)] + (handler (assoc-in request [:body-params :type] (keyword type))) + (handler request)))) (def link-routes (context "/link" [] @@ -102,7 +117,14 @@ :return ::link-map (if-let [link (query/retrieve-link aggregate-id entity-id version)] (ok {:link link}) - (not-found nil))))) + (not-found nil))) + + (POST "/add" [] + :summary "Add a link to the EDEN database" + :middleware [wrap-link-type] + :body [link ::eden-specs/link] + :return ::link-map + (ok {:link (update/update-link (utils/json->edn link))})))) (def ^:private hello-route (GET "/" [] @@ -121,8 +143,8 @@ :description "An API to request statements and links from the EDEN instance."} :tags [{:name "statements" :description "Retrieve Statements"} {:name "links" :description "Retrieve Links"} - {:name "statement" :description "Retrieve single specific statement"} - {:name "link" :description "Retrieve single specific link"}]}}} + {:name "statement" :description "Retrieve or add a single specific statement"} + {:name "link" :description "Retrieve or add a single specific link"}]}}} statement-routes statements-routes link-routes diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index 12b72bf..36d2ed6 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -18,9 +18,12 @@ (when (= (:aggregate-id identifier) config/aggregate-name) (pub/publish-statement statement)) (db/insert-statement statement)) - (cache/cache-miss (str (:aggregate-id identifier) "/" (:entity-id identifier) "/" - (:version identifier)) - statement))) + (let [cache-uri (str (:aggregate-id identifier) "/" (:entity-id identifier) "/" + (:version identifier)) + cached-entity (cache/retrieve cache-uri)] + (when (= :missing cached-entity) + (cache/cache-miss cache-uri statement)))) + statement) (defn update-link "Update a database-entry for a link. Typically inserts a link if not in DB yet." @@ -38,4 +41,5 @@ (cache/cache-miss-link (str (:aggregate-id identifier) "/" (:entity-id identifier) "/" (:version identifier)) link) - (db/insert-link link)))) + (db/insert-link link)) + link)) From 8712a75ad81bc3a65c558a2808f1c04112829da0 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Wed, 14 Nov 2018 15:19:23 +0100 Subject: [PATCH 20/47] Feature/forks backend --- aggregator/src/aggregator/query/update.clj | 26 +++++++++ .../test/aggregator/query/update_test.clj | 57 ++++++++++++++----- 2 files changed, 68 insertions(+), 15 deletions(-) diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index 36d2ed6..96dea5a 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -3,6 +3,8 @@ [aggregator.query.cache :as cache] [aggregator.broker.publish :as pub] [aggregator.config :as config] + [aggregator.specs :as specs] + [clojure.spec.alpha :as s] [taoensso.timbre :as log])) (defn update-statement @@ -43,3 +45,27 @@ link) (db/insert-link link)) link)) + +(defn update-statement-content + "Updates the content-text of a statement and bumps the version." + [statement updated-text] + (let [updated-statement (-> statement + (assoc-in [:content :content-string] (str updated-text)) + (update-in [:identifier :version] inc))] + (when (s/valid? ::specs/statement updated-statement) + (db/insert-statement updated-statement) + updated-statement))) + +(defn fork-statement + "Forks a statement with a new identifier, content-string and author." + [statement identifier content-string author] + (let [updated-statement (-> statement + (assoc-in [:content :content-string] (str content-string)) + (assoc-in [:content :author] (str author)) + (assoc :identifier identifier) + (assoc-in [:identifier :version] 1) + (assoc :predecessors [(:identifier statement)]))] + (when (s/valid? ::specs/statement updated-statement) + (db/insert-statement updated-statement) + (pub/publish-statement updated-statement) + updated-statement))) diff --git a/aggregator/test/aggregator/query/update_test.clj b/aggregator/test/aggregator/query/update_test.clj index 51f0dc3..7ac0c30 100644 --- a/aggregator/test/aggregator/query/update_test.clj +++ b/aggregator/test/aggregator/query/update_test.clj @@ -3,27 +3,54 @@ [aggregator.config :as config] [clojure.test :refer [deftest is]])) +(def some-statement + {:identifier {:aggregate-id "name-test" :entity-id "34" :version 1} + :content {:author "Jorge" + :content-string "money does not solve problems of our society" + :created nil} + :predecessors {} + :delete-flag false}) + +(def some-link + {:author "Wegi" :created nil :type :undercut + :source {:aggregate-id "schneider.gg" + :entity-id "W01" :version 1337} + :destination {:aggregate-id "test-link" + :entity-id "W_link_35" :version 1} + :identifier {:aggregate-id "number2" :entity-id "link0r1337" :version 1} + :delete-flag false}) + (deftest test-known-aggregators-update (reset! config/app-state {:known-aggregators #{}}) - (update/update-statement - {:identifier {:aggregate-id "name-test" :entity-id "34" :version 1} - :content {:author "Jorge" - :content-string "money does not solve problems of our society" - :created nil} - :predecessors {} - :delete-flag false}) + (update/update-statement some-statement) (is (contains? (:known-aggregators @config/app-state) "name-test"))) (deftest test-known-aggregators-from-links (reset! config/app-state {:known-aggregators #{}}) - (update/update-link - {:author "Wegi" :created nil :type :undercut - :source {:aggregate-id "schneider.gg" - :entity-id "W01" :version 1337} - :destination {:aggregate-id "test-link" - :entity-id "W_link_35" :version 1} - :identifier {:aggregate-id "number2" :entity-id "link0r1337" :version 1} - :delete-flag false}) + (update/update-link some-link) (is (contains? (:known-aggregators @config/app-state) "schneider.gg")) (is (contains? (:known-aggregators @config/app-state) "test-link")) (is (contains? (:known-aggregators @config/app-state) "number2"))) + +(deftest test-updated-content + (let [updated-statement (update/update-statement-content some-statement "lolz") + updated-statement-2 (update/update-statement-content some-statement :fooo) + not-a-statement (update/update-statement-content some-link "fail")] + (is (= 2 (get-in updated-statement [:identifier :version]))) + (is (= "lolz" (get-in updated-statement [:content :content-string]))) + (is (= ":fooo" (get-in updated-statement-2 [:content :content-string]))) + (is (nil? not-a-statement)))) + +(deftest test-fork-statement + (let [updated-statement (update/fork-statement some-statement {:aggregate-id "new-agg.de" + :entity-id "42" + :version 15} + "New content" "Der Wetschi") + predecessor (first (:predecessors updated-statement))] + (is (= 1 (get-in updated-statement [:identifier :version]))) + (is (= "New content" (get-in updated-statement [:content :content-string]))) + (is (= "new-agg.de" (get-in updated-statement [:identifier :aggregate-id]))) + (is (= "42" (get-in updated-statement [:identifier :entity-id]))) + (is (= "Der Wetschi" (get-in updated-statement [:content :author]))) + (is (= "name-test" (:aggregate-id predecessor))) + (is (= "34" (:entity-id predecessor))))) From ad893e383136fda1467955d3af2b336539b5618b Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Wed, 14 Nov 2018 15:37:57 +0100 Subject: [PATCH 21/47] Prevent loops in the retriever --- aggregator/src/aggregator/query/retriever.clj | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/aggregator/src/aggregator/query/retriever.clj b/aggregator/src/aggregator/query/retriever.clj index 9de5c60..3206f4d 100644 --- a/aggregator/src/aggregator/query/retriever.clj +++ b/aggregator/src/aggregator/query/retriever.clj @@ -15,21 +15,36 @@ (when (contains? entity :content) true)) +(defn- str-id + "Return the string-representation of an entities ID." + [entity] + (let [aggregate-id (get-in entity [:identifier :aggregate-id]) + entity-id (get-in entity [:identifier :aggregate-id]) + version (get-in entity [:identifier :version])] + (format "%s/%s/%s" aggregate-id entity-id version))) + +(defn- add-visited + "Add an element to the visited set. Returns the new set." + [visited entity] + (conj visited (str-id entity))) + (defn lookup-related-breadth-first [entity] - (loop [[head & rest] [entity]] + (loop [[head & rest] [entity] + visited #{}] ;; Sleep half a second to not hog many resources (Thread/sleep 500) (log/debug (format "Continuing background retrieval with head %s" head)) (let [aggregate-id (get-in head [:identifier :aggregate-id]) entity-id (get-in head [:identifier :entity-id]) version (get-in head [:identifier :version])] - (if (whitelisted? head) + (if (and (whitelisted? head) + (not (contains? visited (str-id head)))) ;; Loop prevention (if (statement? head) ;; Head is a statement - Continue with rest + all links to head (let [links-to (query/links-to aggregate-id entity-id version) continue-queue (concat rest links-to)] - (some-> (seq continue-queue) recur)) + (some-> (seq continue-queue) (recur (add-visited visited head)))) ;; Head is a link - Get all undercuts to it and the links source if possible (let [undercuts-to (query/retrieve-undercuts aggregate-id entity-id) source-aggregator (get-in head [:source :aggregate-id]) @@ -40,9 +55,9 @@ source-entity-id source-version)] continue-queue (concat rest undercuts-to source-statement)] - (some-> (seq continue-queue) recur))) + (some-> (seq continue-queue) (recur (add-visited visited head))))) ;; Aggregator not whitelisted - Recur with rest when there are elements left - (some-> (seq rest) recur))))) + (some-> (seq rest) (recur (add-visited visited head))))))) (defn automatic-retriever "Starts an automatic retriever that looks up statements and links related to things contained in the cache." From 2250e6d8f28c5a54d951a0796476f86cd91ee5f2 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Thu, 22 Nov 2018 14:15:56 +0100 Subject: [PATCH 22/47] Add possibility to search for custom fields in EDEN --- aggregator/src/aggregator/api/routes.clj | 11 +++++++++-- aggregator/src/aggregator/query/db.clj | 6 ++++++ aggregator/src/aggregator/query/query.clj | 6 ++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index 07535b3..ee9e845 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -49,7 +49,14 @@ entity-id :- ::eden-specs/entity-id] :return ::statements-map (ok {:statements (query/tiered-retrieval aggregate-id entity-id - {:opts [:no-remote]})})))) + {:opts [:no-remote]})})) + + (GET "/custom" [] + :summary "Returns all statements matching the search term in a custom field" + :query-params [custom-field :- spec/string? + search-term :- spec/string?] + :return ::statements-map + (ok {:statements (query/custom-statement custom-field search-term)})))) (def links-routes (context "/links" [] @@ -68,7 +75,7 @@ entity-id :- ::eden-specs/entity-id] :return ::links-map (ok {:links (query/local-undercuts aggregate-id entity-id)})) - + (GET "/to" [] :summary "Return all links pointing to a specific statement" :query-params [aggregate-id :- ::eden-specs/aggregate-id diff --git a/aggregator/src/aggregator/query/db.clj b/aggregator/src/aggregator/query/db.clj index 73f3f56..316318f 100644 --- a/aggregator/src/aggregator/query/db.clj +++ b/aggregator/src/aggregator/query/db.clj @@ -116,3 +116,9 @@ "Return all statements from the elasticsearch-db where content.content-string containts `query`" [query] (unpack-elastic (elastic/search :statements-fuzzy query))) + + +(defn custom-statement-search + "Search for statements by looking for content in a custom field." + [field search-term] + (unpack-elastic (elastic/search :statements {(keyword field) search-term}))) diff --git a/aggregator/src/aggregator/query/query.clj b/aggregator/src/aggregator/query/query.clj index 6d31e7a..2b3c469 100644 --- a/aggregator/src/aggregator/query/query.clj +++ b/aggregator/src/aggregator/query/query.clj @@ -188,3 +188,9 @@ "Retrieve all statements where the content.content-string contains the `query`" [query] (db/statements-contain query)) + + +(defn custom-statement + "Retrieve a statement with a custom field containg a specific search-term." + [field search-term] + (db/custom-statement-search field search-term)) From 640bdbd74fe857daea78bdfd2bcfe95928bca85a Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Thu, 22 Nov 2018 14:16:58 +0100 Subject: [PATCH 23/47] Bump dbas-version --- dbas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbas b/dbas index 1642e5a..f6c0abc 160000 --- a/dbas +++ b/dbas @@ -1 +1 @@ -Subproject commit 1642e5a8c7f34a4e9fdb6f467df36b9c05ccfe56 +Subproject commit f6c0abc9942731fd2092a2cd0fee502f22690b12 From 71c176be324f538d4f0d975cd1fcc1301e01840b Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Mon, 26 Nov 2018 10:38:55 +0100 Subject: [PATCH 24/47] Add swagger to root route instead of /swagger --- aggregator/src/aggregator/api/routes.clj | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index ee9e845..23ef4d0 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -133,18 +133,11 @@ :return ::link-map (ok {:link (update/update-link (utils/json->edn link))})))) -(def ^:private hello-route - (GET "/" [] - :summary "Test whether the api is online" - :query-params [] - :return ::welcome-message - (ok "Hello!"))) - (def app (let [compojure-api-handler (api {:coercion :spec :swagger - {:ui "/swagger" + {:ui "/" :spec "/swagger.json" :data {:info {:title "EDEN Aggregator API" :description "An API to request statements and links from the EDEN instance."} @@ -156,7 +149,6 @@ statements-routes link-routes links-routes - hello-route (undocumented (compojure.route/not-found (not-found {:not "found"}))))] (ring-cors/wrap-cors From dc99b49b7850c2e687fb7036cbf71f8a172b97f9 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Mon, 26 Nov 2018 12:49:13 +0100 Subject: [PATCH 25/47] Fix test --- aggregator/test/aggregator/api/routes_test.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aggregator/test/aggregator/api/routes_test.clj b/aggregator/test/aggregator/api/routes_test.clj index 45fcfa6..67efe5a 100644 --- a/aggregator/test/aggregator/api/routes_test.clj +++ b/aggregator/test/aggregator/api/routes_test.clj @@ -16,9 +16,9 @@ (deftest handler-test - (testing "Test root route for status 200" + (testing "Test root route for status 302" (let [response (routes/app (mock/request :get "/"))] - (is (= (:status response) 200))))) + (is (= (:status response) 302))))) (deftest statement-nonexistent-route (testing "Test nonexistent-route for status 500" From 93f6baa3bcd5ea89cd245c4f371cbb1b29119463 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Mon, 26 Nov 2018 15:29:35 +0100 Subject: [PATCH 26/47] Add/simplified add routes --- aggregator/src/aggregator/api/routes.clj | 24 ++++++++++++ aggregator/src/aggregator/query/update.clj | 38 +++++++++++++++++++ .../test/aggregator/query/update_test.clj | 24 ++++++++++++ 3 files changed, 86 insertions(+) diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index 23ef4d0..a52a69d 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -15,10 +15,33 @@ (s/def ::welcome-message spec/string?) (s/def ::statements (s/coll-of ::eden-specs/statement)) (s/def ::statements-map (s/keys :req-un [::statements])) +(s/def ::minimal-statement (s/keys :req-un [::eden-specs/content-string ::eden-specs/author])) +(s/def ::minimal-premise ::minimal-statement) +(s/def ::minimal-conclusion ::minimal-statement) (s/def ::links (s/coll-of ::eden-specs/link)) (s/def ::links-map (s/keys :req-un [::links])) (s/def ::statement-map (s/keys :req-un [::eden-specs/statement])) (s/def ::link-map (s/keys :req-un [::eden-specs/link])) +(s/def ::premise-id ::eden-specs/identifier) +(s/def ::conclusion-id ::eden-specs/identifier) +(s/def ::new-argument (s/keys :req-un [::premise-id ::conclusion-id])) +(s/def ::link-type #{"support" "attack" "undercut"}) +(s/def ::minimal-argument (s/keys :req-un [::minimal-premise ::minimal-conclusion ::link-type])) + +(def argument-routes + (context "/argument" [] + :tags ["argument"] + :coercion :spec + + (POST "/add" [] + :summary "Add a new argument to the EDEN database" + :body [request-body ::minimal-argument] + :return ::new-argument + (ok + (let [premise (:minimal-premise request-body) + conclusion (:minimal-conclusion request-body) + link-type (:link-type request-body)] + (update/add-argument premise conclusion link-type)))))) (def statements-routes (context "/statements" [] @@ -149,6 +172,7 @@ statements-routes link-routes links-routes + argument-routes (undocumented (compojure.route/not-found (not-found {:not "found"}))))] (ring-cors/wrap-cors diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index 96dea5a..839fa04 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -69,3 +69,41 @@ (db/insert-statement updated-statement) (pub/publish-statement updated-statement) updated-statement))) + +(defn- statement-from-minimal + "Generate a statement from the minimal needed information." + [{:keys [content-string author]}] + {:content {:content-string content-string + :author author + :created nil} + :identifier {:aggregate-id config/aggregate-name + :entity-id (str (java.util.UUID/randomUUID)) + :version 1} + :delete-flag :false + :predecessors []}) + +(defn- link-premise-conclusion + "Given a premise and a conclusion, link them both with an argument link." + [premise conclusion link-type] + (let [premise-id (:identifier premise) + conclusion-id (:identifier conclusion)] + {:type (:keyword link-type) + :source premise-id + :destination conclusion-id + :delete-flag :false + :identifier {:aggregate-id config/aggregate-name + :entity-id (str "link_" (java.util.UUID/randomUUID)) + :version 1}})) + +(defn add-argument + "Adds an argument to the database." + [premise conclusion link-type] + (let [complete-premise (statement-from-minimal premise) + complete-conclusion (statement-from-minimal conclusion) + link (link-premise-conclusion complete-premise complete-conclusion link-type)] + (update-statement complete-premise) + (update-statement complete-conclusion) + (update-link link) + {:premise-id (:identifier complete-premise) + :conclusion-id (:identifier complete-conclusion) + :link-id (:identifier link)})) diff --git a/aggregator/test/aggregator/query/update_test.clj b/aggregator/test/aggregator/query/update_test.clj index 7ac0c30..f99bc6f 100644 --- a/aggregator/test/aggregator/query/update_test.clj +++ b/aggregator/test/aggregator/query/update_test.clj @@ -1,5 +1,6 @@ (ns aggregator.query.update-test (:require [aggregator.query.update :as update] + [aggregator.query.query :as query] [aggregator.config :as config] [clojure.test :refer [deftest is]])) @@ -54,3 +55,26 @@ (is (= "Der Wetschi" (get-in updated-statement [:content :author]))) (is (= "name-test" (:aggregate-id predecessor))) (is (= "34" (:entity-id predecessor))))) + + +(deftest add-argument + (let [{:keys [premise-id conclusion-id link-id]} (update/add-argument + {:content-string "Der Kalli testet" + :author "¯\\_(ツ)_/¯"} + {:content-string "Conclusion wird supportet" + :author "Foo"} + :support)] + (is (= "¯\\_(ツ)_/¯" + (get-in (query/exact-statement (:aggregate-id premise-id) + (:entity-id premise-id) + (:version premise-id)) + [:content :author]))) + (is (= "Conclusion wird supportet" + (get-in (query/exact-statement (:aggregate-id conclusion-id) + (:entity-id conclusion-id) + (:version conclusion-id)) + [:content :content-string]))) + (is (not (nil? + (count (query/retrieve-link (:aggregate-id link-id) + (:entity-id link-id) + (:version link-id)))))))) From 15fec3ebb335f8ef101e7ef3d5f3edf0aab5e2a1 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Tue, 27 Nov 2018 10:10:01 +0100 Subject: [PATCH 27/47] Refactor statement map member Names --- aggregator/db/set1/arguments.edn | 52 ++++++------- aggregator/db/set2/arguments.edn | 74 +++++++++---------- aggregator/src/aggregator/api/routes.clj | 36 ++++----- .../src/aggregator/graphql/dbas_connector.clj | 2 +- aggregator/src/aggregator/query/update.clj | 6 +- aggregator/src/aggregator/specs.clj | 4 +- .../src/aggregator/utils/pg_listener.clj | 2 +- .../test/aggregator/broker/publish_test.clj | 5 +- aggregator/test/aggregator/query/db_test.clj | 30 ++++---- .../test/aggregator/query/query_test.clj | 26 +++---- .../test/aggregator/query/update_test.clj | 14 ++-- .../test/aggregator/search/core_test.clj | 6 +- 12 files changed, 129 insertions(+), 128 deletions(-) diff --git a/aggregator/db/set1/arguments.edn b/aggregator/db/set1/arguments.edn index 0d9e0ee..e05d129 100644 --- a/aggregator/db/set1/arguments.edn +++ b/aggregator/db/set1/arguments.edn @@ -1,26 +1,26 @@ -[{:content {:author "deka" :content-string "der Kampf unentschieden ausfällt" :created nil} :identifier {:aggregate-id "aggregator:8888" :entity-id "1" :version 1} :delete-flag false :predecessors []} - {:content {:author "dekan" :content-string "der Kampf nicht unentschieden ausfallen kann. Zu irgend einem Zeitpunkt wird nur noch genau ein Tier leben. Dieses hat gewonnen" :created nil} :identifier {:aggregate-id "aggregator:8888" :entity-id "2" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "diepfe" :content-string "die Pferde fliehen und die meisten überleben werden"} :identifier {:aggregate-id "aggregator:8888" :entity-id "3" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "woot" :content-string "sie ihre Energien aneinander aufrauchen werden und dann umfallen"} :identifier {:aggregate-id "aggregator:8888" :entity-id "4" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "diepfe" :content-string "die Pferde fliehen und die meisten somit überleben werden"} :identifier {:aggregate-id "aggregator:8888" :entity-id "5" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Wendy" :content-string "wenn die Pferde fliehen, gibt es keinen Kampf. Nach Vorraussetzung der Frage findet aber ein Kampf statt"} :identifier {:aggregate-id "aggregator:8888" :entity-id "6" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Pazi" :content-string "man alles dran setzen sollte, den ewigen Konflikt zu beenden"} :identifier {:aggregate-id "aggregator:8888" :entity-id "10" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "elkawe" :content-string "der Kampf ein wundervolles Entertainment ist"} :identifier {:aggregate-id "aggregator:8888" :entity-id "11" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Adolf" :content-string "beide Abnormitäten aus dem Genpool entfernt werden sollten"} :identifier {:aggregate-id "aggregator:8888" :entity-id "12" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Hans" :content-string "diese Abnormitäten sich durchaus behaupten können"} :identifier {:aggregate-id "aggregator:8888" :entity-id "14" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Peta" :content-string "Tiere nur aussterben sollten, wenn sie sich nicht behaupten können"} :identifier {:aggregate-id "aggregator:8888" :entity-id "16" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Piece" :content-string "Frieden das beste für unsere Welt ist"} :identifier {:aggregate-id "aggregator:8888" :entity-id "17" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "!Leroy" :content-string "es besser ist, wenn sich diese aggressiven Tiere sich gegenseitig beschäftigen"} :identifier {:aggregate-id "aggregator:8888" :entity-id "18" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "LongJohn" :content-string "sie sich im Frieden verbünden könnten. Anschließend könnten wir die gejagten sein. Eine neue Ära der Unterdrückung unter Herrschaft von tyrannischen Hühnern und grausamen Pferdchen erwartet uns"} :identifier {:aggregate-id "aggregator:8888" :entity-id "20" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Johnny" :content-string "Und wen grillen wir, wenn sich die Viecher nicht gegenseitig abmurksen"} :identifier {:aggregate-id "aggregator:8888" :entity-id "21" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "elkawe" :content-string "Frieden zwischen Riesenhühnern und Mini-Pferden sehr langweilig ist"} :identifier {:aggregate-id "aggregator:8888" :entity-id "22" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Piece" :content-string "Frieden unser größtes Ziel sein sollte :)"} :identifier {:aggregate-id "aggregator:8888" :entity-id "23" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Reuter" :content-string "einem egal sein sollte wer von beiden Verliert"} :identifier {:aggregate-id "aggregator:8888" :entity-id "35" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Johnny" :content-string "wenn alle leben, kann man alle Essen! Lecker Lasagne"} :identifier {:aggregate-id "aggregator:8888" :entity-id "36" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Johnny" :content-string "Lasagne schmeckt immer gut! Mjam Mjam Mjam"} :identifier {:aggregate-id "aggregator:8888" :entity-id "40" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Menschenfreund" :content-string "Es ist besser Nutztiere zu halten als die Ausrottung einer potenziell köstlichen Nahrungsquelle zu riskieren. Lasagne"} :identifier {:aggregate-id "aggregator:8888" :entity-id "41" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Melvin" :content-string "wir dann möglicherweise zu wenig Daten generieren"} :identifier {:aggregate-id "aggregator:8888" :entity-id "42" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Haniball" :content-string "Fleisch ist Fleisch"} :identifier { :aggregate-id "aggregator:8888" :entity-id "43" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Susi" :content-string "die 100 Pferde deutlich aufwendiger zuzubereiten sind"} :identifier { :aggregate-id "aggregator:8888" :entity-id "44" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Johnny" :content-string "Das Riesen Huhn brät ewig auf dem Grill"} :identifier {:aggregate-id "aggregator:8888" :entity-id "45" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Haniball" :content-string "das Huhn natürlich (mit geringem Aufwand) vorher zerlegt werden muss"} :identifier {:aggregate-id "aggregator:8888" :entity-id "46" :version 1} :delete-flag false :predecessors []}] +[{:content {:author "deka" :text "der Kampf unentschieden ausfällt" :created nil} :identifier {:aggregate-id "aggregator:8888" :entity-id "1" :version 1} :delete-flag false :predecessors []} + {:content {:author "dekan" :text "der Kampf nicht unentschieden ausfallen kann. Zu irgend einem Zeitpunkt wird nur noch genau ein Tier leben. Dieses hat gewonnen" :created nil} :identifier {:aggregate-id "aggregator:8888" :entity-id "2" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "diepfe" :text "die Pferde fliehen und die meisten überleben werden"} :identifier {:aggregate-id "aggregator:8888" :entity-id "3" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "woot" :text "sie ihre Energien aneinander aufrauchen werden und dann umfallen"} :identifier {:aggregate-id "aggregator:8888" :entity-id "4" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "diepfe" :text "die Pferde fliehen und die meisten somit überleben werden"} :identifier {:aggregate-id "aggregator:8888" :entity-id "5" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Wendy" :text "wenn die Pferde fliehen, gibt es keinen Kampf. Nach Vorraussetzung der Frage findet aber ein Kampf statt"} :identifier {:aggregate-id "aggregator:8888" :entity-id "6" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Pazi" :text "man alles dran setzen sollte, den ewigen Konflikt zu beenden"} :identifier {:aggregate-id "aggregator:8888" :entity-id "10" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "elkawe" :text "der Kampf ein wundervolles Entertainment ist"} :identifier {:aggregate-id "aggregator:8888" :entity-id "11" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Adolf" :text "beide Abnormitäten aus dem Genpool entfernt werden sollten"} :identifier {:aggregate-id "aggregator:8888" :entity-id "12" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Hans" :text "diese Abnormitäten sich durchaus behaupten können"} :identifier {:aggregate-id "aggregator:8888" :entity-id "14" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Peta" :text "Tiere nur aussterben sollten, wenn sie sich nicht behaupten können"} :identifier {:aggregate-id "aggregator:8888" :entity-id "16" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Piece" :text "Frieden das beste für unsere Welt ist"} :identifier {:aggregate-id "aggregator:8888" :entity-id "17" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "!Leroy" :text "es besser ist, wenn sich diese aggressiven Tiere sich gegenseitig beschäftigen"} :identifier {:aggregate-id "aggregator:8888" :entity-id "18" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "LongJohn" :text "sie sich im Frieden verbünden könnten. Anschließend könnten wir die gejagten sein. Eine neue Ära der Unterdrückung unter Herrschaft von tyrannischen Hühnern und grausamen Pferdchen erwartet uns"} :identifier {:aggregate-id "aggregator:8888" :entity-id "20" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Johnny" :text "Und wen grillen wir, wenn sich die Viecher nicht gegenseitig abmurksen"} :identifier {:aggregate-id "aggregator:8888" :entity-id "21" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "elkawe" :text "Frieden zwischen Riesenhühnern und Mini-Pferden sehr langweilig ist"} :identifier {:aggregate-id "aggregator:8888" :entity-id "22" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Piece" :text "Frieden unser größtes Ziel sein sollte :)"} :identifier {:aggregate-id "aggregator:8888" :entity-id "23" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Reuter" :text "einem egal sein sollte wer von beiden Verliert"} :identifier {:aggregate-id "aggregator:8888" :entity-id "35" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Johnny" :text "wenn alle leben, kann man alle Essen! Lecker Lasagne"} :identifier {:aggregate-id "aggregator:8888" :entity-id "36" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Johnny" :text "Lasagne schmeckt immer gut! Mjam Mjam Mjam"} :identifier {:aggregate-id "aggregator:8888" :entity-id "40" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Menschenfreund" :text "Es ist besser Nutztiere zu halten als die Ausrottung einer potenziell köstlichen Nahrungsquelle zu riskieren. Lasagne"} :identifier {:aggregate-id "aggregator:8888" :entity-id "41" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Melvin" :text "wir dann möglicherweise zu wenig Daten generieren"} :identifier {:aggregate-id "aggregator:8888" :entity-id "42" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Haniball" :text "Fleisch ist Fleisch"} :identifier { :aggregate-id "aggregator:8888" :entity-id "43" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Susi" :text "die 100 Pferde deutlich aufwendiger zuzubereiten sind"} :identifier { :aggregate-id "aggregator:8888" :entity-id "44" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Johnny" :text "Das Riesen Huhn brät ewig auf dem Grill"} :identifier {:aggregate-id "aggregator:8888" :entity-id "45" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author "Haniball" :text "das Huhn natürlich (mit geringem Aufwand) vorher zerlegt werden muss"} :identifier {:aggregate-id "aggregator:8888" :entity-id "46" :version 1} :delete-flag false :predecessors []}] diff --git a/aggregator/db/set2/arguments.edn b/aggregator/db/set2/arguments.edn index 475e531..32af849 100644 --- a/aggregator/db/set2/arguments.edn +++ b/aggregator/db/set2/arguments.edn @@ -1,37 +1,37 @@ -[{:content {:author "erazor" :content-string "die hundert Pferde gewinnen" :created nil} :identifier {:entity-id "1" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Feuerlöscher" :content-string "Als direkter Nachfahre der Dinosaurier sind Hühner schlicht der überlegene Gegner" :created nil} :identifier {:entity-id "2" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Freud" :content-string "Pferde sind leider zu doof" :created nil} :identifier {:entity-id "3" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Feuerlöscher" :content-string "Pferde im Vergleich zu Hühner ein ausgeprägtes Sozial- und Kommunikationsverhalten zeigen" :created nil} :identifier {:entity-id "4" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Feuerlöscher" :content-string "Hühner nicht intelligenter sind" :identifier {:entity-id "5" :aggregate-id "aggregator_set2:8888" :created nil} :version 1} :delete-flag false :predecessors []} - {:content {:author "Bombur" :content-string "Pferde sind Fluchttiere. Ein riesiges Huhn kann sie jagen. Kann sie zerstören. Kann sie vernichten" :created nil} :identifier {:entity-id "6" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Johnny" :content-string "Lasagne schmeckt immer gut" :created nil} :identifier {:entity-id "7" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Haniball" :content-string "Das Huhn Lasagne sicher auch mag" :created nil} :identifier {:entity-id "8" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Lucifer" :content-string "Pferde keine Hörner haben" :created nil} :identifier {:entity-id "9" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Balthasar" :content-string "Hühner auch keine Hörner haben" :created nil} :identifier {:entity-id "10" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Lucy" :content-string "Pferde sind zu gutmütig" :created nil} :identifier {:entity-id "11" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Fallout" :content-string "Sich der Krieg nie ändert" :created nil} :identifier {:entity-id "12" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "LP" :content-string "die große Anzahl an Pferden, die geringe Größe eine einzelnen Pferde, in Summe mehr als aufwiegt" :created nil} :identifier {:entity-id "20" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Feuerlöscher" :content-string "sie dem Huhn keinen Schaden beibringen können. Das Huhn durch Flügelschläge, den enormen Schnabel, oder die Krallen an den Füßen gleich mehrere Pferde gleichzeitig töten kann. Ein Gemetzel" :created nil} :identifier {:entity-id "21" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Carlos" :content-string "eine zu große Anzahl gegen ein einzelnes Ziel eher hinderlich ist" :created nil} :identifier {:entity-id "22" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "lolzor" :content-string "die Pferde das Huhn langsam zu tode trampeln" :created nil} :identifier {:entity-id "23" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Indiana Jones" :content-string "Die Mini-Pferde können Hühner einfach nur kitzeln. Mehr nicht" :created nil} :identifier {:entity-id "24" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Bombur" :content-string "vermutlich auch genug Pferde von dem übergroßen Huhn tod getrampelt werden" :created nil} :identifier {:entity-id "25" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "McGockles" :content-string "das Huhn gewinnen würde" :created nil} :identifier {:entity-id "50" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Meter" :content-string "die Pferde nicht mal so groß sind wie die Beine des Huhns. -> Die Pferde können dem Huhn (fast) nichts tun" :created nil} :identifier {:entity-id "51" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Herbi" :content-string "es fliegen kann. So wird es für die Pferde schwer, das Huhn zu attackieren" :created nil} :identifier {:entity-id "52" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Feuerlöscher" :content-string "Hühner nicht fliegen können" :created nil} :identifier {:entity-id "53" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Gore" :content-string "der Schnabel größer wäre als ein Menschlicher Kopf!? Zack. Kopf weg" :created nil} :identifier {:entity-id "54" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Imperator" :content-string "Die Federn eines pferdegroßen Huhns so dick sind, dass die Mini Pferde keinen Schaden anrichten können" :created nil} :identifier {:entity-id "55" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "PewPew" :content-string "es Laseraugen hat" :created nil} :identifier {:entity-id "56" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Greenwall" :content-string "Laseraugen keinen erkennbaren Vorteil im Kampf gegen hundert Pferde bringen" :created nil} :identifier {:entity-id "57" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "PewPew" :content-string "Laseraugen durchaus mehrere huhngroße Pferde pro Sekunde rösten können" :created nil} :identifier {:entity-id "58" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Dr. Schlauschlau" :content-string "Laser traditionell zu den Doomsday-Waffen zu zählen sind" :created nil} :identifier {:entity-id "59" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Hans" :content-string "die Kategorisierung einer Waffe alleine keinen Aufschluss über den Kampfwert gibt" :created nil} :identifier {:entity-id "60" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Fiat Multipla" :content-string "ein Huhn auf Pferde im Rücken nicht reagieren kann, wenn es gleichzeitig von vorne angegriffen wird" :created nil} :identifier {:entity-id "61" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Meter" :content-string "die Größe der Pferde nicht ausreicht, um dem Huhn zu schaden. Folglich kann das Huhn aus allen Richtungen agegriffen werden ohne in Bedrängnis zu geraten" :created nil} :identifier {:entity-id "62" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "C. Meter" :content-string "ein huhngroßes Huhn ca. 40 cm groß ist und daher ein huhngroßes Pferd ebenfalls 40cm groß ist. Schon deutlich kleinere Tiere können Menschen/Tiere Schaden zufügen" :created nil} :identifier {:entity-id "63" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Doomsday" :content-string "Auf dem Rücken des Huhns sind sie verloren! Das Huhn kann sie so nur noch einfacher zu ihrem Nest von Kalbsgroßen Kpken bringen und den blutrünstigen Nachwuchs heranzüchten" :created nil} :identifier {:entity-id "64" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Pilot" :content-string "Hühner können zumindest kurz fliegen. Somit können Feinde vom Rücken abgeschüttelt werden. Das alleine kann tödlich enden" :created nil} :identifier {:entity-id "65" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Meter" :content-string "die Fallhöhe nicht so groß ist, dass alle Pferde sterben, wenn sie runterfallen. Sie beträgt maximal 1 Meter" :created nil} :identifier {:entity-id "66" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Pilot" :content-string "selbst wenn die Fallhöhe nicht tödlich ist, können die Pferde dem Huhn dann nicht mehr gefährlich werden" :created nil} :identifier {:entity-id "67" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Pensimax" :content-string "Die Fallhöhe ist mitunter nicht hoch genug um die Pferde zu töten, aber sie bringen sie definitiv in einen taktischen Nachteil. Die Chance auf tödliche Verletzungen ist dennoch da" :created nil} :identifier {:entity-id "68" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []}] +[{:content {:author "erazor" :text "die hundert Pferde gewinnen" :created nil} :identifier {:entity-id "1" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Feuerlöscher" :text "Als direkter Nachfahre der Dinosaurier sind Hühner schlicht der überlegene Gegner" :created nil} :identifier {:entity-id "2" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Freud" :text "Pferde sind leider zu doof" :created nil} :identifier {:entity-id "3" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Feuerlöscher" :text "Pferde im Vergleich zu Hühner ein ausgeprägtes Sozial- und Kommunikationsverhalten zeigen" :created nil} :identifier {:entity-id "4" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Feuerlöscher" :text "Hühner nicht intelligenter sind" :identifier {:entity-id "5" :aggregate-id "aggregator_set2:8888" :created nil} :version 1} :delete-flag false :predecessors []} + {:content {:author "Bombur" :text "Pferde sind Fluchttiere. Ein riesiges Huhn kann sie jagen. Kann sie zerstören. Kann sie vernichten" :created nil} :identifier {:entity-id "6" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Johnny" :text "Lasagne schmeckt immer gut" :created nil} :identifier {:entity-id "7" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Haniball" :text "Das Huhn Lasagne sicher auch mag" :created nil} :identifier {:entity-id "8" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Lucifer" :text "Pferde keine Hörner haben" :created nil} :identifier {:entity-id "9" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Balthasar" :text "Hühner auch keine Hörner haben" :created nil} :identifier {:entity-id "10" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Lucy" :text "Pferde sind zu gutmütig" :created nil} :identifier {:entity-id "11" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Fallout" :text "Sich der Krieg nie ändert" :created nil} :identifier {:entity-id "12" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "LP" :text "die große Anzahl an Pferden, die geringe Größe eine einzelnen Pferde, in Summe mehr als aufwiegt" :created nil} :identifier {:entity-id "20" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Feuerlöscher" :text "sie dem Huhn keinen Schaden beibringen können. Das Huhn durch Flügelschläge, den enormen Schnabel, oder die Krallen an den Füßen gleich mehrere Pferde gleichzeitig töten kann. Ein Gemetzel" :created nil} :identifier {:entity-id "21" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Carlos" :text "eine zu große Anzahl gegen ein einzelnes Ziel eher hinderlich ist" :created nil} :identifier {:entity-id "22" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "lolzor" :text "die Pferde das Huhn langsam zu tode trampeln" :created nil} :identifier {:entity-id "23" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Indiana Jones" :text "Die Mini-Pferde können Hühner einfach nur kitzeln. Mehr nicht" :created nil} :identifier {:entity-id "24" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Bombur" :text "vermutlich auch genug Pferde von dem übergroßen Huhn tod getrampelt werden" :created nil} :identifier {:entity-id "25" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "McGockles" :text "das Huhn gewinnen würde" :created nil} :identifier {:entity-id "50" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Meter" :text "die Pferde nicht mal so groß sind wie die Beine des Huhns. -> Die Pferde können dem Huhn (fast) nichts tun" :created nil} :identifier {:entity-id "51" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Herbi" :text "es fliegen kann. So wird es für die Pferde schwer, das Huhn zu attackieren" :created nil} :identifier {:entity-id "52" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Feuerlöscher" :text "Hühner nicht fliegen können" :created nil} :identifier {:entity-id "53" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Gore" :text "der Schnabel größer wäre als ein Menschlicher Kopf!? Zack. Kopf weg" :created nil} :identifier {:entity-id "54" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Imperator" :text "Die Federn eines pferdegroßen Huhns so dick sind, dass die Mini Pferde keinen Schaden anrichten können" :created nil} :identifier {:entity-id "55" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "PewPew" :text "es Laseraugen hat" :created nil} :identifier {:entity-id "56" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Greenwall" :text "Laseraugen keinen erkennbaren Vorteil im Kampf gegen hundert Pferde bringen" :created nil} :identifier {:entity-id "57" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "PewPew" :text "Laseraugen durchaus mehrere huhngroße Pferde pro Sekunde rösten können" :created nil} :identifier {:entity-id "58" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Dr. Schlauschlau" :text "Laser traditionell zu den Doomsday-Waffen zu zählen sind" :created nil} :identifier {:entity-id "59" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Hans" :text "die Kategorisierung einer Waffe alleine keinen Aufschluss über den Kampfwert gibt" :created nil} :identifier {:entity-id "60" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Fiat Multipla" :text "ein Huhn auf Pferde im Rücken nicht reagieren kann, wenn es gleichzeitig von vorne angegriffen wird" :created nil} :identifier {:entity-id "61" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Meter" :text "die Größe der Pferde nicht ausreicht, um dem Huhn zu schaden. Folglich kann das Huhn aus allen Richtungen agegriffen werden ohne in Bedrängnis zu geraten" :created nil} :identifier {:entity-id "62" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "C. Meter" :text "ein huhngroßes Huhn ca. 40 cm groß ist und daher ein huhngroßes Pferd ebenfalls 40cm groß ist. Schon deutlich kleinere Tiere können Menschen/Tiere Schaden zufügen" :created nil} :identifier {:entity-id "63" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Doomsday" :text "Auf dem Rücken des Huhns sind sie verloren! Das Huhn kann sie so nur noch einfacher zu ihrem Nest von Kalbsgroßen Kpken bringen und den blutrünstigen Nachwuchs heranzüchten" :created nil} :identifier {:entity-id "64" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Pilot" :text "Hühner können zumindest kurz fliegen. Somit können Feinde vom Rücken abgeschüttelt werden. Das alleine kann tödlich enden" :created nil} :identifier {:entity-id "65" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Meter" :text "die Fallhöhe nicht so groß ist, dass alle Pferde sterben, wenn sie runterfallen. Sie beträgt maximal 1 Meter" :created nil} :identifier {:entity-id "66" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Pilot" :text "selbst wenn die Fallhöhe nicht tödlich ist, können die Pferde dem Huhn dann nicht mehr gefährlich werden" :created nil} :identifier {:entity-id "67" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author "Pensimax" :text "Die Fallhöhe ist mitunter nicht hoch genug um die Pferde zu töten, aber sie bringen sie definitiv in einen taktischen Nachteil. Die Chance auf tödliche Verletzungen ist dennoch da" :created nil} :identifier {:entity-id "68" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []}] diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index a52a69d..ddebabc 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -8,38 +8,39 @@ [spec-tools.spec :as spec] [clojure.spec.alpha :as s] [aggregator.specs :as eden-specs] - [ring.util.http-response :refer [ok not-found]] - [ring.middleware.cors :as ring-cors] - [taoensso.timbre :as log])) + [ring.util.http-response :refer [ok not-found created]] + [ring.middleware.cors :as ring-cors])) (s/def ::welcome-message spec/string?) (s/def ::statements (s/coll-of ::eden-specs/statement)) (s/def ::statements-map (s/keys :req-un [::statements])) (s/def ::minimal-statement (s/keys :req-un [::eden-specs/content-string ::eden-specs/author])) -(s/def ::minimal-premise ::minimal-statement) -(s/def ::minimal-conclusion ::minimal-statement) +(s/def ::premise ::minimal-statement) +(s/def ::conclusion ::minimal-statement) (s/def ::links (s/coll-of ::eden-specs/link)) (s/def ::links-map (s/keys :req-un [::links])) (s/def ::statement-map (s/keys :req-un [::eden-specs/statement])) (s/def ::link-map (s/keys :req-un [::eden-specs/link])) -(s/def ::premise-id ::eden-specs/identifier) -(s/def ::conclusion-id ::eden-specs/identifier) -(s/def ::new-argument (s/keys :req-un [::premise-id ::conclusion-id])) +(s/def ::premise-name ::eden-specs/identifier) +(s/def ::conclusion-name ::eden-specs/identifier) +(s/def ::link-name ::eden-specs/identifier) +(s/def ::new-argument (s/keys :req-un [::premise-name ::conclusion-name] + :opt-un [::link-name])) (s/def ::link-type #{"support" "attack" "undercut"}) -(s/def ::minimal-argument (s/keys :req-un [::minimal-premise ::minimal-conclusion ::link-type])) +(s/def ::minimal-argument (s/keys :req-un [::premise ::conclusion ::link-type])) (def argument-routes (context "/argument" [] :tags ["argument"] :coercion :spec - (POST "/add" [] - :summary "Add a new argument to the EDEN database" + (POST "/" [] + :summary "Add a new argument to the EDEN database." :body [request-body ::minimal-argument] :return ::new-argument - (ok - (let [premise (:minimal-premise request-body) - conclusion (:minimal-conclusion request-body) + (created + (let [premise (:premise request-body) + conclusion (:conclusion request-body) link-type (:link-type request-body)] (update/add-argument premise conclusion link-type)))))) @@ -122,7 +123,7 @@ (ok {:statement statement}) (not-found nil))) - (POST "/add" [] + (POST "/" [] :summary "Add a statement to the EDEN database" :body [statement ::eden-specs/statement] :return ::statement-map @@ -149,7 +150,7 @@ (ok {:link link}) (not-found nil))) - (POST "/add" [] + (POST "/" [] :summary "Add a link to the EDEN database" :middleware [wrap-link-type] :body [link ::eden-specs/link] @@ -167,7 +168,8 @@ :tags [{:name "statements" :description "Retrieve Statements"} {:name "links" :description "Retrieve Links"} {:name "statement" :description "Retrieve or add a single specific statement"} - {:name "link" :description "Retrieve or add a single specific link"}]}}} + {:name "link" :description "Retrieve or add a single specific link"} + {:name "argument" :description "Retrive or add whole arguments"}]}}} statement-routes statements-routes link-routes diff --git a/aggregator/src/aggregator/graphql/dbas_connector.clj b/aggregator/src/aggregator/graphql/dbas_connector.clj index 7bf8308..45c600a 100644 --- a/aggregator/src/aggregator/graphql/dbas_connector.clj +++ b/aggregator/src/aggregator/graphql/dbas_connector.clj @@ -30,7 +30,7 @@ (let [result (query-db "query { statements { uid, textversions { content, authorUid} }}")] (map (fn [statement] (let [default-statement {:content - {:content-string (get-in statement [:textversions :content]) + {:text (get-in statement [:textversions :content]) :created nil ;; dbas won't play :author (str "author#: " (get-in statement [:textversions :authorUid]))} diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index 839fa04..632e2cf 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -50,7 +50,7 @@ "Updates the content-text of a statement and bumps the version." [statement updated-text] (let [updated-statement (-> statement - (assoc-in [:content :content-string] (str updated-text)) + (assoc-in [:content :text] (str updated-text)) (update-in [:identifier :version] inc))] (when (s/valid? ::specs/statement updated-statement) (db/insert-statement updated-statement) @@ -60,7 +60,7 @@ "Forks a statement with a new identifier, content-string and author." [statement identifier content-string author] (let [updated-statement (-> statement - (assoc-in [:content :content-string] (str content-string)) + (assoc-in [:content :text] (str content-string)) (assoc-in [:content :author] (str author)) (assoc :identifier identifier) (assoc-in [:identifier :version] 1) @@ -73,7 +73,7 @@ (defn- statement-from-minimal "Generate a statement from the minimal needed information." [{:keys [content-string author]}] - {:content {:content-string content-string + {:content {:content-text content-string :author author :created nil} :identifier {:aggregate-id config/aggregate-name diff --git a/aggregator/src/aggregator/specs.clj b/aggregator/src/aggregator/specs.clj index d04e608..ae3e84e 100644 --- a/aggregator/src/aggregator/specs.clj +++ b/aggregator/src/aggregator/specs.clj @@ -4,10 +4,10 @@ (s/def ::no-slash (s/and string? #(not (re-find #"/" %)) #(pos? (count %)))) (s/def ::author string?) -(s/def ::content-string string?) +(s/def ::text string?) (s/def ::created (s/or :nil nil? :timestamp string?)) ;; timestamp (s/def ::content - (s/keys :req-un [::content-string ::created ::author])) + (s/keys :req-un [::text ::created ::author])) (s/def ::aggregate-id ::no-slash) (s/def ::entity-id ::no-slash) diff --git a/aggregator/src/aggregator/utils/pg_listener.clj b/aggregator/src/aggregator/utils/pg_listener.clj index ad7ee12..1f9d5b7 100644 --- a/aggregator/src/aggregator/utils/pg_listener.clj +++ b/aggregator/src/aggregator/utils/pg_listener.clj @@ -15,7 +15,7 @@ [textversion] (log/debug (format "Received new textversion from D-BAS: %s" (:data textversion))) (let [statement {:content {:author (str (get-in textversion [:data :author_uid])) - :content-string (get-in textversion [:data :content]) + :text (get-in textversion [:data :content]) :created nil} :identifier {:aggregate-id config/aggregate-name :entity-id (str (get-in textversion [:data :uid])) diff --git a/aggregator/test/aggregator/broker/publish_test.clj b/aggregator/test/aggregator/broker/publish_test.clj index 2c6cf2d..211897f 100644 --- a/aggregator/test/aggregator/broker/publish_test.clj +++ b/aggregator/test/aggregator/broker/publish_test.clj @@ -8,10 +8,9 @@ (defonce queue (first (last (s/exercise string?)))) (def statement {:content {:author "kangaroo" - :content-string "Schnapspralinen" + :text "Schnapspralinen" :created nil} - :identifier { - :aggregate-id "huepfer.verlag" + :identifier {:aggregate-id "huepfer.verlag" :entity-id "1" :version 1} :predecessors {} diff --git a/aggregator/test/aggregator/query/db_test.clj b/aggregator/test/aggregator/query/db_test.clj index c968128..928b4cb 100644 --- a/aggregator/test/aggregator/query/db_test.clj +++ b/aggregator/test/aggregator/query/db_test.clj @@ -8,71 +8,71 @@ (search/entrypoint) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "34" :version 1} :content {:author "Jorge" - :content-string "money does not solve problems of our society" + :text "money does not solve problems of our society" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P12" :version 1} :content {:author "George" - :content-string "we should shut down University Park" + :text "we should shut down University Park" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P13" :version 1} :content {:author "George" - :content-string "shutting down University Park will save $100.000 a year" + :text "shutting down University Park will save $100.000 a year" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P22" :version 1} :content {:author "AlterVerwalter" - :content-string "the city is planing a new park in the upcoming month" + :text "the city is planing a new park in the upcoming month" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "7" :version 1} :content {:author "Bolek" - :content-string "we should not abandon our town's core task" + :text "we should not abandon our town's core task" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P23" :version 1} :content {:author "XxxBaerchiDarkDestoyerxxX" - :content-string "there is a smaller park in O-Town" + :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P232" :version 1} :content {:author "XxxBestoyerxxX" - :content-string "there is a smaller park in O-Town" + :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P231" :version 1} :content {:author "XxxBoyerxxX" - :content-string "there is a smaller park in O-Town" + :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P230" :version 1} :content {:author "XxxBayerxxX" - :content-string "there is a smaller park in O-Town" + :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P29" :version 1} :content {:author "XxxBaeryerxxX" - :content-string "there is a smaller park in O-Town" + :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id config/aggregate-name :entity-id "P29v2" :version 1} :content {:author "XxxBaeryerxxX" - :content-string "there is a smaller park in O-Town" + :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) - + (db/insert-link {:author "Wegi" :created nil :type :undercut :source {:aggregate-id "schneider.gg" :entity-id "W01" :version 1337} @@ -89,7 +89,7 @@ (is (= (get-in (first (db/statements-by-uri "hhu.de/34")) [:identifier :version]) 1)) (is (= (get-in (first (db/statements-by-uri "hhu.de/P12")) [:identifier :aggregate-id]) "hhu.de")) (is (= (get-in (first (db/statements-by-uri "hhu.de/P13")) [:identifier :entity-id]) "P13")) - (is (= (get-in (first (db/statements-by-uri "hhu.de/P22")) [:content :content-string]) + (is (= (get-in (first (db/statements-by-uri "hhu.de/P22")) [:content :text]) "the city is planing a new park in the upcoming month")) (is (= (get-in (first (db/statements-by-uri "hhu.de/7")) [:content :author]) "Bolek"))) @@ -99,13 +99,13 @@ (deftest insert-statement-test (db/insert-statement {:content - {:author "Wegi" :content-string "Test me baby one more time" :created nil} + {:author "Wegi" :text "Test me baby one more time" :created nil} :identifier {:aggregate-id "schneider.gg" :entity-id "W01" :version 1337} :delete-flag false :predecessors {}}) (Thread/sleep 2000) - (is (= (get-in (db/exact-statement "schneider.gg" "W01" 1337) [:content :content-string]) + (is (= (get-in (db/exact-statement "schneider.gg" "W01" 1337) [:content :text]) "Test me baby one more time"))) (deftest insert-link-test diff --git a/aggregator/test/aggregator/query/query_test.clj b/aggregator/test/aggregator/query/query_test.clj index 3323104..bf3c220 100644 --- a/aggregator/test/aggregator/query/query_test.clj +++ b/aggregator/test/aggregator/query/query_test.clj @@ -9,73 +9,73 @@ (defn fixtures [f] (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "34" :version 1} :content {:author "Jorge" - :content-string "money does not solve problems of our society" + :text "money does not solve problems of our society" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P12" :version 1} :content {:author "George" - :content-string "we should shut down University Park" + :text "we should shut down University Park" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P13" :version 1} :content {:author "George" - :content-string "shutting down University Park will save $100.000 a year" + :text "shutting down University Park will save $100.000 a year" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P22" :version 1} :content {:author "AlterVerwalter" - :content-string "the city is planing a new park in the upcoming month" + :text "the city is planing a new park in the upcoming month" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "7" :version 1} :content {:author "Bolek" - :content-string "we should not abandon our town's core task" + :text "we should not abandon our town's core task" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P23" :version 1} :content {:author "XxxBaerchiDarkDestoyerxxX" - :content-string "there is a smaller park in O-Town" + :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P232" :version 1} :content {:author "XxxBestoyerxxX" - :content-string "there is a smaller park in O-Town" + :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P231" :version 1} :content {:author "XxxBoyerxxX" - :content-string "there is a smaller park in O-Town" + :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P230" :version 1} :content {:author "XxxBayerxxX" - :content-string "there is a smaller park in O-Town" + :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P29" :version 1} :content {:author "XxxBaeryerxxX" - :content-string "there is a smaller park in O-Town" + :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P420" :version 1} :content {:author "saywhaaat" - :content-string "califragilistic extrahotentific" + :text "califragilistic extrahotentific" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id config/aggregate-name :entity-id "P29v2" :version 1} :content {:author "XxxBaeryerxxX" - :content-string "there is a smaller park in O-Town" + :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) @@ -104,7 +104,7 @@ (deftest test-cached-statements (let [statement {:identifier {:aggregate-id "cache-aggregator" :entity-id "cache-id" :version 1} :content {:author "XxxBaeryerxxX" - :content-string "there is a smaller park in O-Town" + :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false} diff --git a/aggregator/test/aggregator/query/update_test.clj b/aggregator/test/aggregator/query/update_test.clj index f99bc6f..9bba92f 100644 --- a/aggregator/test/aggregator/query/update_test.clj +++ b/aggregator/test/aggregator/query/update_test.clj @@ -7,7 +7,7 @@ (def some-statement {:identifier {:aggregate-id "name-test" :entity-id "34" :version 1} :content {:author "Jorge" - :content-string "money does not solve problems of our society" + :text "money does not solve problems of our society" :created nil} :predecessors {} :delete-flag false}) @@ -38,8 +38,8 @@ updated-statement-2 (update/update-statement-content some-statement :fooo) not-a-statement (update/update-statement-content some-link "fail")] (is (= 2 (get-in updated-statement [:identifier :version]))) - (is (= "lolz" (get-in updated-statement [:content :content-string]))) - (is (= ":fooo" (get-in updated-statement-2 [:content :content-string]))) + (is (= "lolz" (get-in updated-statement [:content :text]))) + (is (= ":fooo" (get-in updated-statement-2 [:content :text]))) (is (nil? not-a-statement)))) (deftest test-fork-statement @@ -49,7 +49,7 @@ "New content" "Der Wetschi") predecessor (first (:predecessors updated-statement))] (is (= 1 (get-in updated-statement [:identifier :version]))) - (is (= "New content" (get-in updated-statement [:content :content-string]))) + (is (= "New content" (get-in updated-statement [:content :text]))) (is (= "new-agg.de" (get-in updated-statement [:identifier :aggregate-id]))) (is (= "42" (get-in updated-statement [:identifier :entity-id]))) (is (= "Der Wetschi" (get-in updated-statement [:content :author]))) @@ -59,9 +59,9 @@ (deftest add-argument (let [{:keys [premise-id conclusion-id link-id]} (update/add-argument - {:content-string "Der Kalli testet" + {:text "Der Kalli testet" :author "¯\\_(ツ)_/¯"} - {:content-string "Conclusion wird supportet" + {:text "Conclusion wird supportet" :author "Foo"} :support)] (is (= "¯\\_(ツ)_/¯" @@ -73,7 +73,7 @@ (get-in (query/exact-statement (:aggregate-id conclusion-id) (:entity-id conclusion-id) (:version conclusion-id)) - [:content :content-string]))) + [:content :text]))) (is (not (nil? (count (query/retrieve-link (:aggregate-id link-id) (:entity-id link-id) diff --git a/aggregator/test/aggregator/search/core_test.clj b/aggregator/test/aggregator/search/core_test.clj index 70a04af..f961d2b 100644 --- a/aggregator/test/aggregator/search/core_test.clj +++ b/aggregator/test/aggregator/search/core_test.clj @@ -4,7 +4,7 @@ [clojure.spec.alpha :as s] [aggregator.specs :as gspecs])) -(def kangaroo {:content {:content-string "Schnapspralinen" +(def kangaroo {:content {:text "Schnapspralinen" :author "kangaroo" :created nil} :identifier {:aggregate-id "huepfer.verlag" @@ -13,7 +13,7 @@ :predecessors {} :delete-flag false}) -(def penguin {:content {:content-string "Teewurst" +(def penguin {:content {:text "Teewurst" :author "penguin" :created nil} :identifier {:aggregate-id "penguin.books:8080" @@ -22,7 +22,7 @@ :predecessors {} :delete-flag false}) -(def penguin2 {:content {:content-string "Teewurst 2: Die Rache der Teewurst" +(def penguin2 {:content {:text "Teewurst 2: Die Rache der Teewurst" :author "penguin" :created nil} :identifier {:aggregate-id "penguin.books:8080" From 104d3ef243c4a16b4220311a490ed268b7aef984 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Tue, 27 Nov 2018 12:22:31 +0100 Subject: [PATCH 28/47] Replace more instances of content-string with text --- aggregator/project.clj | 4 ++-- aggregator/src/aggregator/api/routes.clj | 13 ++++++++++++- aggregator/src/aggregator/query/db.clj | 2 +- aggregator/src/aggregator/query/query.clj | 2 +- aggregator/src/aggregator/query/update.clj | 10 +++++----- aggregator/src/aggregator/search/core.clj | 6 +++--- 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/aggregator/project.clj b/aggregator/project.clj index 592ef89..7926b7a 100644 --- a/aggregator/project.clj +++ b/aggregator/project.clj @@ -20,8 +20,8 @@ [ring-cors "0.1.12"] [clj-http "3.7.0"] [codox-theme-rdash "0.1.2"] - [metosin/compojure-api "2.0.0-alpha19"] - [metosin/spec-tools "0.6.1"] + [metosin/compojure-api "2.0.0-alpha28"] + [metosin/spec-tools "0.8.2"] [cheshire "5.8.0"]] :profiles {:dev {:dependencies [[org.clojure/test.check "0.9.0"] diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index ddebabc..b58dcbe 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -2,6 +2,7 @@ "Define and expose the routes for the REST API in this file." (:require [compojure.route] [compojure.api.sweet :refer [GET POST api context resource undocumented]] + [compojure.api.exception :as ex] [aggregator.query.query :as query] [aggregator.utils.common :as utils] [aggregator.query.update :as update] @@ -14,18 +15,22 @@ (s/def ::welcome-message spec/string?) (s/def ::statements (s/coll-of ::eden-specs/statement)) (s/def ::statements-map (s/keys :req-un [::statements])) -(s/def ::minimal-statement (s/keys :req-un [::eden-specs/content-string ::eden-specs/author])) + +(s/def ::minimal-statement (s/keys :req-un [::eden-specs/text ::eden-specs/author])) (s/def ::premise ::minimal-statement) (s/def ::conclusion ::minimal-statement) + (s/def ::links (s/coll-of ::eden-specs/link)) (s/def ::links-map (s/keys :req-un [::links])) (s/def ::statement-map (s/keys :req-un [::eden-specs/statement])) (s/def ::link-map (s/keys :req-un [::eden-specs/link])) + (s/def ::premise-name ::eden-specs/identifier) (s/def ::conclusion-name ::eden-specs/identifier) (s/def ::link-name ::eden-specs/identifier) (s/def ::new-argument (s/keys :req-un [::premise-name ::conclusion-name] :opt-un [::link-name])) + (s/def ::link-type #{"support" "attack" "undercut"}) (s/def ::minimal-argument (s/keys :req-un [::premise ::conclusion ::link-type])) @@ -39,6 +44,7 @@ :body [request-body ::minimal-argument] :return ::new-argument (created + "/argument" (let [premise (:premise request-body) conclusion (:conclusion request-body) link-type (:link-type request-body)] @@ -160,6 +166,11 @@ (def app (let [compojure-api-handler (api {:coercion :spec + :exceptions + {:handlers + {::ex/request-parsing (ex/with-logging ex/request-parsing-handler :info) + ::ex/request-validation (ex/with-logging ex/request-validation-handler :error) + ::ex/response-validation (ex/with-logging ex/response-validation-handler :error)}} :swagger {:ui "/" :spec "/swagger.json" diff --git a/aggregator/src/aggregator/query/db.clj b/aggregator/src/aggregator/query/db.clj index 316318f..3e318e9 100644 --- a/aggregator/src/aggregator/query/db.clj +++ b/aggregator/src/aggregator/query/db.clj @@ -113,7 +113,7 @@ {:identifier.aggregate-id config/aggregate-name}))))) (defn statements-contain - "Return all statements from the elasticsearch-db where content.content-string containts `query`" + "Return all statements from the elasticsearch-db where content.text containts `query`" [query] (unpack-elastic (elastic/search :statements-fuzzy query))) diff --git a/aggregator/src/aggregator/query/query.clj b/aggregator/src/aggregator/query/query.clj index 2b3c469..67fa04f 100644 --- a/aggregator/src/aggregator/query/query.clj +++ b/aggregator/src/aggregator/query/query.clj @@ -185,7 +185,7 @@ (up/update-link link))))) (defn statements-contain - "Retrieve all statements where the content.content-string contains the `query`" + "Retrieve all statements where the content.text contains the `query`" [query] (db/statements-contain query)) diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index 632e2cf..d38a3db 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -57,10 +57,10 @@ updated-statement))) (defn fork-statement - "Forks a statement with a new identifier, content-string and author." - [statement identifier content-string author] + "Forks a statement with a new identifier, text and author." + [statement identifier text author] (let [updated-statement (-> statement - (assoc-in [:content :text] (str content-string)) + (assoc-in [:content :text] (str text)) (assoc-in [:content :author] (str author)) (assoc :identifier identifier) (assoc-in [:identifier :version] 1) @@ -72,8 +72,8 @@ (defn- statement-from-minimal "Generate a statement from the minimal needed information." - [{:keys [content-string author]}] - {:content {:content-text content-string + [{:keys [text author]}] + {:content {:content-text text :author author :created nil} :identifier {:aggregate-id config/aggregate-name diff --git a/aggregator/src/aggregator/search/core.clj b/aggregator/src/aggregator/search/core.clj index b678b53..e6a0086 100644 --- a/aggregator/src/aggregator/search/core.clj +++ b/aggregator/src/aggregator/search/core.clj @@ -171,7 +171,7 @@ (search-request {:query {:match - {:content.content-string + {:content.text {:query (append-star-if-not-empty querystring) :fuzziness "AUTO"}}}} :statements)) @@ -220,8 +220,8 @@ :filter ["lowercase" "synonym_filter"]}}}}} {:statement {:properties {:identifier.aggregate-id {:type :keyword} :identifier.entity-id {:type :keyword} - :content.content-string {:type "text" - :analyzer "synonym_analyzer"}}}}) + :content.text {:type "text" + :analyzer "synonym_analyzer"}}}}) (create-index "links" {} {:link {:properties {:identifier.aggregate-id {:type :keyword} :identifier.entity-id {:type :keyword}}}})) From dcae1976e35fcd3b99629e027fa38665a48e5c44 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Tue, 27 Nov 2018 12:32:34 +0100 Subject: [PATCH 29/47] Fix false text string in update module --- aggregator/src/aggregator/query/update.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index d38a3db..576850d 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -47,7 +47,7 @@ link)) (defn update-statement-content - "Updates the content-text of a statement and bumps the version." + "Updates the text of a statement and bumps the version." [statement updated-text] (let [updated-statement (-> statement (assoc-in [:content :text] (str updated-text)) @@ -73,7 +73,7 @@ (defn- statement-from-minimal "Generate a statement from the minimal needed information." [{:keys [text author]}] - {:content {:content-text text + {:content {:text text :author author :created nil} :identifier {:aggregate-id config/aggregate-name From cde7583075a204bd009cab8a6016044875d428cb Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Tue, 27 Nov 2018 12:41:53 +0100 Subject: [PATCH 30/47] Change okay to created --- aggregator/src/aggregator/api/routes.clj | 8 ++++++-- aggregator/src/aggregator/query/update.clj | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index b58dcbe..10a3f63 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -133,7 +133,9 @@ :summary "Add a statement to the EDEN database" :body [statement ::eden-specs/statement] :return ::statement-map - (ok {:statement (update/update-statement (utils/json->edn statement))})))) + (created + "/statement" + {:statement (update/update-statement (utils/json->edn statement))})))) (defn wrap-link-type [handler] (fn [request] @@ -161,7 +163,9 @@ :middleware [wrap-link-type] :body [link ::eden-specs/link] :return ::link-map - (ok {:link (update/update-link (utils/json->edn link))})))) + (created + "/link" + {:link (update/update-link (utils/json->edn link))})))) (def app (let [compojure-api-handler diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index 576850d..ef4db5e 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -79,7 +79,7 @@ :identifier {:aggregate-id config/aggregate-name :entity-id (str (java.util.UUID/randomUUID)) :version 1} - :delete-flag :false + :delete-flag false :predecessors []}) (defn- link-premise-conclusion @@ -90,7 +90,7 @@ {:type (:keyword link-type) :source premise-id :destination conclusion-id - :delete-flag :false + :delete-flag false :identifier {:aggregate-id config/aggregate-name :entity-id (str "link_" (java.util.UUID/randomUUID)) :version 1}})) From ebaf482f16fed841daaf234cef119755a7325be4 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Wed, 28 Nov 2018 14:57:34 +0100 Subject: [PATCH 31/47] Add time-not-str function and add it to newly created objects --- aggregator/src/aggregator/query/update.clj | 6 ++++-- aggregator/src/aggregator/utils/common.clj | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index ef4db5e..97b9d26 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -4,6 +4,7 @@ [aggregator.broker.publish :as pub] [aggregator.config :as config] [aggregator.specs :as specs] + [aggregator.utils.common :as utils] [clojure.spec.alpha :as s] [taoensso.timbre :as log])) @@ -75,7 +76,7 @@ [{:keys [text author]}] {:content {:text text :author author - :created nil} + :created (utils/time-now-str)} :identifier {:aggregate-id config/aggregate-name :entity-id (str (java.util.UUID/randomUUID)) :version 1} @@ -93,7 +94,8 @@ :delete-flag false :identifier {:aggregate-id config/aggregate-name :entity-id (str "link_" (java.util.UUID/randomUUID)) - :version 1}})) + :version 1} + :created (utils/time-now-str)})) (defn add-argument "Adds an argument to the database." diff --git a/aggregator/src/aggregator/utils/common.clj b/aggregator/src/aggregator/utils/common.clj index 40e599c..bd83648 100644 --- a/aggregator/src/aggregator/utils/common.clj +++ b/aggregator/src/aggregator/utils/common.clj @@ -58,6 +58,11 @@ ([message data] (return-map :ok message data))) +(defn time-now-str + "Returns the current time as an Linux Epoch Time String." + [] + (str (.getEpochSecond (java.time.Instant/now)))) + ;; ----------------------------------------------------------------------------- ;; Specs From bf414267c944b1e897bcc4f75844e69f72d5e659 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Thu, 29 Nov 2018 15:52:02 +0100 Subject: [PATCH 32/47] Refactor user from a string to a map with several information --- .../src/aggregator/graphql/dbas_connector.clj | 36 ++++++++++++++----- aggregator/src/aggregator/query/db.clj | 2 +- aggregator/src/aggregator/query/update.clj | 2 +- aggregator/src/aggregator/specs.clj | 9 +++-- .../src/aggregator/utils/pg_listener.clj | 9 +++-- 5 files changed, 42 insertions(+), 16 deletions(-) diff --git a/aggregator/src/aggregator/graphql/dbas_connector.clj b/aggregator/src/aggregator/graphql/dbas_connector.clj index 45c600a..f3962b8 100644 --- a/aggregator/src/aggregator/graphql/dbas_connector.clj +++ b/aggregator/src/aggregator/graphql/dbas_connector.clj @@ -2,7 +2,8 @@ (:require [clj-http.client :as client] [clojure.data.json :as json] [clojure.walk :refer [keywordize-keys]] - [aggregator.config :as config])) + [aggregator.config :as config] + [taoensso.timbre :as log])) (defn- query-db [query] @@ -27,13 +28,16 @@ (defn get-statements "Return all statements from the D-BAS instance. The result is already in the EDEN-conform format." [] - (let [result (query-db "query { statements { uid, textversions { content, authorUid} }}")] + (let [result (query-db "query { statements { uid, textversions { content, author {publicNickname, uid}} }}")] (map (fn [statement] - (let [default-statement {:content + (let [author-name (get-in statement [:textversions :author :publicNickname]) + author-id (get-in statement [:textversions :author :uid]) + default-statement {:content {:text (get-in statement [:textversions :content]) :created nil ;; dbas won't play - :author (str "author#: " - (get-in statement [:textversions :authorUid]))} + :author {:dgep-native true + :name author-name + :id (Integer/parseInt author-id)}} :identifier {:aggregate-id config/aggregate-name :entity-id (:uid statement) @@ -71,10 +75,12 @@ premises (query-db (format "query {premises(premisegroupUid: %d) {statementUid}}" group-uid)) - link-type-val (link-type argument)] + link-type-val (link-type argument) + author (get argument [:author])] (map (fn [premise] - {:author (str "author#: " - (:authorUid argument)) + {:author {:dgep-native true + :name (:publicNickname author) + :id (:uid author)} :created nil ;; nil until we solve the graphql problem :type link-type-val :source {:aggregate-id config/aggregate-name @@ -92,6 +98,18 @@ (defn get-links "Return a map of all links that can be requested from the connected D-BAS instance." [] - (let [result (query-db "query {arguments {uid conclusionUid, isSupportive, authorUid, argumentUid, premisegroupUid}}") + (let [result (query-db "query {arguments {uid conclusionUid, isSupportive, author {publicNickname uid}, argumentUid, premisegroupUid}}") return-val (mapcat links-from-argument (:arguments result))] return-val)) + +(defn get-author + "Queries D-BAS for an author and returns an author-map." + [author-id] + (let [id (if (int? author-id) + author-id + (Integer/parseInt author-id)) + result (query-db (format "query {user(uid: %d){publicNickname}}" id))] + (log/debug result) + {:dgep-native true + :id id + :name (get-in result [:user :publicNickname])})) diff --git a/aggregator/src/aggregator/query/db.clj b/aggregator/src/aggregator/query/db.clj index 3e318e9..64f518d 100644 --- a/aggregator/src/aggregator/query/db.clj +++ b/aggregator/src/aggregator/query/db.clj @@ -42,7 +42,7 @@ (defn statements-by-author "Return all statements with a certain author." [author] - (unpack-elastic (elastic/search :statements {:content.author author}))) + (unpack-elastic (elastic/search :statements {:content.author.name author}))) (defn links-by-uri "Return all link-versions defined by the uri" diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index 97b9d26..d9eaa35 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -62,7 +62,7 @@ [statement identifier text author] (let [updated-statement (-> statement (assoc-in [:content :text] (str text)) - (assoc-in [:content :author] (str author)) + (assoc-in [:content :author] (utils/json->edn author)) (assoc :identifier identifier) (assoc-in [:identifier :version] 1) (assoc :predecessors [(:identifier statement)]))] diff --git a/aggregator/src/aggregator/specs.clj b/aggregator/src/aggregator/specs.clj index ae3e84e..f395ca6 100644 --- a/aggregator/src/aggregator/specs.clj +++ b/aggregator/src/aggregator/specs.clj @@ -2,9 +2,14 @@ (:require [clojure.spec.alpha :as s])) (s/def ::no-slash (s/and string? #(not (re-find #"/" %)) #(pos? (count %)))) +(s/def ::non-empty-string (s/and string? #((complement clojure.string/blank?) %))) -(s/def ::author string?) -(s/def ::text string?) +(s/def ::dgep-native boolean?) +(s/def ::name ::non-empty-string) +(s/def ::id pos-int?) +(s/def ::author (s/keys :req-un [::dgep-native ::name ::id])) + +(s/def ::text ::non-empty-string) (s/def ::created (s/or :nil nil? :timestamp string?)) ;; timestamp (s/def ::content (s/keys :req-un [::text ::created ::author])) diff --git a/aggregator/src/aggregator/utils/pg_listener.clj b/aggregator/src/aggregator/utils/pg_listener.clj index 1f9d5b7..98c611e 100644 --- a/aggregator/src/aggregator/utils/pg_listener.clj +++ b/aggregator/src/aggregator/utils/pg_listener.clj @@ -3,7 +3,7 @@ [aggregator.config :as config] [aggregator.query.update :as update] [taoensso.timbre :as log] - [aggregator.graphql.dbas-connector :refer [links-from-argument get-statement-origin]])) + [aggregator.graphql.dbas-connector :as dbas-conn :refer [links-from-argument get-statement-origin]])) (defn- handle-statements "Handle changes in statements" @@ -14,7 +14,8 @@ "Handle changes in the textversions. They belong to the statements." [textversion] (log/debug (format "Received new textversion from D-BAS: %s" (:data textversion))) - (let [statement {:content {:author (str (get-in textversion [:data :author_uid])) + (let [author-id (get-in textversion [:data :author_uid]) + statement {:content {:author (dbas-conn/get-author author-id) :text (get-in textversion [:data :content]) :created nil} :identifier {:aggregate-id config/aggregate-name @@ -29,7 +30,9 @@ :identifier {:aggregate-id (str (:aggregate_id origin)) :entity-id (str (:entity_id origin)) :version (:version origin)}) - [:content :author] (str (:author origin)))) + [:content :author] {:dgep-native false + :name (str (:author origin)) + :id 1234567})) (update/update-statement statement)))) (defn- handle-arguments From da998b6222d4bce77b84ed63d666b508370ccc56 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Thu, 29 Nov 2018 15:52:29 +0100 Subject: [PATCH 33/47] Change testdata and tests to use new format --- aggregator/db/set1/arguments.edn | 52 ++++++------- aggregator/db/set1/links.edn | 48 ++++++------ aggregator/db/set2/arguments.edn | 74 +++++++++---------- aggregator/db/set2/links.edn | 72 +++++++++--------- .../test/aggregator/broker/publish_test.clj | 4 +- .../aggregator/broker/subscriber_test.clj | 16 ++-- aggregator/test/aggregator/query/db_test.clj | 62 +++++++++++----- .../test/aggregator/query/query_test.clj | 57 ++++++++++---- .../test/aggregator/query/update_test.clj | 27 +++++-- .../test/aggregator/search/core_test.clj | 12 ++- 10 files changed, 253 insertions(+), 171 deletions(-) diff --git a/aggregator/db/set1/arguments.edn b/aggregator/db/set1/arguments.edn index e05d129..7ffdc6a 100644 --- a/aggregator/db/set1/arguments.edn +++ b/aggregator/db/set1/arguments.edn @@ -1,26 +1,26 @@ -[{:content {:author "deka" :text "der Kampf unentschieden ausfällt" :created nil} :identifier {:aggregate-id "aggregator:8888" :entity-id "1" :version 1} :delete-flag false :predecessors []} - {:content {:author "dekan" :text "der Kampf nicht unentschieden ausfallen kann. Zu irgend einem Zeitpunkt wird nur noch genau ein Tier leben. Dieses hat gewonnen" :created nil} :identifier {:aggregate-id "aggregator:8888" :entity-id "2" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "diepfe" :text "die Pferde fliehen und die meisten überleben werden"} :identifier {:aggregate-id "aggregator:8888" :entity-id "3" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "woot" :text "sie ihre Energien aneinander aufrauchen werden und dann umfallen"} :identifier {:aggregate-id "aggregator:8888" :entity-id "4" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "diepfe" :text "die Pferde fliehen und die meisten somit überleben werden"} :identifier {:aggregate-id "aggregator:8888" :entity-id "5" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Wendy" :text "wenn die Pferde fliehen, gibt es keinen Kampf. Nach Vorraussetzung der Frage findet aber ein Kampf statt"} :identifier {:aggregate-id "aggregator:8888" :entity-id "6" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Pazi" :text "man alles dran setzen sollte, den ewigen Konflikt zu beenden"} :identifier {:aggregate-id "aggregator:8888" :entity-id "10" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "elkawe" :text "der Kampf ein wundervolles Entertainment ist"} :identifier {:aggregate-id "aggregator:8888" :entity-id "11" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Adolf" :text "beide Abnormitäten aus dem Genpool entfernt werden sollten"} :identifier {:aggregate-id "aggregator:8888" :entity-id "12" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Hans" :text "diese Abnormitäten sich durchaus behaupten können"} :identifier {:aggregate-id "aggregator:8888" :entity-id "14" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Peta" :text "Tiere nur aussterben sollten, wenn sie sich nicht behaupten können"} :identifier {:aggregate-id "aggregator:8888" :entity-id "16" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Piece" :text "Frieden das beste für unsere Welt ist"} :identifier {:aggregate-id "aggregator:8888" :entity-id "17" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "!Leroy" :text "es besser ist, wenn sich diese aggressiven Tiere sich gegenseitig beschäftigen"} :identifier {:aggregate-id "aggregator:8888" :entity-id "18" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "LongJohn" :text "sie sich im Frieden verbünden könnten. Anschließend könnten wir die gejagten sein. Eine neue Ära der Unterdrückung unter Herrschaft von tyrannischen Hühnern und grausamen Pferdchen erwartet uns"} :identifier {:aggregate-id "aggregator:8888" :entity-id "20" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Johnny" :text "Und wen grillen wir, wenn sich die Viecher nicht gegenseitig abmurksen"} :identifier {:aggregate-id "aggregator:8888" :entity-id "21" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "elkawe" :text "Frieden zwischen Riesenhühnern und Mini-Pferden sehr langweilig ist"} :identifier {:aggregate-id "aggregator:8888" :entity-id "22" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Piece" :text "Frieden unser größtes Ziel sein sollte :)"} :identifier {:aggregate-id "aggregator:8888" :entity-id "23" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Reuter" :text "einem egal sein sollte wer von beiden Verliert"} :identifier {:aggregate-id "aggregator:8888" :entity-id "35" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Johnny" :text "wenn alle leben, kann man alle Essen! Lecker Lasagne"} :identifier {:aggregate-id "aggregator:8888" :entity-id "36" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Johnny" :text "Lasagne schmeckt immer gut! Mjam Mjam Mjam"} :identifier {:aggregate-id "aggregator:8888" :entity-id "40" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Menschenfreund" :text "Es ist besser Nutztiere zu halten als die Ausrottung einer potenziell köstlichen Nahrungsquelle zu riskieren. Lasagne"} :identifier {:aggregate-id "aggregator:8888" :entity-id "41" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Melvin" :text "wir dann möglicherweise zu wenig Daten generieren"} :identifier {:aggregate-id "aggregator:8888" :entity-id "42" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Haniball" :text "Fleisch ist Fleisch"} :identifier { :aggregate-id "aggregator:8888" :entity-id "43" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Susi" :text "die 100 Pferde deutlich aufwendiger zuzubereiten sind"} :identifier { :aggregate-id "aggregator:8888" :entity-id "44" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Johnny" :text "Das Riesen Huhn brät ewig auf dem Grill"} :identifier {:aggregate-id "aggregator:8888" :entity-id "45" :version 1} :delete-flag false :predecessors []} - {:content {:created nil :author "Haniball" :text "das Huhn natürlich (mit geringem Aufwand) vorher zerlegt werden muss"} :identifier {:aggregate-id "aggregator:8888" :entity-id "46" :version 1} :delete-flag false :predecessors []}] +[{:content {:author {:name "deka" :dgep-native false :id 123} :text "der Kampf unentschieden ausfällt" :created nil} :identifier {:aggregate-id "aggregator:8888" :entity-id "1" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "dekan" :dgep-native false :id 123} :text "der Kampf nicht unentschieden ausfallen kann. Zu irgend einem Zeitpunkt wird nur noch genau ein Tier leben. Dieses hat gewonnen" :created nil} :identifier {:aggregate-id "aggregator:8888" :entity-id "2" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "diepfe" :dgep-native false :id 123} :text "die Pferde fliehen und die meisten überleben werden"} :identifier {:aggregate-id "aggregator:8888" :entity-id "3" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "woot" :dgep-native false :id 123} :text "sie ihre Energien aneinander aufrauchen werden und dann umfallen"} :identifier {:aggregate-id "aggregator:8888" :entity-id "4" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "diepfe" :dgep-native false :id 123} :text "die Pferde fliehen und die meisten somit überleben werden"} :identifier {:aggregate-id "aggregator:8888" :entity-id "5" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Wendy" :dgep-native false :id 123} :text "wenn die Pferde fliehen, gibt es keinen Kampf. Nach Vorraussetzung der Frage findet aber ein Kampf statt"} :identifier {:aggregate-id "aggregator:8888" :entity-id "6" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Pazi" :dgep-native false :id 123} :text "man alles dran setzen sollte, den ewigen Konflikt zu beenden"} :identifier {:aggregate-id "aggregator:8888" :entity-id "10" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "elkawe" :dgep-native false :id 123} :text "der Kampf ein wundervolles Entertainment ist"} :identifier {:aggregate-id "aggregator:8888" :entity-id "11" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Adolf" :dgep-native false :id 123} :text "beide Abnormitäten aus dem Genpool entfernt werden sollten"} :identifier {:aggregate-id "aggregator:8888" :entity-id "12" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Hans" :dgep-native false :id 123} :text "diese Abnormitäten sich durchaus behaupten können"} :identifier {:aggregate-id "aggregator:8888" :entity-id "14" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Peta" :dgep-native false :id 123} :text "Tiere nur aussterben sollten, wenn sie sich nicht behaupten können"} :identifier {:aggregate-id "aggregator:8888" :entity-id "16" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Piece" :dgep-native false :id 123} :text "Frieden das beste für unsere Welt ist"} :identifier {:aggregate-id "aggregator:8888" :entity-id "17" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "!Leroy" :dgep-native false :id 123} :text "es besser ist, wenn sich diese aggressiven Tiere sich gegenseitig beschäftigen"} :identifier {:aggregate-id "aggregator:8888" :entity-id "18" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "LongJohn" :dgep-native false :id 123} :text "sie sich im Frieden verbünden könnten. Anschließend könnten wir die gejagten sein. Eine neue Ära der Unterdrückung unter Herrschaft von tyrannischen Hühnern und grausamen Pferdchen erwartet uns"} :identifier {:aggregate-id "aggregator:8888" :entity-id "20" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Johnny" :dgep-native false :id 123} :text "Und wen grillen wir, wenn sich die Viecher nicht gegenseitig abmurksen"} :identifier {:aggregate-id "aggregator:8888" :entity-id "21" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "elkawe" :dgep-native false :id 123} :text "Frieden zwischen Riesenhühnern und Mini-Pferden sehr langweilig ist"} :identifier {:aggregate-id "aggregator:8888" :entity-id "22" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Piece" :dgep-native false :id 123} :text "Frieden unser größtes Ziel sein sollte :)"} :identifier {:aggregate-id "aggregator:8888" :entity-id "23" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Reuter" :dgep-native false :id 123} :text "einem egal sein sollte wer von beiden Verliert"} :identifier {:aggregate-id "aggregator:8888" :entity-id "35" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Johnny" :dgep-native false :id 123} :text "wenn alle leben, kann man alle Essen! Lecker Lasagne"} :identifier {:aggregate-id "aggregator:8888" :entity-id "36" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Johnny" :dgep-native false :id 123} :text "Lasagne schmeckt immer gut! Mjam Mjam Mjam"} :identifier {:aggregate-id "aggregator:8888" :entity-id "40" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Menschenfreund" :dgep-native false :id 123} :text "Es ist besser Nutztiere zu halten als die Ausrottung einer potenziell köstlichen Nahrungsquelle zu riskieren. Lasagne"} :identifier {:aggregate-id "aggregator:8888" :entity-id "41" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Melvin" :dgep-native false :id 123} :text "wir dann möglicherweise zu wenig Daten generieren"} :identifier {:aggregate-id "aggregator:8888" :entity-id "42" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Haniball" :dgep-native false :id 123} :text "Fleisch ist Fleisch"} :identifier { :aggregate-id "aggregator:8888" :entity-id "43" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Susi" :dgep-native false :id 123} :text "die 100 Pferde deutlich aufwendiger zuzubereiten sind"} :identifier { :aggregate-id "aggregator:8888" :entity-id "44" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Johnny" :dgep-native false :id 123} :text "Das Riesen Huhn brät ewig auf dem Grill"} :identifier {:aggregate-id "aggregator:8888" :entity-id "45" :version 1} :delete-flag false :predecessors []} + {:content {:created nil :author {:name "Haniball" :dgep-native false :id 123} :text "das Huhn natürlich (mit geringem Aufwand) vorher zerlegt werden muss"} :identifier {:aggregate-id "aggregator:8888" :entity-id "46" :version 1} :delete-flag false :predecessors []}] diff --git a/aggregator/db/set1/links.edn b/aggregator/db/set1/links.edn index 5cc9956..48791ef 100644 --- a/aggregator/db/set1/links.edn +++ b/aggregator/db/set1/links.edn @@ -1,24 +1,24 @@ -[{:author "woot" :type :support :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l2"} :source {:aggregate-id "aggregator:8888" :entity-id "4" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "1" :version 1} :delete-flag false} - {:author "dekan" :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l3"} :source {:aggregate-id "aggregator:8888" :entity-id "2" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "1" :version 1} :delete-flag false} - {:author "diepfe" :type :support :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l4"} :source {:aggregate-id "aggregator:8888" :entity-id "3" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "1" :version 1} :delete-flag false} - {:author "diepfe" :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l5"} :source {:aggregate-id "aggregator:8888" :entity-id "3" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "4" :version 1} :delete-flag false} - {:author "diepfe" :type :support :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l6"} :source {:aggregate-id "aggregator:8888" :entity-id "5" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "1" :version 1} :delete-flag false} - {:author "Wendy" :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l7"} :source {:aggregate-id "aggregator:8888" :entity-id "6" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "5" :version 1} :delete-flag false} - {:author "Johnny" :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l9"} :source {:aggregate-id "aggregator:8888" :entity-id "36" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "35" :version 1} :delete-flag false} - {:author "Melvin" :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l10"} :source {:aggregate-id "aggregator:8888" :entity-id "42" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "35" :version 1} :delete-flag false} - {:author "Johnny" :type :support :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l11"} :source {:aggregate-id "aggregator:8888" :entity-id "40" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "35" :version 1} :delete-flag false} - {:author "Haniball" :type :support :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l12"} :source {:aggregate-id "aggregator:8888" :entity-id "43" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "35" :version 1} :delete-flag false} - {:author "Menschenfreund" :type :undercut :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l13"} :source {:aggregate-id "aggregator:8888" :entity-id "41" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "l11" :version 1} :delete-flag false} - {:author "Susi" :type :undercut :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l14"} :source {:aggregate-id "aggregator:8888" :entity-id "44" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "l12" :version 1} :delete-flag false} - {:author "Johnny" :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l15"} :source {:aggregate-id "aggregator:8888" :entity-id "45" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "44" :version 1} :delete-flag false} - {:author "Haniball" :type :undercut :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l16"} :source {:aggregate-id "aggregator:8888" :entity-id "46" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "l15" :version 1} :delete-flag false} - {:author "elkawe" :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l18"} :source {:aggregate-id "aggregator:8888" :entity-id "11" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "10" :version 1} :delete-flag false} - {:author "Adolf" :type :support :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l19"} :source {:aggregate-id "aggregator:8888" :entity-id "12" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "10" :version 1} :delete-flag false} - {:author "Hans" :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l20"} :source {:aggregate-id "aggregator:8888" :entity-id "14" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "12" :version 1} :delete-flag false} - {:author "Peta" :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l21"} :source {:aggregate-id "aggregator:8888" :entity-id "16" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "12" :version 1} :delete-flag false} - {:author "Piece" :type :support :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l22"} :source {:aggregate-id "aggregator:8888" :entity-id "17" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "10" :version 1} :delete-flag false} - {:author "!Leroy" :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l23"} :source {:aggregate-id "aggregator:8888" :entity-id "18" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "17" :version 1} :delete-flag false} - {:author "Johnny" :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l24"} :source {:aggregate-id "aggregator:8888" :entity-id "21" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "17" :version 1} :delete-flag false} - {:author "LongJohn" :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l25"} :source {:aggregate-id "aggregator:8888" :entity-id "20" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "17" :version 1} :delete-flag false} - {:author "elkawe" :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l26"} :source {:aggregate-id "aggregator:8888" :entity-id "22" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "17" :version 1} :delete-flag false} - {:author "Piece" :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l27"} :source {:aggregate-id "aggregator:8888" :entity-id "23" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "22" :version 1} :delete-flag false}] +[{:author {:name "woot" :dgep-native false :id 666} :type :support :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l2"} :source {:aggregate-id "aggregator:8888" :entity-id "4" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "1" :version 1} :delete-flag false} + {:author {:name "dekan" :dgep-native false :id 666} :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l3"} :source {:aggregate-id "aggregator:8888" :entity-id "2" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "1" :version 1} :delete-flag false} + {:author {:name "diepfe" :dgep-native false :id 666} :type :support :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l4"} :source {:aggregate-id "aggregator:8888" :entity-id "3" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "1" :version 1} :delete-flag false} + {:author {:name "diepfe" :dgep-native false :id 666} :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l5"} :source {:aggregate-id "aggregator:8888" :entity-id "3" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "4" :version 1} :delete-flag false} + {:author {:name "diepfe" :dgep-native false :id 666} :type :support :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l6"} :source {:aggregate-id "aggregator:8888" :entity-id "5" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "1" :version 1} :delete-flag false} + {:author {:name "Wendy" :dgep-native false :id 666} :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l7"} :source {:aggregate-id "aggregator:8888" :entity-id "6" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "5" :version 1} :delete-flag false} + {:author {:name "Johnny" :dgep-native false :id 666} :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l9"} :source {:aggregate-id "aggregator:8888" :entity-id "36" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "35" :version 1} :delete-flag false} + {:author {:name "Melvin" :dgep-native false :id 666} :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l10"} :source {:aggregate-id "aggregator:8888" :entity-id "42" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "35" :version 1} :delete-flag false} + {:author {:name "Johnny" :dgep-native false :id 666} :type :support :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l11"} :source {:aggregate-id "aggregator:8888" :entity-id "40" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "35" :version 1} :delete-flag false} + {:author {:name "Haniball" :dgep-native false :id 666} :type :support :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l12"} :source {:aggregate-id "aggregator:8888" :entity-id "43" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "35" :version 1} :delete-flag false} + {:author {:name "Menschenfreund" :dgep-native false :id 666} :type :undercut :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l13"} :source {:aggregate-id "aggregator:8888" :entity-id "41" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "l11" :version 1} :delete-flag false} + {:author {:name "Susi" :dgep-native false :id 666} :type :undercut :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l14"} :source {:aggregate-id "aggregator:8888" :entity-id "44" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "l12" :version 1} :delete-flag false} + {:author {:name "Johnny" :dgep-native false :id 666} :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l15"} :source {:aggregate-id "aggregator:8888" :entity-id "45" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "44" :version 1} :delete-flag false} + {:author {:name "Haniball" :dgep-native false :id 666} :type :undercut :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l16"} :source {:aggregate-id "aggregator:8888" :entity-id "46" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "l15" :version 1} :delete-flag false} + {:author {:name "elkawe" :dgep-native false :id 666} :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l18"} :source {:aggregate-id "aggregator:8888" :entity-id "11" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "10" :version 1} :delete-flag false} + {:author {:name "Adolf" :dgep-native false :id 666} :type :support :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l19"} :source {:aggregate-id "aggregator:8888" :entity-id "12" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "10" :version 1} :delete-flag false} + {:author {:name "Hans" :dgep-native false :id 666} :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l20"} :source {:aggregate-id "aggregator:8888" :entity-id "14" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "12" :version 1} :delete-flag false} + {:author {:name "Peta" :dgep-native false :id 666} :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l21"} :source {:aggregate-id "aggregator:8888" :entity-id "16" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "12" :version 1} :delete-flag false} + {:author {:name "Piece" :dgep-native false :id 666} :type :support :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l22"} :source {:aggregate-id "aggregator:8888" :entity-id "17" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "10" :version 1} :delete-flag false} + {:author {:name "!Leroy" :dgep-native false :id 666} :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l23"} :source {:aggregate-id "aggregator:8888" :entity-id "18" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "17" :version 1} :delete-flag false} + {:author {:name "Johnny" :dgep-native false :id 666} :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l24"} :source {:aggregate-id "aggregator:8888" :entity-id "21" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "17" :version 1} :delete-flag false} + {:author {:name "LongJohn" :dgep-native false :id 666} :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l25"} :source {:aggregate-id "aggregator:8888" :entity-id "20" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "17" :version 1} :delete-flag false} + {:author {:name "elkawe" :dgep-native false :id 666} :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l26"} :source {:aggregate-id "aggregator:8888" :entity-id "22" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "17" :version 1} :delete-flag false} + {:author {:name "Piece" :dgep-native false :id 666} :type :attack :identifier {:version 1 :aggregate-id "aggregator:8888" :entity-id "l27"} :source {:aggregate-id "aggregator:8888" :entity-id "23" :version 1} :created nil :destination {:aggregate-id "aggregator:8888" :entity-id "22" :version 1} :delete-flag false}] diff --git a/aggregator/db/set2/arguments.edn b/aggregator/db/set2/arguments.edn index 32af849..61248c3 100644 --- a/aggregator/db/set2/arguments.edn +++ b/aggregator/db/set2/arguments.edn @@ -1,37 +1,37 @@ -[{:content {:author "erazor" :text "die hundert Pferde gewinnen" :created nil} :identifier {:entity-id "1" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Feuerlöscher" :text "Als direkter Nachfahre der Dinosaurier sind Hühner schlicht der überlegene Gegner" :created nil} :identifier {:entity-id "2" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Freud" :text "Pferde sind leider zu doof" :created nil} :identifier {:entity-id "3" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Feuerlöscher" :text "Pferde im Vergleich zu Hühner ein ausgeprägtes Sozial- und Kommunikationsverhalten zeigen" :created nil} :identifier {:entity-id "4" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Feuerlöscher" :text "Hühner nicht intelligenter sind" :identifier {:entity-id "5" :aggregate-id "aggregator_set2:8888" :created nil} :version 1} :delete-flag false :predecessors []} - {:content {:author "Bombur" :text "Pferde sind Fluchttiere. Ein riesiges Huhn kann sie jagen. Kann sie zerstören. Kann sie vernichten" :created nil} :identifier {:entity-id "6" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Johnny" :text "Lasagne schmeckt immer gut" :created nil} :identifier {:entity-id "7" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Haniball" :text "Das Huhn Lasagne sicher auch mag" :created nil} :identifier {:entity-id "8" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Lucifer" :text "Pferde keine Hörner haben" :created nil} :identifier {:entity-id "9" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Balthasar" :text "Hühner auch keine Hörner haben" :created nil} :identifier {:entity-id "10" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Lucy" :text "Pferde sind zu gutmütig" :created nil} :identifier {:entity-id "11" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Fallout" :text "Sich der Krieg nie ändert" :created nil} :identifier {:entity-id "12" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "LP" :text "die große Anzahl an Pferden, die geringe Größe eine einzelnen Pferde, in Summe mehr als aufwiegt" :created nil} :identifier {:entity-id "20" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Feuerlöscher" :text "sie dem Huhn keinen Schaden beibringen können. Das Huhn durch Flügelschläge, den enormen Schnabel, oder die Krallen an den Füßen gleich mehrere Pferde gleichzeitig töten kann. Ein Gemetzel" :created nil} :identifier {:entity-id "21" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Carlos" :text "eine zu große Anzahl gegen ein einzelnes Ziel eher hinderlich ist" :created nil} :identifier {:entity-id "22" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "lolzor" :text "die Pferde das Huhn langsam zu tode trampeln" :created nil} :identifier {:entity-id "23" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Indiana Jones" :text "Die Mini-Pferde können Hühner einfach nur kitzeln. Mehr nicht" :created nil} :identifier {:entity-id "24" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Bombur" :text "vermutlich auch genug Pferde von dem übergroßen Huhn tod getrampelt werden" :created nil} :identifier {:entity-id "25" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "McGockles" :text "das Huhn gewinnen würde" :created nil} :identifier {:entity-id "50" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Meter" :text "die Pferde nicht mal so groß sind wie die Beine des Huhns. -> Die Pferde können dem Huhn (fast) nichts tun" :created nil} :identifier {:entity-id "51" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Herbi" :text "es fliegen kann. So wird es für die Pferde schwer, das Huhn zu attackieren" :created nil} :identifier {:entity-id "52" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Feuerlöscher" :text "Hühner nicht fliegen können" :created nil} :identifier {:entity-id "53" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Gore" :text "der Schnabel größer wäre als ein Menschlicher Kopf!? Zack. Kopf weg" :created nil} :identifier {:entity-id "54" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Imperator" :text "Die Federn eines pferdegroßen Huhns so dick sind, dass die Mini Pferde keinen Schaden anrichten können" :created nil} :identifier {:entity-id "55" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "PewPew" :text "es Laseraugen hat" :created nil} :identifier {:entity-id "56" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Greenwall" :text "Laseraugen keinen erkennbaren Vorteil im Kampf gegen hundert Pferde bringen" :created nil} :identifier {:entity-id "57" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "PewPew" :text "Laseraugen durchaus mehrere huhngroße Pferde pro Sekunde rösten können" :created nil} :identifier {:entity-id "58" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Dr. Schlauschlau" :text "Laser traditionell zu den Doomsday-Waffen zu zählen sind" :created nil} :identifier {:entity-id "59" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Hans" :text "die Kategorisierung einer Waffe alleine keinen Aufschluss über den Kampfwert gibt" :created nil} :identifier {:entity-id "60" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Fiat Multipla" :text "ein Huhn auf Pferde im Rücken nicht reagieren kann, wenn es gleichzeitig von vorne angegriffen wird" :created nil} :identifier {:entity-id "61" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Meter" :text "die Größe der Pferde nicht ausreicht, um dem Huhn zu schaden. Folglich kann das Huhn aus allen Richtungen agegriffen werden ohne in Bedrängnis zu geraten" :created nil} :identifier {:entity-id "62" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "C. Meter" :text "ein huhngroßes Huhn ca. 40 cm groß ist und daher ein huhngroßes Pferd ebenfalls 40cm groß ist. Schon deutlich kleinere Tiere können Menschen/Tiere Schaden zufügen" :created nil} :identifier {:entity-id "63" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Doomsday" :text "Auf dem Rücken des Huhns sind sie verloren! Das Huhn kann sie so nur noch einfacher zu ihrem Nest von Kalbsgroßen Kpken bringen und den blutrünstigen Nachwuchs heranzüchten" :created nil} :identifier {:entity-id "64" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Pilot" :text "Hühner können zumindest kurz fliegen. Somit können Feinde vom Rücken abgeschüttelt werden. Das alleine kann tödlich enden" :created nil} :identifier {:entity-id "65" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Meter" :text "die Fallhöhe nicht so groß ist, dass alle Pferde sterben, wenn sie runterfallen. Sie beträgt maximal 1 Meter" :created nil} :identifier {:entity-id "66" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Pilot" :text "selbst wenn die Fallhöhe nicht tödlich ist, können die Pferde dem Huhn dann nicht mehr gefährlich werden" :created nil} :identifier {:entity-id "67" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} - {:content {:author "Pensimax" :text "Die Fallhöhe ist mitunter nicht hoch genug um die Pferde zu töten, aber sie bringen sie definitiv in einen taktischen Nachteil. Die Chance auf tödliche Verletzungen ist dennoch da" :created nil} :identifier {:entity-id "68" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []}] +[{:content {:author {:name "erazor" :dgep-native false :id 123} :text "die hundert Pferde gewinnen" :created nil} :identifier {:entity-id "1" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Feuerlöscher" :dgep-native false :id 123} :text "Als direkter Nachfahre der Dinosaurier sind Hühner schlicht der überlegene Gegner" :created nil} :identifier {:entity-id "2" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Freud" :dgep-native false :id 123} :text "Pferde sind leider zu doof" :created nil} :identifier {:entity-id "3" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Feuerlöscher" :dgep-native false :id 123} :text "Pferde im Vergleich zu Hühner ein ausgeprägtes Sozial- und Kommunikationsverhalten zeigen" :created nil} :identifier {:entity-id "4" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Feuerlöscher" :dgep-native false :id 123} :text "Hühner nicht intelligenter sind" :identifier {:entity-id "5" :aggregate-id "aggregator_set2:8888" :created nil} :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Bombur" :dgep-native false :id 123} :text "Pferde sind Fluchttiere. Ein riesiges Huhn kann sie jagen. Kann sie zerstören. Kann sie vernichten" :created nil} :identifier {:entity-id "6" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Johnny" :dgep-native false :id 123} :text "Lasagne schmeckt immer gut" :created nil} :identifier {:entity-id "7" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Haniball" :dgep-native false :id 123} :text "Das Huhn Lasagne sicher auch mag" :created nil} :identifier {:entity-id "8" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Lucifer" :dgep-native false :id 123} :text "Pferde keine Hörner haben" :created nil} :identifier {:entity-id "9" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Balthasar" :dgep-native false :id 123} :text "Hühner auch keine Hörner haben" :created nil} :identifier {:entity-id "10" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Lucy" :dgep-native false :id 123} :text "Pferde sind zu gutmütig" :created nil} :identifier {:entity-id "11" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Fallout" :dgep-native false :id 123} :text "Sich der Krieg nie ändert" :created nil} :identifier {:entity-id "12" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "LP" :dgep-native false :id 123} :text "die große Anzahl an Pferden, die geringe Größe eine einzelnen Pferde, in Summe mehr als aufwiegt" :created nil} :identifier {:entity-id "20" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Feuerlöscher" :dgep-native false :id 123} :text "sie dem Huhn keinen Schaden beibringen können. Das Huhn durch Flügelschläge, den enormen Schnabel, oder die Krallen an den Füßen gleich mehrere Pferde gleichzeitig töten kann. Ein Gemetzel" :created nil} :identifier {:entity-id "21" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Carlos" :dgep-native false :id 123} :text "eine zu große Anzahl gegen ein einzelnes Ziel eher hinderlich ist" :created nil} :identifier {:entity-id "22" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "lolzor" :dgep-native false :id 123} :text "die Pferde das Huhn langsam zu tode trampeln" :created nil} :identifier {:entity-id "23" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Indiana Jones" :dgep-native false :id 123} :text "Die Mini-Pferde können Hühner einfach nur kitzeln. Mehr nicht" :created nil} :identifier {:entity-id "24" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Bombur" :dgep-native false :id 123} :text "vermutlich auch genug Pferde von dem übergroßen Huhn tod getrampelt werden" :created nil} :identifier {:entity-id "25" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "McGockles" :dgep-native false :id 123} :text "das Huhn gewinnen würde" :created nil} :identifier {:entity-id "50" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Meter" :dgep-native false :id 123} :text "die Pferde nicht mal so groß sind wie die Beine des Huhns. -> Die Pferde können dem Huhn (fast) nichts tun" :created nil} :identifier {:entity-id "51" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Herbi" :dgep-native false :id 123} :text "es fliegen kann. So wird es für die Pferde schwer, das Huhn zu attackieren" :created nil} :identifier {:entity-id "52" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Feuerlöscher" :dgep-native false :id 123} :text "Hühner nicht fliegen können" :created nil} :identifier {:entity-id "53" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Gore" :dgep-native false :id 123} :text "der Schnabel größer wäre als ein Menschlicher Kopf!? Zack. Kopf weg" :created nil} :identifier {:entity-id "54" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Imperator" :dgep-native false :id 123} :text "Die Federn eines pferdegroßen Huhns so dick sind, dass die Mini Pferde keinen Schaden anrichten können" :created nil} :identifier {:entity-id "55" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "PewPew" :dgep-native false :id 123} :text "es Laseraugen hat" :created nil} :identifier {:entity-id "56" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Greenwall" :dgep-native false :id 123} :text "Laseraugen keinen erkennbaren Vorteil im Kampf gegen hundert Pferde bringen" :created nil} :identifier {:entity-id "57" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "PewPew" :dgep-native false :id 123} :text "Laseraugen durchaus mehrere huhngroße Pferde pro Sekunde rösten können" :created nil} :identifier {:entity-id "58" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Dr. Schlauschlau" :dgep-native false :id 123} :text "Laser traditionell zu den Doomsday-Waffen zu zählen sind" :created nil} :identifier {:entity-id "59" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Hans" :dgep-native false :id 123} :text "die Kategorisierung einer Waffe alleine keinen Aufschluss über den Kampfwert gibt" :created nil} :identifier {:entity-id "60" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Fiat Multipla" :dgep-native false :id 123} :text "ein Huhn auf Pferde im Rücken nicht reagieren kann, wenn es gleichzeitig von vorne angegriffen wird" :created nil} :identifier {:entity-id "61" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Meter" :dgep-native false :id 123} :text "die Größe der Pferde nicht ausreicht, um dem Huhn zu schaden. Folglich kann das Huhn aus allen Richtungen agegriffen werden ohne in Bedrängnis zu geraten" :created nil} :identifier {:entity-id "62" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "C. Meter" :dgep-native false :id 123} :text "ein huhngroßes Huhn ca. 40 cm groß ist und daher ein huhngroßes Pferd ebenfalls 40cm groß ist. Schon deutlich kleinere Tiere können Menschen/Tiere Schaden zufügen" :created nil} :identifier {:entity-id "63" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Doomsday" :dgep-native false :id 123} :text "Auf dem Rücken des Huhns sind sie verloren! Das Huhn kann sie so nur noch einfacher zu ihrem Nest von Kalbsgroßen Kpken bringen und den blutrünstigen Nachwuchs heranzüchten" :created nil} :identifier {:entity-id "64" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Pilot" :dgep-native false :id 123} :text "Hühner können zumindest kurz fliegen. Somit können Feinde vom Rücken abgeschüttelt werden. Das alleine kann tödlich enden" :created nil} :identifier {:entity-id "65" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Meter" :dgep-native false :id 123} :text "die Fallhöhe nicht so groß ist, dass alle Pferde sterben, wenn sie runterfallen. Sie beträgt maximal 1 Meter" :created nil} :identifier {:entity-id "66" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Pilot" :dgep-native false :id 123} :text "selbst wenn die Fallhöhe nicht tödlich ist, können die Pferde dem Huhn dann nicht mehr gefährlich werden" :created nil} :identifier {:entity-id "67" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []} + {:content {:author {:name "Pensimax" :dgep-native false :id 123} :text "Die Fallhöhe ist mitunter nicht hoch genug um die Pferde zu töten, aber sie bringen sie definitiv in einen taktischen Nachteil. Die Chance auf tödliche Verletzungen ist dennoch da" :created nil} :identifier {:entity-id "68" :aggregate-id "aggregator_set2:8888" :version 1} :delete-flag false :predecessors []}] diff --git a/aggregator/db/set2/links.edn b/aggregator/db/set2/links.edn index daa9d16..9c9fd39 100644 --- a/aggregator/db/set2/links.edn +++ b/aggregator/db/set2/links.edn @@ -1,36 +1,36 @@ -[{:author "Meter" :type :support :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l2" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "51" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "50" :version 1} :created nil } - {:author "Herbi" :type :support :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l3" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "52" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "50" :version 1} :created nil } - {:author "Feuerlöscher" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l4" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "53" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "52" :version 1} :created nil } - {:author "Gore" :type :support :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l5" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "54" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "50" :version 1} :created nil } - {:author "Imperator" :type :support :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l6" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "55" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "50" :version 1} :created nil } - {:author "PewPew" :type :support :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l7" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "56" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "50" :version 1} :created nil } - {:author "Greenwall" :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l8" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "57" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l7" :version 1} :created nil} - {:author "PewPew" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l9" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "58" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "57" :version 1} :created nil } - {:author "Dr. Schlauschlau" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l10" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "59" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "57" :version 1} :created nil } - {:author "Hans" :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l11" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "60" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l10" :version 1} :created nil} - {:author "Fiat Multipla" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l12" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "61" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "50" :version 1} :created nil } - {:author "Meter" :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l13" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "62" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l12" :version 1} :created nil} - {:author "C. Meter" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l14" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "63" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "62" :version 1} :created nil } - {:author "Doomsday" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l15" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "64" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "61" :version 1} :created nil } - {:author "Pilot" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l16" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "65" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "61" :version 1} :created nil } - {:author "Meter" :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l17" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "66" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l16" :version 1} :created nil} - {:author "Pilot" :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l18" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "67" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l17" :version 1} :created nil} - {:author "Pensimax" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l19" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "68" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "66" :version 1} :created nil } - {:author "Feuerlöscher" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l21" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "2" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "1" :version 1} :created nil } - {:author "Bombur" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l22" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "6" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "1" :version 1} :created nil } - {:author "Freud" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l23" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "3" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "1" :version 1} :created nil } - {:author "Feuerlöscher" :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l24" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "5" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l23" :version 1} :created nil} - {:author "Feuerlöscher" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l25" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "4" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "3" :version 1} :created nil } - {:author "Lucifer" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l26" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "8" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "1" :version 1} :created nil } - {:author "Balthasar" :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l27" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "10" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l26" :version 1} :created nil} - {:author "Johnny" :type :support :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l28" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "7" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "1" :version 1} :created nil } - {:author "Haniball" :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l29" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "8" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l28" :version 1} :created nil } - {:author "Lucy" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l30" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "11" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "1" :version 1} :created nil } - {:author "Fallout" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l31" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "12" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "11" :version 1} :created nil } - {:author "LP" :type :support :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l32" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "20" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "1" :version 1} :created nil } - {:author "Feuerlöscher" :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l33" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "21" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l32" :version 1} :created nil} - {:author "Carlos" :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l34" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "22" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l32" :version 1} :created nil} - {:author "lolzor" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l35" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "23" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "22" :version 1} :created nil } - {:author "Bombur" :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l36" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "25" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l35" :version 1} :created nil} - {:author "Indiana Jones" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l37" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "24" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "23" :version 1} :created nil } - {:author "Imperator" :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l38" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "55" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "23" :version 1} :created nil }] +[{:author {:name "Meter" :dgep-native false :id 666} :type :support :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l2" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "51" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "50" :version 1} :created nil } + {:author {:name "Herbi" :dgep-native false :id 666} :type :support :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l3" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "52" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "50" :version 1} :created nil } + {:author {:name "Feuerlöscher" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l4" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "53" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "52" :version 1} :created nil } + {:author {:name "Gore" :dgep-native false :id 666} :type :support :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l5" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "54" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "50" :version 1} :created nil } + {:author {:name "Imperator" :dgep-native false :id 666} :type :support :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l6" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "55" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "50" :version 1} :created nil } + {:author {:name "PewPew" :dgep-native false :id 666} :type :support :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l7" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "56" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "50" :version 1} :created nil } + {:author {:name "Greenwall" :dgep-native false :id 666} :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l8" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "57" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l7" :version 1} :created nil} + {:author {:name "PewPew" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l9" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "58" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "57" :version 1} :created nil } + {:author {:name "Dr. Schlauschlau" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l10" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "59" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "57" :version 1} :created nil } + {:author {:name "Hans" :dgep-native false :id 666} :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l11" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "60" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l10" :version 1} :created nil} + {:author {:name "Fiat Multipla" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l12" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "61" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "50" :version 1} :created nil } + {:author {:name "Meter" :dgep-native false :id 666} :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l13" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "62" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l12" :version 1} :created nil} + {:author {:name "C. Meter" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l14" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "63" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "62" :version 1} :created nil } + {:author {:name "Doomsday" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l15" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "64" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "61" :version 1} :created nil } + {:author {:name "Pilot" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l16" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "65" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "61" :version 1} :created nil } + {:author {:name "Meter" :dgep-native false :id 666} :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l17" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "66" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l16" :version 1} :created nil} + {:author {:name "Pilot" :dgep-native false :id 666} :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l18" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "67" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l17" :version 1} :created nil} + {:author {:name "Pensimax" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l19" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "68" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "66" :version 1} :created nil } + {:author {:name "Feuerlöscher" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l21" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "2" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "1" :version 1} :created nil } + {:author {:name "Bombur" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l22" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "6" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "1" :version 1} :created nil } + {:author {:name "Freud" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l23" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "3" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "1" :version 1} :created nil } + {:author {:name "Feuerlöscher" :dgep-native false :id 666} :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l24" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "5" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l23" :version 1} :created nil} + {:author {:name "Feuerlöscher" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l25" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "4" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "3" :version 1} :created nil } + {:author {:name "Lucifer" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l26" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "8" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "1" :version 1} :created nil } + {:author {:name "Balthasar" :dgep-native false :id 666} :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l27" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "10" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l26" :version 1} :created nil} + {:author {:name "Johnny" :dgep-native false :id 666} :type :support :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l28" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "7" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "1" :version 1} :created nil } + {:author {:name "Haniball" :dgep-native false :id 666} :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l29" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "8" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l28" :version 1} :created nil } + {:author {:name "Lucy" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l30" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "11" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "1" :version 1} :created nil } + {:author {:name "Fallout" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l31" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "12" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "11" :version 1} :created nil } + {:author {:name "LP" :dgep-native false :id 666} :type :support :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l32" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "20" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "1" :version 1} :created nil } + {:author {:name "Feuerlöscher" :dgep-native false :id 666} :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l33" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "21" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l32" :version 1} :created nil} + {:author {:name "Carlos" :dgep-native false :id 666} :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l34" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "22" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l32" :version 1} :created nil} + {:author {:name "lolzor" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l35" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "23" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "22" :version 1} :created nil } + {:author {:name "Bombur" :dgep-native false :id 666} :type :undercut :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l36" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "25" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "l35" :version 1} :created nil} + {:author {:name "Indiana Jones" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l37" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "24" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "23" :version 1} :created nil } + {:author {:name "Imperator" :dgep-native false :id 666} :type :attack :identifier {:aggregate-id "aggregator_set2:8888" :entity-id "l38" :version 1} :source {:aggregate-id "aggregator_set2:8888" :entity-id "55" :version 1 } :destination {:aggregate-id "aggregator_set2:8888" :entity-id "23" :version 1} :created nil }] diff --git a/aggregator/test/aggregator/broker/publish_test.clj b/aggregator/test/aggregator/broker/publish_test.clj index 211897f..f4d5855 100644 --- a/aggregator/test/aggregator/broker/publish_test.clj +++ b/aggregator/test/aggregator/broker/publish_test.clj @@ -7,7 +7,9 @@ (defonce queue (first (last (s/exercise string?)))) -(def statement {:content {:author "kangaroo" +(def statement {:content {:author {:dgep-native false + :name "Kängaroo" + :id 15} :text "Schnapspralinen" :created nil} :identifier {:aggregate-id "huepfer.verlag" diff --git a/aggregator/test/aggregator/broker/subscriber_test.clj b/aggregator/test/aggregator/broker/subscriber_test.clj index d32320c..4175221 100644 --- a/aggregator/test/aggregator/broker/subscriber_test.clj +++ b/aggregator/test/aggregator/broker/subscriber_test.clj @@ -10,12 +10,16 @@ (def queue (str (lib/uuid))) (def queue-two (str (lib/uuid))) ;; like Mewto, hihi -(def statement {:author "kangaroo" - :content "Schnapspralinen" - :aggregate-id "huepfer.verlag" - :entity-id "1" - :version 1 - :created nil}) +(def statement {:content {:text "Schnapspralinen2" + :created nil + :author {:dgep-native false + :name "kangaroo" + :id 42}} + :identifier {:aggregate-id "huepfer.verlag" + :entity-id "1" + :version 1} + :delete-flag true + :predecessors []}) (def link (first (last (s/exercise ::gspecs/link)))) diff --git a/aggregator/test/aggregator/query/db_test.clj b/aggregator/test/aggregator/query/db_test.clj index 928b4cb..e10864d 100644 --- a/aggregator/test/aggregator/query/db_test.clj +++ b/aggregator/test/aggregator/query/db_test.clj @@ -7,73 +7,98 @@ (defn fixtures [f] (search/entrypoint) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "34" :version 1} - :content {:author "Jorge" + :content {:author {:name "Jorge" + :dgep-native true + :id 1234} :text "money does not solve problems of our society" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P12" :version 1} - :content {:author "George" + :content {:author {:name "George" + :dgep-native true + :id 1234} :text "we should shut down University Park" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P13" :version 1} - :content {:author "George" + :content {:author {:name "George" + :dgep-native true + :id 1234} :text "shutting down University Park will save $100.000 a year" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P22" :version 1} - :content {:author "AlterVerwalter" + :content {:author {:name "AlterVerwalter" + :dgep-native true + :id 1234} :text "the city is planing a new park in the upcoming month" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "7" :version 1} - :content {:author "Bolek" + :content {:author {:name "Bolek" + :dgep-native true + :id 1234} :text "we should not abandon our town's core task" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P23" :version 1} - :content {:author "XxxBaerchiDarkDestoyerxxX" + :content {:author {:name "XxxBaerchiDarkDestoyerxxX" + :dgep-native true + :id 1234} :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P232" :version 1} - :content {:author "XxxBestoyerxxX" + :content {:author {:name "XxxBestroyerxxX" + :dgep-native true + :id 1234} :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P231" :version 1} - :content {:author "XxxBoyerxxX" + :content {:author {:name "XxxBoyerxxX" + :dgep-native true + :id 1234} :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P230" :version 1} - :content {:author "XxxBayerxxX" + :content {:author {:name "XxxBayerxxX" + :dgep-native true + :id 1234} :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P29" :version 1} - :content {:author "XxxBaeryerxxX" + :content {:author {:name "XxxBaeryerxxX" + :dgep-native true + :id 1234} :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id config/aggregate-name :entity-id "P29v2" :version 1} - :content {:author "XxxBaeryerxxX" + :content {:author {:name "XxxBaeryerxxX" + :dgep-native true + :id 1234} :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) - (db/insert-link {:author "Wegi" :created nil :type :undercut + (db/insert-link {:author {:name "Wegi" + :dgep-native true + :id 1234} + :created nil :type :undercut :source {:aggregate-id "schneider.gg" :entity-id "W01" :version 1337} :destination {:aggregate-id "schneider.gg" @@ -91,7 +116,7 @@ (is (= (get-in (first (db/statements-by-uri "hhu.de/P13")) [:identifier :entity-id]) "P13")) (is (= (get-in (first (db/statements-by-uri "hhu.de/P22")) [:content :text]) "the city is planing a new park in the upcoming month")) - (is (= (get-in (first (db/statements-by-uri "hhu.de/7")) [:content :author]) "Bolek"))) + (is (= (get-in (first (db/statements-by-uri "hhu.de/7")) [:content :author :name]) "Bolek"))) (deftest statement-by-author-test (is (= (count (db/statements-by-author "XxxBaerchiDarkDestoyerxxX")) 1)) @@ -99,7 +124,10 @@ (deftest insert-statement-test (db/insert-statement {:content - {:author "Wegi" :text "Test me baby one more time" :created nil} + {:author {:name "Wegi" + :dgep-native true + :id 1234} + :text "Test me baby one more time" :created nil} :identifier {:aggregate-id "schneider.gg" :entity-id "W01" :version 1337} :delete-flag false @@ -109,9 +137,9 @@ "Test me baby one more time"))) (deftest insert-link-test - (is (= (:author (db/exact-link "schneider.gg" "W01" 1337 "schneider.gg" "W_link_35" 1)) + (is (= (:name (:author (db/exact-link "schneider.gg" "W01" 1337 "schneider.gg" "W_link_35" 1))) "Wegi")) - (is (= "Wegi" (:author (first (db/links-by-uri "schneider.gg/link0r1337")))))) + (is (= "Wegi" (:name (:author (first (db/links-by-uri "schneider.gg/link0r1337"))))))) (deftest random-statements (let [results (db/random-statements 1)] @@ -121,7 +149,7 @@ (deftest test-entity-by-uri (let [results (db/entities-by-uri "hhu.de/34" :statements)] (is (= 1 (count results))) - (is (= "Jorge" (get-in (first results) [:content :author]))))) + (is (= "Jorge" (get-in (first results) [:content :author :name]))))) (deftest test-undercuts (let [results (db/get-undercuts "schneider.gg" "W_link_35")] diff --git a/aggregator/test/aggregator/query/query_test.clj b/aggregator/test/aggregator/query/query_test.clj index bf3c220..35ba4ba 100644 --- a/aggregator/test/aggregator/query/query_test.clj +++ b/aggregator/test/aggregator/query/query_test.clj @@ -8,79 +8,106 @@ (defn fixtures [f] (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "34" :version 1} - :content {:author "Jorge" + :content {:author {:name "Jorge" + :dgep-native true + :id 1234} :text "money does not solve problems of our society" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P12" :version 1} - :content {:author "George" + :content {:author {:name "George" + :dgep-native true + :id 1234} :text "we should shut down University Park" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P13" :version 1} - :content {:author "George" + :content {:author {:name "George" + :dgep-native true + :id 1234} :text "shutting down University Park will save $100.000 a year" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P22" :version 1} - :content {:author "AlterVerwalter" + :content {:author {:name "AlterVerwalter" + :dgep-native true + :id 1234} :text "the city is planing a new park in the upcoming month" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "7" :version 1} - :content {:author "Bolek" + :content {:author {:name "Bolek" + :dgep-native true + :id 1234} :text "we should not abandon our town's core task" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P23" :version 1} - :content {:author "XxxBaerchiDarkDestoyerxxX" + :content {:author {:name "XxxBaerchiDarkDestoyerxxX" + :dgep-native true + :id 1234} :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P232" :version 1} - :content {:author "XxxBestoyerxxX" + :content {:author {:name "XxxBestoyerxxX" + :dgep-native true + :id 1234} :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P231" :version 1} - :content {:author "XxxBoyerxxX" + :content {:author {:name "XxxBoyerxxX" + :dgep-native true + :id 1234} :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P230" :version 1} - :content {:author "XxxBayerxxX" + :content {:author {:name "XxxBayerxxX" + :dgep-native true + :id 1234} :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P29" :version 1} - :content {:author "XxxBaeryerxxX" + :content {:author {:name "XxxBaeryerxxX" + :dgep-native true + :id 1234} :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id "hhu.de" :entity-id "P420" :version 1} - :content {:author "saywhaaat" + :content {:author {:name "saywhaaat" + :dgep-native true + :id 1234} :text "califragilistic extrahotentific" :created nil} :predecessors {} :delete-flag false}) (db/insert-statement {:identifier {:aggregate-id config/aggregate-name :entity-id "P29v2" :version 1} - :content {:author "XxxBaeryerxxX" + :content {:author {:name "XxxBaeryerxxX" + :dgep-native true + :id 1234} :text "there is a smaller park in O-Town" :created nil} :predecessors {} :delete-flag false}) - (db/insert-link {:author "Wegi" :created nil :type :undercut + (db/insert-link {:author {:name "Wegi" + :dgep-native true + :id 1234} + :created nil :type :undercut :source {:aggregate-id "schneider.gg" :entity-id "W01" :version 1337} :destination {:aggregate-id "schneider.gg" @@ -103,7 +130,9 @@ (deftest test-cached-statements (let [statement {:identifier {:aggregate-id "cache-aggregator" :entity-id "cache-id" :version 1} - :content {:author "XxxBaeryerxxX" + :content {:author {:name "XxxBaeryerxxX" + :dgep-native true + :id 1234} :text "there is a smaller park in O-Town" :created nil} :predecessors {} diff --git a/aggregator/test/aggregator/query/update_test.clj b/aggregator/test/aggregator/query/update_test.clj index 9bba92f..c4ce0d2 100644 --- a/aggregator/test/aggregator/query/update_test.clj +++ b/aggregator/test/aggregator/query/update_test.clj @@ -6,14 +6,20 @@ (def some-statement {:identifier {:aggregate-id "name-test" :entity-id "34" :version 1} - :content {:author "Jorge" + :content {:author {:name "Jorge" + :id 666 + :dgep-native false} :text "money does not solve problems of our society" :created nil} :predecessors {} :delete-flag false}) (def some-link - {:author "Wegi" :created nil :type :undercut + {:author {:name "Wegi" + :dgep-native true + :id 1234} + :created nil + :type :undercut :source {:aggregate-id "schneider.gg" :entity-id "W01" :version 1337} :destination {:aggregate-id "test-link" @@ -46,13 +52,16 @@ (let [updated-statement (update/fork-statement some-statement {:aggregate-id "new-agg.de" :entity-id "42" :version 15} - "New content" "Der Wetschi") + "New content" + {:name "Der Wetschi" + :dgep-native true + :id 1}) predecessor (first (:predecessors updated-statement))] (is (= 1 (get-in updated-statement [:identifier :version]))) (is (= "New content" (get-in updated-statement [:content :text]))) (is (= "new-agg.de" (get-in updated-statement [:identifier :aggregate-id]))) (is (= "42" (get-in updated-statement [:identifier :entity-id]))) - (is (= "Der Wetschi" (get-in updated-statement [:content :author]))) + (is (= "Der Wetschi" (get-in updated-statement [:content :author :name]))) (is (= "name-test" (:aggregate-id predecessor))) (is (= "34" (:entity-id predecessor))))) @@ -60,15 +69,19 @@ (deftest add-argument (let [{:keys [premise-id conclusion-id link-id]} (update/add-argument {:text "Der Kalli testet" - :author "¯\\_(ツ)_/¯"} + :author {:name "¯\\_(ツ)_/¯" + :dgep-native false + :id 69}} {:text "Conclusion wird supportet" - :author "Foo"} + :author {:name "Foo" + :dgep-native false + :id 89}} :support)] (is (= "¯\\_(ツ)_/¯" (get-in (query/exact-statement (:aggregate-id premise-id) (:entity-id premise-id) (:version premise-id)) - [:content :author]))) + [:content :author :name]))) (is (= "Conclusion wird supportet" (get-in (query/exact-statement (:aggregate-id conclusion-id) (:entity-id conclusion-id) diff --git a/aggregator/test/aggregator/search/core_test.clj b/aggregator/test/aggregator/search/core_test.clj index f961d2b..4a3730f 100644 --- a/aggregator/test/aggregator/search/core_test.clj +++ b/aggregator/test/aggregator/search/core_test.clj @@ -5,7 +5,9 @@ [aggregator.specs :as gspecs])) (def kangaroo {:content {:text "Schnapspralinen" - :author "kangaroo" + :author {:name "kangaroo" + :dgep-native true + :id 1234} :created nil} :identifier {:aggregate-id "huepfer.verlag" :entity-id "1" @@ -14,7 +16,9 @@ :delete-flag false}) (def penguin {:content {:text "Teewurst" - :author "penguin" + :author {:name "penguin" + :dgep-native true + :id 1234} :created nil} :identifier {:aggregate-id "penguin.books:8080" :entity-id "1" @@ -23,7 +27,9 @@ :delete-flag false}) (def penguin2 {:content {:text "Teewurst 2: Die Rache der Teewurst" - :author "penguin" + :author {:name "penguin" + :dgep-native true + :id 1234} :created nil} :identifier {:aggregate-id "penguin.books:8080" :entity-id "2" From a2877b8d6e88db6c39d0610c50c03fd9199e342e Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Thu, 29 Nov 2018 16:06:25 +0100 Subject: [PATCH 34/47] Change route functionality for add-argument --- aggregator/src/aggregator/api/routes.clj | 15 ++++++++------- aggregator/src/aggregator/query/update.clj | 15 +++++++++------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index 10a3f63..9cad7fb 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -16,9 +16,8 @@ (s/def ::statements (s/coll-of ::eden-specs/statement)) (s/def ::statements-map (s/keys :req-un [::statements])) -(s/def ::minimal-statement (s/keys :req-un [::eden-specs/text ::eden-specs/author])) -(s/def ::premise ::minimal-statement) -(s/def ::conclusion ::minimal-statement) +(s/def ::premise ::eden-specs/text) +(s/def ::conclusion ::eden-specs/text) (s/def ::links (s/coll-of ::eden-specs/link)) (s/def ::links-map (s/keys :req-un [::links])) @@ -31,8 +30,9 @@ (s/def ::new-argument (s/keys :req-un [::premise-name ::conclusion-name] :opt-un [::link-name])) +(s/def ::author-id ::eden-specs/id) (s/def ::link-type #{"support" "attack" "undercut"}) -(s/def ::minimal-argument (s/keys :req-un [::premise ::conclusion ::link-type])) +(s/def ::minimal-argument (s/keys :req-un [::premise ::conclusion ::link-type ::author-id])) (def argument-routes (context "/argument" [] @@ -47,8 +47,9 @@ "/argument" (let [premise (:premise request-body) conclusion (:conclusion request-body) - link-type (:link-type request-body)] - (update/add-argument premise conclusion link-type)))))) + link-type (:link-type request-body) + author-id (:author-id request-body)] + (update/add-argument premise conclusion link-type author-id)))))) (def statements-routes (context "/statements" [] @@ -184,7 +185,7 @@ {:name "links" :description "Retrieve Links"} {:name "statement" :description "Retrieve or add a single specific statement"} {:name "link" :description "Retrieve or add a single specific link"} - {:name "argument" :description "Retrive or add whole arguments"}]}}} + {:name "argument" :description "Add whole arguments"}]}}} statement-routes statements-routes link-routes diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index d9eaa35..8735aa0 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -3,6 +3,7 @@ [aggregator.query.cache :as cache] [aggregator.broker.publish :as pub] [aggregator.config :as config] + [aggregator.graphql.dbas-connector :as dbas] [aggregator.specs :as specs] [aggregator.utils.common :as utils] [clojure.spec.alpha :as s] @@ -73,7 +74,7 @@ (defn- statement-from-minimal "Generate a statement from the minimal needed information." - [{:keys [text author]}] + [text author] {:content {:text text :author author :created (utils/time-now-str)} @@ -85,10 +86,11 @@ (defn- link-premise-conclusion "Given a premise and a conclusion, link them both with an argument link." - [premise conclusion link-type] + [premise conclusion link-type author] (let [premise-id (:identifier premise) conclusion-id (:identifier conclusion)] {:type (:keyword link-type) + :author author :source premise-id :destination conclusion-id :delete-flag false @@ -99,10 +101,11 @@ (defn add-argument "Adds an argument to the database." - [premise conclusion link-type] - (let [complete-premise (statement-from-minimal premise) - complete-conclusion (statement-from-minimal conclusion) - link (link-premise-conclusion complete-premise complete-conclusion link-type)] + [premise conclusion link-type author-id] + (let [author (dbas/get-author author-id) + complete-premise (statement-from-minimal premise author) + complete-conclusion (statement-from-minimal conclusion author) + link (link-premise-conclusion complete-premise complete-conclusion link-type author)] (update-statement complete-premise) (update-statement complete-conclusion) (update-link link) From 3c5e1986c9a827fe7baa58fd6f6966790cc136a5 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 30 Nov 2018 09:39:12 +0100 Subject: [PATCH 35/47] Fix add-argument test to adhere to new syntax --- aggregator/test/aggregator/query/update_test.clj | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/aggregator/test/aggregator/query/update_test.clj b/aggregator/test/aggregator/query/update_test.clj index c4ce0d2..1a7d72c 100644 --- a/aggregator/test/aggregator/query/update_test.clj +++ b/aggregator/test/aggregator/query/update_test.clj @@ -68,15 +68,11 @@ (deftest add-argument (let [{:keys [premise-id conclusion-id link-id]} (update/add-argument - {:text "Der Kalli testet" - :author {:name "¯\\_(ツ)_/¯" - :dgep-native false - :id 69}} - {:text "Conclusion wird supportet" - :author {:name "Foo" - :dgep-native false - :id 89}} - :support)] + "Der Kalli testet" + "Conclusion wird supportet" + :author {:name "¯\\_(ツ)_/¯" + :dgep-native false + :id 69})] (is (= "¯\\_(ツ)_/¯" (get-in (query/exact-statement (:aggregate-id premise-id) (:entity-id premise-id) From 277dbf7fbdc01cd08544aa5a279e7fa093210b39 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 30 Nov 2018 10:06:17 +0100 Subject: [PATCH 36/47] Fix tests for real --- aggregator/src/aggregator/query/update.clj | 2 +- aggregator/test/aggregator/query/update_test.clj | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index 8735aa0..381981e 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -100,7 +100,7 @@ :created (utils/time-now-str)})) (defn add-argument - "Adds an argument to the database." + "Adds an argument to the database. Asuming the author exists and belongs to the local DGEP." [premise conclusion link-type author-id] (let [author (dbas/get-author author-id) complete-premise (statement-from-minimal premise author) diff --git a/aggregator/test/aggregator/query/update_test.clj b/aggregator/test/aggregator/query/update_test.clj index 1a7d72c..54d4fdd 100644 --- a/aggregator/test/aggregator/query/update_test.clj +++ b/aggregator/test/aggregator/query/update_test.clj @@ -66,14 +66,12 @@ (is (= "34" (:entity-id predecessor))))) -(deftest add-argument +(deftest test-add-argument (let [{:keys [premise-id conclusion-id link-id]} (update/add-argument "Der Kalli testet" "Conclusion wird supportet" - :author {:name "¯\\_(ツ)_/¯" - :dgep-native false - :id 69})] - (is (= "¯\\_(ツ)_/¯" + 1)] + (is (= "anonymous" (get-in (query/exact-statement (:aggregate-id premise-id) (:entity-id premise-id) (:version premise-id)) From c9089542cb4aeb24a0d3044878ab7ade2f407772 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 30 Nov 2018 10:23:44 +0100 Subject: [PATCH 37/47] Add quick statement-add from text --- aggregator/src/aggregator/api/routes.clj | 38 ++++++++++++------- aggregator/src/aggregator/query/update.clj | 13 +++++++ .../test/aggregator/query/update_test.clj | 8 ++++ 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index 9cad7fb..203f4dd 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -34,6 +34,8 @@ (s/def ::link-type #{"support" "attack" "undercut"}) (s/def ::minimal-argument (s/keys :req-un [::premise ::conclusion ::link-type ::author-id])) +(s/def ::quick-statement-body (s/keys :req-un [::eden-specs/text ::author-id])) + (def argument-routes (context "/argument" [] :tags ["argument"] @@ -121,22 +123,30 @@ :coercion :spec (GET "/" [] - :summary "Return a specific statement by identifiers" - :query-params [aggregate-id :- ::eden-specs/aggregate-id - entity-id :- ::eden-specs/entity-id - version :- ::eden-specs/version] - :return ::statement-map - (if-let [statement (query/exact-statement aggregate-id entity-id version)] - (ok {:statement statement}) - (not-found nil))) + :summary "Return a specific statement by identifiers" + :query-params [aggregate-id :- ::eden-specs/aggregate-id + entity-id :- ::eden-specs/entity-id + version :- ::eden-specs/version] + :return ::statement-map + (if-let [statement (query/exact-statement aggregate-id entity-id version)] + (ok {:statement statement}) + (not-found nil))) (POST "/" [] - :summary "Add a statement to the EDEN database" - :body [statement ::eden-specs/statement] - :return ::statement-map - (created - "/statement" - {:statement (update/update-statement (utils/json->edn statement))})))) + :summary "Add a statement to the EDEN database" + :body [statement ::eden-specs/statement] + :return ::statement-map + (created + "/statement" + {:statement (update/update-statement (utils/json->edn statement))})) + + (POST "/from-text" [] + :summary "Add a statement only providing text and author-id" + :body [request-body ::quick-statement-body] + :return ::statement-map + (created + "/statement" + {:statement (update/statement-from-text request-body)})))) (defn wrap-link-type [handler] (fn [request] diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index 381981e..ea8c489 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -112,3 +112,16 @@ {:premise-id (:identifier complete-premise) :conclusion-id (:identifier complete-conclusion) :link-id (:identifier link)})) + +(defn statement-from-text + "Adds an argument only from text and author-id. Assumes author belongs to local DGEP." + [text author-id] + (let [author (dbas/get-author author-id)] + {:content {:text text + :author author + :created (utils/time-now-str)} + :identifier {:aggregate-id config/aggregate-name + :entity-id (str (java.util.UUID/randomUUID)) + :version 1} + :delete-flag false + :predecessors []})) diff --git a/aggregator/test/aggregator/query/update_test.clj b/aggregator/test/aggregator/query/update_test.clj index 54d4fdd..687630c 100644 --- a/aggregator/test/aggregator/query/update_test.clj +++ b/aggregator/test/aggregator/query/update_test.clj @@ -85,3 +85,11 @@ (count (query/retrieve-link (:aggregate-id link-id) (:entity-id link-id) (:version link-id)))))))) + +(deftest test-statement-from-text + (let [text "This statement-stuff is craaaaazy" + new-statement (update/statement-from-text text 1)] + (is (= text (get-in new-statement [:content :text]))) + (is (= "anonymous" (get-in new-statement [:content :author :name]))) + (is (= config/aggregate-name (get-in new-statement [:identifier :aggregate-id]))) + (is (= 1 (get-in new-statement [:identifier :version]))))) From b713ca4ca2a06ee3e273647490f60dadf2274026 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 30 Nov 2018 10:25:16 +0100 Subject: [PATCH 38/47] Fix small error --- aggregator/test/aggregator/query/update_test.clj | 1 + 1 file changed, 1 insertion(+) diff --git a/aggregator/test/aggregator/query/update_test.clj b/aggregator/test/aggregator/query/update_test.clj index 687630c..fff0068 100644 --- a/aggregator/test/aggregator/query/update_test.clj +++ b/aggregator/test/aggregator/query/update_test.clj @@ -70,6 +70,7 @@ (let [{:keys [premise-id conclusion-id link-id]} (update/add-argument "Der Kalli testet" "Conclusion wird supportet" + :support 1)] (is (= "anonymous" (get-in (query/exact-statement (:aggregate-id premise-id) From c5c0817ddbb5cce8f7ea990df61130efd62f4915 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 30 Nov 2018 11:11:32 +0100 Subject: [PATCH 39/47] Add a quicker way to add local links --- aggregator/src/aggregator/api/routes.clj | 17 ++++++++++++++++- aggregator/src/aggregator/query/update.clj | 14 ++++++++++++++ .../test/aggregator/query/update_test.clj | 10 ++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index 203f4dd..d4642df 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -35,6 +35,8 @@ (s/def ::minimal-argument (s/keys :req-un [::premise ::conclusion ::link-type ::author-id])) (s/def ::quick-statement-body (s/keys :req-un [::eden-specs/text ::author-id])) +(s/def ::quicklink-request (s/keys :req-un [::eden-specs/type ::eden-specs/source + ::eden-specs/destination ::author-id])) (def argument-routes (context "/argument" [] @@ -176,7 +178,20 @@ :return ::link-map (created "/link" - {:link (update/update-link (utils/json->edn link))})))) + {:link (update/update-link (utils/json->edn link))})) + + (POST "/shorthand" [] + :summary "Add a link via source, destination and author. Autogenerate rest." + :middleware [wrap-link-type] + :body [quicklink-request ::quicklink-request] + :return ::link-map + (created + "/link" + (let [source (:source quicklink-request) + destination (:destination quicklink-request) + author-id (:author-id quicklink-request) + link-type (:type quicklink-request)] + {:link (update/quicklink link-type source destination author-id)}))))) (def app (let [compojure-api-handler diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index ea8c489..d982e8a 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -125,3 +125,17 @@ :version 1} :delete-flag false :predecessors []})) + +(defn quicklink + "Add a link from source, destination, type and author. Assumes author belongs to local DGEP" + [type source destination author-id] + (let [author (dbas/get-author author-id)] + {:type type + :source source + :destination destination + :identifier {:aggregate-id config/aggregate-name + :entity-id (str "link-" (java.util.UUID/randomUUID)) + :version 1} + :delete-flag false + :created (utils/time-now-str) + :author author})) diff --git a/aggregator/test/aggregator/query/update_test.clj b/aggregator/test/aggregator/query/update_test.clj index fff0068..d0176fc 100644 --- a/aggregator/test/aggregator/query/update_test.clj +++ b/aggregator/test/aggregator/query/update_test.clj @@ -94,3 +94,13 @@ (is (= "anonymous" (get-in new-statement [:content :author :name]))) (is (= config/aggregate-name (get-in new-statement [:identifier :aggregate-id]))) (is (= 1 (get-in new-statement [:identifier :version]))))) + +(deftest test-quicklink-add + (let [source (:source some-link) + destination (assoc (:source some-link) :entity-id "link_special_1") + new-link (update/quicklink :support source destination 1)] + (is (= "schneider.gg" (get-in new-link [:source :aggregate-id]))) + (is (= "link_special_1" (get-in new-link [:destination :entity-id]))) + (is (= config/aggregate-name (get-in new-link [:identifier :aggregate-id]))) + (is (= 1 (get-in new-link [:identifier :version]))) + (is (= "anonymous" (get-in new-link [:author :name]))))) From 275829ed80e2b5a9835a929d139ee5b0a7a99d02 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 30 Nov 2018 14:06:30 +0100 Subject: [PATCH 40/47] Add possibility to add additional information for shorthand statement add --- aggregator/src/aggregator/api/routes.clj | 9 +++-- aggregator/src/aggregator/query/query.clj | 4 +-- aggregator/src/aggregator/query/update.clj | 38 +++++++++++----------- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index d4642df..c4e9a0b 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -34,7 +34,9 @@ (s/def ::link-type #{"support" "attack" "undercut"}) (s/def ::minimal-argument (s/keys :req-un [::premise ::conclusion ::link-type ::author-id])) -(s/def ::quick-statement-body (s/keys :req-un [::eden-specs/text ::author-id])) +(s/def ::additional map?) +(s/def ::quick-statement-body (s/keys :req-un [::eden-specs/text ::author-id] + :opt-un [::additional])) (s/def ::quicklink-request (s/keys :req-un [::eden-specs/type ::eden-specs/source ::eden-specs/destination ::author-id])) @@ -148,7 +150,10 @@ :return ::statement-map (created "/statement" - {:statement (update/statement-from-text request-body)})))) + (let [text (:text request-body) + author-id (:author-id request-body) + additional (:additional request-body)] + {:statement (update/statement-from-text text author-id additional)}))))) (defn wrap-link-type [handler] (fn [request] diff --git a/aggregator/src/aggregator/query/query.clj b/aggregator/src/aggregator/query/query.clj index 67fa04f..9b4e641 100644 --- a/aggregator/src/aggregator/query/query.clj +++ b/aggregator/src/aggregator/query/query.clj @@ -7,7 +7,8 @@ [aggregator.config :as config] [clj-http.client :as client] [clojure.string :as str] - [taoensso.timbre :as log])) + [taoensso.timbre :as log] + [aggregator.query.update :as update])) (defn get-data "Get data from a remote aggregator." @@ -189,7 +190,6 @@ [query] (db/statements-contain query)) - (defn custom-statement "Retrieve a statement with a custom field containg a specific search-term." [field search-term] diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index d982e8a..360d9ed 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -74,15 +74,20 @@ (defn- statement-from-minimal "Generate a statement from the minimal needed information." - [text author] - {:content {:text text - :author author - :created (utils/time-now-str)} - :identifier {:aggregate-id config/aggregate-name - :entity-id (str (java.util.UUID/randomUUID)) - :version 1} - :delete-flag false - :predecessors []}) + ([text author] + (statement-from-minimal text author {})) + ([text author additional] + (let [statement {:content {:text text + :author author + :created (utils/time-now-str)} + :identifier {:aggregate-id config/aggregate-name + :entity-id (str (java.util.UUID/randomUUID)) + :version 1} + :delete-flag false + :predecessors []} + forbidden-fields #{:content :identifier :delete-flag :predecessors} + filtered-additional (apply dissoc additional forbidden-fields)] + (conj statement filtered-additional)))) (defn- link-premise-conclusion "Given a premise and a conclusion, link them both with an argument link." @@ -115,16 +120,11 @@ (defn statement-from-text "Adds an argument only from text and author-id. Assumes author belongs to local DGEP." - [text author-id] - (let [author (dbas/get-author author-id)] - {:content {:text text - :author author - :created (utils/time-now-str)} - :identifier {:aggregate-id config/aggregate-name - :entity-id (str (java.util.UUID/randomUUID)) - :version 1} - :delete-flag false - :predecessors []})) + ([text author-id] + (statement-from-text text author-id {})) + ([text author-id additional] + (let [author (dbas/get-author author-id)] + (update-statement (statement-from-minimal text author additional))))) (defn quicklink "Add a link from source, destination, type and author. Assumes author belongs to local DGEP" From ffa4c43ab1236b542626ced5cde452097e326b9e Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 30 Nov 2018 14:16:08 +0100 Subject: [PATCH 41/47] Fix wrong graphQl behaviour with links --- aggregator/src/aggregator/graphql/dbas_connector.clj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aggregator/src/aggregator/graphql/dbas_connector.clj b/aggregator/src/aggregator/graphql/dbas_connector.clj index f3962b8..1b7a0e2 100644 --- a/aggregator/src/aggregator/graphql/dbas_connector.clj +++ b/aggregator/src/aggregator/graphql/dbas_connector.clj @@ -76,7 +76,7 @@ "query {premises(premisegroupUid: %d) {statementUid}}" group-uid)) link-type-val (link-type argument) - author (get argument [:author])] + author (:author argument)] (map (fn [premise] {:author {:dgep-native true :name (:publicNickname author) @@ -94,7 +94,6 @@ :version 1}}) (:premises premises)))) - (defn get-links "Return a map of all links that can be requested from the connected D-BAS instance." [] From 4abf7a13f1bace9f21c0c5b610f30403656e8a32 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 30 Nov 2018 14:41:55 +0100 Subject: [PATCH 42/47] Add test for new additionals syntax and fix link from dbas generation --- .../src/aggregator/graphql/dbas_connector.clj | 16 +++++++++------- aggregator/test/aggregator/query/update_test.clj | 11 +++++++++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/aggregator/src/aggregator/graphql/dbas_connector.clj b/aggregator/src/aggregator/graphql/dbas_connector.clj index 1b7a0e2..570c572 100644 --- a/aggregator/src/aggregator/graphql/dbas_connector.clj +++ b/aggregator/src/aggregator/graphql/dbas_connector.clj @@ -76,28 +76,30 @@ "query {premises(premisegroupUid: %d) {statementUid}}" group-uid)) link-type-val (link-type argument) - author (:author argument)] + author (:author argument) + destination-id (or (:conclusionUid argument) (:argumentUid argument))] (map (fn [premise] {:author {:dgep-native true :name (:publicNickname author) - :id (:uid author)} + :id (Integer/parseInt (:uid author))} :created nil ;; nil until we solve the graphql problem :type link-type-val :source {:aggregate-id config/aggregate-name - :entity-id (:statementUid premise) + :entity-id (str (:statementUid premise)) :version 1} :destination {:aggregate-id config/aggregate-name :version 1 - :entity-id (:conclusionUid argument)} + :entity-id (str destination-id)} :identifier {:aggregate-id config/aggregate-name - :entity-id (:uid argument) - :version 1}}) + :entity-id (str (:uid argument)) + :version 1} + :delete-flag (:isDisabled argument)}) (:premises premises)))) (defn get-links "Return a map of all links that can be requested from the connected D-BAS instance." [] - (let [result (query-db "query {arguments {uid conclusionUid, isSupportive, author {publicNickname uid}, argumentUid, premisegroupUid}}") + (let [result (query-db "query {arguments {uid conclusionUid, isSupportive, author {publicNickname uid}, argumentUid, premisegroupUid, isDisabled}}") return-val (mapcat links-from-argument (:arguments result))] return-val)) diff --git a/aggregator/test/aggregator/query/update_test.clj b/aggregator/test/aggregator/query/update_test.clj index d0176fc..916dd92 100644 --- a/aggregator/test/aggregator/query/update_test.clj +++ b/aggregator/test/aggregator/query/update_test.clj @@ -89,11 +89,18 @@ (deftest test-statement-from-text (let [text "This statement-stuff is craaaaazy" - new-statement (update/statement-from-text text 1)] + new-statement (update/statement-from-text text 1) + statement-with-adds (update/statement-from-text text 1 {:aggregator-id :rekt + :content "doubly" + :reference "My Humps"})] (is (= text (get-in new-statement [:content :text]))) (is (= "anonymous" (get-in new-statement [:content :author :name]))) (is (= config/aggregate-name (get-in new-statement [:identifier :aggregate-id]))) - (is (= 1 (get-in new-statement [:identifier :version]))))) + (is (= 1 (get-in new-statement [:identifier :version]))) + (is (= text (get-in statement-with-adds [:content :text]))) + (is (= "anonymous" (get-in statement-with-adds [:content :author :name]))) + (is (= config/aggregate-name (get-in statement-with-adds [:identifier :aggregate-id]))) + (is (= "My Humps" (:reference statement-with-adds))))) (deftest test-quicklink-add (let [source (:source some-link) From c6aebf924bd7051186cfd1e8435af590323d9c48 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 30 Nov 2018 14:50:08 +0100 Subject: [PATCH 43/47] Add additionals support for argument shorthand function --- aggregator/src/aggregator/api/routes.clj | 10 +++++---- aggregator/src/aggregator/query/update.clj | 24 ++++++++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index c4e9a0b..b936327 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -32,9 +32,10 @@ (s/def ::author-id ::eden-specs/id) (s/def ::link-type #{"support" "attack" "undercut"}) -(s/def ::minimal-argument (s/keys :req-un [::premise ::conclusion ::link-type ::author-id])) - (s/def ::additional map?) +(s/def ::minimal-argument (s/keys :req-un [::premise ::conclusion ::link-type ::author-id] + :opt-un [::additional])) + (s/def ::quick-statement-body (s/keys :req-un [::eden-specs/text ::author-id] :opt-un [::additional])) (s/def ::quicklink-request (s/keys :req-un [::eden-specs/type ::eden-specs/source @@ -54,8 +55,9 @@ (let [premise (:premise request-body) conclusion (:conclusion request-body) link-type (:link-type request-body) - author-id (:author-id request-body)] - (update/add-argument premise conclusion link-type author-id)))))) + author-id (:author-id request-body) + additional (:additional request-body)] + (update/add-argument premise conclusion link-type author-id additional)))))) (def statements-routes (context "/statements" [] diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index 360d9ed..1f0af2a 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -106,17 +106,19 @@ (defn add-argument "Adds an argument to the database. Asuming the author exists and belongs to the local DGEP." - [premise conclusion link-type author-id] - (let [author (dbas/get-author author-id) - complete-premise (statement-from-minimal premise author) - complete-conclusion (statement-from-minimal conclusion author) - link (link-premise-conclusion complete-premise complete-conclusion link-type author)] - (update-statement complete-premise) - (update-statement complete-conclusion) - (update-link link) - {:premise-id (:identifier complete-premise) - :conclusion-id (:identifier complete-conclusion) - :link-id (:identifier link)})) + ([premise conclusion link-type author-id] + (add-argument premise conclusion link-type author-id {})) + ([premise conclusion link-type author-id additionals] + (let [author (dbas/get-author author-id) + complete-premise (statement-from-minimal premise author additionals) + complete-conclusion (statement-from-minimal conclusion author additionals) + link (link-premise-conclusion complete-premise complete-conclusion link-type author)] + (update-statement complete-premise) + (update-statement complete-conclusion) + (update-link link) + {:premise-id (:identifier complete-premise) + :conclusion-id (:identifier complete-conclusion) + :link-id (:identifier link)}))) (defn statement-from-text "Adds an argument only from text and author-id. Assumes author belongs to local DGEP." From c9a24287d312da5580817cb3fa931ac01c8a710d Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 30 Nov 2018 15:06:20 +0100 Subject: [PATCH 44/47] Add Search by reference-host --- aggregator/src/aggregator/api/routes.clj | 27 ++++++++++++++-------- aggregator/src/aggregator/query/update.clj | 6 ++--- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index b936327..4092e30 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -33,8 +33,10 @@ (s/def ::author-id ::eden-specs/id) (s/def ::link-type #{"support" "attack" "undercut"}) (s/def ::additional map?) +(s/def ::additional-premise map?) +(s/def ::additional-conclusion map?) (s/def ::minimal-argument (s/keys :req-un [::premise ::conclusion ::link-type ::author-id] - :opt-un [::additional])) + :opt-un [::additional-premise ::additional-conclusion])) (s/def ::quick-statement-body (s/keys :req-un [::eden-specs/text ::author-id] :opt-un [::additional])) @@ -56,8 +58,9 @@ conclusion (:conclusion request-body) link-type (:link-type request-body) author-id (:author-id request-body) - additional (:additional request-body)] - (update/add-argument premise conclusion link-type author-id additional)))))) + additional-p (:additional-premise request-body) + additional-c (:additional-conclusion request-body)] + (update/add-argument premise conclusion link-type author-id additional-p additional-c)))))) (def statements-routes (context "/statements" [] @@ -83,12 +86,18 @@ (ok {:statements (query/starter-set)})) (GET "/by-id" [] - :summary "Returns all statements matching aggregator and entity-id" - :query-params [aggregate-id :- ::eden-specs/aggregate-id, - entity-id :- ::eden-specs/entity-id] - :return ::statements-map - (ok {:statements (query/tiered-retrieval aggregate-id entity-id - {:opts [:no-remote]})})) + :summary "Returns all statements matching aggregator and entity-id" + :query-params [aggregate-id :- ::eden-specs/aggregate-id, + entity-id :- ::eden-specs/entity-id] + :return ::statements-map + (ok {:statements (query/tiered-retrieval aggregate-id entity-id + {:opts [:no-remote]})})) + + (GET "/by-reference-host" [] + :summary "Returns all statements matching aggregator and entity-id" + :query-params [host :- spec/string?] + :return ::statements-map + (ok {:statements (query/custom-statement :reference.host host)})) (GET "/custom" [] :summary "Returns all statements matching the search term in a custom field" diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index 1f0af2a..df0ee34 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -108,10 +108,10 @@ "Adds an argument to the database. Asuming the author exists and belongs to the local DGEP." ([premise conclusion link-type author-id] (add-argument premise conclusion link-type author-id {})) - ([premise conclusion link-type author-id additionals] + ([premise conclusion link-type author-id additional-premise additional-conclusion] (let [author (dbas/get-author author-id) - complete-premise (statement-from-minimal premise author additionals) - complete-conclusion (statement-from-minimal conclusion author additionals) + complete-premise (statement-from-minimal premise author additional-premise) + complete-conclusion (statement-from-minimal conclusion author additional-conclusion) link (link-premise-conclusion complete-premise complete-conclusion link-type author)] (update-statement complete-premise) (update-statement complete-conclusion) From d236ca7580b83a21695665e7d16c7fe1b0147f48 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 30 Nov 2018 15:07:39 +0100 Subject: [PATCH 45/47] Add search for reference text --- aggregator/src/aggregator/api/routes.clj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/aggregator/src/aggregator/api/routes.clj b/aggregator/src/aggregator/api/routes.clj index 4092e30..ef2889b 100644 --- a/aggregator/src/aggregator/api/routes.clj +++ b/aggregator/src/aggregator/api/routes.clj @@ -99,6 +99,12 @@ :return ::statements-map (ok {:statements (query/custom-statement :reference.host host)})) + (GET "/by-reference-text" [] + :summary "Returns all statements matching aggregator and entity-id" + :query-params [text :- spec/string?] + :return ::statements-map + (ok {:statements (query/custom-statement :reference.text text)})) + (GET "/custom" [] :summary "Returns all statements matching the search term in a custom field" :query-params [custom-field :- spec/string? From 557b3f69deb14b99de2171dbe30d806955cba950 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 30 Nov 2018 15:15:09 +0100 Subject: [PATCH 46/47] Bump Version to 0.3 --- CHANGELOG.md | 10 ++++++++++ aggregator/project.clj | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..12537da --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# 0.3 +Major Changes with 0.3 +* The user is not a simple String anymore. The user is now a map containing the public Screenname (`:name`), the `:id` and the `dgep-native` flag which is set when the user is native to the aggregator stated in `identifier.aggregator-id`. +* Shorthands for adding statements and whole arguments just by text all accept a author-id and assume the author is local to the current DGEP instance. +* Shorthands for adding arguments and statements now accept additional fields trhough the `additional` map. You can add any custom field there. Attributes added here will be first-class on the resulting statements. This means that adding `additional: {"foo" "bar"}` will add a field `:foo` with the value `bar` to the resulting statement. +* Added support for first-class reference search. + * A `reference` field is expected to contain a `:text`, `:host` and `:path` + * References can be searched by host- and text-content in the corresponding routes (See `/index.html#!/statements` for an overview) +* Other custom fields can be searched via `/statements/custom` +* A bug with the DBAS-Connector has been fixed and now again produces correct links. diff --git a/aggregator/project.clj b/aggregator/project.clj index 7926b7a..951d688 100644 --- a/aggregator/project.clj +++ b/aggregator/project.clj @@ -1,4 +1,4 @@ -(defproject aggregator "0.2" +(defproject aggregator "0.3" :description "The aggregator module for the EDEN framework. The aggregator coordinates the internal and external dataflows of an EDEN instance." :url "http://example.com/FIXME" :license {:name "Eclipse Public License" From a0be7a2bcf88f8c9e7ba05c7329dd896fea715a8 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Fri, 30 Nov 2018 15:20:07 +0100 Subject: [PATCH 47/47] Minor Bugfix --- aggregator/src/aggregator/query/update.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aggregator/src/aggregator/query/update.clj b/aggregator/src/aggregator/query/update.clj index df0ee34..006fe9b 100644 --- a/aggregator/src/aggregator/query/update.clj +++ b/aggregator/src/aggregator/query/update.clj @@ -107,7 +107,7 @@ (defn add-argument "Adds an argument to the database. Asuming the author exists and belongs to the local DGEP." ([premise conclusion link-type author-id] - (add-argument premise conclusion link-type author-id {})) + (add-argument premise conclusion link-type author-id {} {})) ([premise conclusion link-type author-id additional-premise additional-conclusion] (let [author (dbas/get-author author-id) complete-premise (statement-from-minimal premise author additional-premise)