wiki.ziemers.de

ziemer's informatik Wiki

Benutzer-Werkzeuge

Webseiten-Werkzeuge


wiki:software:beuthbot:database

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
wiki:software:beuthbot:database [11.06.2020 13:25]
Lukas Danckwerth
wiki:software:beuthbot:database [29.06.2020 14:01] (aktuell)
Tobias Belkner [Table of Content]
Zeile 1: Zeile 1:
 =====database===== =====database=====
 +
 +==== Table of Content ====
 +     - [[[[wiki:software:beuthbot:database#database|database]]
 +     - [[[[wiki:software:beuthbot:database#Table of Content|Table of Content]]
 +     - [[[[wiki:software:beuthbot:database#Motivation|Motivation]]
 +     - [[[[wiki:software:beuthbot:database#Requirements|Requirements]]
 +       - [[[[wiki:software:beuthbot:database#Functional|Functional]]
 +       - [[[[wiki:software:beuthbot:database#Non Functional|Non Functional]]
 +     - [[[[wiki:software:beuthbot:database#User Stories|User Stories]] 
 +     - [[[[wiki:software:beuthbot:database#Use Cases|Use Cases]]
 +     - [[[[wiki:software:beuthbot:database#Klassendiagramm User|Klassendiagramm User]]
 +     - [[[[wiki:software:beuthbot:database#Technologies|Technologies]]
 +     - [[[[wiki:software:beuthbot:database#Integration|Integration]]
 +       - [[[[wiki:software:beuthbot:database#Sequenzdiagramm mit angesteuertem Service|Sequenzdiagramm mit angesteuertem Service]]
 +       - [[[[wiki:software:beuthbot:database#Sequenzdiagramm nur Datenbank betreffend|Sequenzdiagramm nur Datenbank betreffend]]
 +     - [[[[wiki:software:beuthbot:database#Getting Started|Getting Started]]
 +       - [[[[wiki:software:beuthbot:database#Windows|Windows]]
 +     - [[[[wiki:software:beuthbot:database#API|API]]
 +       - [[[[wiki:software:beuthbot:database#Request all Users|Request all Users]]
 +       - [[[[wiki:software:beuthbot:database#Request Users|Request Users]]
 +       - [[[[wiki:software:beuthbot:database#Add / Change Detail|Add / Change Detail]]
 +       - [[[[wiki:software:beuthbot:database#Delete all Details|Delete all Details]]
 +       - [[[[wiki:software:beuthbot:database#Delete Detail|Delete Detail]]
  
 ====Motivation==== ====Motivation====
Zeile 54: Zeile 77:
   * ''/DBUS103/'' Als Student möchte ich dem Bot sagen können, dass er meine ALLE meine Daten löschen soll.   * ''/DBUS103/'' Als Student möchte ich dem Bot sagen können, dass er meine ALLE meine Daten löschen soll.
   * ''/DBUS103/'' Als Student möchte ich dem Bot sagen können, dass er ein Detail über mich löschen soll.   * ''/DBUS103/'' Als Student möchte ich dem Bot sagen können, dass er ein Detail über mich löschen soll.
-  * ''/DBUS104/'' Als ... möchte ich ..., damit ich ... 
  
  
-====Use Cases (?)====+====Use Cases====
  
 +<uml>
 +@startuml
 +left to right direction
 +
 +actor "Student" as ST 
 +
 +package BeuthBot {
 +  actor "DBController" as DBC << Application >>
 +  usecase "Remember Nickname" as UC1
 +  usecase "Forget Nickname" as UC2
 +  usecase "Remember Detail" as UC3
 +  usecase "Forget Detail" as UC4
 +  usecase "Forget All Detail" as UC5
 +}
 +
 +ST --> UC1
 +ST --> UC2
 +ST --> UC3
 +ST --> UC4
 +ST --> UC5
 +
 +UC1 --> DBC
 +UC2 --> DBC
 +UC3 --> DBC
 +UC4 --> DBC
 +UC5 --> DBC
 +@enduml
 +</uml>
  
 ====Klassendiagramm User==== ====Klassendiagramm User====
Zeile 75: Zeile 125:
 ====Technologies==== ====Technologies====
  
-Durch die Anforderung, dass die Details, die zu einem User gespeichert werden sehr variabel sein können, ist von einer relationalen Datenbank wie MySQL o.ä. abzuraten. MongoDB ist eine dokumentenorientierte NoSQL-Datenbank. Mit ihr können Sammlungen von JSON-ähnlichen Dokumenten erstellt und verwalten werden. So können wir die Daten zu einem User in komplexen Hierarchien verschachteln und erweitern ohne uns Gedanken zu einem Tabellen-Schema machen zu müssen.+Durch die Anforderung, dass die Details, die zu einem User gespeichert werden sehr variabel sein können, ist von einer relationalen Datenbank wie MySQL o.ä. abzuraten. MongoDB ist eine dokumentenorientierte NoSQL-Datenbank. Mit ihr können Sammlungen von JSON-ähnlichen Dokumenten erstellt und verwaltet werden. So können wir die Daten zu einem User in komplexen Hierarchien verschachteln und erweitern ohne uns Gedanken zu einem Tabellen-Schema machen zu müssen.
  
   * MongoDB [[https://www.mongodb.com/de|Link]]   * MongoDB [[https://www.mongodb.com/de|Link]]
   * MongoDB Docker Image [[https://hub.docker.com/_/mongo|Link]]   * MongoDB Docker Image [[https://hub.docker.com/_/mongo|Link]]
  
-====Function==== +<uml> 
- +@startuml 
 +package "docker-compose.yml"
 +  [MongoDB (Container)] 
 +  [DB Controller (Container)] 
 +
 +@enduml 
 +</uml>
  
 ====Integration==== ====Integration====
- 
-// # An welcher Stelle wird die DB in das System eingebaut?// 
- 
-// # Wie wird sie eingebaut?// 
- 
-// # Wie sieht das Endprodukt aus?// 
  
 <uml> <uml>
Zeile 131: Zeile 180:
  
 GW -> DC: Request GW -> DC: Request
-DC -> GW: Response (Intent + [Args])+activate DC 
 +return Response (Intent + [Args]
  
 GW -> DBC: Request User GW -> DBC: Request User
 +activate DBC
 DBC -> DB: Get User DBC -> DB: Get User
-DB -> DBC: Return User +activate DB 
-DBC -> GW: Respones User+return Return User 
 +return Responses User
  
 GW -> SE: Request (User + [Args]) GW -> SE: Request (User + [Args])
-SE -> GW: Answere+activate SE 
 +return Answer
 @enduml @enduml
 </uml> </uml>
Zeile 154: Zeile 207:
 endbox endbox
  
-GW -> DC: Request "Merke dir, dass ich vegetarich esse." +GW -> DC: Request "Merke dir, dass ich vegetarisch esse." 
-DC -> GW: Response (Intent + [Args])+activate DC 
 +return Response (Intent + [Args])
  
 GW -> DBC: Add Detail "vegetarisch" GW -> DBC: Add Detail "vegetarisch"
 +activate DBC
 DBC -> DB: Store "vegetarisch" DBC -> DB: Store "vegetarisch"
-DB -> DBC: Result +activate DB 
-DBC -> GW: Result+return Result 
 +return GW: Result
 @enduml @enduml
 </uml> </uml>
Zeile 173: Zeile 229:
   * Erste versuche mit dem Trainingsmodell von RASA   * Erste versuche mit dem Trainingsmodell von RASA
  
 +====Getting Started====
 +
 +Die Datenbank wurde mit Docker erstellt. Um diese zum laufen zu bringen müssen folgende Befehle ausgeführt werden:
 +
 +<code>
 +# clone the repository
 +git clone https://github.com/beuthbot/database.git
 +
 +# go to the folder
 +cd database
 +
 +# start the docker container to run the mongodb and its corresponding database microservice
 +docker-compose up
 +</code>
 +
 +===Windows===
 +
 +Damit es auf Windows funktionieren kann müssen folgende Zeilen in der docker-compose.yml Datei geändert werden:
 +
 +<code>
 +...
 +    volumes:
 +      - mongodata:/data/db # needed for me to run container on Windows 10
 +      #- ./../.database:/data/db # For Mac/Linux
 +...
 +# needed for me to run container on Windows 10
 +volumes:
 +  mongodata:
 +</code>
 +
 +Außerdem muss ein shared Folder existieren, welcher beispielsweise 'mongodb' genannt werden muss, worin sich der Ordner 'data' mit den Unterordnern 'db' und 'configdb' befindet.
 +Die Ordnerstruktur sollte nun wie folgt aussehen:
 +<code>
 +E:\mongodb
 +    └───data
 +          ├───configdb
 +          └───db
 +</code>
 +
 +==== API ====
 +=== Request all Users ===
 +Requests all Users in the collection
 +<code>
 +GET http://localhost:27000/users
 +</code>
 +
 +== Response ==
 +<code>
 +{...},
 +{
 +  "id": 12345678,
 +  "nickname": "Alan",
 +  "details" : {
 +    "eating_habit" : "vegetarisch",
 +    "city" : "Berlin"
 +  }
 +},
 +{...}
 +</code>
 +
 +== Error ==
 +<code>
 +{
 +  "error": ...
 +}
 +</code>
 +=== Request User ===
 +
 +<code>
 +GET http://localhost:27000/users/<id>
 +</code>
 +
 +== Reponse ==
 +Request a single user with the given id.
 +<code>
 +{
 +  "id": 12345678,
 +  "nickname": "Alan",
 +  "details" : {
 +    "eating_habit" : "vegetarisch",
 +    "city" : "Berlin"
 +  }
 +}
 +</code>
 +
 +== Error ==
 +
 +<code>
 +{
 +  "error": ...
 +}
 +</code>
 +
 +=== Add / Change Detail ===
 +Add/Change a Detaile to/from the User with the given id.
 +<code>
 +POST http://localhost:27000/users/<id>/detail
 +</code>
 +
 +== Request Body ==
 +
 +<code>
 +{
 +  "detail": "eating_habit",
 +  "value": "vegetarisch"
 +}
 +</code>
 +
 +== Reponse ==
 +If the operation was successful the error will be set to null and the success will be set to true. If the operation failed an error message will be set and the success will be set to false.
 +<code>
 +{
 +  "error": null,
 +  "success": true | false
 +}
 +</code>
 +===  Delete all Details ===
 +Deletes all Details from the User with the given id
 +<code>
 +DELETE http://localhost:27000/user/<id>/detail?q=<value>
 +</code>
 +
 +== Reponse ==
 +If the operation was successful the error will be set to null and the success will be set to true. If the operation failed an error message will be set and the success will be set to false.
 +
 +<code>
 +{
 +  "error": null,
 +  "success": true | false
 +}
 +</code>
 +
 +===  Delete Detail ===
 +Deletes one Detail from the User with the given id.
 +
 +<code>
 +DELETE http://localhost:27000/user/<id>/detail?q=<value>
 +</code>
 +
 +== Reponse ==
 +If the operation was successful the error will be set to null and the success will be set to true. If the operation failed an error message will be set and the success will be set to false.
 +<code>
 +{
 +  "error": null,
 +  "success": true | false
 +}
 +</code>
 + 
wiki/software/beuthbot/database.1591874743.txt.gz · Zuletzt geändert: 11.06.2020 13:25 von Lukas Danckwerth