Archive

Posts Tagged ‘drupal’

Politicans per capita in EU member states

December 8, 2010 3 comments

I was looking for an interesting query to use as the basis for a quick SPARQL in Drupal7 page, and given Ireland’s “austerity” (aka hairshirt) budget yesterday and our glorious IMF bailout,  I was minded to create a query ranking number of members of houses of legislature in each country against population.

The query took a long time because its very difficult to ascertain the field names from the dbpedia infobox fields, the dbpedia properties and ontology, and the variations in field usage per country, the apparent disconnect (for a human) between a topic and what might be exected as property. I for instance was expecting to be able see a reference to the house of parliament on each country’s page, but its in fact a little more organised than that 🙂

In the end the easiest way to do this is to open up the SPARQL endpoint [1], for example a wiki page about a country, then find an URI for a dbpedia resource for a country. I ended up using the Czech Republic URI [2].

After much tooing-and-froing the query I came up with the query below. Strangely, some countries have recorded populations that this query doesnt find (eg Germany – simplify the query and take a look).  It’s a bit rough around the edges but the evidence is clear [1] : Ireland is over-represented in legislature.

  • Anyone have any opinions why Ireland is over-represented ?
  • Is the situation similar at local level ?
  • Why doe the query not pick up dbpprop:populationEstimate for Germany ?
SELECT ?s ?t ?estPop ?estPopYear ?cenPop ?cenPopYear ?house ?n (?estPop/?n) as ?estPerCapita (?cenPop/?n) as ?cenPerCapita
WHERE { 
?s ?p <http://dbpedia.org/resource/Category:European_Union_member_states> .
?t skos:subject ?s .
?t rdf:type dbpedia-owl:Country .

optional{
?b skos:broader ?s .
?house skos:subject ?b .
?house dbpedia-owl:numberOfMembers ?n .

?t dbpprop:populationEstimate ?estPop .
?t dbpprop:populationCensus ?cenPop .
?t dbpprop:populationEstimateYear ?estPopYear .
?t dbpprop:populationCensusYear ?cenPopYear .
}

}
order by ?t

[1] http://dbpedia.org/sparql

[2] http://dbpedia.org/resource/Czech_Republic

[3] http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&should-sponge=soft&query=SELECT+%3Fs+%3Ft+%3FestPop+%3FestPopYear+%3FcenPop+%3FcenPopYear+%3Fhouse+%3Fn+%28%3FestPop%2F%3Fn%29+as+%3FestPerCapita+%28%3FcenPop%2F%3Fn%29+as+%3FcenPerCapitaWHERE+{+%0D%0A%3Fs+%3Fp+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FCategory%3AEuropean_Union_member_states%3E+.%0D%0A%3Ft+skos%3Asubject+%3Fs+.%0D%0A%3Ft+rdf%3Atype+dbpedia-owl%3ACountry+.%0D%0A%0D%0Aoptional{%0D%0A%3Fb+skos%3Abroader+%3Fs+.%0D%0A%3Fhouse+skos%3Asubject+%3Fb+.%0D%0A%3Fhouse+dbpedia-owl%3AnumberOfMembers+%3Fn+.%0D%0A%0D%0A%3Ft+dbpprop%3ApopulationEstimate+%3FestPop+.%0D%0A%3Ft+dbpprop%3ApopulationCensus+%3FcenPop+.%0D%0A%3Ft+dbpprop%3ApopulationEstimateYear+%3FestPopYear+.%0D%0A%3Ft+dbpprop%3ApopulationCensusYear+%3FcenPopYear+.%0D%0A}%0D%0A%0D%0A}%0D%0Aorder+by+%3Ft%0D%0A&debug=on&timeout=&format=text%2Fhtml&save=display&fname=fname=

Advertisements

Drupal 7 on Ubuntu 10.10 or 10.04 for SPARQL federation

October 28, 2010 3 comments

Quick steps to install Drupal 7

This, so you can use the SPARQL federating plugin

First install ubuntu ! 10.10 isnt much over 10.04, perhaps less even, so go with what you have v10-wise.

 

Now you need apache,mysql,php and drupal, database setup (ie LAMP + drupal). Then and a variety sparql modules and support.

In short

  1. Install LAMP
  2. Setup MySQL (or create a database for it)
  3. Download and Setup Drupal (or update/upgrade)
  4. Configure Drupal
  5. Add modules

In some more detail

  1. Install Lamp
  2. Install PHP gd – you’ll get errors about it during Drupal install otherwise
  3. Setup mysql with database called d7 and admin user drupal
    1. create database d7
    2. grant all privileges on d7 to drupal@localhost identified by ‘password’ -if you get into trouble install phpmyadmin
  4. download drupal7, expand and move the expanded dir into the docroot/cms (you may need sudo for all of this)
    1. gzip -dc drupal.*.*.tar.gz | tar -xvf -
    2. mkdir /var/www/cms
    3. cd drupal.*.*
    4. mv * /var/www/cms
    5. read the README about creating default site and perms
  5. take a breath
  6. restart apache for the hell of it - sudo /etc/init.d/apache2 restart
  7. go to http://127.0.0.1/cms and create the first site by following the steps
  8. reset perms as per readme on settings.php

now find the SPARQL plugin [1,2] that Lin at DERI created and get to work on content-types[3]……

I’ve left messages but haven’t had a response yet – Sparql Views as it is on GitHub Jan 2011 won’t install on the official Drupal7 release (drush doesnt like it either, it seems). But theres also VARQL[4], built on top of what Lin did, that might be good for you.

There are dependencies you should be prepared to install – Views (not unsurprisingly), Dialog [5], Chaos Tools Suite [6] (maybe  RDFx [7] – Sparql Views has it, needs it, but Drupal7 has some conflict either at install or runtime – needs more investigation).

And you’ll need to download and manually install, as ftp to localhost, using the UI installer won’t work (at least not for me on Ubuntu 10.04/10).  Relying on ftp is just a bad way of installing things IMO.

Update rather than Upgrade

FYI : I easily updated (not upgraded [9]) my Drupal7 Beta to official release byfollowing Yodi Aditya’s instructions [8]

 

 

[1] http://cph2010.drupal.org/sessions/using-rdf-semantic-web-modules

[2] http://drupal.org/project/sparql_views

[3] http://semantic-drupal.com/

[4] http://drupal.org/project/varql

[5] http://drupal.org/project/dialog

[6] http://drupal.org/project/ctools

[7] http://groups.drupal.org/node/59388

[8] http://yoodey.com/how-migration-upgrade-drupal-7-rc-drupal-7-final

[9] http://drupal.org/upgrade

 

FOAF ? Drupal ? WordPress ? RDFa ?

November 2, 2009 Comments off

Why cant I upload my foaf profile to wordpress ? Or can I ?

Will wordpress go the semantic way as Drupal7 is heading ?

Any modules for RDFa -ing the HTML in Drupal, without me having to manually crank it out, if I wanted to ?

Categories: semantic Tags: , , ,

Semantic Progress

October 31, 2009 Comments off

Getting closer. Integrated some fixed dbpedia lod links, now looking at rest of toplevel info in repository items for possible ontology matching and lod links. Will also need a static decorator for dc publish info, and perhaps foaf links to here.

Getty AAT thesaurus looks like the job for some of the other information yet to conceptize, but there are licensing costs. Need to consider some more.

Drupal7 looks interesting, esp for up-and-running publishing needs – might be quick way to build app on top of LewisT.  Shame (for me) its in PHP!

Got to get the hosting machine set up some more: damned intel i845 graphics chip causing all kinds if issues with package installation for me. I might need something more powerful as well. we’ll see.

  • not enough time in the day !
  • Drupal7 vs ?
  • Calendering, Todo, fix SCM
  • All things RDFized
  • dc into lewist
  • foaf into lewist
  • more geonames into lewist
  • publish and be damned !
  • Getty – AAT
  • domainnames to set up
  • machine setup
  • openVirtuoso, pubby, sesame ? jena repos with ARQ ?
  • HI2111 – elphin, dunraven, newspaper.