SlideShare a Scribd company logo
RDF Processing for JAVA:
                             A comparative study

                                Ioanid Tibuleac, Cristian Turlica,
             1
                 Facultatea de Informatica, Universitatea „Al. I. Cuza“, Iasi, Romania
                            {ioanid.tibuleac, cristian.turlica}@info.uaic.ro



       Abstract. This paper aims to be an introduction to some RDF processing APIs
       for Java developers. The APIs that are given a brief description here are Jena
       and Sesame. Aspects like RDF storage capabilities, RDF access through
       SPARQL queries and overall programmer support are taken into consideration.
       Some tests have been conducted to estimate which of the two runs SPARQL
       queries faster on an in memory graph read from a file. Conclusions are that Jena
       will generally run slower then Sesame when executing a single query, but its
       optimizations allow it to perform better when executing a sequence of queries.

       Keywords: API, RDF, SPARQL, Java, Jena, Sesame.




1 Introduction

This paper discusses certain aspects of RDF processing APIs for Java developers. We
have chosen two of the most used APIs, according to our own opinion. Jena and
Sesame offer RDF data access, storage in files, sql or native RDF databases, querying
and inferencing. These features have made us select them as our test case.


2 Jena RDF Api

Jena is an open source Semantic Web Framework for Java developed by researchers
from HP Labs Semantic Web Programme [1]. It provides support for RDF
manipulation, from creation and storage of statements, to SPARQL queries and RDF
graph operations. Besides the RDF API, the Jena framework also contains the OWL
API, a component for processing ontology, and a rule based inference engine.
   In Jena RDF elements have been modeled into Java classes. The RDF graph
concept is called model and is handled using an instance of the Model class. Other
concepts like resource, property and literal are represented by the Resource, Property
and Literal interfaces.
   These interfaces are contained in the jena.rdf.model package, toghether with a
ModelFactory that allows the creation of models with various storage methods. The
model is built as a set of statements, thus elimininating the existance of duplicates,
and supports the union, intersection and difference graph operations. The
jena.rdf.impl package offers implementation for the interfaces of the RDF elements
that is used by the model.
   The Jena framework offers various representation modes for RDF triples. Besides
memory and file storage, Jena comes with two systems designed to persist RDF
information, the TDB and SDB.
   File level storage is obtained using Java InputStreams and OutputStreams. Though
the API also contains methods to read or write triples with either a Java Reader or
Writer class, there is a strong warning about using these methods when writing files.
Problems may appear due to the encoding of the output file. Supported RDF formats
are RDF/XML, RDF/XML-ABBREV, N3,N-TRIPLE and TURTLE.
   The SDB offers RDF persistence using conventional SQL databases. As a result,
specific database tools can be used to improve and secure data access, while offering
support for SPARQL queries. A multitude of database management systems can be
used, including Microsoft Sql Server 2005, Oracle 10g and PostgreSQL.
   The TDB offers native support for triples and SPARQL queries, allowing custom
indexing and storage. This Java engine uses both static and dinamic optimization of
SPARQL queries, taking into account partially retrieved data. These features make
the TDB engine faster then the SBD, according to the developers.
   The Jena framework contains an implementation of the W3C SPARQL
specifications, the ARQ query engine. The access given by the model interface is
limited to iterating statements that satisfy certain conditions, but this is extended by
the jena.rdf.query package. The supported SPARQL constructs are SELECT,
CONSTRUCT, DESCRIBE and ASK.
   The Jena framework comes with documentation and tutorials that allow
programers to easily test its capabilities. In depth information is also available for
more experienced users. Community information is also available on various sites,
like [5], showing that the Jena framework is used and that its development will be
continued.


3 Sesame

Sesame is an open source framework for storage, infering and querying the RDF data
[2]. The RDF API may be used to manipulate statements in a normal java application,
or as a part of a client –server application. The Sesame framework also contains a
Http Server that can be addressed using the SPARQL protocol.
   The Sesame framework has a more complex architecture. At the bases of the
architecture is the RDF Model where the basic RDF concepts, like literal or statement,
are defined as interfaces. There are other specialized components, like the Rio (RDF
I/O) that manage reading and writing RDF to various file formats and the Sail API
(Storage and Inference API) that gives uniform access to a RDF storage regardless of
what it may be. The API used to manipulate RDF data at a higher level is the
Repository API that offers access via the Sail API or via Http to a remote repository.
   Sesame offers in memory, native and remote access to RDF data.
   The Sesame framework uses the SeRQL (Sesame RDF Query Language).
Apperantly this language is very similar to SPARQL and features have been adopted
back and forth between the two. Thought we did not take time to notice significant
differences between the two, a partially different language then the standard may
require additional time to get used to.
   The Sesame framework comes with a lot of documentation, but unfortunately it
may prove to be too difficult for less experienced users. Running a simple program
has proven, at first, a little difficult for us, because of the additional libraries used by
the Repository API (for example Simple Logging Façade for Java). As a result we
have turned to online help like [4]. Overall, the documentation is perhaps more
detailed then the one for Jena, but simple examples are scarce.


4 SPARQL Tests

We have made several tests using the two APIs and a two RDF files that vary in size.
The development environment used was Eclipse. We have used a code sample for
Sesame available at [4]. Our main focus was testing SPARQL query execution speed,
using files as storage for the RDF statements.
   The first RDF file is a larger file containing information about sessions and
speakers at a conference [3]. The SPARQL query selects information about distinct
presentations:
            SELECT DISTINCT ?title ?presenter ?description
            WHERE
            {
               ?session rdf:type svcc:Session .
               ?session dc:title ?title .
               ?session svcc:presenter ?presenter .
               ?session dc:description ?description .
            };
   Execution times obviously favor Sesame over Jena (as shown in the table below).
The documentation for Jena explains that a search is conducted for the reuse of the
rdf:ID element and this may cause a slower response when reading large files.

    Query 1 execution                      Jena                          Sesame
            1                              2172                            656
            2                              2094                            625
            3                              2125                            687
            4                              2062                            625
            5                              2031                            641

   The same situation occurs for the second query that searches in a file containing
information about semantic web tools [6], though the timing difference is reduced.
            SELECT ?nume ?url ?limbaj
            WHERE {
              [g:label ?nume;
               g:URL ?url ;
g:FOSS ?foss ;
                g:Category ?categ ;
                g:Language ?limbaj ] .
               FILTER( ?foss = ‘Yes’ &&
                ?categ = ‘Database/Datastore’ &&
                (?limbaj = ‘PHP’ || regex (?limbaj, ‘^C’))) .
              } ORDER BY ?limbaj

     Query 2 execution                      Jena                           Sesame
             1                              1860                             656
             2                              1875                             672
             3                              1891                             672
             4                              1875                             688
             5                              1813                             688

  Runing both tests shows that Jena’s execution speed increases as more queries are
made, getting close to the performance of Sesame.

     Combined           Jena Q1           Jena Q2            Sesame Q1          Sesame Q2
     execution
         1                2110               234                 765                 188
         2                2782               250                 985                 265
         3                3063               406                1156                 250
         4                2156               187                 719                 187
         5                2251               265                 735                 203

   Out initial tests were somewhat different because we used a Sesame repository
object with inferencing, although there was no need for it. In this case, Sesame’s
performance decreased but it still managed to outrun Jena on single query execution.
However, multiple query execution confirmed that Jena can perform better in such
cases.
   In conclusion, we see the Jena RDF API as an easier starting point for most
programmers, thought it might not be as complex as the Sesame framework.


References

1. Jena website, http://jena.sourceforge.net/documentation.html
2. Sesame website, http://www.openrdf.org/documentation.jsp
3. Hewett Research, http://www.hewettresearch.com/svcc2009/
4. “How to use the Sesame Java API to power a Web or Client – Server Application",
   http://answers.oreilly.com/topic/447-how-to-use-the-sesame-java-api-to-power-a-web-or-
   client-server-application/
5. “Jena, A Java API for RDF”, http://www.docstoc.com/docs/13042314/Jena-----A-Java-API-
   for-RDF
6. Sweet rdf file, http://profs.info.uaic.ro/~busaco/teach/courses/wade/demos/sparql/sparql.zip

More Related Content

What's hot

A first Draft to Java Configuration
A first Draft to Java ConfigurationA first Draft to Java Configuration
A first Draft to Java ConfigurationAnatole Tresch
 
CDI Best Practices with Real-Life Examples - TUT3287
CDI Best Practices with Real-Life Examples - TUT3287CDI Best Practices with Real-Life Examples - TUT3287
CDI Best Practices with Real-Life Examples - TUT3287Ahmad Gohar
 
The latest features coming to Java 12
The latest features coming to Java 12The latest features coming to Java 12
The latest features coming to Java 12NexSoftsys
 
Java 12 - New features in action
Java 12 -   New features in actionJava 12 -   New features in action
Java 12 - New features in actionMarco Molteni
 
ORC Improvement & Roadmap in Apache Spark 2.3 and 2.4
ORC Improvement & Roadmap in Apache Spark 2.3 and 2.4ORC Improvement & Roadmap in Apache Spark 2.3 and 2.4
ORC Improvement & Roadmap in Apache Spark 2.3 and 2.4Dongjoon Hyun
 
Performance Update: When Apache ORC Met Apache Spark
Performance Update: When Apache ORC Met Apache SparkPerformance Update: When Apache ORC Met Apache Spark
Performance Update: When Apache ORC Met Apache SparkDataWorks Summit
 
Configuration with Apache Tamaya
Configuration with Apache TamayaConfiguration with Apache Tamaya
Configuration with Apache TamayaAnatole Tresch
 
AWS Observability Made Simple
AWS Observability Made SimpleAWS Observability Made Simple
AWS Observability Made SimpleLuciano Mammino
 
Case Study: Credit Card Core System with Exalogic, Exadata, Oracle Cloud Mach...
Case Study: Credit Card Core System with Exalogic, Exadata, Oracle Cloud Mach...Case Study: Credit Card Core System with Exalogic, Exadata, Oracle Cloud Mach...
Case Study: Credit Card Core System with Exalogic, Exadata, Oracle Cloud Mach...Hirofumi Iwasaki
 
Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Shaer Hassan
 
My sql 56_roadmap_april2012
My sql 56_roadmap_april2012My sql 56_roadmap_april2012
My sql 56_roadmap_april2012sqlhjalp
 
ORC File - Optimizing Your Big Data
ORC File - Optimizing Your Big DataORC File - Optimizing Your Big Data
ORC File - Optimizing Your Big DataDataWorks Summit
 
Java EE 7 with Apache Spark for the World’s Largest Credit Card Core Systems ...
Java EE 7 with Apache Spark for the World’s Largest Credit Card Core Systems ...Java EE 7 with Apache Spark for the World’s Largest Credit Card Core Systems ...
Java EE 7 with Apache Spark for the World’s Largest Credit Card Core Systems ...Hirofumi Iwasaki
 
2012 replication
2012 replication2012 replication
2012 replicationsqlhjalp
 
ORC improvement in Apache Spark 2.3
ORC improvement in Apache Spark 2.3ORC improvement in Apache Spark 2.3
ORC improvement in Apache Spark 2.3Dongjoon Hyun
 

What's hot (19)

A first Draft to Java Configuration
A first Draft to Java ConfigurationA first Draft to Java Configuration
A first Draft to Java Configuration
 
CDI Best Practices with Real-Life Examples - TUT3287
CDI Best Practices with Real-Life Examples - TUT3287CDI Best Practices with Real-Life Examples - TUT3287
CDI Best Practices with Real-Life Examples - TUT3287
 
The latest features coming to Java 12
The latest features coming to Java 12The latest features coming to Java 12
The latest features coming to Java 12
 
Shaik Abbas DBA
Shaik Abbas DBAShaik Abbas DBA
Shaik Abbas DBA
 
Java 12 - New features in action
Java 12 -   New features in actionJava 12 -   New features in action
Java 12 - New features in action
 
ORC Improvement & Roadmap in Apache Spark 2.3 and 2.4
ORC Improvement & Roadmap in Apache Spark 2.3 and 2.4ORC Improvement & Roadmap in Apache Spark 2.3 and 2.4
ORC Improvement & Roadmap in Apache Spark 2.3 and 2.4
 
Performance Update: When Apache ORC Met Apache Spark
Performance Update: When Apache ORC Met Apache SparkPerformance Update: When Apache ORC Met Apache Spark
Performance Update: When Apache ORC Met Apache Spark
 
Configuration with Apache Tamaya
Configuration with Apache TamayaConfiguration with Apache Tamaya
Configuration with Apache Tamaya
 
AWS Observability Made Simple
AWS Observability Made SimpleAWS Observability Made Simple
AWS Observability Made Simple
 
Case Study: Credit Card Core System with Exalogic, Exadata, Oracle Cloud Mach...
Case Study: Credit Card Core System with Exalogic, Exadata, Oracle Cloud Mach...Case Study: Credit Card Core System with Exalogic, Exadata, Oracle Cloud Mach...
Case Study: Credit Card Core System with Exalogic, Exadata, Oracle Cloud Mach...
 
Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09
 
My sql 56_roadmap_april2012
My sql 56_roadmap_april2012My sql 56_roadmap_april2012
My sql 56_roadmap_april2012
 
ORC File - Optimizing Your Big Data
ORC File - Optimizing Your Big DataORC File - Optimizing Your Big Data
ORC File - Optimizing Your Big Data
 
Ruby on rails
Ruby on railsRuby on rails
Ruby on rails
 
361 Rac
361 Rac361 Rac
361 Rac
 
Cloud Native Java:GraalVM
Cloud Native Java:GraalVMCloud Native Java:GraalVM
Cloud Native Java:GraalVM
 
Java EE 7 with Apache Spark for the World’s Largest Credit Card Core Systems ...
Java EE 7 with Apache Spark for the World’s Largest Credit Card Core Systems ...Java EE 7 with Apache Spark for the World’s Largest Credit Card Core Systems ...
Java EE 7 with Apache Spark for the World’s Largest Credit Card Core Systems ...
 
2012 replication
2012 replication2012 replication
2012 replication
 
ORC improvement in Apache Spark 2.3
ORC improvement in Apache Spark 2.3ORC improvement in Apache Spark 2.3
ORC improvement in Apache Spark 2.3
 

Viewers also liked

Un Nino Y Un Perro(Diana,Areli 1 B)
Un Nino Y Un Perro(Diana,Areli 1 B)Un Nino Y Un Perro(Diana,Areli 1 B)
Un Nino Y Un Perro(Diana,Areli 1 B)SOFIA
 
Рекламная стратегия Virgin
Рекламная стратегия  VirginРекламная стратегия  Virgin
Рекламная стратегия VirginAnya88booms
 
Blog Trip Summary
Blog  Trip SummaryBlog  Trip Summary
Blog Trip Summarygapostol
 
Who Is This Man?
Who Is  This  Man?Who Is  This  Man?
Who Is This Man?Kathy Man
 
エコなWebサーバー
エコなWebサーバーエコなWebサーバー
エコなWebサーバーemasaka
 
presentations
presentationspresentations
presentationsMISY
 

Viewers also liked (8)

Bewerbung
BewerbungBewerbung
Bewerbung
 
Un Nino Y Un Perro(Diana,Areli 1 B)
Un Nino Y Un Perro(Diana,Areli 1 B)Un Nino Y Un Perro(Diana,Areli 1 B)
Un Nino Y Un Perro(Diana,Areli 1 B)
 
B7300
B7300B7300
B7300
 
Рекламная стратегия Virgin
Рекламная стратегия  VirginРекламная стратегия  Virgin
Рекламная стратегия Virgin
 
Blog Trip Summary
Blog  Trip SummaryBlog  Trip Summary
Blog Trip Summary
 
Who Is This Man?
Who Is  This  Man?Who Is  This  Man?
Who Is This Man?
 
エコなWebサーバー
エコなWebサーバーエコなWebサーバー
エコなWebサーバー
 
presentations
presentationspresentations
presentations
 

Similar to Rdf Processing For Java A Comparative Study

RDF_API_Java_Stefan_Apostoaie
RDF_API_Java_Stefan_ApostoaieRDF_API_Java_Stefan_Apostoaie
RDF_API_Java_Stefan_Apostoaieiosstef
 
Comparative Study That Aims Rdf Processing For The Java Platform
Comparative Study That Aims Rdf Processing For The Java PlatformComparative Study That Aims Rdf Processing For The Java Platform
Comparative Study That Aims Rdf Processing For The Java PlatformComputer Science
 
Programming in Spark - Lessons Learned in OpenAire project
Programming in Spark - Lessons Learned in OpenAire projectProgramming in Spark - Lessons Learned in OpenAire project
Programming in Spark - Lessons Learned in OpenAire projectŁukasz Dumiszewski
 
Java 7 Dolphin manjula kollipara
Java 7 Dolphin manjula kolliparaJava 7 Dolphin manjula kollipara
Java 7 Dolphin manjula kolliparaManjula Kollipara
 
Rdf Processing Tools In Java
Rdf Processing Tools In JavaRdf Processing Tools In Java
Rdf Processing Tools In JavaDicusarCorneliu
 
Rollin onj Rubyv3
Rollin onj Rubyv3Rollin onj Rubyv3
Rollin onj Rubyv3Oracle
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Arun Gupta
 
Learn about SPARK tool and it's componemts
Learn about SPARK tool and it's componemtsLearn about SPARK tool and it's componemts
Learn about SPARK tool and it's componemtssiddharth30121
 
Grails And The Semantic Web
Grails And The Semantic WebGrails And The Semantic Web
Grails And The Semantic Webwilliam_greenly
 
Bring the Spark To Your Eyes
Bring the Spark To Your EyesBring the Spark To Your Eyes
Bring the Spark To Your EyesDemi Ben-Ari
 
Scala: An experience report
Scala: An experience reportScala: An experience report
Scala: An experience reportMark Needham
 
04.egovFrame Runtime Environment Workshop
04.egovFrame Runtime Environment Workshop04.egovFrame Runtime Environment Workshop
04.egovFrame Runtime Environment WorkshopChuong Nguyen
 
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Espen Brækken
 
Breathing new life into JSP with OSGi? Why!!! - R Auge
Breathing new life into JSP with OSGi? Why!!! - R AugeBreathing new life into JSP with OSGi? Why!!! - R Auge
Breathing new life into JSP with OSGi? Why!!! - R Augemfrancis
 
Introduction To J Boss Seam
Introduction To J Boss SeamIntroduction To J Boss Seam
Introduction To J Boss Seamashishkulkarni
 
Spark r under the hood with Hossein Falaki
Spark r under the hood with Hossein FalakiSpark r under the hood with Hossein Falaki
Spark r under the hood with Hossein FalakiDatabricks
 

Similar to Rdf Processing For Java A Comparative Study (20)

RDF_API_Java_Stefan_Apostoaie
RDF_API_Java_Stefan_ApostoaieRDF_API_Java_Stefan_Apostoaie
RDF_API_Java_Stefan_Apostoaie
 
Comparative Study That Aims Rdf Processing For The Java Platform
Comparative Study That Aims Rdf Processing For The Java PlatformComparative Study That Aims Rdf Processing For The Java Platform
Comparative Study That Aims Rdf Processing For The Java Platform
 
Programming in Spark - Lessons Learned in OpenAire project
Programming in Spark - Lessons Learned in OpenAire projectProgramming in Spark - Lessons Learned in OpenAire project
Programming in Spark - Lessons Learned in OpenAire project
 
Java 7 Dolphin manjula kollipara
Java 7 Dolphin manjula kolliparaJava 7 Dolphin manjula kollipara
Java 7 Dolphin manjula kollipara
 
Rdf Processing Tools In Java
Rdf Processing Tools In JavaRdf Processing Tools In Java
Rdf Processing Tools In Java
 
Rollin onj Rubyv3
Rollin onj Rubyv3Rollin onj Rubyv3
Rollin onj Rubyv3
 
Empire: JPA for RDF & SPARQL
Empire: JPA for RDF & SPARQLEmpire: JPA for RDF & SPARQL
Empire: JPA for RDF & SPARQL
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
 
Scala a case4
Scala a case4Scala a case4
Scala a case4
 
.NET RDF APIS
.NET RDF APIS.NET RDF APIS
.NET RDF APIS
 
Learn about SPARK tool and it's componemts
Learn about SPARK tool and it's componemtsLearn about SPARK tool and it's componemts
Learn about SPARK tool and it's componemts
 
Grails And The Semantic Web
Grails And The Semantic WebGrails And The Semantic Web
Grails And The Semantic Web
 
Bring the Spark To Your Eyes
Bring the Spark To Your EyesBring the Spark To Your Eyes
Bring the Spark To Your Eyes
 
Scala: An experience report
Scala: An experience reportScala: An experience report
Scala: An experience report
 
04.egovFrame Runtime Environment Workshop
04.egovFrame Runtime Environment Workshop04.egovFrame Runtime Environment Workshop
04.egovFrame Runtime Environment Workshop
 
Spark
SparkSpark
Spark
 
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex
 
Breathing new life into JSP with OSGi? Why!!! - R Auge
Breathing new life into JSP with OSGi? Why!!! - R AugeBreathing new life into JSP with OSGi? Why!!! - R Auge
Breathing new life into JSP with OSGi? Why!!! - R Auge
 
Introduction To J Boss Seam
Introduction To J Boss SeamIntroduction To J Boss Seam
Introduction To J Boss Seam
 
Spark r under the hood with Hossein Falaki
Spark r under the hood with Hossein FalakiSpark r under the hood with Hossein Falaki
Spark r under the hood with Hossein Falaki
 

Recently uploaded

Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXMIRIAMSALINAS13
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfTamralipta Mahavidyalaya
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxCapitolTechU
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfbu07226
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfQucHHunhnh
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resourcesaileywriter
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345beazzy04
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxbennyroshan06
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxDenish Jangid
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportAvinash Rai
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfPo-Chuan Chen
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfVivekanand Anglo Vedic Academy
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online PresentationGDSCYCCE
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersPedroFerreira53928
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxakshayaramakrishnan21
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chipsGeoBlogs
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePedroFerreira53928
 

Recently uploaded (20)

Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resources
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 

Rdf Processing For Java A Comparative Study

  • 1. RDF Processing for JAVA: A comparative study Ioanid Tibuleac, Cristian Turlica, 1 Facultatea de Informatica, Universitatea „Al. I. Cuza“, Iasi, Romania {ioanid.tibuleac, cristian.turlica}@info.uaic.ro Abstract. This paper aims to be an introduction to some RDF processing APIs for Java developers. The APIs that are given a brief description here are Jena and Sesame. Aspects like RDF storage capabilities, RDF access through SPARQL queries and overall programmer support are taken into consideration. Some tests have been conducted to estimate which of the two runs SPARQL queries faster on an in memory graph read from a file. Conclusions are that Jena will generally run slower then Sesame when executing a single query, but its optimizations allow it to perform better when executing a sequence of queries. Keywords: API, RDF, SPARQL, Java, Jena, Sesame. 1 Introduction This paper discusses certain aspects of RDF processing APIs for Java developers. We have chosen two of the most used APIs, according to our own opinion. Jena and Sesame offer RDF data access, storage in files, sql or native RDF databases, querying and inferencing. These features have made us select them as our test case. 2 Jena RDF Api Jena is an open source Semantic Web Framework for Java developed by researchers from HP Labs Semantic Web Programme [1]. It provides support for RDF manipulation, from creation and storage of statements, to SPARQL queries and RDF graph operations. Besides the RDF API, the Jena framework also contains the OWL API, a component for processing ontology, and a rule based inference engine. In Jena RDF elements have been modeled into Java classes. The RDF graph concept is called model and is handled using an instance of the Model class. Other concepts like resource, property and literal are represented by the Resource, Property and Literal interfaces. These interfaces are contained in the jena.rdf.model package, toghether with a ModelFactory that allows the creation of models with various storage methods. The model is built as a set of statements, thus elimininating the existance of duplicates, and supports the union, intersection and difference graph operations. The
  • 2. jena.rdf.impl package offers implementation for the interfaces of the RDF elements that is used by the model. The Jena framework offers various representation modes for RDF triples. Besides memory and file storage, Jena comes with two systems designed to persist RDF information, the TDB and SDB. File level storage is obtained using Java InputStreams and OutputStreams. Though the API also contains methods to read or write triples with either a Java Reader or Writer class, there is a strong warning about using these methods when writing files. Problems may appear due to the encoding of the output file. Supported RDF formats are RDF/XML, RDF/XML-ABBREV, N3,N-TRIPLE and TURTLE. The SDB offers RDF persistence using conventional SQL databases. As a result, specific database tools can be used to improve and secure data access, while offering support for SPARQL queries. A multitude of database management systems can be used, including Microsoft Sql Server 2005, Oracle 10g and PostgreSQL. The TDB offers native support for triples and SPARQL queries, allowing custom indexing and storage. This Java engine uses both static and dinamic optimization of SPARQL queries, taking into account partially retrieved data. These features make the TDB engine faster then the SBD, according to the developers. The Jena framework contains an implementation of the W3C SPARQL specifications, the ARQ query engine. The access given by the model interface is limited to iterating statements that satisfy certain conditions, but this is extended by the jena.rdf.query package. The supported SPARQL constructs are SELECT, CONSTRUCT, DESCRIBE and ASK. The Jena framework comes with documentation and tutorials that allow programers to easily test its capabilities. In depth information is also available for more experienced users. Community information is also available on various sites, like [5], showing that the Jena framework is used and that its development will be continued. 3 Sesame Sesame is an open source framework for storage, infering and querying the RDF data [2]. The RDF API may be used to manipulate statements in a normal java application, or as a part of a client –server application. The Sesame framework also contains a Http Server that can be addressed using the SPARQL protocol. The Sesame framework has a more complex architecture. At the bases of the architecture is the RDF Model where the basic RDF concepts, like literal or statement, are defined as interfaces. There are other specialized components, like the Rio (RDF I/O) that manage reading and writing RDF to various file formats and the Sail API (Storage and Inference API) that gives uniform access to a RDF storage regardless of what it may be. The API used to manipulate RDF data at a higher level is the Repository API that offers access via the Sail API or via Http to a remote repository. Sesame offers in memory, native and remote access to RDF data. The Sesame framework uses the SeRQL (Sesame RDF Query Language). Apperantly this language is very similar to SPARQL and features have been adopted
  • 3. back and forth between the two. Thought we did not take time to notice significant differences between the two, a partially different language then the standard may require additional time to get used to. The Sesame framework comes with a lot of documentation, but unfortunately it may prove to be too difficult for less experienced users. Running a simple program has proven, at first, a little difficult for us, because of the additional libraries used by the Repository API (for example Simple Logging Façade for Java). As a result we have turned to online help like [4]. Overall, the documentation is perhaps more detailed then the one for Jena, but simple examples are scarce. 4 SPARQL Tests We have made several tests using the two APIs and a two RDF files that vary in size. The development environment used was Eclipse. We have used a code sample for Sesame available at [4]. Our main focus was testing SPARQL query execution speed, using files as storage for the RDF statements. The first RDF file is a larger file containing information about sessions and speakers at a conference [3]. The SPARQL query selects information about distinct presentations: SELECT DISTINCT ?title ?presenter ?description WHERE { ?session rdf:type svcc:Session . ?session dc:title ?title . ?session svcc:presenter ?presenter . ?session dc:description ?description . }; Execution times obviously favor Sesame over Jena (as shown in the table below). The documentation for Jena explains that a search is conducted for the reuse of the rdf:ID element and this may cause a slower response when reading large files. Query 1 execution Jena Sesame 1 2172 656 2 2094 625 3 2125 687 4 2062 625 5 2031 641 The same situation occurs for the second query that searches in a file containing information about semantic web tools [6], though the timing difference is reduced. SELECT ?nume ?url ?limbaj WHERE { [g:label ?nume; g:URL ?url ;
  • 4. g:FOSS ?foss ; g:Category ?categ ; g:Language ?limbaj ] . FILTER( ?foss = ‘Yes’ && ?categ = ‘Database/Datastore’ && (?limbaj = ‘PHP’ || regex (?limbaj, ‘^C’))) . } ORDER BY ?limbaj Query 2 execution Jena Sesame 1 1860 656 2 1875 672 3 1891 672 4 1875 688 5 1813 688 Runing both tests shows that Jena’s execution speed increases as more queries are made, getting close to the performance of Sesame. Combined Jena Q1 Jena Q2 Sesame Q1 Sesame Q2 execution 1 2110 234 765 188 2 2782 250 985 265 3 3063 406 1156 250 4 2156 187 719 187 5 2251 265 735 203 Out initial tests were somewhat different because we used a Sesame repository object with inferencing, although there was no need for it. In this case, Sesame’s performance decreased but it still managed to outrun Jena on single query execution. However, multiple query execution confirmed that Jena can perform better in such cases. In conclusion, we see the Jena RDF API as an easier starting point for most programmers, thought it might not be as complex as the Sesame framework. References 1. Jena website, http://jena.sourceforge.net/documentation.html 2. Sesame website, http://www.openrdf.org/documentation.jsp 3. Hewett Research, http://www.hewettresearch.com/svcc2009/ 4. “How to use the Sesame Java API to power a Web or Client – Server Application", http://answers.oreilly.com/topic/447-how-to-use-the-sesame-java-api-to-power-a-web-or- client-server-application/ 5. “Jena, A Java API for RDF”, http://www.docstoc.com/docs/13042314/Jena-----A-Java-API- for-RDF 6. Sweet rdf file, http://profs.info.uaic.ro/~busaco/teach/courses/wade/demos/sparql/sparql.zip