Overview
This is a memo on how to count the number of triples in an RDF store.
This time, we will use the Japan Search RDF store as an example.
https://jpsearch.go.jp/rdf/sparql/easy/
Number of Triples
You can count the number of triples with the following query.
The result is as follows.
As of the time of writing this article (May 6, 2024), there were 1,280,645,565 triples.
NumberOfTriples
1280645565
How Many Triples Are Connected by a Specific Property
Next, let’s count how many triples are connected by a specific property. Here is an example query.
The result is as follows.
We can see that there are 399,447,925 triples, approximately 400 million, connected by schema:description.
| p | count |
|---|---|
| schema:description | 399447925 |
| rdf:type | 84363276 |
| jps:relationType | 72908233 |
| jps:value | 72214780 |
| schema:name | 57377225 |
| schema:provider | 52481873 |
Counting Combinations of Specific Subject and Object Types Using a Specified Property
To understand the overview of the above connections, we count the combinations of subject types and object types where ?subject and ?object are linked by the schema:description property.
The result is as follows.
There were approximately 9,000 triples with instances of the type:図書 (Book) class as subjects.
| subjectType | objectType | count |
|---|---|---|
| type:図書 | 87593194 | |
| type:動物標本 | 47068657 | |
| type:植物標本 | 46548944 | |
| type:アクセス情報 | 33291083 | |
| type:雑誌 | 21643930 | |
| type:行政文書 | 11780814 |
Counting Instances
With the following query, we count the combinations of triples that have instances of the type:図書 (Book) class as subjects and schema:description as the property.
The result is as follows.
We can see that a single instance has many triples connected by schema:description.
By actually accessing the following URL, it was confirmed that there are indeed 251 triples.
https://jpsearch.go.jp/data/bibnl-20601759
Summary
I hope this is helpful for analyzing the number of triples in an RDF store.