# phpman > perldoc > RDF::Redland::Query

## NAME
    [RDF::Redland::Query](https://www.chedong.com/phpMan.php/perldoc/RDF%3A%3ARedland%3A%3AQuery/markdown) - Redland RDF Syntax Query Class

## SYNOPSIS
      use [RDF::Redland](https://www.chedong.com/phpMan.php/perldoc/RDF%3A%3ARedland/markdown);

      ...
      my $query=new [RDF::Redland::Query](https://www.chedong.com/phpMan.php/perldoc/RDF%3A%3ARedland%3A%3AQuery/markdown)($query_string); # default query language
      my $results=$query->execute($model);
      # or my $results=$model->query_execute($query);
      while(!$results->finished) {
        for (my $i=0; $i < $results->bindings_count(); $i++) {
          my $name=$results->binding_name($i);
          my $value=$results->binding_value($i);
          # ... do something with the results
        }
        $results->next_result;
      }

## DESCRIPTION
    This class represents queries of various syntaxes over an [RDF::Redland::Model](https://www.chedong.com/phpMan.php/perldoc/RDF%3A%3ARedland%3A%3AModel/markdown) returning a
    sequence of results that (currently) bind variable names to [RDF::Redland::Node](https://www.chedong.com/phpMan.php/perldoc/RDF%3A%3ARedland%3A%3ANode/markdown) values.

## CONSTRUCTORS
    new QUERY-STRING [BASE-URI [QUERY-LANG-URI [QUERY-LANG]]]
        Create a new [RDF::Redland::Query](https://www.chedong.com/phpMan.php/perldoc/RDF%3A%3ARedland%3A%3AQuery/markdown) object for a query string *QUERY-STRING* with optional base
        URI *BASE-URI* IN QUERY language *QUERY-LANG* or query language URI *QUERY-LANG-URI* (both
        can be undef). If *QUERY-LANG-URI* is omitted, the current directory is used as the base
        URI. If *QUERY-LANG-NAME* is undef, the default query language "rdql" is used. If *BASE-URI*
        is omitted, no base URI is used.

## METHODS
    execute MODEL
        Run the query against model *MODEL* returning a [RDF::Redland::QueryResults](https://www.chedong.com/phpMan.php/perldoc/RDF%3A%3ARedland%3A%3AQueryResults/markdown) object or undef
        on failure.

## SEE ALSO
    [RDF::Redland::QueryResults](https://www.chedong.com/phpMan.php/perldoc/RDF%3A%3ARedland%3A%3AQueryResults/markdown)

## AUTHOR
    Dave Beckett - <http://www.dajobe.org/>

