项目作者: jlguenego

项目描述 :
Command line sparql utility
高级语言: JavaScript
项目地址: git://github.com/jlguenego/sparql-bin.git
创建时间: 2019-06-15T11:59:29Z
项目社区:https://github.com/jlguenego/sparql-bin

开源协议:

下载


SPARQL bin

Command line utility for making SPARQL request from a command line.

Installation

  1. npm i -g sparql-bin

Example

Create a file test.sparql.txt with a wikidata SPARQL request inside.

  1. # The rivers which go to the Seine.
  2. SELECT ?river ?riverLabel ?longueur ?superficie
  3. WHERE
  4. {
  5. ?river wdt:P403 wd:Q1471;
  6. wdt:P2043 ?longueur;
  7. wdt:P2053 ?superficie.
  8. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  9. }
  10. ORDER BY DESC(?superficie)

Then do

  1. sparql test.sparql.txt

And you get the result in CSV format.

File

You can add a second argument to the command. For instance:

  1. sparql test.sparql.txt answer.csv

Limitations

You can only reach wikidata. The endpoint is hardcoded.

Author

Jean-Louis GUENEGO