OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



[SOLVED] How to make a list of the article keywords?

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

[SOLVED] How to make a list of the article keywords?

Postby mbria » Mon Jan 25, 2010 9:21 am

Hi,

We are starting to build our "corpus of knowledge" to create our magazine thesaurus... so our magazine's editor asked me to list every keyword associated with each article.

I said: Yes, sure. No problem.

I thought I could easily build a SQL query to extract just this information, but there is a problem... I'm unable to understand the data structure of OJS database, at least how the keywords are stored in database and associated with every article.

I tried with:

SELECT * FROM `article_search_keyword_list` AS kl,
`article_search_object_keywords` AS ok
WHERE kl.keyword_id = ok.keyword_id AND ok.object_id = XXX

But I'm unsure about what keywords are shown with this.

Any clue about how to deal with this?

Cheers,

m.
Last edited by mbria on Wed Mar 03, 2010 4:35 am, edited 1 time in total.
mbria
 
Posts: 313
Joined: Wed Dec 14, 2005 4:15 am

Re: How to make a list of the article keywords?

Postby mcrider » Wed Feb 03, 2010 10:48 am

Hi Marc,

Try this:
Code: Select all
SELECT * FROM article_search_keyword_list AS kl,
article_search_object_keywords AS ok,
article_search_objects AS so
WHERE kl.keyword_id = ok.keyword_id AND so.object_id = ok.object_id AND so.article_id = 1


Change article_id to whatever article id you want--I leave it to you to find a way to iterate over all your articles, lest you do it by hand :)

Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: How to make a list of the article keywords?

Postby mbria » Wed Mar 03, 2010 4:01 am

Hi Matt,

I tried with your suggestion to count terms:

Code: Select all
SELECT kl.keyword_id, keyword_text, count( keyword_text )
FROM article_search_keyword_list AS kl, article_search_object_keywords AS ok, article_search_objects AS so
WHERE kl.keyword_id = ok.keyword_id
AND so.object_id = ok.object_id
GROUP BY keyword_text


But what I see from results is an index of every word used in articles... not the keywords published by authors/editors in the article's metadata.

Do I need to filter by "type"? for instance type = 16?

Thanks a lot for your help (again :-D),

m.
mbria
 
Posts: 313
Joined: Wed Dec 14, 2005 4:15 am

Re: How to make a list of the article keywords?

Postby mbria » Wed Mar 03, 2010 4:30 am

I answer myself. :-)

Looks like "type=16" rows are the metadata keywords (at least it fits well with the few articles I checked) so, to rise up the "corpus of knowledge" of your magazine:

Code: Select all
SELECT kl.keyword_id, keyword_text, count( keyword_text )
FROM article_search_keyword_list AS kl, article_search_object_keywords AS ok, article_search_objects AS so
WHERE kl.keyword_id = ok.keyword_id
AND so.object_id = ok.object_id
AND type = 16
GROUP BY keyword_text


If your magazine is multilang:

Code: Select all
SELECT kl.keyword_id, keyword_text, a.language, count( keyword_text )
FROM article_search_keyword_list AS kl, article_search_object_keywords AS ok, article_search_objects AS so, articles AS a
WHERE kl.keyword_id = ok.keyword_id
AND so.object_id = ok.object_id
AND a.article_id = so.article_id
AND type = 16
GROUP BY keyword_text


Cheers,

m.

PD: Please, Matt, et. al... correct me if I'm talking rubbish.
mbria
 
Posts: 313
Joined: Wed Dec 14, 2005 4:15 am

Re: [SOLVED] How to make a list of the article keywords?

Postby cristianviza » Wed Oct 09, 2013 3:24 pm

Hello . I need listing all keywords, for that I used this query :
SELECT keyword_text FROM article_search_keyword_list AS kl,
article_search_object_keywords AS ok,
article_search_objects AS so
WHERE kl.keyword_id = ok.keyword_id AND so.object_id = ok.object_id AND so.type = 16

Now i want put this query in the code ojs, so I created:

classes/palabras/PalabrasDAO.inc.php :
pages/palabras/index.php:
pages/palabras/IndexPalabrasHandler.inc.php :
/templates/palabras/palabras.tpl:

The code these files here: https://drive.google.com/folderview?id=0B_86aqj65IYPYmVRYU1mdjRjX2c&usp=sharing

the problem is when I uncommented this lines
Code: Select all
import('classes.palabras.PalabrasDAO.inc.php');   
$palabrasDao =& DAORegistry::getDAO('PalabrasDAO');
return $palabrasDao->getAllPalabras();

in pages/palabras/IndexPalabrasHandler.inc.php

error:
Fatal error: require_once(): Failed opening required 'classes/palabras/PalabrasDAO/inc/php.inc.php' (include_path='.:/var/www/ojs-2.3.7/classes:/var/www/ojs-2.3.7/pages:/var/www/ojs-2.3.7/lib/pkp:/var/www/ojs-2.3.7/lib/pkp/classes:/var/www/ojs-2.3.7/lib/pkp/pages:/var/www/ojs-2.3.7/lib/pkp/lib/adodb:/var/www/ojs-2.3.7/lib/pkp/lib/phputf8:/var/www/ojs-2.3.7/lib/pkp/lib/pqp/classes:/var/www/ojs-2.3.7/lib/pkp/lib/smarty:.:/usr/share/php:/usr/share/pear') in /var/www/ojs-2.3.7/lib/pkp/includes/functions.inc.php on line 30

There is an easier way to list all the keywords?
(so do not use this code does not work)

Regards Cristian
cristianviza
 
Posts: 75
Joined: Tue Nov 06, 2012 10:22 am
Location: Argentina

Re: [SOLVED] How to make a list of the article keywords?

Postby asmecher » Wed Oct 09, 2013 4:17 pm

Hi Cristian,

Import statements should not include the ".inc.php" part of the filename. Please try to avoid posting until you're really stuck -- this one was fairly obvious.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 9050
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 1 guest