Created
February 12, 2010 05:11
-
-
Save rjpbonnal/302322 to your computer and use it in GitHub Desktop.
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
require 'rubygems' | |
require 'active_rdf' | |
class Bio | |
class SPARQL | |
def initialize(params ={}) | |
@adapter=ConnectionPool.add(:type => :sparql, :url => 'http://geneid.bio2rdf.org/sparql', :engine => :virtuoso) | |
end | |
def full_text_search(text) | |
Query.new.select(:s, :p, :o).where(:s,:p,:o).where(:o,RDFS::Resource.new('bif:contains'), text).execute | |
end | |
def self.to_tab(results) | |
results.collect {|row| | |
row.join("\t") | |
} | |
end | |
end | |
end | |
myEndPoint=Bio::SPARQL.new | |
#look for Gene TP53 | |
myGeneSemWeb=myEndPoint.full_text_search("TP53") | |
#Format in a tabular format | |
puts myEndPoint.to_tab(myGeneSemWeb) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment