RacerPro 2.0 preview : The persistent triple store:
We want to show you the use of the AllegroGraph triple store as a persistent secondary memory for RacerPro 2.0 and how to perform reasoning with it.
Introduction
The SemWeb demo demonstrates the synergy between RacerPro 2.0 and AllegroGraph.
In practical applications, not all parts always require reasoning with expressive TBoxes (specified for instance in OWL ontologies). Indeed, for some purposes, classical data retrieval is just fine. However, in almost all real life scenarios there will be a large amount of data. Hence, data access must scale at least for the standard retrieval tasks. At the same time, it must be possible to apply expressive reasoning to (parts of) the data without producing copies of the data. For this purpose, we propose to use a triple store for RDF.
Very efficient client software is available to query and manipulate RDF triple stores. RacerPro relies on one of the fastest triple store for billions of triples: AllegroGraph form Franz Inc. The AllegroGraph triple store is part of RacerPro 2.0 preview.
Using a triple store has several advantages. On the one hand, triples may be manipulated and retrieved from programs (Turing-complete representations), e.g. Java programs or Common Lisp programs, without reasoning as usual in industrial applications. On the other hand, the same triples can be queried w.r.t. a background a background ontology. This involves reasoning and might result in additional, implicit triples to be found.
Background — Explanation of the principles
RacerPro allows for accessing existing AllegroGraph triple stores as well as for the creation of new ones. In the following example, an existing triple store is opened, and the triples are read into the knowledge base. Afterwards three nRQL queries are answering over the knowledge base. There is no need to write long-winded data extraction programs that move triples to OWL files on which, in turn, reasoning is then applied.
(evaluate
(let ((db (open-triple-store "test")))
(use-triple-store db :kb-name 'test-kb)))
(retrieve (?x
(:datatype-fillers (#!:name ?x))
(:datatype-fillers (#!:emailAddress ?x))
(:datatype-fillers (#!:telephone ?x)))
(and (?x #!:Professor)
(?x |http://www.Department0.University0.edu| #!:worksFor)
(?x (a #!:name))
(?x (a #!:emailAddress))
(?x (a #!:telephone))))
(retrieve (?x ?y ?z)
(and (?x ?y #!:advisor)
(?x ?z #!:takesCourse)
(?y ?z #!:teacherOf)
(?x #!:Student)
(?y #!:Faculty)
(?z #!:Course)))
(retrieve (?x ?y)
(and (?y |http://www.University0.edu| #!:subOrganizationOf)
(?y #!:Department)
(?x ?y #!:memberOf)
(?x #!:Chair)))
The examples should illustrate the flavor of how triples can be accessed from RacerPro. Currently, for reasoning, the triples are loaded into main memory by RacerPro. Thus, only a limited number of triples should be in the store. In a future version, reasoning will be done also on secondary memory.
A more comfortable querying of the triple store is possible using RacerPorter. In the example shown below, the query asking for all chairs of the university departments is formulated in a SQL-like syntax:
select ?x where (?x rdf:type lubm:Chair)
The result tuples can be selected in a separate presentation tab (Query IO) of the editor as illustrated below.
Afterwards, e.g., the corresponding inferred relational (role-filler) ABox struture can be viewed using one of the graph panes of RacerPorter (see below).
As mentioned before, it is not always the case that reasoning is required. Therefore, one can pose the same nRQL queries to secondary memory for very fast access (but without reasoning). RacerPro optimizes the queries in order to provide good averagecase performance.
(open-triple-store "test")
(pretrieve (?x
(:datatype-fillers (#!:name ?x))
(:datatype-fillers (#!:emailAddress ?x))
(:datatype-fillers (#!:telephone ?x)))
(and (?x #!:Professor)
(?x |http://www.Department0.University0.edu| #!:worksFor)
(?x (a #!:name))
(?x (a #!:emailAddress))
(?x (a #!:telephone))))
(pretrieve (?x ?y ?z)
(and (?x ?y #!:advisor)
(?x ?z #!:takesCourse)
(?y ?z #!:teacherOf)
(?x #!:Student)
(?y #!:Faculty)
(?z #!:Course)))
(pretrieve (?x ?y)
(and (?y |http://www.University0.edu| #!:subOrganizationOf)
(?y #!:Department)
(?x ?y #!:memberOf)
(?x #!:Chair)))
In addition, it is possible to materialize in a triple store what can be computed by applying reasoning w.r.t. a background ontology such that later on the results are available to all applications which may or may not use reasoning. It is possible to optimized index data structures for subsequent query answering.
(evaluate
(let ((db (open-triple-store "test")))
(use-triple-store db :kb-name 'test-kb :ignore-import t)
(materialize-inferences 'test-kb :db db :abox t :index-p t)))
A triple store may be created by RacerPro as well.
(evaluate
(let ((db (create-triple-store "test" :if-exists :supersede)))
(triple-store-read-file "..." :db db)))
Ad-hoc Querying with SPARQL
Queries can also be specified in the SPARQL language and can be executed with or without reasoning w.r.t. background ontologies.
(sparql-retrieve " PREFIX lubm: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#> SELECT ?x, ?y WHERE ( ?x lubm:subOrganizationOf "http://www.University0.edu" ) ( ?y rdf:type lubm:Department ) ( ?x lubm:memberOf ?y ) ( ?x rdf:type lubm:Chair ) ")
This is the SPARQL pendant to the third query in the example above.
Note that there is no need to store the OWL ontology in the triple store. With RacerPro you can access your existing triple store with various different OWL ontologies. An ontology can be put into a file or can possibly be retrieved from the Web. A triple store is then opened an queries are answered w.r.t. this triple store. The triple store corresponds to the ABox in this case.
Run the sample code
Please ensure that RacerPro is running in unsafe mode, i.e., start RacerPro with the command line option "-u" (as "RacerPro -- -u"), or simply launch RacerPorter from the RacerPro 2.0 directory which automatically launches RacerPro in unsafe mode.
Retrieve the example code from the distribution package or use the download option below. Extract the files and regard the Readme file for more information on how to set up the LUBM example.
|
|
Semantic Web examples for RacerPro 2.0 preview 259.2 KB Last modified: 02/10/2010 09:48:05 AM |
| This archive contains example files for the "Semantic Web tutorial". Where provided, please regard the enclosed "Readme" files for more information. |
