shadybones / hypergraphdb

Automatically exported from code.google.com/p/hypergraphdb
0 stars 0 forks source link

Creating a graph based on existing API #69

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello 

Could you help me with this please

I want to know how to store the Links with relationships in the new hypergraph 
based on the existing API of wordnet

you provide this example in the wiki pages:

HyperGraph graph = HGEnvironment("c:/temp/test_hgdb");
  Book mybook = new Book("Critique of Pure Reason", "E. Kant");  
  HGHandle bookHandle = graph.add(mybook);
  HGHandle priceHandle = graph.add(9.95);
  HGValueLink link = new HGValueLink("book_price", bookHandle, priceHandle);

I tried to add the link to the graph but after I traverse the graph I couldn't 
get the same result if I traverse the original one.

graph.add(link);

Could you help please?

Thank you

Original issue reported on code.google.com by copy4e...@gmail.com on 5 Dec 2011 at 4:59

GoogleCodeExporter commented 9 years ago
I'm not sure I understand the question. How do you traverse the graph? What is 
the "original one" vs. the "non-original one"?

Original comment by borislav...@gmail.com on 5 Dec 2011 at 3:35

GoogleCodeExporter commented 9 years ago
sorry for miss-explaining my question 

I mean by the original graph is the wordnet hypergraph

and the non-original or the new graph is the graph i create which would be like 
subset of the wordnet hypergraph.

the problem for me is how to store links with relations in a proper way because 
when I add them to  my new graph using the code you provide in the wiki page 

HyperGraph graph = HGEnvironment("c:/temp/test_hgdb");
  Book mybook = new Book("Critique of Pure Reason", "E. Kant");  
  HGHandle bookHandle = graph.add(mybook);
  HGHandle priceHandle = graph.add(9.95);
  HGValueLink link = new HGValueLink("book_price", bookHandle, priceHandle);
  graph.add(link);

I tried to traverse the wordnet graph for spisific word using depthFirstSearch 
you provide in the wiki pages also and I get a list of result then I tried to 
traverse the new graph with the same word using the same depthFirstSearch 
algorithm I got different result than the one with the wordnet.

so could you help me to know how to store the links with relations in a proper 
way so I can traverse it and get same result of wordnet. 

Thank you for your help I really appreciated. 

Original comment by copy4e...@gmail.com on 6 Dec 2011 at 4:43

GoogleCodeExporter commented 9 years ago
Well, what you're doing in terms of storage looks right. I'll probably need to 
see you traversal code. Keep in mind that each atom in HGDB is typed. So when 
you query or traverse, you generally specify the types of links you're 
interested in. With this book example, the type of the link is actually 
java.lang.String and the value is "book_price". With wordnet links, in general 
only the type matters as no value is really stored (except glosses for synsets 
if I remember correctly.). So when you traverse, make sure you configure your 
adjacency list generator correctly and it should work. You can always debug by 
doing the traversal manually - graph.getIncidenceSet(currentAtom) etc...

Original comment by borislav...@gmail.com on 9 Dec 2011 at 4:02

GoogleCodeExporter commented 9 years ago
Thank You for your help, I was trying to store the links with the values thats 
why I didn't get the same result
I think I miss understand how the wordnet is stored in the hypergraph thats why 
I am confused.

sorry for asking too many requests from you but do you have any reference on 
how the data of wordnet is stored in the hypergraph so I can understand it.

Thank you for your support I really appreciated. 

Original comment by copy4e...@gmail.com on 11 Dec 2011 at 6:40

GoogleCodeExporter commented 9 years ago
Well, there's the overview which you have probably seen: 
http://hypergraphdb.org/learn?page=WordNet&project=hypergraphdb. Otherwise, the 
code is as always the best reference :)

Original comment by borislav...@gmail.com on 11 Dec 2011 at 10:25

GoogleCodeExporter commented 9 years ago
Well, there's the overview which you have probably seen: 
http://hypergraphdb.org/learn?page=WordNet&project=hypergraphdb. Otherwise, the 
code is as always the best reference :)

Original comment by borislav...@gmail.com on 11 Dec 2011 at 10:25

shark132 commented 7 years ago

Hello, everyone! These days I'm working on a wordnet editor. This is a project which is going to become the basis of my graduational work.

I have to use HypergrahDB, Wordnet and JafaFX. I'm quite new to this field of study and honestly there's not much info on the web. The main example of how to connect HypergraphDB and Wordnet is the usage of HGWordnetLoader.

I suppose that after wordnet was loaded into hypergraph we can only work with that graph. We also can use some classes like "WNGraph, WnStats,SemTool".. But there is not many method that can be really helpful.

The only thing I could do is to get Noun,Verb, Adj and Adverb sences of a given word. That is all.. I am trying to get isAroot of a word using "getIsaRoot" from WnGraph class but it returns back the same HGHandle. Example: HGHandle wordHandle = wnGraph.findWord("dog"); HGHandle handle = wnGraph.getIsaRoot(wordHandle);

handle and wordHandle are equal..I don't understand why.. There are also some other methods similiar to the above one. For example: public HGHandle getNounIsaRoot() { HGHandle wh = hg.findOne(graph, hg.and(hg.type(Word.class), hg.eq("lemma", "entity"))); return hg.findOne(graph, hg.and(hg.type(NounSynsetLink.class), hg.incident(wh))); }

How is is suppose to work? It takes no argument...It's developped to return the first meaning of the word" entity". I tried to copy this code and use another word instead of "entity". the result is the same: the first meaning of a given word.. I thought that the method should return an ancestor.. for example: dog - animal, boy - human etc...

I have no idea how to find synonyms, antonyms,hypernyms etc... Could you please help me in any way.