This file contains hidden or 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
| require 'rubygems' | |
| require 'kasabi' | |
| require 'json' | |
| require 'rdf' | |
| require 'rdf/json' | |
| #Demonstration api key | |
| APIKEY = "YOUR_API_KEY" | |
| dataset = Kasabi::Dataset.new("http://kasabi.com/dataset/nasa", :apikey => APIKEY ) |
This file contains hidden or 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
| require 'rubygems' | |
| require 'kasabi' | |
| require 'json' | |
| #change to your API key | |
| APIKEY = "YOUR_API_KEY" | |
| dataset = Kasabi::Dataset.new("http://kasabi.com/dataset/nasa", :apikey => APIKEY ) | |
| #Search for "Apollo", limiting to 5 results |
This file contains hidden or 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
| require 'rubygems' | |
| require 'kasabi' | |
| require 'json' | |
| #change to your API key | |
| APIKEY = "YOUR_API_KEY" | |
| dataset = Kasabi::Dataset.new("http://kasabi.com/dataset/nasa", :apikey => APIKEY ) | |
| #Search for "Apollo", limiting to 5 results |
This file contains hidden or 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
| require 'rubygems' | |
| require 'kasabi' | |
| #Demonstration api key | |
| APIKEY = "YOUR_API_KEY" | |
| dataset = Kasabi::Dataset.new("http://kasabi.com/dataset/nasa", :apikey => APIKEY ) | |
| #SPARQL query to find name of spacecraft launched on 16th July 1969, as JSON" | |
| QUERY = <<-EOL |
This file contains hidden or 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
| require 'sinatra' | |
| require 'kasabi' | |
| get '/' do | |
| dataset = Kasabi::Dataset.new("http://data.kasabi.com/dataset/nasa", :apikey => ENV["KASABI_API_KEY"]) | |
| @query = params[:query] || "apollo" | |
| @results = dataset.search_api_client.search(@query) | |
| template =<<-EOL | |
| <html> |
This file contains hidden or 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
| require "rubygems" | |
| require "bundler" | |
| Bundler.require | |
| require "./app" | |
| run Sinatra::Application |
This file contains hidden or 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
| source :rubyforge | |
| gem 'rack' | |
| gem 'sinatra' | |
| gem 'kasabi' |
This file contains hidden or 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
| package example; | |
| import com.hp.hpl.jena.query.Query; | |
| import com.hp.hpl.jena.query.QueryExecution; | |
| import com.hp.hpl.jena.query.QueryExecutionFactory; | |
| import com.hp.hpl.jena.query.QueryFactory; | |
| import com.hp.hpl.jena.query.ResultSet; | |
| import com.hp.hpl.jena.query.ResultSetFormatter; | |
| import com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP; |
This file contains hidden or 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
| # add this to your user's .profile | |
| KASABI_API_KEY="123MYSECRETKEY" ; export KASABI_API_KEY |
This file contains hidden or 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
| # Create an apache proxy with Kasabi apikey header injection | |
| # Requests to http://127.0.0.1/kasabi will be forwarded and have the X-KASABI-APIKEY header set. | |
| # e.g. | |
| # http://127.0.0.1/kasabi/dataset/food/apis/search?query=fish | |
| # will be forwarded to | |
| # http://api.kasabi.com/dataset/food/apis/search?query=fish | |
| # and responses will be passed back to the client | |
| NameVirtualHost * |
OlderNewer