Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ms/bdd concepts #90

Merged
merged 46 commits into from
Aug 22, 2021
Merged

Ms/bdd concepts #90

merged 46 commits into from
Aug 22, 2021

Conversation

FrankUrbach
Copy link
Collaborator

This is the PR for the fully implemented BDD tests. Some changes were needed to accomplish the goal. Hints, suggestions and questions are very appreciated.

= and others added 27 commits June 20, 2021 21:26
case something whent wrong by quering something
implemented relation_type_get_relates_for_role_label and the necessary
functions for this.
are worked through. The debugging is open.
graql part were deleted because they are not relevant
for now.
Copy link
Member

@tk3369 tk3369 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great PR! I don't have much to say about logic and BDDs and so I left some minor comments and formatting suggestions.

Project.toml Outdated
@@ -9,13 +9,19 @@ DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Pretend = "8ad1c615-040c-41b0-a18f-ae9e9fd09b5b"
ProtoBuf = "3349acd9-ac6a-5e09-bcdb-63829b23a429"
SnoopCompile = "aa65fe97-06da-5843-b5b1-d5d13cad87d2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is SnoopCompile needed here or in the global env?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. Only a relict from working on starting time.

@@ -1,7 +1,7 @@
using Pkg
using ProtoBuf

root_dir_java = "/Users/frank/Documents/JuliaProjects/JuliaSource/TypeDBClient/client-java"
# root_dir_java = "/Users/frank/Documents/JuliaProjects/JuliaSource/TypeDBClient/client-java"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just delete this line

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!


function _treq(; kwargs...)
return Proto.Transaction_Req(
concept_manager_req = Proto.ConceptManager_Req(; kwargs...)
)
end

function put_entity_type_req(label::String)
function put_entity_type_req(label::Optional{String})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we handle nothing then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. I think this was only a try to solve a problem. Changed back

Comment on lines 405 to 409
Proto.RelationType_SetRelates_Req(;
label = role_label,
overridden_label) :
Proto.RelationType_SetRelates_Req(;
label = role_label)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor formatting issue. Only a single indent from prior line is needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hope, I changed it right yet.

@@ -22,5 +22,5 @@ function Cluster_TypeDBStub(channel::gRPCClient.gRPCChannel)
end

function ensure_connected(stub::T) where {T<:AbstractTypeDBStub}
throw(TypeDBClientException(GENERAL_UNKOWN_ERROR,"function TypeDBStub.jl/ensure_onnected isn't implemented yet"))
throw(TypeDBClientException(GENERAL_UNKOWN_ERROR,"function TypeDBStub.jl/ensure_connected isn't implemented yet"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stack trace would have shown the file path anyways. I would just change the message string to Not implemented yet

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

req = SessionRequestBuilder.close_req(session.sessionID)
stub = session.client.core_stub.blockingStub
Proto.session_close(stub, gRPCController(), req )
if session_alive === true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if session_alive === true
if session_alive

@@ -58,13 +58,28 @@ end

function query(transaction::T, request::R, batch::Bool) where {T<:AbstractCoreTransaction, R<:Proto.ProtoType}
!is_open(transaction) && throw(TypeDBClientException(CLIENT_TRANSACTION_CLOSED))
result = single_request(transaction.bidirectional_stream, request, batch)
result = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not type stable. Same comment for stream function below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right and now it is changed.

@@ -78,6 +93,7 @@ function close(transaction::T)::Bool where {T<:AbstractCoreTransaction}
delete!(transaction.session, transaction.transaction_id)
catch ex
throw(TypeDBClientException("something went wrong closing Transaction", ex))
return false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line would never be reached since it throws right above...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@then("entity(person) get instances is empty") do context
attr = g.get(context[:cm], EntityType, "person")
res_ent = g.get_instances(g.as_remote(attr, context[:transaction]))
@expect isempty(res_ent) === true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the function clearly returns bool, there is no need to compare with true. Same comment for a few other cases below.

Suggested change
@expect isempty(res_ent) === true
@expect isempty(res_ent)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For today it isn't possible to formulate only a variable which contains a Bool in the expect section. A issue is filed and a PR to reach the goal is submitted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erik has merged the change what made it possible to fulfill your suggestion.

Comment on lines +130 to +134
try
set_has(context[:transaction], context[:a], context[:bob])
catch ex
@expect ex !== nothing
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you care about the type/cause of exception?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Here only the occurence of an exception counts.

@codecov
Copy link

codecov bot commented Aug 17, 2021

Codecov Report

Merging #90 (e05d464) into main (9bfb8c8) will increase coverage by 25.30%.
The diff coverage is 17.98%.

Impacted file tree graph

@@            Coverage Diff             @@
##            main      #90       +/-   ##
==========================================
+ Coverage   0.00%   25.30%   +25.30%     
==========================================
  Files         10       50       +40     
  Lines       5488     7611     +2123     
==========================================
+ Hits           0     1926     +1926     
- Misses      5488     5685      +197     
Impacted Files Coverage Δ
src/api/TypeDBOptions.jl 0.00% <0.00%> (ø)
src/common/exception/ErrorMessage.jl 0.00% <0.00%> (ø)
src/common/exception/TypeDBClientException.jl 0.00% <0.00%> (ø)
src/common/exception/gRPC_Result_Handling.jl 0.00% <0.00%> (ø)
src/common/rpc/TypeDBStub.jl 0.00% <0.00%> (ø)
src/concept/ConceptManager.jl 0.00% <0.00%> (ø)
src/concept/answer/ConceptMapGroup.jl 0.00% <0.00%> (ø)
src/concept/answer/NumericGroup.jl 0.00% <0.00%> (ø)
src/concept/thing/Attribute.jl 0.00% <0.00%> (ø)
src/concept/type/ThingType.jl 0.00% <0.00%> (ø)
... and 89 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 785ed0b...e05d464. Read the comment docs.

TypeDBClient V1 automation moved this from In progress to Reviewer approved Aug 22, 2021
Copy link
Member

@tk3369 tk3369 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor comments. OK to merge now if you wish.

@@ -8,9 +8,9 @@ CurrentModule = TypeDBClient

So, TypeDB itself provides various ways how to communicate (read from & write to) with the database.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
So, TypeDB itself provides various ways how to communicate (read from & write to) with the database.
So, TypeDB itself provides various ways how to communicate (read from & write to) the database.

Comment on lines 3 to 5
using ..TypeDBClient

g = TypeDBClient
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean... It seems ok to me? If not, you can at least make g a const.

julia> module Foo
           foo() = 1
           module Bar
               import ..Foo as g
               bar() = g.foo()
           end
       end
Main.Foo

julia> Foo.Bar.bar()
1

src/concept/type/RelationType.jl Show resolved Hide resolved
@tk3369
Copy link
Member

tk3369 commented Aug 22, 2021

Please squash when you merge to main branch. Thanks

@FrankUrbach FrankUrbach merged commit 8594b55 into main Aug 22, 2021
TypeDBClient V1 automation moved this from Reviewer approved to Done Aug 22, 2021
@FrankUrbach FrankUrbach deleted the ms/bdd-concepts branch August 22, 2021 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Implementation New implementation step
Projects
3 participants