kimiaprojects/cattle_dataset — Issue #1: complex query attempts
Author: kimiaprojects
Created: 2012-02-27 17:24:01+00:00
State: open

# a simple query for this dataset "query_test.nt"
*
*
*
*
* <2009>
* <43>

*
*
*
*
* <2009>
* <43>

*
*
*
*
* <2009>
* <43>
------------------------------------
#Adding the statements to graph
graph=RDF::Graph.new

_RDF::Reader.open("/home/miki/Desktop/query_test.nt") do |reader|_
_reader.each_statement do |statement|_
_graph << statement_
_end_
_end_
-------------------------------------
#querying all submissions dates

_predicate=RDF::URI.new("weekVisited")_
_query = RDF::Query.new({_
_:submission => {_
_predicate => :week_
_}_
_})_
_query._execute(graph).each do |solution|
puts solution.inspect
#"submission=#{solution.submission} week=#{solution.week}"
end
-------------------------------------
#output

#, :**week**=>#})>
#, :**week**=>#})>
#, :**week**=>#})>