## Resolved Graph Database with Valentina - QUESTION

1. Jurriaan Schulman
3. Thursday, August 11 2016, 06:38 AM
Hello,

I'm looking for a graph database to represent and store knowledge (like Cayley or Neo4j) which can be used with Xojo. Would it be possible to use Valentina for this kind of work, using records as nodes and binary links as edges?

Cheers,

Jurriaan
Comment
Responses (25)
============================

It seems you want that you can have
Company has customer some person
Person has customer some company

right?

And this not cover all variants I think. What about
- persons to person?
- company to company?

Yes, you are right. But I didn't want to make the example to complex.
Comment
1. more than a month ago
3. # 1
So far please forget about theory you have learn in Graph DB books.
Comment
1. more than a month ago
3. # 2
Well,

lets at first consider logic benhind of BinaryLinks.

You have two tables, and you create binary link between them using command, which want to see that tables:
CREATE BINARY LINK isCustomerOf ON TABLES ( Person, Company ) AS MANY TO ONE;

Order of tables in this command is very important.
Later you need send RecIDs for LINK command exactly in this order.
So if record John Doe has RecID = 8
and PAradigma Software has RecID = 4,
then
LINK RECORD 8 OF Person WITH RECORD 4 of Company [USING isCustomerOf]

ValentinaDB inside will create pair of values (4,8)

============================

It seems you want that you can have
Company has customer some person
Person has customer some company

right?

And this not cover all variants I think. What about
- persons to person?
- company to company?
Comment
1. more than a month ago
3. # 3
Hello Ruslan,

You know that in graph databases, the relationships between nodes can be directed or undirected. So when I query the database, I want to know if a link between two records is directed or not and what the direction of a relationship (link) is, i.e. what is the start (tail) and what is the end (head) of a relationship (= binary link).

For instance:
Table "Person", Record 1 = "John Doe"
Table "Company", Record 1 = "Paradigma Software"
Binary Link labeled "isCustomerOf" between record "John Doe" and record "Paradigma Software".

1) If John Doe is a customer of Paradigma Software, yet Paradigma Software is not a customer of John Doe, the link would be directed.
2) If Paradigma Software is a customer of John Doe, yet John Doe is not a customer of Paradigma Software, the link would also be directed.
3) But if Paradigma Software is a customer of John Doe and John Doe is also a customer of Paradigma Software, the link would be undirected.

So my question is:

How would I do this in Valentina?

I could maybe use the new VKeyValueForLink, so the binary link gets an attribute "isDirected" with a value true or false.

Now, when I query the database and the value of a key of VKeyValueForLink "isDirected" is true, how do I know the direction of the link? How do I know if record "John Doe" is a customer of "Paradigma Software" or the other way around?

Jurriaan
Comment
1. more than a month ago
3. # 4
Hi Jurriaan,

I have not catch question. Please make some example Table, fields, 2(?) records
Comment
1. more than a month ago
3. # 5
Hello Ruslan,

If I want to map a directed graph in Valentina, what would be the best way to store/retrieve which is the tail (record) and which is the head (record) of a binary link between two records?

Jurriaan
Comment
1. more than a month ago
3. # 6
Comment
1. more than a month ago
3. # 7
For now please use that private-private channel

Also we will try to setup BETA section for beta testers,
where we will be able discuss upcoming features.
I see Lynn already have create this category in this forum.
Comment
1. more than a month ago
3. # 8
Hello Ruslan,

Regards,

Jurriaan
Comment
1. more than a month ago
3. # 9
I have sent URL there
Comment
1. more than a month ago
3. # 10
Hello Ruslan,

yes, of course I would like to read the article.

Regards,

Jurriaan
Comment
1. more than a month ago
3. # 11
Hi Jurian,

We did good progress with KeyValue

Would you like read article in its current state?
Comment
1. more than a month ago
3. # 12
Hi Jurian,

1) yes

2) API is easy enough todo yourself.
SQL is important for client-server, when the whole query should run on server side

API is better for LOCAL or localhost dbs.

3) yes correct.
Well, if we discuss and you will show HOW this can be possible, yes we can implement that.

Btw, I not remember - you going have local db or client-server?

Note, that Valentina have stored procedures, some logic can be programmed there, and become part of db schema.
Comment
1. more than a month ago
3. # 13
Hello Ruslan,

after reading the documentation, I have a few questions.

1) is it correct that if I want to do a hierarchical query with Valentina that this is only possible when the linked objects are of the same class (table)?

2) is it correct that I must use SQL for hierarchical queries (there are no API methods for this)?

3) is it correct that when I want to do a Hierarchical query on linked objetcs of different classes (link between tables), I have to implement this myself in the application code? Would it be possible to add methods for this in a future release of Valentina?

Cheers,

Jurriaan
Comment
1. more than a month ago
3. # 14
KeyValue should not be hard, so I can hope about 2 months...

than more, that here we not going invent something own,
we can just copy ideas of e.g. LevelDB.
Comment
1. more than a month ago
3. # 15

Perfect question

Frankly saying I did not think so deeply yet.
In ideal we'd need to have some integration of this "thing" to others.

ANSWER: KeyValue storage can keep, as known, normal table with horizontal rows. So if we define some part of key as RecID, then we can use that in links.

b) VARIANT - column type.

c) Inheritance

others ...

Just each such feature requires a lots of job and challenge
Comment
1. more than a month ago
3. # 16
Hi Ruslan,

thank you for your explanations, they were vere helpful. I think, Valentina is the right database for the projects I have in mind.

The KeyValue feature you mentioned sounds interesting. Are you thinking about KeyValue as "objects" which can be linked with binary links? If you decide to implement this feature, how long would it take before we can use it in Valentina? Months, years?

Cheers,

Jurriaan
Comment
1. more than a month ago
3. # 17

I think it is obvious that not LevelDB, not MongoDB have this feature.
So they have implement it in some artificial way

The same step must be done in your case over relational Tables + Links.
Comment
1. more than a month ago
3. # 18
I don't know if Valentina has optimzed algorithms to traverse such a graph and about the performance when using many records (objects) with many links to many other objects.

Well, I think our BINARY LINKS, and our feature todo Recursive Searches on any levels down, up, side, are so powerful, that not doubts here

Our BinaryLinks work faster than Relational ULONG - ULONG link based on PK-FK
Right?

And I always was and I am skeptical to KeyValue Storage as UNIVERSAL storage, to keep complex structures.

And I always was and I am skeptical to MongoDB, which keep data in TEXTUAL format of JSON. This can be faster of direct pointers?

Mongo have some win for special tasks, when one user have data, separate from data of other user. So they can scale to hardware. But excuse me, such scale you perfectly and easy can do with RDBMS (postgreSQL, mySQL, MS SQL, VDB).

Format of some file, such as JSON or XML, cannot be base of DB. Remember in about 2000 year how many noise was about XML-based databases, and how they will kill relational. Three times HA HA HA Where XML dbs today?

I think the same story expects the "JSON-boom".

Relational DBs will add COLOMN of JSON type, as some did with XML type, and that is enough.

XML/JSON - are text formats, perfectly can be used for exchange of data
BETWEEN DBs, DB and user, ...
Comment
1. more than a month ago
3. # 19
Yes, I already have understood what you want.

1) Valentina DB is not positions as "graph db", but IMO this definitions are quite conditional.
Lets look on Cayley

Cayley is a spiritual successor to graphd; it shares a similar query strategy for speed. While not an exact replica of it’s predecessor, it brings it’s own features to the table:
• RESTful API
• Multiple (modular) backend stores, such as LevelDB and MongoDB
• Multiple (modular) query languages

LevelDB -- is pure KeyValue storage.
MongoDB - is JSON-format oriented db

OVER this they claim they have build graph-db. Well, okay

2) again, Valentina DB current positioned as Object-Relational.

Can you use it to simulate graphDB? I think yes. Why not.

Just they have spend time to build tools (e.g. QueryLanguage) to look as general-use-db-tool.

You need develop I guess some App/Solution.
You can just use Valentina Model and power.

3) btw, just in last days we thinking about adding into Valentina DB - pure KeyValue feature.
Why not, may be somebody will find it is useful to have in the same DB as normal Tables, so one or few Key-Value things to keep there something.

Comment
1. more than a month ago
3. # 20
• Page :
• 1
• 2

There are no replies made for this post yet.
However, you are not allowed to reply to this post.

## Categories

Announcements & News
1. 0 subcategories
Valentina Studio
1. 2 subcategories
Valentina Server
1. 4 subcategories