Method: Swicky::Notebook.coordinates_for
- Defined in:
- lib/swicky/notebook.rb
.coordinates_for(url) ⇒ Object
Get the “coordinates” (an xpointer in the case of HTML fragments) for all the fragments that are part of the element with the given url.
102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/swicky/notebook.rb', line 102 def coordinates_for(url) result = [] url = sanitize_sparql(url).to_uri frag_qry = ActiveRDF::Query.new(N::URI).select(:fragment, :coordinates).distinct frag_qry.where(:fragment, N::DISCOVERY.isPartOf, url) frag_qry.where(:fragment, N::SWICKY.hasCoordinates, :coordinates) frag_qry.where(:note, N::SWICKY.refersTo, :fragment) frag_qry.execute.each do |fragment, coordinates| result << {'fragment' => fragment.to_s, 'coordinates' => coordinates.to_s} end result end |