Using the Dydra CLI

April 6th 2011 by Ben

One of the best things about using Dydra’s dirt-simple interface is that we made it dirt-simpler with our CLI client. If you’re comfortable on the command line, you can store, publish, and query any RDF data without opening a browser.

After you’ve installed the program, you can create, load, and query databases simply and easily:

$ dydra create rdf-blog-feeds
$ dydra import rdf-blog-feeds ./my-foaf.nt --context http://example.org/me
$ dydra import rdf-blog-feeds http://www.w3.org/People/Berners-Lee/card --context http://example.org/tbl
$ dydra query rdf-blog-feeds 'select * where { graph ?g { ?s ?p ?o } }'
?g ?s ?p ?o
...
...
...

One convenient quality of the CLI client is that it pipes so beautifully into the *nix tools which have evolved over the last decades. A SELECT query response comes back line-by-line, tab-separated by default, so it is easy to integrate into unix pipes:

$ dydra query rdf-blog-feeds 'select distinct ?g where { graph ?g { ?s ?p ?o }}' | xargs curl

The above, for example, will fetch each named graph in a repository with curl.

If you want to dig deeper into the client, it’s written in Ruby and it’s all up on github. It’s actually a decent way to see how to interact with Dydra at the API level. You can submit fixes and features if you want, too!

blog comments powered by Disqus