Configuring AnzoGraph DB to Ignore Missing Graphs

By default, AnzoGraph DB returns a "No such graph or view" error and aborts the query if a query references a graph that does not exist. You can configure AnzoGraph DB to conform to the SPARQL specification and return an empty result instead of an error, however, if a query references a missing graph. Follow the instructions below to configure the system to return empty results instead of an error when a referenced graph does not exist.

  1. Stop the database. See Stop the Database and Leave the System Management Daemon Running for instructions.
  2. On the leader node, open the AnzoGraph DB settings file, settings.conf, in a text editor. The file is in the <install_path>/config directory.
  3. In settings.conf, uncomment the enable_unbound_variables=false line and change the value to true:
    enable_unbound_variables=true
  4. Save and close settings.conf.
  5. Restart the database to apply the configuration change. See Start the Database (the System Management Daemon is Running) for instructions.

In addition to allowing queries that reference non-existent graphs to succeed, setting enable_unbound_variables to true also configures AnzoGraph DB to ignore unbound variables elsewhere in queries. For example, by default (when enable_unbound_variables=false), if a query includes a variable in the SELECT list that is not referenced in a WHERE clause pattern, AnzoGraph DB aborts the query and returns a "Named variable not in contained WHERE clause" error. When enable_unbound_variables=true, AnzoGraph DB does not warn the user about unbound variables. Instead, the results are empty for the unbound variable. For example:

SELECT ?unbound ?person ?name
FROM <http://anzograph.com/people>
WHERE {?person <http://anzograph.com/people#firstname> ?name}
LIMIT 5
 unbound | person      | name
---------+-------------+---------
	 | person35632 | Ross
         | person20216 | Quin
         | person35859 | Kellie
	 | person2551  | Maris
	 | person24963 | Madonna
5 rows

Related Topics