umakaparserが吐き出すJSONは以下のフィールドから成り立っています。
- meta_data
- prefixes
- classes
- properties
- inheritance_structure
それぞれどのように情報を取得しているのかについて記述します。
meta_data
は下記のフィールドを持ちます。
- endpoint: SPARQLエンドポイントのURL
- crawl_date: クロールが終了した日時
- triples: 総トリプル数
- classes: 総クラス数
- properties: 総プロパティ数
以上の内容を、sbmのTurleファイルが下記のような構造であることを想定した上で収集します。
@prefix sd: <http://www.w3.org/ns/sparql-service-description#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix sbm: <http://sparqlbuilder.org/2015/09/rdf-metadata-schema#> .
@prefix void: <http://rdfs.org/ns/void#> .
<サービスノード> a sd:Service ;
sd:endpoint <http://data.allie.dbcls.jp/sparql> ; #<<< endpoint
sd:defaultDataset <データセットノード> .
<データセットノード> a sd:Dataset ;
void:properties "33"^^xsd:long ; #<<< properties
void:classes "19"^^xsd:long ; #<<< classes
void:triples "150184110"^^xsd:long ; #<<< triples
<データセットノード> sbm:crawlLog <クロールログノード> .
<クロールログノード> a sbm:CrawlLog ;
sbm:crawlEndTime "2016-11-15T22:01:49.071+09:00"^^xsd:dateTime ; #<<< crawl_date
buildに与えたSBMファイル、build-indexで与えたオントロジーファイル全てからPREFIX宣言されているものを収集します。 PREFIX宣言が存在する時は、該当するURIを短縮します。 JSONには下記のように記述されます。
{
"prefixes": {
"xml": "http://www.w3.org/XML/1998/namespace",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#"
}
}
classes
は下記のようにJSONに記述されています。
{
"classes": {
":LongForm": {
"entities": 2638336,
"label": {
"en": "LongForm"
},
"rhs": [
[
":frequency",
null
],
[
"rdf:type",
"owl:Class"
],
[
"rdfs:label",
null
]
],
"lhs": [
[
":EachPair",
":hasLongFormOf"
]
]
}
}
}
クラスのURIをkeyとしてvalueのオブジェクトは以下です。
- entities: そのクラスのインスタンスの数です。
- label: そのクラスについて、オントロジーから収集したrdfs:labelの情報を元に言語タグをkey、ラベルをvalueとするオブジェクトです
- subClassOf: そのクラスについて、オントロジーから収集したrdfs:subClassOfの情報を元に親クラスのURIをArrayとしたものです
- rhs: そのクラスが主語となるトリプルがあるとき、述語と目的語となるクラスの一覧です。propertiesで紹介します。
- lhs: そのクラスが目的語となるトリプルがあるとき、主語と述語となるクラスの一覧です。propertiesで紹介します。
以上の内容を、sbmのTurleファイルが下記のような構造であることを想定した上で収集します。
@prefix sd: <http://www.w3.org/ns/sparql-service-description#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix sbm: <http://sparqlbuilder.org/2015/09/rdf-metadata-schema#> .
@prefix void: <http://rdfs.org/ns/void#> .
<サービスノード> a sd:Service ;
sd:endpoint <http://data.allie.dbcls.jp/sparql> ; #<<< endpoint
sd:defaultDataset <データセットノード> .
<データセットノード> void:classPartition <クラスパーティションノード>
<クラスパーティションノード> a void:Dataset ;
void:class <http://purl.org/allie/ontology/201108#LongForm> ; # <<< クラスのURI
void:entities "2638336"^^xsd:long . # <<< entities
properties
は以下のように記述されます。
{
"properties": [
{
"uri": ":frequency",
"triples": 8468287,
"class_relations": [
{
"triples": 3109687,
"object_class": "xsd:string",
"object_datatype": null,
"subject_class": ":EachPair"
},
{
"triples": 2638336,
"object_class": "xsd:string",
"object_datatype": null,
"subject_class": ":LongForm"
},
{
"triples": 743574,
"object_class": "xsd:string",
"object_datatype": null,
"subject_class": ":ShortForm"
}
]
}
]
}
properties
は以下のフィールドを持つオブジェクトのArrayで構成されています。
uri
は述語のURIです。triples
はこの述語が含まれるtripleの個数です。class_relations
は述語が取っている主語や目的語ごとに詳細化したものです。subject_class
は主語となるクラスのURIです。object_class
は目的語となるクラスのURIです。object_datatype
は目的語となるものがリテラルの時にその型のURIです。triples
はその主語と目的語の組み合わせを満たすtripleの個数です。
以上の内容を、sbmのTurleファイルが下記のような構造であることを想定した上で収集します。
@prefix sd: <http://www.w3.org/ns/sparql-service-description#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix sbm: <http://sparqlbuilder.org/2015/09/rdf-metadata-schema#> .
@prefix void: <http://rdfs.org/ns/void#> .
<サービスノード> a sd:Service ;
sd:endpoint <http://data.allie.dbcls.jp/sparql>
sd:defaultDataset <データセットノード> .
<データセットノード> a sd:Dataset ;
void:propertyPartition <プロパティパーティションノード> .
<プロパティパーティションノード> a void:Dataset ;
void:property <http://purl.org/allie/ontology/201108#frequency> ; #� <<< properties[].uri
void:triples "8468287"^^xsd:long ; # <<< properties[].triples
<プロパティパーティションノード> sbm:classRelation <クラスリレーションノード1> .
<クラスリレーションノード1> a sbm:ClassRelation ;
sbm:subjectClass <http://purl.org/allie/ontology/201108#EachPair> ; # <<< properties[].class_relations[].uri
sbm:objectDatatype xsd:string . # <<< properties[].class_relations[].object_datatype
void:triples "3109687"^^xsd:long ; # <<< properties[].class_relations[].triples
<プロパティパーティションノード> sbm:classRelation <クラスリレーションノード2> .
<クラスリレーションノード2> a sbm:ClassRelation ;
sbm:subjectClass <http://purl.org/allie/ontology/201108#LongForm> ; # <<< properties[].class_relations[].uri
sbm:objectClass <http://purl.org/allie/ontology/201108#ResearchArea> . # <<< properties[].class_relations[].object_class
void:triples "2638336"^^xsd:long ; # <<< properties[].class_relations[].triples
inheritance_structure
はbuild-index
に与えたオントロジーからrdfs:subClassOf
の情報を使って木構造を形成します。
以下のように記述されます。
{
"inheritance_structure": {
"uri": ":Pair",
"children": [
{
"uri": ":PairCluster"
},
{
"uri": ":EachPair"
}
]
}
}