Add a new feature to Yioop for it to be able to include relationship type of wikipedia pages it is linked to
yashi2016-10-06 19:25
Adding a new regular expression to Yioop parser which enables it to read relationship type of wikipedia pages it is linked to and store it to database for future retrievels.
Steps to reproduce:
1. Go to Yioop developer homepage
2. Under Manage Groups, add a new group
3. Add pages to it and edit the pages to include new synatx for adding the type of relationship between pages
4. Check database for values in PAGE_RELATIONSHIP table
5. What Links here on each Wikipedia page also populates the relationship type name and not its ID.
Additional information:
I have added a new table PAGE_RELATIONSHIP for storing the relationship type and assigning a unique id to it.
CREATE TABLE PAGE_RELATIONSHIP( ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME VARCHAR(512), CONSTRAINT NAME UNIQUE(NAME));
Also, inserted a value (-1, Not Specified) into it.
yashi2016-10-07 10:07
Hello Professor,
Good Morning!
I am attaching the patch for Del-01 of CS 298.
Adding relationship type of the Wikipedia pages that are linked together by adding a new syntax to the parser enabling it to read z and processing this syntax. After processing, the type of relationship (x) and the text(z) should appear on the Wikipedia page and all these links and relationships should be stored into the database. The linked pages and type of relationship will be displayed on Wikipedia page under What Links Here section of the drop down.
Thank you.
Regards,
Yashi
yashi2016-10-20 15:40
Hello Professor,
Good Afternoon!
I have uploaded the revised patch for Del-01. Please review it and also kindly read 'Additional Information' section of this issue. Thank you.
Regards,
Yashi
administrator2016-10-20 15:52
Hi Yashi,
Thanks for the patch! Here are some minor things that should be revised:
(1) renderRelationshipPage has some commented out code in it that should be removed.
(2) For if statements "if(" should be "if (" and before the open brace should be ") {" not "){"
(3) A couple of your SQL queries are not all in upper case. There is a lower
case "as" for example in SELECT ID as RELATIONSHIP_ID
(4) Replace !isset($page_id) || !$page_id with empty($page_id)
(5) The method name PageHasRelationships should be pageHasRelationships
yashi2016-10-22 00:45
Hello Professor,
Uploaded a new version with all the changes made that you suggested. Please review.
Have a great weekend.
Regards,
Yashi
administrator2016-10-22 09:16
Hey Yashi,
Thanks for the new patch! I am going to probably apply it later today.
It still has some issues so take a look at the changes I make to your
code after I apply it. The main thing is I will add code to handle
database changes and upgrades. Other minor issues were that you had a
lot of lines longer than 80 characters. Sometimes you use NULL, other
times you use null. Finally, unless you are using a triple equal
comparison,
$data["RELATIONSHIPS"]==null
should be replaced with
!$data["RELATIONSHIPS"]
or
empty($data["RELATIONSHIPS"]).
Best,
Chris
administrator2016-10-22 10:16
One other minor thing, you tacked a=chris onto the patch. That notation I have been using on my commits is a holdover from when I used svn. a=chris means a commit done by chris that wasn't reviewed by anyone (self-approved). r=chris, would mean the reviewer of the commit was chris and it would be assumed someone else created the commit (you could find out who by doing svn log). So if you want to tack on that I reviewed your patch you should use r=chris. For git, you don't really need this suffixes on commits since if I review and signoff on your patch, there will be a log entry indicating that I was the reviewer.
Best,
Chris
administrator2016-10-22 15:14
Hey Yashi,
Can you explain what you were trying to do with the code:
if (preg_match('/http/', $extract) ||
preg_match('/.com/', $extract) ||
preg_match('/.org/',$extract)) {
It looks fragile.
Best,
Chris
yashi2016-10-22 15:31
Hello Professor,
Thank you for accepting the patch. I will take care of things that you suggested in future patches.
The part of the code mentioned above (present in fetchLinks method of WikiParser) has been created to remove the external links: removing all http, .org and .com links from the extracted links. We discussed this during the weekly meetings to remove all links containing these keywords.
Regards,
Yashi
administrator2016-10-27 10:25
Fixed in commits leading up to 9ef25ccd0. Thanks Yashi!
Adding a new regular expression to Yioop parser which enables it to read relationship type of wikipedia pages it is linked to and store it to database for future retrievels.
Steps to reproduce: 1. Go to Yioop developer homepage 2. Under Manage Groups, add a new group 3. Add pages to it and edit the pages to include new synatx for adding the type of relationship between pages 4. Check database for values in PAGE_RELATIONSHIP table 5. What Links here on each Wikipedia page also populates the relationship type name and not its ID.
Additional information: I have added a new table PAGE_RELATIONSHIP for storing the relationship type and assigning a unique id to it.
CREATE TABLE PAGE_RELATIONSHIP( ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME VARCHAR(512), CONSTRAINT NAME UNIQUE(NAME));
Also, inserted a value (-1, Not Specified) into it.
Hello Professor,
Good Morning! I am attaching the patch for Del-01 of CS 298. Adding relationship type of the Wikipedia pages that are linked together by adding a new syntax to the parser enabling it to read z and processing this syntax. After processing, the type of relationship (x) and the text(z) should appear on the Wikipedia page and all these links and relationships should be stored into the database. The linked pages and type of relationship will be displayed on Wikipedia page under What Links Here section of the drop down.
Thank you.
Regards, Yashi
Hello Professor,
Good Afternoon! I have uploaded the revised patch for Del-01. Please review it and also kindly read 'Additional Information' section of this issue. Thank you.
Regards, Yashi
Hi Yashi,
Thanks for the patch! Here are some minor things that should be revised:
(1) renderRelationshipPage has some commented out code in it that should be removed.
(2) For if statements "if(" should be "if (" and before the open brace should be ") {" not "){"
(3) A couple of your SQL queries are not all in upper case. There is a lower case "as" for example in SELECT ID as RELATIONSHIP_ID
(4) Replace !isset($page_id) || !$page_id with empty($page_id)
(5) The method name PageHasRelationships should be pageHasRelationships
Hello Professor,
Uploaded a new version with all the changes made that you suggested. Please review. Have a great weekend.
Regards, Yashi
Hey Yashi,
Thanks for the new patch! I am going to probably apply it later today. It still has some issues so take a look at the changes I make to your code after I apply it. The main thing is I will add code to handle database changes and upgrades. Other minor issues were that you had a lot of lines longer than 80 characters. Sometimes you use NULL, other times you use null. Finally, unless you are using a triple equal comparison, $data["RELATIONSHIPS"]==null should be replaced with !$data["RELATIONSHIPS"] or empty($data["RELATIONSHIPS"]).
Best, Chris
One other minor thing, you tacked a=chris onto the patch. That notation I have been using on my commits is a holdover from when I used svn. a=chris means a commit done by chris that wasn't reviewed by anyone (self-approved). r=chris, would mean the reviewer of the commit was chris and it would be assumed someone else created the commit (you could find out who by doing svn log). So if you want to tack on that I reviewed your patch you should use r=chris. For git, you don't really need this suffixes on commits since if I review and signoff on your patch, there will be a log entry indicating that I was the reviewer.
Best, Chris
Hey Yashi,
Can you explain what you were trying to do with the code:
if (preg_match('/http/', $extract) || preg_match('/.com/', $extract) || preg_match('/.org/',$extract)) {It looks fragile.
Best, Chris
Hello Professor,
Thank you for accepting the patch. I will take care of things that you suggested in future patches.
The part of the code mentioned above (present in fetchLinks method of WikiParser) has been created to remove the external links: removing all http, .org and .com links from the extracted links. We discussed this during the weekly meetings to remove all links containing these keywords.
Regards, Yashi
Fixed in commits leading up to 9ef25ccd0. Thanks Yashi!
Attachments:
Del1.patch
Del1version2.patch
Del01Version03.patch