Database Reference
In-Depth Information
SPARQL query
Parser
Syntax tree
Algebra compiler
Algebra tree
Algebra optimizer
Algebra tree
Pig Latin translator
Pig Latin program
Pig
MapReduce jobs
FIGURE 5.3
Modular translation process.
5.3 SParQl TRANSLATION
A translation of SPARQL to Pig Latin enables SPARQL query processing on a
MapReduce cluster, with the great advantage that it benefits from further develop-
ments of Apache Pig without any additional programming effort. This includes both,
performance enhancements and the support for newer versions of Hadoop like the
upcom ing YA R N* (MRv2) framework. For translating SPARQL to Pig Latin we
follow a standard approach that centers on an algebraic representation of SPARQL
expressions (cf. Figure 5.3). First, a SPARQL query is parsed to generate an abstract
syntax tree that is then translated into a SPARQL algebra tree as described by the
W3C documentation [2]. For the syntax and algebra tree generation we used the well-
known ARQ engine of the Jena framework. Before translating the resulting algebra
expressions into Pig Latin, certain optimizations are applied that will be explained later.
The semantics of a SPARQL query is defined on the algebra level and an expres-
sion of the SPARQL algebra can be represented as a tree that is evaluated bottom-up .
Table 5.1 shows the operators of the SPARQL algebra and the corresponding syntax
expressions.
5.3.1 rDF D ata m aPPing
To process RDF data sets with Pig Latin, we first have to define how to represent
an RDF triple in Pig Latin. An RDF triple is a tuple with three fields that can
consist of URIs (Uniform Resource Identifier), RDF literals or blank nodes . Since
URIs are strings in a special format, we represent them as atoms in angle brackets
( <URI> ). Simple and typed RDF literals can also be represented as atoms using a
compound value for literals with a language or data type tag ( "literal"@lang,
* http://hadoop.apache.org/docs/current/hadoop-yarn/hadoop-yarn-site/YARN.html.
http://jena.sourceforge.net/ARQ.
Search WWH ::




Custom Search