[Pharo-users] [ANN] DBPedia: Query Wikipedia from Pharo

Hernán Morales Durand hernan.morales at gmail.com
Sun Mar 2 13:43:45 EST 2014

I have uploaded a new configuration so you can query the english Wikipedia
dataset from Pharo 3 using SPARQL. Some examples follow:

1) Retrieve in JSON movies from the beautiful Julianne Moore:

| jsonResults |
jsonResults := DBPediaSearch new
        timeout: 5000;
        query: 'SELECT DISTINCT ?filmName WHERE {
  ?film foaf:name ?filmName .
  ?film dbpedia-owl:starring ?actress .
  ?actress foaf:name ?name.
  FILTER(contains(?name, "Julianne"))
  FILTER(contains(?name, "Moore"))

To actually get only the titles using NeoJSON:

((((NeoJSONReader fromString: jsonResults) at: #results) at: #bindings)
    collect: [ : entry | entry at: #filmName ]) collect: [ : movie | movie
at: #value ]

2) Retrieve in XML which genre plays those crazy Dream Theater guys  :

DBPediaSearch new
        timeout: 5000;
        query: 'SELECT DISTINCT ?genreLabel
    ?resource dbpprop:genre ?genre.
    ?resource rdfs:label "Dream Theater"@en.
    ?genre rdfs:label ?genreLabel
    FILTER (lang(?genreLabel)="en")
 LIMIT 100';

More examples are available in DBPediaSearch class side. You can install it
from the Configuration Browser.
 If you want to contribute, just ask me and you will be added as
Best regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20140302/89b642c9/attachment.html>

More information about the Pharo-users mailing list