Skip to content

Commit

Permalink
Merge the speed improvements to the main branch (#122)
Browse files Browse the repository at this point in the history
* more documentation

* changed lock usage and yield behavior

* Sligth changes to get more speed

* more functions documented

* try to remove the conflict closing the input
channel during transaction single request

* removed a typo

* more changes

* Simplified getting and processing data from
channels.

* speedup completed

* investigation of some fault using in multi
processing

* changed some minor issues

* Added more documentation and changed some
minor glitches.

* enhanced the change log

* small layout tweak in change log

* up

* Some changes to fullfill all BDD test

* changed the close method when a query fails

* Corrected the Version of the Documenter

* Problems solved in BDD tests

* little changes

* Changed type declaration ::String to
::AbstractString
Divided working through the BDD tests in smaller parts

* added the relation_type test in runner.jl
deleted some unnessecary code inside
preparing the environment.

* thing_type as test added

* added tests for database, session and transaction

* next attempt to go green

* Normal runner trial

* Next attempt to go green

* minor change in steps.jl definition

* minor change in close of Bidirectional Stream

* Merge branch 'main' of https://github.com/Humans-of-Julia/TypeDBClient.jl

* worked trough the review of Tom

* changed the date in documentation to
iso format.

* debug the only failing function so far

* First part of changes from comments

* changed documentation and some functions

* little Change to trigger the documentation

* Next round of improvements suggested by Scott

* remove a little typo and changed some forgotten
places regarding RemoteConcept

* Next Changes according Scott advices.

Co-authored-by: = <=>
Co-authored-by: Scott P. Jones <[email protected]>
  • Loading branch information
FrankUrbach and ScottPJones authored Oct 20, 2021
1 parent 941eb87 commit 5b7d8cf
Show file tree
Hide file tree
Showing 48 changed files with 651 additions and 368 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ docs/src/.DS_Store
docs/src/assets/.DS_Store
.DS_Store

map.mm.md

3 changes: 3 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
TypeDBClient = "7ffdda62-db04-4838-9798-febd00f3125c"

[compat]
Documenter = "0.27.0"
8 changes: 4 additions & 4 deletions docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ CurrentModule = TypeDBClient

## lets list em here
***
03.10.2021
2021-10-03

- more work on docs
- release preparations

***
27.09.2021
2021-09-27

- changed the client to use threading where it is suitable
- extended the docs

***
25.06.2021
2021-06-25

- updated docs
- trigger CI

***
08.11.2020
2020-11-08

- created project logo
- set up initial docs and guidelines
6 changes: 3 additions & 3 deletions docs/src/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ There is the [Workbase] (https://docs.vaticle.com/docs/workbase/overview) the [T

There are clients for the following languages: Java, Node.js and Python.

This is the new community driven Julia client.
This is the community driven Julia client.

## Workflow guidance & roadmap

Our reference client is the [Java version](https://docs.vaticle.com/docs/client-api/java).

The roadmap for TypeDBClient.jl (01.10.2021):
The roadmap for TypeDBClient.jl (2021-10-01):

- completing the client with the cluster functionality (commercial product by Vaticle)
- improving speed
- improving speed
- making multithreading possible and threadsafe

The roadmap for TypeDBClient.jl (24.01.2021):
Expand Down
2 changes: 1 addition & 1 deletion docs/src/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

For a quick example based introduction, you can refer to the folder examples and check out the files there.

However, if you like to watch a Video, showing how to work with the client in a Notebook, you can watch this recording:
However, if you would like to watch a video, showing how to work with the client in a Notebook, you can watch this recording:

[A TypeDB Client Interface in Julia | TypeDBClient.jl](https://youtu.be/liNnm1nShCg?t=1262)

Expand Down
123 changes: 65 additions & 58 deletions docs/src/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,31 @@ Inside the Julia REPL, type ] to enter the Pkg REPL mode then run

## Quickstart

First make sure, the TypeDB server is running.
First make sure the TypeDB server is running.
See [Start the TypeDB Server](https://docs.vaticle.com/docs/running-typedb/install-and-run#start-the-typedb-server) section.

In the Julia REPL or in your source code run:
In the Julia REPL or in your source code:

`using TypeDBClient`

You have two choices:

* If you are only interested in working interactivly, you can use the more simplified API. An example for this is:
* If you are only interested in working interactively, you can use the more simplified API. An example for this is:
```julia
using TypeDBClient: dbconnect, open, read, write, match, insert, commit, create_database

# Connecting the client to TypeDB
dbconnect("127.0.0.1") do client

# Creation of a database
# Create a database
create_database(client, "my-typedb")
# Opening the session
# Opening a session
open(client, "my-typedb") do session
# Open a write transaction
write(session) do transaction
# Make a insert with a TypeQL string
# Insert a record using TypeQL
insert(transaction, raw"insert $_ isa person;")
# Committing the transaction.
# Commit the transaction
commit(transaction)
end
# Open a read session
Expand All @@ -63,28 +63,32 @@ For working with data using TypeQL, please refer to the syntax on [TypeQL Docume
```julia
using TypeDBClient

# Only for convencience reasons, you can write the full name if you want
# Only for convenience reasons, you can write the full name if you want
g = TypeDBClient

# Create a client
client = g.CoreClient("127.0.0.1",1729)

# Create a database called typedb if the database isn't already created by you previously.
# Create a database called typedb if the database wasn't already created by you previously.
g.create_database(client, "typedb")

#= Open a session to write in the schema section of the database.
Be careful if you work with a schema session. No more sessions are allowed
until you close this session. Closing a session is mandatory. Don't forget this
at the end of your work.=#
#=
Open a session to write in the schema section of the database.
Be careful if you work with a schema session. No more sessions are allowed
until you close this session. Closing a session is mandatory. Don't forget this
at the end of your work.
=#
session = g.CoreSession(client, "typedb" , g.Proto.Session_Type.SCHEMA, request_timeout=Inf)

# Open a write transaction
transaction = g.transaction(session, g.Proto.Transaction_Type.WRITE)

#= Make a query in the database
The result of this query will be a vector of ConceptMap.
From there you can access the data as you want.=#
results = g.match(transaction, raw"""match $x sub thing;""")
#=
Make a query in the database
The result of this query will be a vector of ConceptMap.
From there you can access the data as you want.
=#
results = g.match(transaction, "match \$x sub thing;")

# If you want to work further in the session, go ahead, else close the session.
close(session)
Expand All @@ -102,36 +106,39 @@ Modules = [TypeDBClient]
* delete

There are some delete functions:

* database

[`delete_database(client::CoreClient, database_name::String)`](@ref)
[`delete_database(client::AbstractCoreClient, name::AbstractString)`](@ref)

* type

[`delete(r::RemoteConcept{C,T}) where {C <:AbstractThingType, T <: AbstractCoreTransaction}`](@ref)
[`unset_has(transaction::AbstractCoreTransaction, thing::AbstractThing, attribute::Attribute)`](@ref)

Any type can be deleted with this function. Be aware that only types which have no instances
in the database can be deleted.


* get_has

[`get_owns(r::RemoteConcept{C,T}, value_type::Optional{EnumType}=nothing,keys_only::Bool=false) where {C <: AbstractThingType,T <: AbstractCoreTransaction}`](@ref)
[`get_has(transaction::AbstractCoreTransaction,
thing::AbstractThing,
attribute_type::Optional{AttributeType} = nothing,
attribute_types::Optional{Vector{<:AbstractAttributeType}} = nothing,
keys_only = false)`](@ref)


* get_instances

[`get_instances(r::RemoteConcept{C,T}) where
{C <: AbstractThingType,T <: AbstractCoreTransaction}`](@ref)
[`get_instances(r::RemoteConcept{<:AbstractThingType})`](@ref)

* get_owns

[`get_owns(
r::RemoteConcept{C,T},
r::RemoteConcept{<:AbstractThingType},
value_type::Optional{EnumType}=nothing,
keys_only::Bool=false
) where {C <: AbstractThingType,T <: AbstractCoreTransaction}`](@ref)

)`](@ref)

* get_owners

Expand All @@ -143,25 +150,22 @@ Modules = [TypeDBClient]

* AttributeType

[`get_owners(r::RemoteConcept{C,T}, only_key = false) where {
C <: AbstractAttributeType, T <: AbstractCoreTransaction}`](@ref)
[`get_owners(r::RemoteConcept{<: AbstractAttributeType}, only_key = false)`](@ref)


* get_plays

[`get_plays(r::RemoteConcept{C,T}) where
{C <: AbstractThingType,T <: AbstractCoreTransaction}`](@ref)
[`get_plays(r::RemoteConcept{<: AbstractThingType})`](@ref)


* get_regex

[`get_regex(r::RemoteConcept{C,T}) where {
C <: AbstractAttributeType, T <: AbstractCoreTransaction}`](@ref)
* get_regex

[`get_regex(r::RemoteConcept{<:AbstractAttributeType})`](@ref)

* get_rule

[`get_rule(log_mgr::AbstractLogicManager, label::String)`](@ref)
[`get_rule(log_mgr::AbstractLogicManager, label::AbstractString)`](@ref)


* get_rules
Expand All @@ -171,65 +175,68 @@ Modules = [TypeDBClient]

* get_subtypes

[`get_subtypes(r::RemoteConcept{C,T}) where
{C <: AbstractType,T <: AbstractCoreTransaction}`](@ref)
[`get_subtypes(r::RemoteConcept{<:AbstractType})`](@ref)


* get_supertype

[`get_supertype(
r::RemoteConcept{C,T}) where {C <: AbstractType,T <: AbstractCoreTransaction}`](@ref)
[`get_supertype(r::RemoteConcept{<:AbstractType})`](@ref)


* get_supertypes

[`get_supertypes(r::RemoteConcept{C,T}) where
{C <: AbstractType,T <: AbstractCoreTransaction}`](@ref)
[` get_supertypes(r::RemoteConcept{<:AbstractType})`](@ref)


* set_abstract

[`set_abstract(r::RemoteConcept{C,T}) where
{C <: AbstractThingType,T <: AbstractCoreTransaction}`](@ref)
[`set_abstract(r::RemoteConcept{<:AbstractThingType})`](@ref)

* set_has

[`set_has(transaction::AbstractCoreTransaction, thing::AbstractThing, attribute::Attribute)`](@ref)


* set_label

[`set_label(r::RemoteConcept{C,T}, new_label_name::String) where
{C <: AbstractType,T <: AbstractCoreTransaction}`](@ref)
[`set_label(r::RemoteConcept{<:AbstractType},
new_label_name::AbstractString)`](@ref)

* set_owns

[`set_owns(
r::RemoteConcept{C,T},
attribute_type::AbstractType,
is_key::Bool=false,
overriden_type::Optional{AbstractType}=nothing
) where {C <: AbstractType,T <: AbstractCoreTransaction}`](@ref)
r::RemoteConcept{<:AbstractType},
attribute_type::AbstractType,
is_key::Bool=false,
overriden_type::Optional{AbstractType}=nothing
)`](@ref)


* set_plays

[`function set_plays(
r::RemoteConcept{C,T},
[`set_plays(
r::RemoteConcept{<:AbstractThingType},
role_type::AbstractRoleType,
overridden_role_type::Optional{AbstractRoleType}=nothing
) where {C <: AbstractThingType,T <: AbstractCoreTransaction}`](@ref)
)`](@ref)


* set_regex

[``set_regex(r::RemoteConcept{C,T}, regex::Optional{AbstractString}) where {
C <: AbstractAttributeType, T <: AbstractCoreTransaction}](@ref)
[`set_regex(r::RemoteConcept{<:AbstractAttributeType},
regex::Optional{AbstractString})`](@ref)


* set_supertype

[`set_supertype(r::RemoteConcept{C,T},
super_type::AbstractThingType) where
{C <: AbstractThingType,T <: AbstractCoreTransaction}`](@ref)
[`set_supertype(r::RemoteConcept{<: AbstractThingType,<: AbstractCoreTransaction},
super_type::AbstractThingType)`](@ref)


* unset_abstract

[`unset_abstract(r::RemoteConcept{C,T}) where
{C <: AbstractThingType,T <: AbstractCoreTransaction}`](@ref)
[`unset_abstract(r::RemoteConcept{<:AbstractThingType})`](@ref)


* unset_has

Expand Down
2 changes: 1 addition & 1 deletion src/common/exception/TypeDBClientException.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function TypeDBClientException(err::gRPCServiceCallException, parameters...)
return TypeDBClientException(def_err, isempty(parameters) ? Tuple{}() : parameters, nothing, nothing)
end

function TypeDBClientException(message::String, cause::T) where {T<:Exception}
function TypeDBClientException(message::AbstractString, cause::Exception)
err = _build_error_messages(GENERAL_UNKOWN_ERROR)
return TypeDBClientException(err,nothing,message,cause)
end
Loading

0 comments on commit 5b7d8cf

Please sign in to comment.