RIDIQL Reference

RIDIQL (RDF Insertion Deletion Inspection and Query Language) builds several utility commands on top of RDQL to make working with RDF graphs easy. This reference describes each of the commands and gives examples where appropriate.
Note: All commands may be written on multiple lines and are terminated with a ; character. Command names and tokens are case-insensitive, but when written in this reference, they are capitalized for clarity.

Command Index

Connecting ATTACH, DETACH, MODELS, USE
Creating, Modifying, and Exporting CREATE, CREATEINF, DELETE, DUMP, DROP, LOAD, INSERT, RANDOM, REBIND
Files and Directories CAT, CD, LS, PWD
Querying and Drawing COUNT, DRAW, SELECT
Settings / Miscellaneous ALIAS, EXIT, HELP, TRACE
Transactions ABORT, BEGIN, COMMIT

Connecting

ATTACH - Connects to a given file or db store.

Syntax:
Where:
Examples:
A store must be attached (and thus named) before you can USE its models. RDQLPlus remembers the name and location details of an attached store until it is DETACHed . . . you won't need to re-attach each time you use the program.
RDQLPlus comes with an embedded instance of the Mckoi database, which is already attached the first time you run the program. You don't need to worry about setting this up. But to use another database type, you must first download the appropriate JDBC driver. Find pointers at the Jena MySQL HOWTO, Oracle HOWTO, or Postgresql HOWTO page. Once you obtain the correct driver, make sure its java classes are unpacked into the RDQLPLUS_HOME/ext directory so RDQLPlus can use them.
Note that in order to use Oracle, as the HOWTO indicates, you will need to modify Jena source code. If you choose this route, make sure to swap out the RDQLPLUS_HOME/lib/jena.jar file with your own (Jena v2.1) before attempting to use Oracle with RDQLPlus.

DETACH - Disconnects from/forgets about a named store.

Syntax:
Where:
Note: You can't detach a store whose model is in use, and the memory store can never be detached.

MODELS - Lists all models in each attached store.

Syntax:
Every model in each attached store will be listed.

USE - Sets the current model.

Syntax:
Where:
If there is an open transaction on the current model, it will be automatically ABORTed before switching.

Creating, Modifying, and Exporting

CREATE - Creates a model in a store.

Syntax:
Where:

CREATEINF - Creates an inference model.

Syntax:
Where:
Examples:
Although the ontology and source models can be from a persistent store, there is no support for persistent inference models -- they will always be created in memory. Thus, after creation, an inference model can be found at modelName@memory.
If the source data is modified, the inference model won't reflect the new entailments until you issue the REBIND command.
Note that an inference model can be created in which the ontology statements are already in the same model as the source statements. To do this, you can create an empty model and pass THAT in as the ontology model... passing the empty model in as the source model.

DELETE - Removes statement(s) from the model.

Syntax:
Where:
Examples:
When using DELETE SELECT . . ., you may wish to preview the statements that will be deleted first by using DRAW SELECT . . .

DUMP - Exports the model in one of three formats.

Syntax:
Where:

DROP - Permanently removes a model.

Syntax:
Where:
This command actually does two things. First, it removes all the statements from a model (equivalent to "DELETE SELECT * (?r ?p ?v);"). Then it removes the actual empty model from the store.
Note that since the default@memory model cannot be un-associated, DROP will only remove all statements from it. Also, if you DROP the current in-use model, the current model will be set to default@memory when the command completes.

LOAD - Imports statements from a file into the model.

Syntax:
Where:

INSERT - Adds or copies statements to the model.

Syntax:
Where:
Examples:

RANDOM - Creates random statements in the model.

Syntax:
Where:
Examples:
This is intended for testing. Resource URIs will start with res:aa and end with a number between 1 and numResources. Predicate URIs will start with prop:aa and end with a number between 1 and numPredicates.

REBIND - Syncs the inference model with underlying data changes.

Syntax:
You should only run this command when the current model is an inference model and the source data has changed since it was created or the last time it was re-bound.

Files and Directories

Unix-style paths (using /'s) can be used whether you're running on windows or unix. When specifying paths, .. means "parent directory" and . means "current directory". Also, if you use paths with space characters in them, don't use quotes around the path.

CAT - Echoes the content of a text file to the console.

Syntax:
Where:
This just provides a quick way to check on the content of a small text file. Don't run it on large or binary files; you may run out of memory because the scrollback buffer is currently never cleared.

CD - Changes the working directory.

Syntax:
Where:
The new working directory will be shown in the titlebar of the console window.

LS - Lists the contents of a directory..

Syntax:
Where:

PWD - Echoes the current working directory.

Syntax:
Note that since the current working directory is always shown in the titlebar of the console window, this command is really only useful for running RDQLPlus in non-GUI mode (which doesn't exist at this time).

Querying and Drawing

COUNT - Gives subject, statement, and result binding counts.

Syntax:
Where:
When COUNTing on an inference model, the actual number of statements will be returned (not a lower bound).

SELECT - Performs a RDQL query.

Syntax:
Where:
This is by no means a definitive description of RDQL syntax. A more precise and accurate description of RDQL can be found at the RDQL W3C Submission. A nice introduction and tutorial to RDQL can be found at the Jena RDQL Tutorial.
In general, RDQL in RDQLPlus matches the Jena implementation (in fact, it just passes calls straight to Jena). The only exceptions are those mentioned above in regard to the FROM clause and the use of ALIASes.

DRAW - Graphically displays a model or query results.

Syntax:
Where:
Note: RDQLPlus uses the GraphViz "dot" program to do graph layout. In many cases this only takes up to a few seconds, but sometimes (if the graph being drawn is VERY large), the program can run for several minutes, locking up RDQLPlus until it's finished.

Settings and Miscellaneous

ALIAS - Sets, shows, or clears URI aliases.

Syntax:
Where:
Example:
Aliases are used as a convenience in RDQLPlus. You can do everything without aliases that you could do with them. Any time a command calls for a URI, you can use aliasName:restOfURI instead of typing the full URI.
Aliases are also used to aid in readability while DRAWing. If an alias exists for a URI prefix used in the graph, aliasName:restOfURI will be shown in the graph instead of the full URI. Note that aliases are NOT used when printing the results of a plain SELECT command -- full URIs are always printed in the text output of a RDQL query.
Aliases are remembered on subsequent runs of RDQLPlus, until un-set.

EXIT - Exits RDQLPlus.

Syntax:
If there is an open transaction, it will be ABORTed.

HELP - Provides a brief synopsis of all commands.

Syntax:

TRACE - Turns error tracing or or off.

Syntax:
When tracing is on, error messages will be accompanied by additional debugging information.

Transactions

Transactions are only possible on filesystem models and on database models where the underlying RDBMS supports transactions.
For efficiency, filesystem-based models are ALWAYS in a transaction so changes are only really made when the models are COMMITted. All other models start in auto-commit mode and you must explicitly issue a BEGIN command to start a transaction.
Note that the DROP command is always permanent, whether there is a transaction or not. Thus, DROPs can't be rolled back.

ABORT - Cancels/rolls back the current transaction.

Syntax:

BEGIN - Starts a transaction on the current model.

Syntax:

COMMIT - Commits the current transaction.

Syntax:
RDF Resource Description Framework Icon Sourceforge.net Icon