Querying Graphmart Data
The anzo CLI is an advanced administration tool for managing Anzo. It is primarily used for migrations and deployments. To script user interface operations or control Anzo with the CLI, please contact Cambridge Semantics.
This topic provides information about using the anzo CLI to query graphmart data in AnzoGraph.
Use the query subcommand to access the data in graphmarts that are loaded in AnzoGraph:
anzo query "<query_text>" -ds <AZG_URI> -dataset <graphmart_URI>
If you saved the query in a file, run the following command to run the query in the file:
anzo query -f <filename>.rq -ds <AZG_URI> -dataset <graphmart_URI>
Where <filename>.rq is the path to and name of the query file and <AZG_URI> is the Datasource URI shown on the Connections > AnzoGraph screen in the Administration application. For example:
And <graphmart_URI> is the URI for graphmart. To view the URI for a graphmart:
- Click Graphmarts in the Blend menu in the Anzo application.
- On the Graphmarts screen, click the graphmart that you want to query.
- On the details screen for the graphmart, you can view the graphmart URI in the statistics section. For example:
- Click the clipboard icon () to copy the graphmart URI to your clipboard.
Examples
The example below queries a data set to list its classes:
anzo query "SELECT DISTINCT ?p WHERE { ?s ?p ?o.} LIMIT 100" -ds http://cambridgesemantics.com/GqeDatasource/guid_b833b32453694342c7bbc22422035e07 -dataset http://cambridgesemantics.com/Graphmart/f4bc354ebe9540329eef561f66e42454
This example runs a query in a file:
anzo query -f /home/user/queries/classes.rq -ds http://cambridgesemantics.com/GqeDatasource/guid_b833b32453694342c7bbc22422035e07 -dataset http://cambridgesemantics.com/Graphmart/f4bc354ebe9540329eef561f66e42454