-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
25 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,3 +102,8 @@ venv.bak/ | |
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# rasa | ||
models | ||
rasa.db | ||
tracker.db/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,16 +4,14 @@ | |
|
||
import grakn | ||
|
||
from constants import me | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class GraphDatabase: | ||
def __init__(self, uri: Text = "localhost:48555", keyspace: Text = "banking"): | ||
self.client = grakn.Grakn(uri=uri) | ||
self.keyspace = keyspace | ||
self.me = me | ||
self.me = "[email protected]" | ||
|
||
def _thing_to_dict(self, thing): | ||
""" | ||
|
@@ -81,18 +79,6 @@ def _execute_relation_query( | |
|
||
return relations | ||
|
||
@staticmethod | ||
def get_random_person(): | ||
""" | ||
Get a random person of the bank that represents 'me'. | ||
:return: a random person from the knowledge base | ||
""" | ||
|
||
graph = GraphDatabase() | ||
people = graph._execute_entity_query(f"match $x isa person; get;") | ||
return people[random.randint(0, len(people) - 1)] | ||
|
||
def _get_me_clause(self, entity_type: Text) -> Text: | ||
""" | ||
Construct the me clause. Needed to only list, for example, accounts that are | ||
|
@@ -107,9 +93,9 @@ def _get_me_clause(self, entity_type: Text) -> Text: | |
|
||
# do not add the me clause to a query asking for banks or people as they are | ||
# independent of the accounts related to me | ||
if self.me is not None and entity_type not in ["person", "bank"]: | ||
if entity_type not in ["person", "bank"]: | ||
clause = ( | ||
f"$person isa person, has email '{self.me['email']}';" | ||
f"$person isa person, has email '{self.me}';" | ||
f"$contract(customer: $person, offer: $account, provider: $bank) isa contract;" | ||
) | ||
return clause | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
rasa-sdk~=1.1 | ||
rasa~=1.1.4 | ||
rasa-sdk==1.1 | ||
rasa==1.1.4 | ||
grakn==1.4.2 |