Giter Club home page Giter Club logo

sparqltimeliner's Introduction

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.

sparqltimeliner's People

Contributors

uedayou avatar

Stargazers

HC avatar haruna avatar  avatar wukuan405 avatar Shigeru Araki avatar Tomotsugu Kaneko avatar Yosuke Onoue avatar kimihito avatar  avatar Shoichi Otomo avatar yahata avatar Fumihiro Kato avatar

Watchers

Fumihiro Kato avatar Yasunori avatar  avatar  avatar

Forkers

ixkaito cv-ao

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.