Image area and SPARQL

画像の部分を説明したRDFに対してSPARQLによる検索を行い、選択された部分だけをクリッピングして表示してみます。

With SPARQL and XSLT/CSS, we can query parts of an image, and display each clipped region with metadata.

XMLArmyKnife -- SPARQLを利用して、画像の部分をアノテートした(注釈を加えた)RDFファイルにクエリを送り、エリアのタイトル(dc:title)に特定の文字列を含む部分の座標を取りだし、XSLTとCSSを使ってその部分をクリッピングします。

Using Andy Seaborne's SPARQLer demo XMLArmyKnife -- SPARQL, we query an image annotation RDF, find coords of areas whose dc:title include specific string. Then with XSLT and CSS, areas at the returned coords will be clipped from the original image and be displayed.

Example 1: Simple query

アノテートした部分の dc:titlemasaka となっているグラフを取りだし、画像URI、座標、説明を用いてその部分を表示します。元となる画像2つのエリアに注釈を加えたRDFを用います。

Taking RDF graph whose dc:title property has value masaka, and display that area with image's URI, coordinates and description. RDF annotates two areas of the original image.

SPARQL query


Example 2: Query with regex

アノテートした部分の dc:title に "Dan" が含まれるグラフを、正規表現を用いて取り出します。さらに、説明はエリアの説明もしくはエリアが描いているものの説明のいずれかをUNIONとして求めます。2つの画像の9つのエリアに注釈を加えたRDFを用います。

Takes RDF graph whose dc:title property value contains "Dan", using regular expression. Also, this example uses UNION to extract description of the region or that of what is depicted in the region. RDF annotates nine areas of two images.

SPARQL query


Example 3: Query with flickr

flickrでは画像にnoteを加えることができますが、それをRDFに変換し、noteの内容(RDFではdc:titleに変換)に対してクエリを送ります。元となるflickrページから5つのエリアに注釈を加えたRDFを生成しています。

It's also possible to get RDF annotation from flickr's notes. RDF with five area annotations is generated from the original flickr page.

SPARQL query


Example 4: Query over w3photo 2004

w3photo.orgの2004年の写真のうち、アノテーションが加えられている90点の写真を対象にクエリを行います。例ではタイトルに"Tim"を含むエリアを検索します。FILTERの部分を"Jim", "Steve", "Ben", "Eric", "Mark" などに置き換えて試すと、いろいろなエリアを抽出できます。

The target RDF file is a collection of 90 images from w3photo.org's 2004 pictures that have area annotations. This example will retrieve areas whose titles contain "Tim". Other interesting search candidates include "Jim", "Steve", "Ben", "Eric" and "Mark", etc.

SPARQL query


Nearby: SPARQL Construct and XSLT