Class: ActiveRdfAdapter
- Inherits:
-
Object
- Object
- ActiveRdfAdapter
- Defined in:
- lib/active_rdf/federation/active_rdf_adapter.rb
Overview
Generic superclass of all adapters
Class Method Summary collapse
-
.supports_context? ⇒ Boolean
Indicates if this adapter class supports contexts.
Instance Method Summary collapse
-
#clear ⇒ Object
Clear the adapter.
-
#initialize ⇒ ActiveRdfAdapter
constructor
A new instance of ActiveRdfAdapter.
-
#supports_context? ⇒ Boolean
Indicate if the adapter supports contexts.
-
#translate(query) ⇒ Object
translate a query to its string representation.
Constructor Details
#initialize ⇒ ActiveRdfAdapter
Returns a new instance of ActiveRdfAdapter.
10 11 12 |
# File 'lib/active_rdf/federation/active_rdf_adapter.rb', line 10 def initialize @enabled = true end |
Class Method Details
.supports_context? ⇒ Boolean
Indicates if this adapter class supports contexts
35 36 37 38 |
# File 'lib/active_rdf/federation/active_rdf_adapter.rb', line 35 def self.supports_context? @context_supported = false if(@context_supported == nil) @context_supported end |
Instance Method Details
#clear ⇒ Object
Clear the adapter. Crude default implementation, which can be overwritten in subclasses. TODO: This queries all adapters, this may lead to problems…
26 27 28 29 30 31 32 |
# File 'lib/active_rdf/federation/active_rdf_adapter.rb', line 26 def clear raise(ActiveRdfError, "Can only delete from writing adapters") unless(writes?) to_delete = Query.new.select(:s, :p, :o).where(:s, :p, :o).execute to_delete.each do |s, p, o| delete(s, p, o) end end |
#supports_context? ⇒ Boolean
Indicate if the adapter supports contexts
15 16 17 |
# File 'lib/active_rdf/federation/active_rdf_adapter.rb', line 15 def supports_context? self.class.supports_context? end |
#translate(query) ⇒ Object
translate a query to its string representation
20 21 22 |
# File 'lib/active_rdf/federation/active_rdf_adapter.rb', line 20 def translate(query) Query2SPARQL.translate(query) end |