2014-03-02 21:22 GMT-03:00 Alexandre Bergel <alexandre.bergel(a)me.com>om>:
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:
This is a small example. Naturally, adding popup for locations is trivial
to add.
I have described this on our Facebook page:
https://www.facebook.com/ObjectProfile/photos/a.341189379300999.82969.34054…
Super cool!! Thanks for sharing the nice mapping.
Hernán, since SPARQL is a bit obscure,
Absolutely, SPARQL is like the Assembler of the web.
> 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?
Ok, uploaded an updated version. I have parametrized the query triplets as
#universitiesIn: englishCountryName,
DBPediaSearch universitiesIn: 'France'.
DBPediaSearch universitiesIn: 'Chile'.
I have to admit I am still learning SPARQL, but the more queries I execute,
the more I discover linked data structure, so I will add convenience
methods for easy parsing results.
Cheers,
Hernán