Project

dbpedia

0.02
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Simple search for DBpedia resources. Optional support for sparql.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.5.5
 Project Readme

DBpedia Client for Ruby

Features

Installation

Simply add it to your Gemfile:

gem "dbpedia"
gem "sparql-client" # if you want to use sparql

Examples

Search by keyword and prefix (notice their different results)

# Default search is by keyword:
Dbpedia.search('Ham').collect(&:label)
Dbpedia.search('Ham', method: 'keyword').collect(&:label)
#=> ["West Ham United F.C.", "Ham", "West Ham", "East Ham", "Hamarkameratene"]

# To perform a prefix-search (which is usefull for autocompleter) pass `method`:
Dbpedia.search('Ham', method: 'prefix').collect(&:label)
#=> ["Hamburg", "Hampshire", "Hamlet (place)", "Hamlet", "Hamilton, Ontario"]

Fetch search details

results = Dbpedia.search('Hamburg')
puts results.first.label #=> "Hamburg"
puts results.first.categories.count #=> 15
puts results.first.categories.first.label #=> Populated places established in the 9th century"

Possible methods

[results] (SearchResult)
|-- label
|-- uri
|-- description
+-- [categories] (SearchResult::Category)
|   |-- label
|   |-- uri
+-- [classes] (SearchResult::Klass)
    |-- label
    |-- uri

SPARQL Queries

Marke sure you've installed sparql-client!

Dbpedia.sparql.select.whatever

Milestones

  • Implement find for known resources
  • Gemify

Specs

Run $ bundle exec rspec -c

Gloss

Copyright © 2013 Roman Ernst, released under CC BY-SA 3.0 license

.. without warranty of any kind!