I am trying to get the list of Synonyms and Samples given the wordid. After a lot of trial and error I can get the samples for all the synsets but not the actual synonyms. Here is my query which gives me the following results.
select senses.wordid, senses.synsetid, senses.sensekey, synsets.definition FROM
senses
LEFT OUTER JOIN
synsetsON senses.synsetid = synsets.synsetid
where senses.wordid = 79459
I know you can get the synonyms by submiting the synsetid back to the senses table which gives you unique wordid and sensekey which you can then join with the words table. My problem is I can't seem to build that query.
I would like to get these columns if possible. If not synsetid, lemma and definition would do. The current database is mySql but I am hoping the answer would also be applicable to sqlite, since I am using this for an android APP.
wordid, lemma, senseid, synsetid, definition
schema:
CREATE TABLE `synsets` (
`synsetid` int(10) unsigned NOT NULL DEFAULT '0',
`pos` enum('n','v','a','r','s') NOT NULL,
`definition` mediumtext,
PRIMARY KEY (`synsetid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `words` (
`wordid` int(10) unsigned NOT NULL DEFAULT '0',
`lemma` varchar(80) NOT NULL,
`mantiq` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`wordid`),
UNIQUE KEY `unq_words_lemma` (`lemma`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `senses` (
`wordid` int(10) unsigned NOT NULL DEFAULT '0',
`synsetid` int(10) unsigned NOT NULL DEFAULT '0',
`senseid` int(10) unsigned DEFAULT NULL,
`sensekey` varchar(100) DEFAULT NULL,
PRIMARY KEY (`wordid`,`synsetid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `samples` (
`synsetid` int(10) unsigned NOT NULL DEFAULT '0',
`sampleid` smallint(5) unsigned NOT NULL DEFAULT '0',
`sample` mediumtext NOT NULL,
PRIMARY KEY (`synsetid`,`sampleid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Link to database: https://cloud.generatedesign.com/index.php/s/LA2G8ZvqNClqHFN