Reality

Reality is a gem (in its early development stage) for easy and convenient recieving data on various real-life knowledge entities. It uses open data sources (only Wikipedia and DBPedia currently, but more of them planned) and makes data accessible to novices, experimentators and hobbyists.

Now, at earliest version possible, Reality provides access only to world countries data:

# One country
ar = Reality.country('Argentina')
ar.area # => #<Reality::Measure(2,780,400 km²)>
ar.capital # => Buenos Aires
ar.leaders['President'] # => Mauricio Macri

# List of countries:
countries = Reality.countries.to_a
# CAUTION tooks like ~2 min to load on modern Internet & CPU.

countries.
  select{|c| c.continent == 'Africa'}.
  reject{|c| !c.gdp || (c.gdp / c.population).amount > 5_000}.
  map(:area).inject(:+)
# => #<Reality::Measure(22,412,893 km²)>

# or, with loading from wikipedia only relevant countries:
Reality.countries.where(continent: 'Africa').
  reject{|c| !c.gdp || (c.gdp / c.population).amount > 5_000}.
  map(:area).inject(:+)

Rough examples of what the library is supposed to do eventually, can be seen at showcase draft.

Roadmap

  • [x] World countries: first example of Wikipedia -> easy data translation;
  • [x] Generic named measure concept and arithmetics;
  • [ ] Usage of Wikipedia as a query engine like "countries with population larger than", proxied via "List of countries by population");
  • [ ] More of related entities, starting from city, and interaction with countries (like "cities of this country" and more);
  • [ ] Generic entity concept;
  • [ ] Evaluation of usage of DBPedia as a query engine;
  • [ ] Wrappers for most common and most interesting data types (like people, famous places, music bands, movies, and so on) from Wikipedia;
  • [ ] Extending Reality sources to other open data sources, like OpenStreetMap, OpenWeatherMap, OpenExchange and so on;
  • [ ] Extending Reality calculations to real world time and space, like "calculate sunset at concrete date for concrete city and convert it to my timezone", or "calculate distance between those two places" and so on;
  • [ ] Integration with means of pretty output (like RMagick and IRuby Notebooks);
  • ....

Authors

Development sponsored by 2015 Ruby Association Grant.

Initial idea is inspired by "integrated data" of Wolfram Language.

License

MIT