Need Data Modeling Help

95 views
Skip to first unread message

Kiheung Park

unread,
Mar 1, 2015, 10:07:26 PM3/1/15
to orient-...@googlegroups.com
Hi, 

I want to create a database in which can hold agent's information such as politician records. Firstly, I have created 'graph' based DB and named as "Agent_Database."

My goal is to prepare the DB Schema just like the diagram below,
Question 1. 
I am having trouble with embedded type property. Like on Agent class, there is a property called 'contact' that I want to use embedded structure contains address and phone number and etc. 
How can I create properties within the property? 

Question 2.
Just realized that document based database might be more appropriate for this application. Is there are way to copy DB to DB just like a RDBMS? or is there a way to rename the database name?

Question 3.
Is it possible to make clusters based on which group that politicians belong to? Should I ALTER the politician CLASS to ADDCLUSTER after inserting the records? Any suggestion?

I have already searched documents from orientDB, google group and udemy online course discussion board, but couldn't find any solution... 

Let me know if there are easy ways to do these?


Thank you.


PS: I am using Studio version : 2.0 and OrientDB version : 2.0.3

Colin

unread,
Mar 2, 2015, 11:36:46 AM3/2/15
to orient-...@googlegroups.com
Hello.

Question 1:
You'll just embed another document (or vertex) in the contact property.  Are you trying to do this from the Java API?

Question 2:
Once the original database is shutdown, you can just copy the database folder to a new name.  Even if you decide to use the 'document' approach, you don't need to do anything else.  The two mix easily together as well.

Question 3:
Sure.  You could create a cluster per politician classification.  What's the intended purpose?  Another idea is that you could create a base Politician class and then create specialty derived classes that extend Politician.  Each derived class will use its own cluster by default.

Hope that helps.

-Colin

Colin Leister

Orient Technologies

The Company behind OrientDB

Kiheung Park

unread,
Mar 2, 2015, 5:40:01 PM3/2/15
to orient-...@googlegroups.com
Hi Colin,

Question 1:
You'll just embed another document (or vertex) in the contact property.  Are you trying to do this from the Java API?
--> Yes or no. I was trying to modeling through studio. If Java API is the only way to create embedded like property, I guess I have to develop a program. Is there are way to do that in Web interface, like Studio?

Question 2:
Once the original database is shutdown, you can just copy the database folder to a new name.  Even if you decide to use the 'document' approach, you don't need to do anything else.  The two mix easily together as well.
--> Where can I find database folder (default location)? I am using Windows 7 by the way. And what do you mean by saying "two mix easily together?" When creating database from studio, I have to choose either document or graph database. Can I use both?

Question 3:
Sure.  You could create a cluster per politician classification.  What's the intended purpose?  Another idea is that you could create a base Politician class and then create specialty derived classes that extend Politician.  Each derived class will use its own cluster by default.
--> My intention was to keep politicians on group so I could query or search specific agent based on group name. For example, politician A was on both 18th and 19th national assembly member but politician B was only on 18th, then I would like to filter out politician B when I am doing analysis on 19th group only. Thanks for the help though. Really :)

Question 4: (NEW)
When creating a class within Studio, what is linked_type and linked_class? When do I use these for? Can you provide any examples of using those? 

Question 5: (NEW)
When creating class what is Alias for? Can you give example of making actual use of?

Thank you.

Best Regards, 

Kiheung 


--

---
You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orient-database/8Dd_C6nv_AQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luigi Dell'Aquila

unread,
Mar 3, 2015, 3:39:13 AM3/3/15
to orient-...@googlegroups.com
Hi Kiheung,

answers below:

2015-03-02 23:39 GMT+01:00 Kiheung Park <kihp...@gmail.com>:
Hi Colin,

Question 1:
You'll just embed another document (or vertex) in the contact property.  Are you trying to do this from the Java API?
--> Yes or no. I was trying to modeling through studio. If Java API is the only way to create embedded like property, I guess I have to develop a program. Is there are way to do that in Web interface, like Studio?


I hope I got the sense of your question.... you can create embedded documents using JSON

update #9:0 set foo = {"a":1, "b":"C"}

and modify them with dot notation

update #9:0 set foo.a = 2


 
Question 2:
Once the original database is shutdown, you can just copy the database folder to a new name.  Even if you decide to use the 'document' approach, you don't need to do anything else.  The two mix easily together as well.
--> Where can I find database folder (default location)? I am using Windows 7 by the way. And what do you mean by saying "two mix easily together?" When creating database from studio, I have to choose either document or graph database. Can I use both?


you can find the databases folder in the root OrientDB folder, the one where you installed to.
Graph and Document databases are identical, except for the presence of V and E classes in the graph database (if you have a document database, you can enable it to graph just with a  CREATE CLASS V and CREATE CLASS E)
 
Question 3:
Sure.  You could create a cluster per politician classification.  What's the intended purpose?  Another idea is that you could create a base Politician class and then create specialty derived classes that extend Politician.  Each derived class will use its own cluster by default.
--> My intention was to keep politicians on group so I could query or search specific agent based on group name. For example, politician A was on both 18th and 19th national assembly member but politician B was only on 18th, then I would like to filter out politician B when I am doing analysis on 19th group only. Thanks for the help though. Really :)

Question 4: (NEW)
When creating a class within Studio, what is linked_type and linked_class? When do I use these for? Can you provide any examples of using those? 

 
linked_type and linked_class specify add details about link types.
eg. if you declare a property as LINK, you can specify which is the class it links to (linked_class).
The same is for LINKLIST, LINKSET and LINKMAP
embedded_* type properties can contain complex objects (linked_class) or base types, like strings or numbers (linked_type)
 
Question 5: (NEW)
When creating class what is Alias for? Can you give example of making actual use of?


That's just another name for your class, that you can use in your queries. You can change a class alias with this syntax:

ALTER CLASS YourClassName SHORTNAME YourAlias

from that point on, the query

SELECT FROM YourClassName

will be the same as

SELECT FROM YourAlias


Regards

Luigi

 

--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages