Redland RDF Application Framework - Ruby RDoc - Class: Redland::Query

Go to Redland Home - Language Bindings Home - Ruby API Home

Class | Redland::Query
In: | rdf/redland/query.rb
Parent: | Object

This class provides query language support for RDF models either via an adaptor class or direct by persistant storage.

### Methods

create_finalizer execute new

### Attributes

query | [R] |

### Public Class methods

create_finalizer(query)

You shouldn‘t use this. Used internally for cleanup.

[Source]

    # File rdf/redland/query.rb, line 36
        def Query.create_finalizer(query)
          proc{|id| "Finalizer on #{id}"
            #$log_final.info "closing query"
            Redland::librdf_free_query(query)
          }
        end

new(query,language=nil,uri=nil,base_uri=nil)

Constructor - create a new Query object query - the query string language - the name of the query language uri - the URI identifying the query language

[Source]

    # File rdf/redland/query.rb, line 17
        def initialize(query,language=nil,uri=nil,base_uri=nil)
          @language = language
          @uri = uri
          @query = Redland.librdf_new_query($world.world,language,uri,query,base_uri)
          return nil if not @query
          ObjectSpace.define_finalizer(self,Query.create_finalizer(@query))
        end

### Public Instance methods

execute(model)

Execute a query on a model

[Source]

    # File rdf/redland/query.rb, line 26
        def execute(model)
          results=Redland.librdf_query_execute(@query,model.model)
          if not results
            return nil
          else
            return QueryResults.new(results)
          end
        end

Go to Redland Home - Language Bindings Home - Ruby API Home

(C) Copyright 2004-2011 Dave Beckett, (C) Copyright 2004-2005 University of Bristol