Microdata Parser and RDF Extractor for ARC2

概要 Overview

RDF視覚化ツールのために作成したMicrodataからのRDF抽出用プログラムを、ARC2モジュールとして公開するものです。Microdataパーサーは別ファイルとし、独立しても使えるようになっています。PHP 5.2以上が必要です。

This is a Microdata to RDF program, dveleped for RDF visualization tool and packaged as an ARC2 module. Microdata parser is a separate file and can be used independently. Requires PHP 5.2.

Download from Github repository for updated version.

Originally provided at parse-microdata-0.74.zip, which includes ARC2_MicrodataParser.php, Microdata.php and readme.txt.

インストール Installation

ARC2を用意し、そのparsersディレクトリにARC2_MicrodataParser.phpとMicrodata.phpを追加してください。

Prepare ARC2, then place ARC2_MicrodataParser.php and Microdata.php in 'parsers' directory.

利用方法 Usage

ARC2パーサーの基本書法に従っていますので、ほぼ同じ方法で呼び出し、他のARC2アプリケーションの一部として利用できます。

This follows the general style of ARC2 parser, so you can call this parser from within ARC2 application and use the extracted results (RDF triples) with standard ARC2 methods.

(例)

include_once($arc_path."ARC2.php");
$parser = ARC2::getParser("Microdata");
$parser->parse($uri);
$parser->toTurtle($parser->getTriples());

オプションなど Options

RDFの抽出はW3CノートMicrodata to RDFに従っています。この仕様はMicrodataのデータモデルにない追加トリプルやURIを生成するように規定していますが、すべてが必要とは限らないため、どのようなグラフを抽出するかをオプションで指定できるようにしています。

RDF graph is extracted according to W3C Note Microdata to RDF. This specifies to generate extra triples or URIs beyond Microdata model. These can be selected as options for users convenience.

オプションはparse()メソッドの第3引数として指定します。なお、推論トリプルの追加は部分的なサポートです。また言語タグはプロパティ要素のlang属性のみを利用し、上位要素の言語情報を反映しません。詳しくはreadme.txtを参照してください。

Options can be set as the 3rd parameter of parse() method. Note vocabulary entailment is partially supported. Lang tag is generated only in case the itemprop element has lang attribute, i.e. inherent language information is not considered. See readme.txt for more detail.

Microdata.php

Microdata.phpは、Lin ClarkによるMicrodataPHP.phpをベースに、RDF抽出に必要な機能を拡張したものです。単独で利用することも可能ですが、ARC2_MicrodataParser.phpを使うためにはこのファイルが必須です。詳しくはreadme.txtを参照してください。

Microdata.php is an extension to MicrodataPHP.php by Lin Clark so that parsed microdata object can be used for RDF extraction. See readme.txt for more detail.