SlideShare una empresa de Scribd logo
1 de 27
Descargar para leer sin conexión
PigSPARQL
Mapping SPARQL to Pig Latin
3rd International Workshop on
Semantic Web Information Management (SWIM 2011)
Alexander Schätzle
Martin Przyjaciel-Zablocki
Georg Lausen
University of Freiburg
Databases & Information Systems
12 June 2011
1. Motivation
2. Framework
3. PigSPARQL
4. Evaluation
5. Summary
PigSPARQL: Mapping SPARQL to Pig Latin 2
Overview
Overview
 Semantic Web
◦ Amount of Semantic Data increases steadily
◦ RDF is W3C standard for representing Semantic Data
 Social Networks
◦ > 500 million active users in Facebook
◦ Interacting with >900 million objects (pages, groups, events)
◦ Social Graphs can also be represented in RDF
 But how can we execute SPARQL queries on very
large RDF datasets with billions of triples?
 Our Approach: Distributed execution of SPARQL
queries using MapReduce
PigSPARQL: Mapping SPARQL to Pig Latin 3
1. Motivation
Large RDF Graphs
Motivation
PigSPARQL: Mapping SPARQL to Pig Latin 4
2. Framework
MapReduce
MapReduce
 Automatic parallelization of computations
 Distributed File System
◦ Commodity hardware  Fault tolerance by replication
◦ Very large files / write-once, read-many pattern
 Apache Hadoop
◦ Well-known Open-Source implementation
split 1
split 0 Map
Map
Map
Reduce
Reduce
output 0
output 1
Map phase Shuffle & Sort Reduce phase
split 2
split 3
split 4
split 5
Input
(DFS)
Intermediate Results
(Local)
Output
(DFS)
 Properties of Pig Latin (Yahoo!)
◦ „High-Level“ Language for Data Analysis with Hadoop
◦ Automatic Translation into MapReduce-Jobs
◦ Link between User & MapReduce
 Utilize Advantages of MapReduce
◦ Parallelization done by the System
◦ Good Fault Tolerance & Scalability
 Avoid Drawbacks of MapReduce
◦ „Low-Level“ to implement & hard to maintain
◦ No Primitives like JOIN or GROUP
PigSPARQL: Mapping SPARQL to Pig Latin 5
2. Framework
Pig Latin
Pig Latin
 Data model of Pig Latin
◦ Flexible, fully nested
◦ Main Data type: Tuple -> Sequence of fields
◦ A field of a Tuple can be of any Data type, i.e.
PigSPARQL: Mapping SPARQL to Pig Latin 6
2. Framework
Pig Latin
Pig Latin (2)
'Bob' or 24
('John', 'Doe')
('Bob' , 'Sarah')
('Peter', ('likes', 'football'))
'knows' -> {('Sarah')}
'age' -> 24
Atom:
Tuple:
Bag:
Map:
 Important Operators of Pig Latin
PigSPARQL: Mapping SPARQL to Pig Latin 7
2. Framework
Pig Latin
Pig Latin (3)
FOREACH: Apply Processing on every Tuple of a Bag
result = FOREACH input GENERATE field1*field2 AS mul ;
FILTER: Delete unwanted Tuples of a Bag
adults = FILTER persons BY age >= 18 ;
[OUTER] JOIN: Join two or more Bags
result = JOIN left BY field1 [LEFT OUTER], right BY field2;
UNION: Combine two or more Bags
result = UNION bag1, bag2 ;
ORDER: Order a Bag by the specified field(s)
result = ORDER input BY field1 ;
[more]
3. PigSPARQL
Mapping SPARQL to Pig Latin
PigSPARQL: Mapping SPARQL to Pig Latin 8
3. PigSPARQL
 1. Step
◦ Convert SPARQL Query into SPARQL Algebra Tree
PigSPARQL: Mapping SPARQL to Pig Latin 9
3. PigSPARQL
SPARQL Algebra Tree
SPARQL Algebra Tree
BGP
?person age ?age.
?person knows :Peter
BGP
?person mbox ?mb
LeftJoin
Filter
?age >= 18
PREFIX : <http://example.org/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT *
WHERE {
?person foaf:age ?age .
?person foaf:knows :Peter
OPTIONAL {
?person foaf:mbox ?mb
}
FILTER (?age >= 18)
}
 2. Step
◦ Triple Pattern Reodering, Filter Pushing, Filter Substitution
PigSPARQL: Mapping SPARQL to Pig Latin 10
3. PigSPARQL
Algebra Optimization
SPARQL Algebra Optimization
BGP
?person knows :Peter.
?person age ?age
BGP
?person mbox ?mb
LeftJoin
Filter
?age >= 18
BGP
?person age ?age.
?person knows :Peter
BGP
?person mbox ?mb
LeftJoin
Filter
?age >= 18
 3. Step
◦ Translate Algebra Tree to Pig Latin Program
PigSPARQL: Mapping SPARQL to Pig Latin 11
3. PigSPARQL
Mapping to Pig Latin
Mapping to Pig Latin
indata = LOAD 'pathToFile' USING rdfLoader() AS (s,p,o) ;
BGP
?person knows :Peter.
?person age ?age
BGP
?person mbox ?mb
LeftJoin
Filter
?age >= 18
 3. Step
◦ Translate Algebra Tree to Pig Latin Program
PigSPARQL: Mapping SPARQL to Pig Latin 12
3. PigSPARQL
Mapping to Pig Latin
Mapping to Pig Latin (2)
indata = LOAD 'pathToFile' USING rdfLoader() AS (s,p,o) ;
f1 = FILTER indata BY p=='foaf:knows' AND o==':Peter' ;
t1 = FOREACH f1 GENERATE s AS person ;
f2 = FILTER indata BY p=='foaf:age';
t2 = FOREACH f2 GENERATE s AS person, o AS age ;
j1 = JOIN t1 BY person, t2 BY person ;
BGP1 = FOREACH j1 GENERATE
t1::person AS person, t2::age AS age ;
BGP
?person knows :Peter.
?person age ?age
BGP
?person mbox ?mb
LeftJoin
Filter
?age >= 18
 3. Step
◦ Translate Algebra Tree to Pig Latin Program
PigSPARQL: Mapping SPARQL to Pig Latin 13
3. PigSPARQL
Mapping to Pig Latin
Mapping to Pig Latin (3)
indata = LOAD 'pathToFile' USING rdfLoader() AS (s,p,o) ;
f1 = FILTER indata BY p=='foaf:knows' AND o==':Peter' ;
t1 = FOREACH f1 GENERATE s AS person ;
f2 = FILTER indata BY p=='foaf:age';
t2 = FOREACH f2 GENERATE s AS person, o AS age ;
j1 = JOIN t1 BY person, t2 BY person ;
BGP1 = FOREACH j1 GENERATE
t1::person AS person, t2::age AS age ;
F1 = FILTER BGP1 BY age >= 18 ;
BGP
?person knows :Peter.
?person age ?age
BGP
?person mbox ?mb
LeftJoin
Filter
?age >= 18
 3. Step
◦ Translate Algebra Tree to Pig Latin Program
PigSPARQL: Mapping SPARQL to Pig Latin 14
3. PigSPARQL
Mapping to Pig Latin
Mapping to Pig Latin (4)
indata = LOAD 'pathToFile' USING rdfLoader() AS (s,p,o) ;
f1 = FILTER indata BY p=='foaf:knows' AND o==':Peter' ;
t1 = FOREACH f1 GENERATE s AS person ;
f2 = FILTER indata BY p=='foaf:age';
t2 = FOREACH f2 GENERATE s AS person, o AS age ;
j1 = JOIN t1 BY person, t2 BY person ;
BGP1 = FOREACH j1 GENERATE
t1::person AS person, t2::age AS age ;
F1 = FILTER BGP1 BY age >= 18 ;
f1 = FILTER indata BY p=='foaf:mbox' ;
BGP2 = FOREACH indata GENERATE s AS person, o AS mb ;
BGP
?person knows :Peter.
?person age ?age
BGP
?person mbox ?mb
LeftJoin
Filter
?age >= 18
 3. Step
◦ Translate Algebra Tree to Pig Latin Program
PigSPARQL: Mapping SPARQL to Pig Latin 15
3. PigSPARQL
Mapping to Pig Latin
Mapping to Pig Latin (5)
indata = LOAD 'pathToFile' USING rdfLoader() AS (s,p,o) ;
f1 = FILTER indata BY p=='foaf:knows' AND o==':Peter' ;
t1 = FOREACH f1 GENERATE s AS person ;
f2 = FILTER indata BY p=='foaf:age';
t2 = FOREACH f2 GENERATE s AS person, o AS age ;
j1 = JOIN t1 BY person, t2 BY person ;
BGP1 = FOREACH j1 GENERATE
t1::person AS person, t2::age AS age ;
F1 = FILTER BGP1 BY age >= 18 ;
f1 = FILTER indata BY p=='foaf:mbox' ;
BGP2 = FOREACH indata GENERATE s AS person, o AS mb ;
lj = JOIN F1 BY person LEFT OUTER, BGP2 BY person ;
LJ1 = FOREACH lj GENERATE F1::person AS person,
F1::age AS age, BGP2::mb AS mb ;
STORE LJ1 INTO 'pathToOutput' USING resultWriter() ;
BGP
?person knows :Peter.
?person age ?age
BGP
?person mbox ?mb
LeftJoin
Filter
?age >= 18
 SPARQL Algebra
◦ Filter Optimization (Pushing, Splitting, Substitution)
◦ Triple Pattern Reordering by Selectivity
 Algebra Translation
◦ Delete unnecessary Data as early as possible
◦ Multi-Joins to reduce the number of Joins
 Data Representation
◦ Vertical Partitioning of the RDF Data by Predicate
PigSPARQL: Mapping SPARQL to Pig Latin 16
3. PigSPARQL
Optimizations
Optimizations
4. Evaluation
SP2Bench SPARQL Benchmark
PigSPARQL: Mapping SPARQL to Pig Latin 17
4. Evaluation
PigSPARQL: Mapping SPARQL to Pig Latin 18
4. Evaluation
Query 2
SP2Bench Query 2
SELECT ?inproc ?author ?booktitle ?title
?proc ?ee ?page ?url ?yr ?abstract
WHERE {
?inproc rdf:type bench:Inproceedings .
?inproc dc:creator ?author .
?inproc bench:booktitle ?booktitle .
?inproc dc:title ?title .
?inproc dcterms:partOf ?proc .
?inproc rdfs:seeAlso ?ee .
?inproc swrc:pages ?page .
?inproc foaf:homepage ?url .
?inproc dcterms:issued ?yr
OPTIONAL {
?inproc bench:abstract ?abstract
}
}
ORDER BY ?yr
 Native Translation needs 8 Joins + 1 Outer Join
 Optimizations:
 Multi-Join reduces the number of Joins
 Vertical Partitioning reduces input size
0
2
4
6
8
10
12
14
16
18
0 200 400 600 800 1000 1200 1400 1600
Time(hours)
RDF triples (in Millions)
Q2 native Q2 MJ Q2 MJ+VP
3171
1345
1244
2214
388
272
168
126
178
HDFS Bytes Read HDFS Bytes
Written
Reduce Shuffle
Bytes
in GB (1600M RDF triples)
Q2 native
Q2 MJ
Q2 MJ+VP
PigSPARQL: Mapping SPARQL to Pig Latin 19
4. Evaluation
Query 6
SP2Bench Query 6
SELECT ?yr ?name ?doc
WHERE {
?class rdfs:subClassOf foaf:Document .
?doc rdf:type ?class .
?doc dcterms:issued ?yr .
?doc dc:creator ?author .
?author foaf:name ?name
OPTIONAL {
?class2 rdfs:subClassOf foaf:Document .
?doc2 rdf:type ?class2 .
?doc2 dcterms:issued ?yr2 .
?doc2 dc:creator ?author2
FILTER (?author=?author2 && yr2 < yr)
} FILTER (!bound(?author2))
}
 Unsafe Filter Condition (not well designed)
 Implements a (closed world) negation
 Optimizations:
 Vertical Partitioning reduces input size
0
1
2
3
4
5
6
7
8
9
0 200 400 600 800 1000 1200 1400 1600
Time(hours)
RDF triples (in Millions)
Q6 Q6 VP
1545
682
258
451
398
183
905
798
367
HDFS Bytes Read HDFS Bytes
Written
Reduce Shuffle
Bytes
in GB (800M / 1600M RDF triples)
Q6 (800M)
Q6 VP (800M)
Q6 VP (1600M)
5. Summary
PigSPARQL: Key Points
PigSPARQL: Mapping SPARQL to Pig Latin 20
5. Summary
 PigSPARQL: SPARQL execution with MapReduce
 All features of SPARQL 1.0 (not only BGP)
 Evaluation with a SPARQL specific performance
benchmark (more complex queries than LUBM)
 Linear scaling behavior with up to 1.6 Billion triples
 Future Work: SPARQL 1.1
PigSPARQL: Mapping SPARQL to Pig Latin 21
5. Summary
Summary
PigSPARQL: Mapping SPARQL to Pig Latin 22
Questions
Thanks for your attention!
Questions?
Backup Slides
a) SPARQL Graph Pattern
b) Pig Latin – Operators
PigSPARQL: Mapping SPARQL to Pig Latin 23
Backup Slides
PigSPARQL: Mapping SPARQL to Pig Latin 24
Backup Slides
SPARQL
a) SPARQL Graph Pattern
↴ ↶
 Basic Graph Pattern
◦ Finite set of Triple Patterns concatenated with AND (.)
◦ A Triple Pattern is an RDF Triple with variables
 Graph Pattern
◦ A Basic Graph Pattern is a Graph Pattern
◦ If P and P' are Graph Patterns, then {P}.{P'}, {P} UNION {P'} and
{P} OPTIONAL {P'} are also Graph Patterns
◦ If P is a Graph Pattern and R is a Filter Condition, then
P FILTER (R) is also a Graph Pattern
◦ If P is a Graph Pattern, u an URI and ?v a variable, then
GRAPH u {P} and GRAPH ?v {P} are also Graph Pattern
PigSPARQL: Mapping SPARQL to Pig Latin 25
Backup Slides
Pig Latin
b) Pig Latin - Operators
↴ ↶
FOREACH: Apply Processing on every Tuple of a Bag
Ex: result = FOREACH input GENERATE field1*field2 AS mul ;
field1 field2
2 3
4 7
mul
6
28
input result
FILTER: Delete unwanted Tuples of a Bag
Ex: adults = FILTER persons BY age >= 18 ;
name age
Bob 21
Sarah 17
persons
adults
name age
Bob 21
PigSPARQL: Mapping SPARQL to Pig Latin 26
Backup Slides
Pig Latin
b) Pig Latin – Operators (2)
↴ ↶
field1
a
b
left
[OUTER] JOIN: Join two or more Bags
Ex: result = JOIN left BY field1 [LEFT OUTER], right BY field2 ;
field1 field2
4 a
7 a
right
left::
field1
right::
field1
right::
field2
a 4 a
a 7 a
result
field1
a
b
left
field1 field2
4 a
7 a
right
left::
field1
right::
field1
right::
field2
a 4 a
a 7 a
b
result
Outer
PigSPARQL: Mapping SPARQL to Pig Latin 27
Backup Slides
Pig Latin
b) Pig Latin – Operators (3)
↴ ↶
field1 field2
a 1
bag1
UNION: Ex: result = UNION bag1, bag2 ;
field1 field2
a 1
b 3
result
field1 field2
b 3
bag2
U
field1 field2
3 a
1 b
input
ORDER: Ex: result = ORDER input BY field1 ;
field1 field2
1 b
3 a
result

Más contenido relacionado

Similar a PigSPARQL - Mapping SPARQL to Pig Latin

Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILP
Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILPLec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILP
Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILPHsien-Hsin Sean Lee, Ph.D.
 
Introduction to Pig & Pig Latin | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Pig & Pig Latin | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Pig & Pig Latin | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Pig & Pig Latin | Big Data Hadoop Spark Tutorial | CloudxLabCloudxLab
 
The Semantics of SPARQL
The Semantics of SPARQLThe Semantics of SPARQL
The Semantics of SPARQLOlaf Hartig
 
NoSQL and Triple Stores
NoSQL and Triple StoresNoSQL and Triple Stores
NoSQL and Triple Storesandyseaborne
 
Kubernetes Chaos Engineering: Lessons Learned in Networking
Kubernetes Chaos Engineering: Lessons Learned in Networking Kubernetes Chaos Engineering: Lessons Learned in Networking
Kubernetes Chaos Engineering: Lessons Learned in Networking danielepolencic
 
The bytecode hocus pocus - JavaOne 2016
The bytecode hocus pocus - JavaOne 2016The bytecode hocus pocus - JavaOne 2016
The bytecode hocus pocus - JavaOne 2016Raimon Ràfols
 
Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and SemanticsTatiana Al-Chueyr
 
2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL Tiger2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL TigerAkihiro Okuno
 
Web Application Security 101 - 05 Enumeration
Web Application Security 101 - 05 EnumerationWeb Application Security 101 - 05 Enumeration
Web Application Security 101 - 05 EnumerationWebsecurify
 
The bytecode mumbo-jumbo
The bytecode mumbo-jumboThe bytecode mumbo-jumbo
The bytecode mumbo-jumboRaimon Ràfols
 
R getting spatial
R getting spatialR getting spatial
R getting spatialFAO
 
Lineage-driven Fault Injection, SIGMOD'15
Lineage-driven Fault Injection, SIGMOD'15Lineage-driven Fault Injection, SIGMOD'15
Lineage-driven Fault Injection, SIGMOD'15palvaro
 
VYOS & RPKI at the BGP as edge
VYOS & RPKI at the BGP as edgeVYOS & RPKI at the BGP as edge
VYOS & RPKI at the BGP as edgeFaelix Ltd
 
CASL2実行環境紹介
CASL2実行環境紹介CASL2実行環境紹介
CASL2実行環境紹介asuka y
 
Bootstrapping Meta-Languages of Language Workbenches
Bootstrapping Meta-Languages of Language WorkbenchesBootstrapping Meta-Languages of Language Workbenches
Bootstrapping Meta-Languages of Language WorkbenchesGabriël Konat
 
Service Function Chaining with SRv6
Service Function Chaining with SRv6Service Function Chaining with SRv6
Service Function Chaining with SRv6Ahmed AbdelSalam
 

Similar a PigSPARQL - Mapping SPARQL to Pig Latin (20)

Apache pig
Apache pigApache pig
Apache pig
 
Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILP
Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILPLec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILP
Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILP
 
Introduction to Pig & Pig Latin | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Pig & Pig Latin | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Pig & Pig Latin | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Pig & Pig Latin | Big Data Hadoop Spark Tutorial | CloudxLab
 
The Semantics of SPARQL
The Semantics of SPARQLThe Semantics of SPARQL
The Semantics of SPARQL
 
NoSQL and Triple Stores
NoSQL and Triple StoresNoSQL and Triple Stores
NoSQL and Triple Stores
 
inteSearch: An Intelligent Linked Data Information Access Framework
inteSearch: An Intelligent Linked Data Information Access FrameworkinteSearch: An Intelligent Linked Data Information Access Framework
inteSearch: An Intelligent Linked Data Information Access Framework
 
Pig latin
Pig latinPig latin
Pig latin
 
Kubernetes Chaos Engineering: Lessons Learned in Networking
Kubernetes Chaos Engineering: Lessons Learned in Networking Kubernetes Chaos Engineering: Lessons Learned in Networking
Kubernetes Chaos Engineering: Lessons Learned in Networking
 
Apache PIG
Apache PIGApache PIG
Apache PIG
 
The bytecode hocus pocus - JavaOne 2016
The bytecode hocus pocus - JavaOne 2016The bytecode hocus pocus - JavaOne 2016
The bytecode hocus pocus - JavaOne 2016
 
Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and Semantics
 
2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL Tiger2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL Tiger
 
Web Application Security 101 - 05 Enumeration
Web Application Security 101 - 05 EnumerationWeb Application Security 101 - 05 Enumeration
Web Application Security 101 - 05 Enumeration
 
The bytecode mumbo-jumbo
The bytecode mumbo-jumboThe bytecode mumbo-jumbo
The bytecode mumbo-jumbo
 
R getting spatial
R getting spatialR getting spatial
R getting spatial
 
Lineage-driven Fault Injection, SIGMOD'15
Lineage-driven Fault Injection, SIGMOD'15Lineage-driven Fault Injection, SIGMOD'15
Lineage-driven Fault Injection, SIGMOD'15
 
VYOS & RPKI at the BGP as edge
VYOS & RPKI at the BGP as edgeVYOS & RPKI at the BGP as edge
VYOS & RPKI at the BGP as edge
 
CASL2実行環境紹介
CASL2実行環境紹介CASL2実行環境紹介
CASL2実行環境紹介
 
Bootstrapping Meta-Languages of Language Workbenches
Bootstrapping Meta-Languages of Language WorkbenchesBootstrapping Meta-Languages of Language Workbenches
Bootstrapping Meta-Languages of Language Workbenches
 
Service Function Chaining with SRv6
Service Function Chaining with SRv6Service Function Chaining with SRv6
Service Function Chaining with SRv6
 

Último

Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Roomgirls4nights
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Sheetaleventcompany
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirtrahman018755
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebJames Anderson
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...aditipandeya
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 

Último (20)

Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girls
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 

PigSPARQL - Mapping SPARQL to Pig Latin

  • 1. PigSPARQL Mapping SPARQL to Pig Latin 3rd International Workshop on Semantic Web Information Management (SWIM 2011) Alexander Schätzle Martin Przyjaciel-Zablocki Georg Lausen University of Freiburg Databases & Information Systems 12 June 2011
  • 2. 1. Motivation 2. Framework 3. PigSPARQL 4. Evaluation 5. Summary PigSPARQL: Mapping SPARQL to Pig Latin 2 Overview Overview
  • 3.  Semantic Web ◦ Amount of Semantic Data increases steadily ◦ RDF is W3C standard for representing Semantic Data  Social Networks ◦ > 500 million active users in Facebook ◦ Interacting with >900 million objects (pages, groups, events) ◦ Social Graphs can also be represented in RDF  But how can we execute SPARQL queries on very large RDF datasets with billions of triples?  Our Approach: Distributed execution of SPARQL queries using MapReduce PigSPARQL: Mapping SPARQL to Pig Latin 3 1. Motivation Large RDF Graphs Motivation
  • 4. PigSPARQL: Mapping SPARQL to Pig Latin 4 2. Framework MapReduce MapReduce  Automatic parallelization of computations  Distributed File System ◦ Commodity hardware  Fault tolerance by replication ◦ Very large files / write-once, read-many pattern  Apache Hadoop ◦ Well-known Open-Source implementation split 1 split 0 Map Map Map Reduce Reduce output 0 output 1 Map phase Shuffle & Sort Reduce phase split 2 split 3 split 4 split 5 Input (DFS) Intermediate Results (Local) Output (DFS)
  • 5.  Properties of Pig Latin (Yahoo!) ◦ „High-Level“ Language for Data Analysis with Hadoop ◦ Automatic Translation into MapReduce-Jobs ◦ Link between User & MapReduce  Utilize Advantages of MapReduce ◦ Parallelization done by the System ◦ Good Fault Tolerance & Scalability  Avoid Drawbacks of MapReduce ◦ „Low-Level“ to implement & hard to maintain ◦ No Primitives like JOIN or GROUP PigSPARQL: Mapping SPARQL to Pig Latin 5 2. Framework Pig Latin Pig Latin
  • 6.  Data model of Pig Latin ◦ Flexible, fully nested ◦ Main Data type: Tuple -> Sequence of fields ◦ A field of a Tuple can be of any Data type, i.e. PigSPARQL: Mapping SPARQL to Pig Latin 6 2. Framework Pig Latin Pig Latin (2) 'Bob' or 24 ('John', 'Doe') ('Bob' , 'Sarah') ('Peter', ('likes', 'football')) 'knows' -> {('Sarah')} 'age' -> 24 Atom: Tuple: Bag: Map:
  • 7.  Important Operators of Pig Latin PigSPARQL: Mapping SPARQL to Pig Latin 7 2. Framework Pig Latin Pig Latin (3) FOREACH: Apply Processing on every Tuple of a Bag result = FOREACH input GENERATE field1*field2 AS mul ; FILTER: Delete unwanted Tuples of a Bag adults = FILTER persons BY age >= 18 ; [OUTER] JOIN: Join two or more Bags result = JOIN left BY field1 [LEFT OUTER], right BY field2; UNION: Combine two or more Bags result = UNION bag1, bag2 ; ORDER: Order a Bag by the specified field(s) result = ORDER input BY field1 ; [more]
  • 8. 3. PigSPARQL Mapping SPARQL to Pig Latin PigSPARQL: Mapping SPARQL to Pig Latin 8 3. PigSPARQL
  • 9.  1. Step ◦ Convert SPARQL Query into SPARQL Algebra Tree PigSPARQL: Mapping SPARQL to Pig Latin 9 3. PigSPARQL SPARQL Algebra Tree SPARQL Algebra Tree BGP ?person age ?age. ?person knows :Peter BGP ?person mbox ?mb LeftJoin Filter ?age >= 18 PREFIX : <http://example.org/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT * WHERE { ?person foaf:age ?age . ?person foaf:knows :Peter OPTIONAL { ?person foaf:mbox ?mb } FILTER (?age >= 18) }
  • 10.  2. Step ◦ Triple Pattern Reodering, Filter Pushing, Filter Substitution PigSPARQL: Mapping SPARQL to Pig Latin 10 3. PigSPARQL Algebra Optimization SPARQL Algebra Optimization BGP ?person knows :Peter. ?person age ?age BGP ?person mbox ?mb LeftJoin Filter ?age >= 18 BGP ?person age ?age. ?person knows :Peter BGP ?person mbox ?mb LeftJoin Filter ?age >= 18
  • 11.  3. Step ◦ Translate Algebra Tree to Pig Latin Program PigSPARQL: Mapping SPARQL to Pig Latin 11 3. PigSPARQL Mapping to Pig Latin Mapping to Pig Latin indata = LOAD 'pathToFile' USING rdfLoader() AS (s,p,o) ; BGP ?person knows :Peter. ?person age ?age BGP ?person mbox ?mb LeftJoin Filter ?age >= 18
  • 12.  3. Step ◦ Translate Algebra Tree to Pig Latin Program PigSPARQL: Mapping SPARQL to Pig Latin 12 3. PigSPARQL Mapping to Pig Latin Mapping to Pig Latin (2) indata = LOAD 'pathToFile' USING rdfLoader() AS (s,p,o) ; f1 = FILTER indata BY p=='foaf:knows' AND o==':Peter' ; t1 = FOREACH f1 GENERATE s AS person ; f2 = FILTER indata BY p=='foaf:age'; t2 = FOREACH f2 GENERATE s AS person, o AS age ; j1 = JOIN t1 BY person, t2 BY person ; BGP1 = FOREACH j1 GENERATE t1::person AS person, t2::age AS age ; BGP ?person knows :Peter. ?person age ?age BGP ?person mbox ?mb LeftJoin Filter ?age >= 18
  • 13.  3. Step ◦ Translate Algebra Tree to Pig Latin Program PigSPARQL: Mapping SPARQL to Pig Latin 13 3. PigSPARQL Mapping to Pig Latin Mapping to Pig Latin (3) indata = LOAD 'pathToFile' USING rdfLoader() AS (s,p,o) ; f1 = FILTER indata BY p=='foaf:knows' AND o==':Peter' ; t1 = FOREACH f1 GENERATE s AS person ; f2 = FILTER indata BY p=='foaf:age'; t2 = FOREACH f2 GENERATE s AS person, o AS age ; j1 = JOIN t1 BY person, t2 BY person ; BGP1 = FOREACH j1 GENERATE t1::person AS person, t2::age AS age ; F1 = FILTER BGP1 BY age >= 18 ; BGP ?person knows :Peter. ?person age ?age BGP ?person mbox ?mb LeftJoin Filter ?age >= 18
  • 14.  3. Step ◦ Translate Algebra Tree to Pig Latin Program PigSPARQL: Mapping SPARQL to Pig Latin 14 3. PigSPARQL Mapping to Pig Latin Mapping to Pig Latin (4) indata = LOAD 'pathToFile' USING rdfLoader() AS (s,p,o) ; f1 = FILTER indata BY p=='foaf:knows' AND o==':Peter' ; t1 = FOREACH f1 GENERATE s AS person ; f2 = FILTER indata BY p=='foaf:age'; t2 = FOREACH f2 GENERATE s AS person, o AS age ; j1 = JOIN t1 BY person, t2 BY person ; BGP1 = FOREACH j1 GENERATE t1::person AS person, t2::age AS age ; F1 = FILTER BGP1 BY age >= 18 ; f1 = FILTER indata BY p=='foaf:mbox' ; BGP2 = FOREACH indata GENERATE s AS person, o AS mb ; BGP ?person knows :Peter. ?person age ?age BGP ?person mbox ?mb LeftJoin Filter ?age >= 18
  • 15.  3. Step ◦ Translate Algebra Tree to Pig Latin Program PigSPARQL: Mapping SPARQL to Pig Latin 15 3. PigSPARQL Mapping to Pig Latin Mapping to Pig Latin (5) indata = LOAD 'pathToFile' USING rdfLoader() AS (s,p,o) ; f1 = FILTER indata BY p=='foaf:knows' AND o==':Peter' ; t1 = FOREACH f1 GENERATE s AS person ; f2 = FILTER indata BY p=='foaf:age'; t2 = FOREACH f2 GENERATE s AS person, o AS age ; j1 = JOIN t1 BY person, t2 BY person ; BGP1 = FOREACH j1 GENERATE t1::person AS person, t2::age AS age ; F1 = FILTER BGP1 BY age >= 18 ; f1 = FILTER indata BY p=='foaf:mbox' ; BGP2 = FOREACH indata GENERATE s AS person, o AS mb ; lj = JOIN F1 BY person LEFT OUTER, BGP2 BY person ; LJ1 = FOREACH lj GENERATE F1::person AS person, F1::age AS age, BGP2::mb AS mb ; STORE LJ1 INTO 'pathToOutput' USING resultWriter() ; BGP ?person knows :Peter. ?person age ?age BGP ?person mbox ?mb LeftJoin Filter ?age >= 18
  • 16.  SPARQL Algebra ◦ Filter Optimization (Pushing, Splitting, Substitution) ◦ Triple Pattern Reordering by Selectivity  Algebra Translation ◦ Delete unnecessary Data as early as possible ◦ Multi-Joins to reduce the number of Joins  Data Representation ◦ Vertical Partitioning of the RDF Data by Predicate PigSPARQL: Mapping SPARQL to Pig Latin 16 3. PigSPARQL Optimizations Optimizations
  • 17. 4. Evaluation SP2Bench SPARQL Benchmark PigSPARQL: Mapping SPARQL to Pig Latin 17 4. Evaluation
  • 18. PigSPARQL: Mapping SPARQL to Pig Latin 18 4. Evaluation Query 2 SP2Bench Query 2 SELECT ?inproc ?author ?booktitle ?title ?proc ?ee ?page ?url ?yr ?abstract WHERE { ?inproc rdf:type bench:Inproceedings . ?inproc dc:creator ?author . ?inproc bench:booktitle ?booktitle . ?inproc dc:title ?title . ?inproc dcterms:partOf ?proc . ?inproc rdfs:seeAlso ?ee . ?inproc swrc:pages ?page . ?inproc foaf:homepage ?url . ?inproc dcterms:issued ?yr OPTIONAL { ?inproc bench:abstract ?abstract } } ORDER BY ?yr  Native Translation needs 8 Joins + 1 Outer Join  Optimizations:  Multi-Join reduces the number of Joins  Vertical Partitioning reduces input size 0 2 4 6 8 10 12 14 16 18 0 200 400 600 800 1000 1200 1400 1600 Time(hours) RDF triples (in Millions) Q2 native Q2 MJ Q2 MJ+VP 3171 1345 1244 2214 388 272 168 126 178 HDFS Bytes Read HDFS Bytes Written Reduce Shuffle Bytes in GB (1600M RDF triples) Q2 native Q2 MJ Q2 MJ+VP
  • 19. PigSPARQL: Mapping SPARQL to Pig Latin 19 4. Evaluation Query 6 SP2Bench Query 6 SELECT ?yr ?name ?doc WHERE { ?class rdfs:subClassOf foaf:Document . ?doc rdf:type ?class . ?doc dcterms:issued ?yr . ?doc dc:creator ?author . ?author foaf:name ?name OPTIONAL { ?class2 rdfs:subClassOf foaf:Document . ?doc2 rdf:type ?class2 . ?doc2 dcterms:issued ?yr2 . ?doc2 dc:creator ?author2 FILTER (?author=?author2 && yr2 < yr) } FILTER (!bound(?author2)) }  Unsafe Filter Condition (not well designed)  Implements a (closed world) negation  Optimizations:  Vertical Partitioning reduces input size 0 1 2 3 4 5 6 7 8 9 0 200 400 600 800 1000 1200 1400 1600 Time(hours) RDF triples (in Millions) Q6 Q6 VP 1545 682 258 451 398 183 905 798 367 HDFS Bytes Read HDFS Bytes Written Reduce Shuffle Bytes in GB (800M / 1600M RDF triples) Q6 (800M) Q6 VP (800M) Q6 VP (1600M)
  • 20. 5. Summary PigSPARQL: Key Points PigSPARQL: Mapping SPARQL to Pig Latin 20 5. Summary
  • 21.  PigSPARQL: SPARQL execution with MapReduce  All features of SPARQL 1.0 (not only BGP)  Evaluation with a SPARQL specific performance benchmark (more complex queries than LUBM)  Linear scaling behavior with up to 1.6 Billion triples  Future Work: SPARQL 1.1 PigSPARQL: Mapping SPARQL to Pig Latin 21 5. Summary Summary
  • 22. PigSPARQL: Mapping SPARQL to Pig Latin 22 Questions Thanks for your attention! Questions?
  • 23. Backup Slides a) SPARQL Graph Pattern b) Pig Latin – Operators PigSPARQL: Mapping SPARQL to Pig Latin 23 Backup Slides
  • 24. PigSPARQL: Mapping SPARQL to Pig Latin 24 Backup Slides SPARQL a) SPARQL Graph Pattern ↴ ↶  Basic Graph Pattern ◦ Finite set of Triple Patterns concatenated with AND (.) ◦ A Triple Pattern is an RDF Triple with variables  Graph Pattern ◦ A Basic Graph Pattern is a Graph Pattern ◦ If P and P' are Graph Patterns, then {P}.{P'}, {P} UNION {P'} and {P} OPTIONAL {P'} are also Graph Patterns ◦ If P is a Graph Pattern and R is a Filter Condition, then P FILTER (R) is also a Graph Pattern ◦ If P is a Graph Pattern, u an URI and ?v a variable, then GRAPH u {P} and GRAPH ?v {P} are also Graph Pattern
  • 25. PigSPARQL: Mapping SPARQL to Pig Latin 25 Backup Slides Pig Latin b) Pig Latin - Operators ↴ ↶ FOREACH: Apply Processing on every Tuple of a Bag Ex: result = FOREACH input GENERATE field1*field2 AS mul ; field1 field2 2 3 4 7 mul 6 28 input result FILTER: Delete unwanted Tuples of a Bag Ex: adults = FILTER persons BY age >= 18 ; name age Bob 21 Sarah 17 persons adults name age Bob 21
  • 26. PigSPARQL: Mapping SPARQL to Pig Latin 26 Backup Slides Pig Latin b) Pig Latin – Operators (2) ↴ ↶ field1 a b left [OUTER] JOIN: Join two or more Bags Ex: result = JOIN left BY field1 [LEFT OUTER], right BY field2 ; field1 field2 4 a 7 a right left:: field1 right:: field1 right:: field2 a 4 a a 7 a result field1 a b left field1 field2 4 a 7 a right left:: field1 right:: field1 right:: field2 a 4 a a 7 a b result Outer
  • 27. PigSPARQL: Mapping SPARQL to Pig Latin 27 Backup Slides Pig Latin b) Pig Latin – Operators (3) ↴ ↶ field1 field2 a 1 bag1 UNION: Ex: result = UNION bag1, bag2 ; field1 field2 a 1 b 3 result field1 field2 b 3 bag2 U field1 field2 3 a 1 b input ORDER: Ex: result = ORDER input BY field1 ; field1 field2 1 b 3 a result