Alexandre
so cool
Noa may be taking the idea of ROE (to manipulate queries) and creating a ROE for SPARQL should be investigated.
Is your student good.
I do not remember how roe is implemented.

Stef\
On 03 Mar 2014, at 01:22, Alexandre Bergel <alexandre.bergel@me.com> wrote:

I’ve just tried and it works pretty well! Impressive!

Below I describe a small example that fetches some data about the US Universities from DBPedia and visualize them using Roassal2. 

Pick a fresh 3.0 image.

First, you need to load Hernán work, Sven’s NeoJSON, and Roassal 2 (If you are using a Moose Image, there is no need to load Roassal2 since it is already in):
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Gofer it
  smalltalkhubUser: 'SvenVanCaekenberghe' project:  'Neo';
  package:  'ConfigurationOfNeoJSON';
  load.
((Smalltalk at: #ConfigurationOfNeoJSON) load).

Gofer it
  smalltalkhubUser: 'hernan' project: 'DBPedia';
  package: 'DBPedia';
  load.

Gofer it
  smalltalkhubUser: 'ObjectProfile' project:  'Roassal2';
  package:  'ConfigurationOfRoassal2';
  load.
((Smalltalk at: #ConfigurationOfRoassal2) loadBleedingEdge).

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Using Roassal2, I was able to render some data extracted from dbpedia:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| map locations rawData rawData2 rawData3 |
map := RTMapBuilder new.

map countries: #('UnitedStates' 'Canada' 'Mexico').
map color: Color veryVeryLightGray.

rawData := DBPediaSearch universitiesInUS.
rawData2 := ((NeoJSONReader fromString: rawData) at: #results) at: #bindings.
rawData3 := rawData2 select: [ :d | d keys includesAll: #('label' 'long' 'lat') ] thenCollect: [ :d | { (Float readFrom: ((d at: 'long') at: 'value')) . (Float readFrom: ((d at: 'lat') at: 'value')) . (d at: 'label' ) at: 'value' } ].


locations := rawData3.
locations do: [ :array |
map cities addCityNamed: array third location: array second @ array first ].
map cities shape size: 8; color: (Color blue alpha: 0.03).
map cities: (locations collect: #third).

map scale: 2.

map render.
map view openInWindowSized: 1000 @ 500.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

This is what you get:

<Screen Shot 2014-03-02 at 9.09.57 PM.png>

This is a small example. Naturally, adding popup for locations is trivial to add.

I have described this on our Facebook page:

Hernán, since SPARQL is a bit obscure, it would be great if you could add some more example, and also, how to parametrize the examples. For example, now we can get data for the US, how to modify your example to get them for France or Chile? 

Cheers,
Alexandre


On Mar 2, 2014, at 3:43 PM, Hernán Morales Durand <hernan.morales@gmail.com> wrote:

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 
        setJsonFormat;
        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"))
}';
        execute

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 
        setXmlFormat;
        setDebugOn;
        timeout: 5000;
        query: 'SELECT DISTINCT ?genreLabel
WHERE {
    ?resource dbpprop:genre ?genre.
    ?resource rdfs:label "Dream Theater"@en.
    ?genre rdfs:label ?genreLabel
    FILTER (lang(?genreLabel)="en")
}
 LIMIT 100';
        execute

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 contributor.
Best regards,

Hernán

_______________________________________________
Pharo-business mailing list
Pharo-business@lists.pharo.org
http://lists.pharo.org/mailman/listinfo/pharo-business_lists.pharo.org

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev