Querying Graphmart Data
This topic provides information about using the Anzo command line interface (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 AG_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 AG_URI -dataset graphmart_URI
Where filename.rq is the path to and name of the query file and AG_URI is the Datasource URI shown on the Administration > AnzoGraph screen in the Anzo console. For example:
And graphmart_URI is the URI for graphmart. To view the URI for a graphmart:
- Click Graphmarts in the Anzo console.
- 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