FROST : RDF Triple Store with a SPARQL Query Engine
Version
1.1.0
Abstract
FROST is a fast in-memory RDF database system that compactly stores RDF triples.
Download
Example
RDF Data
<http://example.com/Woman> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://example.com/Human> .
<http://example.com/Man> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://example.com/Human> .
<http://example.com/Alice> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Woman> .
<http://example.com/Alice> <http://example/Properties#name> "Alice" .
<http://example.com/Alice> <http://example/Properties#age> "20" .
<http://example.com/Bob> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Man> .
<http://example.com/Bob> <http://example/Properties#name> "Bob" .
<http://example.com/Bob> <http://example/Properties#knows> <http://example.com/Alice> .
<http://example.com/Bob> <http://example/Properties#age> "21" .
Query1
#Query to search the name of the known female of Bob
PREFIX ex: <http://example.com/>
PREFIX prop: <http://example/Properties#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT * WHERE{ex:Bob prop:knows ?x .?x rdf:type ex:Woman .?x prop:name ?y .}
C:FROST>frost --data sample.nt --query query1.rq
----------------------------------------
| x
| y |
========================================
| <http://example.com/Alice> | "Alice" |
----------------------------------------
Query2
#Query to search the resources of distance 2 from Bob
PREFIX ex: <http://example.com/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?o1 ?o2 WHERE{ex:Bob ?p1 ?o1 .?o1 ?p ?o2 .}
C:FROST>frost --data sample.nt --query query2.rq
-----------------------------------------------------------
| o1
| o2
|
===========================================================
| <http://example.com/Alice> | "Alice"
|
| <http://example.com/Alice> | <http://example.com/Woman> |
| <http://example.com/Man> | <http://example.com/Human> |
-----------------------------------------------------------
Query3
#Query to search the type of Bob
PREFIX ex: <http://example.com/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT * WHERE{ex:Bob rdf:type ?x .}
C:FROST>frost --data sample.nt --query query3.rq
----------------------------
| x |
============================
| <http://example.com/Man> |
----------------------------
You can select the inference mode with the following option.
C:FROST>frost --data sample.nt --query query3.rq -inf
------------------------------
| x |
==============================
| <http://example.com/Man> |
| <http://example.com/Human> |
------------------------------
Query4
PREFIX ex: <http://example.com/>
PREFIX prop: <http://example/Properties#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT * WHERE{?person rdf:type ex:Human .?person prop:name ?name .
?person prop:age ?age .FILTER(?age >= 20 && REGEX(?name,"l"))}
C:FROST>frost --data sample.nt --query query4.rq -inf
-----------------------------------------------
| person
| name
| age |
===============================================
| <http://example.com/Alice> | "Alice" | "20" |
-----------------------------------------------
System Requirement
Java 7 or later.
Usage
java -jar frost.jar --data
<data_name> --query
<query_name> [-options]
<data_name> | N-Triples file |
<query_name> | Query file |
You can use a batch file as follows.
frost --data <data_name> --query <query_name> [-options]
Options
-version | Print version |
-help | Print help |
--result csv | Output with csv(faster than default format)
|
-inf | Inference mode
|
-once |
|
-comp | More compress mode
|
--ld num | Divide load (num split)
|
Index data is generated in folder(temporarydata) under current directory after FROST executed.
You delete the index data and execute FROST if you change inference mode or not.
Query
FROST supports a restricted query syntax of SPARQL.
You can see some examples of SELECT queries in the zipped file.
Syntax
Query | ::= | Prologue SelectQuery |
---|
Prologue | ::= | PrefixDecl* |
---|
PrefixDecl | ::= | 'PREFIX' PNAME_NS IRI_REF |
---|
SelectQuery | ::= | 'SELECT' ( Var+ | '*' ) WhereClause SolutionModifier |
---|
WhereClause | ::= | 'WHERE'? GroupGraphPattern |
---|
SolutionModifier | ::= | LimitOffsetClauses* |
---|
GroupGraphPattern | ::= | '{' TripleBlock? ('.' TripleBlock? )* '}' |
---|
TripleBlock | ::= | VarOrTerm ' ' VarOrTerm ' ' VarOrTerm |
---|
Publications
- K Fujiwara, K Kaneiwa, An Efficient Query Solution for Large RDF Graphs, Transactions of the Japanese Society for Artificial Intelligence, Vol. 29, No. 4, pp. 364-374, 2014 (in Japanese).[PDF]