8000 GitHub - CV-AO/SPARQLTimeliner: Timeliner for SPARQL endpoint
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

CV-AO/SPARQLTimeliner

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SPARQL Timeliner

SPARQL Timelinerは、Open Knowledge Foundation Labs が開発した Timeliner(現TimeMapper)にSPARQLエンドポイント対応を行ったWebアプリです。

詳しくは、こちらをご覧ください

SPARQL Timelinerではサーバ側で検索結果をキャッシュしていますが、このバージョンはJavascriptで検索結果を逐一取得します。 そのため、PHPやPythonなどのサーバサイド・スクリプトは必要ありません。

構成

  • /index.html ファイル

SPARQL Timeliner 本体。Javascript・CSSファイルはインターネット上のファイルを指定していますので、このファイルのみで動きます。 通常は以下の「src」フォルダ内のファイルは必要ありません。 次節「使い方」を参考に、titleタグ、SPARQLエンドポイント、クエリを書き換えてください。

  • /src フォルダ

SPARQL Timeliner を動かすために必要なJavascript・CSSファイルが含まれています。 JavascriptやCSSをカスタマイズしたい場合は、srcフォルダ以下のファイルを利用してください。

使い方

/index.htmlのtitleタグと、エンドポイントのURLとSPARQLクエリに関する設定を変更します。 エンドポイントURLとSPARQLクエリはmetaタグとして以下のように記述します。

<!-- SPARQLエンドポイント -->
<meta name="sparql-endpoint" 
content="http://lodcu.cs.chubu.ac.jp/SparqlEPCU/RDFServer.jsp?reqtype=api&project=toukaido" />

<!-- SPARQLクエリ -->
<meta name="sparql-query" content="
  PREFIX schema: <http://schema.org/>
  PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
  PREFIX dcterm: <http://purl.org/dc/terms/>
  select distinct ?title ?start ?lat ?long ?description ?image 
  where {
    ?link a <toukaido:浮世絵>;
    rdfs:label ?title;
    dcterm:created ?start;
    schema:image ?image;
    dcterm:description ?description;
    geo:lat ?lat;
    geo:long ?long.
  }
  LIMIT 100
" />

SPARQLクエリの作成方法については、

を参照してください。

出力フォーマットはJSONのみ対応しています。 もしJSONPを利用する場合は、

<meta name="sparql-datatype" content="jsonp" />

を追加してください。

あとは任意のWebサーバに全てのファイルを置けば、SPARQL Timelinerアプリが動きます。

Javascript で指定したい場合は、以下のように設定してください。

var state = {};

// エンドポイントURL
state.endpoint = "http://lodcu.cs.chubu.ac.jp/SparqlEPCU/RDFServer.jsp?reqtype=api&project=toukaido";
// SPARQLクエリ
state.query = "PREFIX schema: <http://schema.org/>PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>PREFIX dcterm: <http://purl.org/dc/terms/>select distinct ?title ?start ?lat ?long ?description ?image where {?link a <toukaido:浮世絵>;rdfs:label ?title;dcterm:created ?start;schema:image ?image;dcterm:description ?description;geo:lat ?lat;geo:long ?long.}LIMIT 100";
// jsonフォーマット指定
state.format = "json";
// jsonp利用の場合
// state.type = "jsonp";

createTimeliner(state);

対応エンドポイント

以下のエンドポイントでは動作することを確認しています。

※これ以外のエンドポイントについては、クロスドメイン制約によりデータを取得できない可能性があります。

注意

index.htmlのアクセス毎にエンドポイントへ検索を行いますので、指定したエンドポイントの状態によっては何も表示されないときがあります。また、過度なアクセスはエンドポイントの負荷を高めますので、十分注意してください。

DBpediaDBpedia Japaneseなどの頻繁な更新がないエンドポイントについては、検索結果キャッシュ機能付きSPARQL Timelinerの利用をお勧めします。

ライセンス

Copyright © 2014 Hiroshi Ueda(@uedayou). Licensed under the MIT license.

About

Timeliner for SPARQL endpoint

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 95.3%
  • HTML 3.7%
  • CSS 1.0%
0