Module: PublishMyData::SparqlHelper
- Defined in:
- app/helpers/publish_my_data/sparql_helper.rb
Instance Method Summary collapse
- #default_prefixes ⇒ Object
- #default_query ⇒ Object
- #default_query_with_graph ⇒ Object
- #link_to_sparql_results_format(text, format, query, pagination_params = nil) ⇒ Object
- #url_for_sparql_results_format(format, query, interpolations = {}) ⇒ Object
Instance Method Details
#default_prefixes ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/helpers/publish_my_data/sparql_helper.rb', line 14 def default_prefixes prefix_string = "" PublishMyData.prefixes.each do |key, value| prefix_string += "PREFIX #{key}: <#{value}>\n" end prefix_string end |
#default_query ⇒ Object
22 23 24 |
# File 'app/helpers/publish_my_data/sparql_helper.rb', line 22 def default_query() default_prefixes + "\nSELECT DISTINCT *\nWHERE {\n ?s ?p ?o\n}\nLIMIT 20" end |
#default_query_with_graph ⇒ Object
26 27 28 |
# File 'app/helpers/publish_my_data/sparql_helper.rb', line 26 def default_query_with_graph default_prefixes + "\nSELECT DISTINCT *\nWHERE {\n GRAPH <%{graph}> {\n ?s ?p ?o\n }\n}\nLIMIT 20" end |
#link_to_sparql_results_format(text, format, query, pagination_params = nil) ⇒ Object
3 4 5 6 7 |
# File 'app/helpers/publish_my_data/sparql_helper.rb', line 3 def link_to_sparql_results_format(text, format, query, pagination_params=nil) link_params = {:format => format, :query => query} link_params.merge!(:page => pagination_params.page, :per_page => pagination_params.per_page) if pagination_params link_to text, link_params end |
#url_for_sparql_results_format(format, query, interpolations = {}) ⇒ Object
9 10 11 12 |
# File 'app/helpers/publish_my_data/sparql_helper.rb', line 9 def url_for_sparql_results_format(format, query, interpolations={}) interpolations.merge!(:format => format, :query => query, :only_path => false) url_for interpolations end |