Skip to content
This repository has been archived by the owner on May 31, 2019. It is now read-only.

farbenmeer/dbpedia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

Releases

No releases published

Packages

No packages published

Languages