Re: Querying dbpedia from the command line?

Richard Cyganiak wrote:
 > I'm not sure if it works on every SPARQL endpoint, but try this:
 >
 > curl -F 'query=SELECT * WHERE { ?s ?p ?o } LIMIT 3'
 > http://dbpedia.org/sparql
 >
 > The key is using curl's -F parameter (which takes a key-value pair and
 > urlencodes the value), and putting the 'query=...' part into quotes.

Bingo! As written, this query didn't work in Windows and did in Linux, 
but when I changed the the single quotes to double quotes, it worked in 
Windows both from the command line and from a batch file. It's also 
great because it's so much terser and more readable than all the escaped 
versions.

As a side note, I think this is going to be very big, because while 
Linked Data (and much of the semantic web) is theoretically about 
exposing data to programs instead of to eyeballs like the traditional 
web, most of the linked data and semantic web demos I see out there are 
about visual browsing of linked data--displaying it to eyeballs. When we 
can grab the results of a linked data SPARQL query with a script, then 
we can really start doing new and interesting things with it.

Bob

Received on Thursday, 18 September 2008 01:47:10 UTC