---
name: "RDF::Query::Util"
section: "3pm"
platform: "linux"
package: "librdf-query-perl"
version: "2.919-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/RDF::Query::Util"
---

# RDF::Query::Util(3pm)

Miscellaneous utility functions to support work with RDF::Query.

## NAME

RDF::Query::Util - Miscellaneous utility functions to support work with RDF::Query.

## VERSION

This document describes RDF::Query::Util version 2.919.

## SYNOPSIS

```
 use RDF::Query::Util;
 my $query = &RDF::Query::Util::cli_make_query;
 my $model = &RDF::Query::Util::cli_make_model;
 $query->execute( $model );
 ...
```

## FUNCTIONS

- "cli\_make\_query\_and\_model"

  Returns a query object, model, and args HASHref based on the arguments in `@ARGV`. These arguments are parsed using `"cli_make_query"` and `"make_model"`.

- "cli\_make\_query"

  Returns a RDF::Query object based on the arguments in `@ARGV`. These arguments are parsed using `&cli_parse_args`. If the -e flag is not present, the query will be loaded from a file named by the argument in `@ARGV` immediately following the final argument parsed by `&cli_parse_args`.

- "cli\_make\_model"

  Calls `"make_model"` with arguments from `@ARGV`, returning the constructed model object.

  `"cli_make_model"` will usually be called after cli\_make\_query, allowing a typical CLI invocation to look like \`prog.pl \[flags\] \[query file\] \[data files\]\`.

- "make\_model ( @files )"

  Returns a model object suitable for use in a call to `"$query->execute"`, loaded with RDF from files and/or URLs listed in `@files`. This model may be any of the supported models, but as currently implemented will be a RDF::Trine::Model object.

- "cli\_parse\_args"

  Parses CLI arguments from `@ARGV` and returns a HASH with the recognized key/values. The allowable arguments are listed below.

## COMMAND LINE ARGUMENTS

- \-e *str*

  Specifies the query string *str*.

- \-l *lang*

  Specifies the query language *lang* used. This should be one of: **sparql**, **sparql11**, or **rdql**.

- \-O

  Turns on optimization.

- \-o

  Turns off optimization.

- \-c *class*

  Specifies the perl *class* used to construct the query object. Defaults to `"RDF::Query"`.

- \-f

  Implies -c **RDF::Query::Federate**.

- \-F *loc*

  Specifies the URL or path to a file *loc* which contains an RDF service description. The described service is used as an underlying triplestore for query answering. Implies -f.

- \-E *url*

  Specifies the URL of a remove SPARQL endpoint to be used as a data source. The endpoint is used as an underlying triplestore for query answering. Implies -f.

- \-s *database-type*

  Specifies the database type to use for the underlying data model.

- \-u *user*

  - \-p *password*

  - \-m *model*

  ## AUTHOR

```
 Gregory Todd Williams <gwilliams@cpan.org>
```
