Do I need a database configuration to use JWPL?

392 views Asked by At

I am trying to understand the Java Wikipedia Library API (JWPL).

To instanciate a Wikipedia object, I need a DatabaseConfiguration. See the code below.

// configure the database connection parameters
DatabaseConfiguration dbConfig = new DatabaseConfiguration();
dbConfig.setHost("SERVER_URL");
dbConfig.setDatabase("DATABASE");
dbConfig.setUser("USER");
dbConfig.setPassword("PASSWORD");
dbConfig.setLanguage(Language.german);

// Create the Wikipedia object
Wikipedia wiki = new Wikipedia(dbConfig);

What exactly is the DatabaseConfiguration and why do I need it? The Javadoc isn't clear about it.

What I need to do is to get the category of a word with the API, isn't it a way to use it like:

String category = wiki.getCathegory("word");

without database connexion?

2

There are 2 answers

0
blurfus On BEST ANSWER

From their documentation page (emphasis is mine)

JWPL is for you:

  • If you need structured access to Wikipedia in Java.

JWPL is not for you:

  • If you need to query live data. JWPL works on an optimized database, i.e. you are querying a static Wikipedia dump. This gives much better performance and lightens the load on the Wikipedia servers.

So the DB settings are to be provided by you.

This means you have to install your own Database server, insert all the dumped data given by Wikipedia and query your own database.

You would have to update your Database regularly if you need 'fresh' results.

If you need up-to-date (i.e. live) results, you would have to use a different tool.

0
TheMrSean On

JWPL doesn't provide you access to Wikipedia, it provides an API to the Wikipedia database. You need to download a dump of the database, as detailed here.

You will also need to be running some form of an SQL database that can handle a 4GB+ MyISAM tables, if you are planning on using an English dump. Details on that can be found here.