Method: Swicky::Notebook.annotations_for_image
- Defined in:
- lib/swicky/notebook.rb
.annotations_for_image(url) ⇒ Object
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/swicky/notebook.rb', line 126 def annotations_for_image(url) url = sanitize_sparql(url).to_uri select_annotations([:note, N::SWICKY.refersTo, :fragment], [:fragment, N::DISCOVERY.isPartOf, url]) # result = [] # url = sanitize_sparql(url).to_uri # q = ActiveRDF::Query.new(N::URI).select(:fragment).distinct.where(:fragment, N::DISCOVERY.isPartOf, url) # q.execute.each do |fragment| # result = {fragment.uri.to_s => {}} # q2 = ActiveRDF::Query.new(N::URI).select(:predicate, :object).distinct # q2.where fragment, :predicate, :object # q2.execute.each do |predicate, object| # result[fragment.uri.to_s][predicate.to_s] = object.to_s # end # end # result end |