DB2 Version 10.1 for Linux, UNIX, and Windows

queryrdfstore command

In DB2® Version 10.1 Fix Pack 2 and later fix packs, you can use the queryrdfstore command to query an RDF store from the command line. You can run this query from a file or by specifying it inline as an argument to the queryrdfstore command.

Command syntax

Read syntax diagramSkip visual syntax diagram
>>-queryrdfstore--storeName--+------------------+--------------->
                             '- -host--hostName-'   

>--+--------------------+-- -db--dbName-- -user--userName------->
   '- -port--portNumber-'                                   

>-- -password--password--+------------------+------------------->
                         '- -schema--schema-'   

>--+---------------------------------------------+-------------->
   '- -uniondefaultgraph--unionDefaultGraphValue-'   

>--+---------------------+--+-------------------+--------------->
   '- -reopt--reoptValue-'  '- -file--queryFile-'   

>--+------------------+----------------------------------------><
   '-queryStringValue-'   

Command parameters

storeName
Specifies the RDF store to be queried.
-host hostNames
Specifies the host where the database is located.
-port portNumber
Specifies the port number of the database.
-db dbName
Specifies the database to which a connection is established.
-user userName
Specifies the authorization name that is used to establish the connection.
-password password
Specifies the password that is used to establish the connection.
-schema schemaName
Specifies the database schema for the RDF store.
-uniondefaultgraphunionDefaultGraphValue
Specifies whether a union default graph is being used. The value can be true or false.
-reoptreoptValue
Specifies the repeat options for running the query. The options are once, always, or none. The default value is none.
-filequeryFile
Specifies the file that contains the SPARQL query.
queryStringValue
Specifies the SPARQL query issued as a string.

Example

Example 1: The following command specifies a query for triples in an RDF store named myStore and in the RDFSAMPL database on a local system, with the unionDefaultGraph parameter set to trueYou can query all the triples in an RDF store name myStore in the RDFSAMPL database on the local system, with the unionDefaultGraph parameter set to true.
queryrdfstore myStore -db RDFSAMPL -user db2admin 
-password db2admin -schema db2admin 
-uniondefaultgraph true "select * where {?s ?p ?v}"
Example 2: The following command specifies query usage within in a text file.
queryrdfstore myStore -db RDFSAMPL -user db2admin 
-password db2admin -schema db2admin 
-uniondefaultgraph true -file "C:\query.txt"

Usage notes

You must issue the command and parameter names in lowercase.

You can specify the query either within a file or as a parameter for the command, but not both.