My issue is the following:
I'm trying my hand at WordNet MySQL, trying to add another view aside from the ones already present, like:
CREATE OR REPLACE VIEW synsetsXsemlinksXsynsets AS
SELECT
linkid,s.synsetid AS ssynsetid
,s.definition AS sdefinition
,d.synsetid AS dsynsetid
,d.definition AS ddefinition
FROM synsets AS s
INNER JOIN
semlinks AS l ON s.synsetid = l.synset1id
INNER JOIN
synsets AS d ON l.synset2id = d.synsetid;
So taking that code as a reference I tried to do something like:
CREATE VIEW graph AS
SELECT
l.linkid
,s.synsetid AS sssinsetid
,w.lemma AS swlemma
,s.definition AS sdefinition
,d.synsetid AS dsynsetid
,w.lemma AS dwlemma
,d.definition AS ddefinition
FROM synsets AS s
INNER JOIN
semlinks AS l ON s.synsetid = l.synset1id
INNER JOIN
synsets AS d ON l.synset2id = d.synsetid
INNER JOIN
lexlinks AS x ON l.synset1id = x.synset1id
AND l.synset2id = x.synset2id
INNER JOIN
words AS w ON w.wordid = x.word1id
AND x.word2id = w.wordid
In order to get: linkid | ssynsetid | swlemma | sdefition| dsynsetid | dwlemma | ddefition
.
But it did not worked as expected. While the first gives me 285639 rows, mine just give me 12 rows. I'm not sure where is the problem. Any help?
EDIT:
What I expected to happen was that the statement will return the words in sslemma and their lemmas in dwlemma. So I was hopping I will get the words used and their lemma form also. Thanks.
Use LEFT JOIN for the 2 extra tables.
...
FROM synsets AS s
INNER JOIN
semlinks AS l ON s.synsetid = l.synset1id
INNER JOIN
synsets AS d ON l.synset2id = d.synsetid
LEFT JOIN
lexlinks AS x ON l.synset1id = x.synset1id
AND l.synset2id = x.synset2id
LEFT JOIN
words AS w ON w.wordid = x.word1id
AND x.word2id = w.wordid
Because if INNER JOIN is used then it would filter those that don't match.