LoginSignup
3
3

More than 5 years have passed since last update.

VirtuosoでコマンドラインからSPARQLを実行する

Last updated at Posted at 2015-09-08

はじめに

Virtuosoドキュメントなさすぎ

やりたいこと

SPARQLをコマンドラインから動かしたい

やること

コマンドラインから動かす

使ってるもの

AMIで配布されているVirtuosoを使ってます。
http://amiage.com/ja/apps/virtuoso-open-source-edition-ja/

やったこと

isqlを立ち上げる

AMI版Virtuosoは素のままだとフルパスで呼び出す必要があります。

 $ /opt/virtuoso-opensource/bin/isql
 SQL> sparql select * from <http://localhost:8890/sparql> where {?a ?b ?c} limit 3;

で、その結果はこんな感じ。

a b c
LONG VARCHAR LONGVARCHAR LONG VARCHAR
http://localhost:8890/sparql http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/ns/sparql-service-description#Service
http://localhost:8890/sparql http://www.w3.org/ns/sparql-service-description#endpoint http://localhost:8890/sparql
http://localhost:8890/sparql http://www.w3.org/ns/sparql-service-description#feature http://www.w3.org/ns/sparql-service-description#UnionDefaultGraph

RDFなので戻り値は基本的にトリプルです。
SPARQLでパラメータを3つ指定したから3つなだけでトリプル云々は無関係でしたorz

「ブラウザからSPARQL叩けばいいやん」って話にも思えるかもしれませんがまぁ知っておいて損はしませんしね。

jq使いたい場合はwgetあたりでエンドポイントをAPIのようにぶん殴ったほうがよさそうです(適当)

3
3
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3