-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael Aufreiter
committed
Mar 27, 2009
0 parents
commit 66eca6e
Showing
27 changed files
with
875 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
*.log | ||
log/* | ||
pkg/* | ||
doc | ||
cov | ||
pkg | ||
.DS_Store | ||
coverage.html | ||
coverage/* | ||
*.db | ||
\#* | ||
_Yardoc | ||
.yardoc | ||
tmp/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
=== 0.0.1 / not released | ||
|
||
* Birthday! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2009 Michael Aufreiter | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.gitignore | ||
History.txt | ||
LICENSE | ||
Manifest.txt | ||
README.txt | ||
Rakefile | ||
TODO | ||
dm-ambition.gemspec | ||
lib/dm-ambition.rb | ||
lib/dm-ambition/collection.rb | ||
lib/dm-ambition/model.rb | ||
lib/dm-ambition/query.rb | ||
lib/dm-ambition/query/filter_processor.rb | ||
lib/dm-ambition/version.rb | ||
spec/public/collection_spec.rb | ||
spec/public/model_spec.rb | ||
spec/public/shared/filter_shared_spec.rb | ||
spec/semipublic/query_spec.rb | ||
spec/spec.opts | ||
spec/spec_helper.rb | ||
tasks/hoe.rb | ||
tasks/install.rb | ||
tasks/spec.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This project has been renamed and moved to http://github.com/michael/ken/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
= Mql | ||
|
||
* http://www.github.com/michael/ken | ||
|
||
== DESCRIPTION: | ||
|
||
FIX (describe your package) | ||
|
||
== FEATURES/PROBLEMS: | ||
|
||
* FIX (list of features or problems) | ||
|
||
== SYNOPSIS: | ||
|
||
FIX (code sample of usage) | ||
|
||
== REQUIREMENTS: | ||
|
||
* FIX (list of requirements) | ||
|
||
== INSTALL: | ||
|
||
* FIX (sudo gem install, anything else) | ||
|
||
== LICENSE: | ||
|
||
(The MIT License) | ||
|
||
Copyright (c) 2009 Michael Aufreiter | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
'Software'), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'pathname' | ||
require 'rubygems' | ||
|
||
ROOT = Pathname(__FILE__).dirname.expand_path | ||
JRUBY = RUBY_PLATFORM =~ /java/ | ||
WINDOWS = Gem.win_platform? | ||
SUDO = (WINDOWS || JRUBY) ? '' : ('sudo' unless ENV['SUDOLESS']) | ||
|
||
require ROOT + 'lib/ken/version' | ||
|
||
AUTHOR = 'Michael Aufreiter' | ||
EMAIL = 'ma[at]zive[dot]at' | ||
GEM_NAME = 'ken' | ||
GEM_VERSION = '0.0.1'# Ken::VERSION | ||
GEM_DEPENDENCIES = [ | ||
[ 'ParseTree', '~>3.0.3' ], | ||
[ 'ruby2ruby', '~>1.2.2' ], | ||
[ 'extlib', '~>0.9.10' ], | ||
[ 'addressable', '~>2.0.1' ] | ||
] | ||
|
||
GEM_CLEAN = %w[ log pkg coverage ] | ||
GEM_EXTRAS = { :has_rdoc => true, :extra_rdoc_files => %w[ README.txt LICENSE TODO History.txt ] } | ||
|
||
PROJECT_NAME = 'ken' | ||
PROJECT_URL = "http://github.com/michael/#{GEM_NAME}" | ||
PROJECT_DESCRIPTION = PROJECT_SUMMARY = 'Ruby API for Accessing the Freebase' | ||
|
||
#[ ROOT, ROOT.parent ].each do |dir| | ||
[ ROOT ].each do |dir| | ||
Pathname.glob(dir.join('tasks/**/*.rb').to_s).each { |f| require f } | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'pathname' | ||
require 'rubygems' | ||
|
||
EXAMPLES_ROOT = Pathname(__FILE__).dirname.expand_path | ||
require EXAMPLES_ROOT.parent + 'lib/ken' | ||
|
||
Ken::Session.new('http://www.freebase.com', 'ma', 'xxxxx') | ||
|
||
# fetch a resource | ||
|
||
artist = Ken.get('/en/the_rolling_stones') | ||
|
||
# let's inspect that resource | ||
artist.types.each do |type| | ||
puts "" | ||
puts type.name | ||
puts "==================================================" | ||
type.properties.each do |prop| | ||
puts prop.name | ||
# soon you will also be able to fetch attribute values by simply calling | ||
# -> artist.read_attribute(prop.id) | ||
# or if you already know which attribute you want to fetch | ||
# -> artist.<attributename> e.g. artist.origin | ||
end | ||
puts | ||
end | ||
|
||
puts artist.read_attribute('origin') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
require 'pathname' | ||
require 'rubygems' | ||
require 'net/http' | ||
require 'json' | ||
require 'extlib' | ||
require 'addressable/uri' | ||
|
||
dir = Pathname(__FILE__).dirname.expand_path + 'ken' | ||
|
||
require dir + 'version' | ||
require dir + 'resource' | ||
require dir + 'type' | ||
require dir + 'property' | ||
require dir + 'collection' | ||
require dir + 'session' | ||
require dir + 'logger' | ||
|
||
# init logger as soon as the library is required | ||
Ken::Logger.new(STDOUT, :error) | ||
|
||
|
||
module Ken | ||
def self.all(options = {}) | ||
#raise ArgumentError.new("must be a hash") unless options.is_a(::Hash) | ||
raise NotImplementedError | ||
end | ||
|
||
def self.get(id) | ||
# TODO check if it has a correct /type/object/id syntax | ||
raise ArgumentError.new("must be a string") unless id.is_a?(::String) | ||
|
||
query = { | ||
:id => id, | ||
:name => nil, | ||
:type => [{ | ||
:id => nil, | ||
:name => nil, | ||
:properties => [{ | ||
:id => nil, | ||
:name => nil, | ||
:expected_type => nil | ||
}] | ||
}] | ||
} | ||
|
||
result = Ken.session.mqlread(query) | ||
return Ken::Resource.new(result) | ||
end | ||
end # module Ken |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Ken | ||
class Collection < Array | ||
# def initialize(data = []) | ||
# @data = data | ||
# end | ||
|
||
# def method_missing(name, *args, &blk) | ||
# @data.send name, *args, &blk | ||
# end | ||
end | ||
end |
Oops, something went wrong.