CHAPTER 8 – Jena:RDF in Java 박형우 SNU OOPSLA Lab. August 27, 2004.

Slides:



Advertisements
Similar presentations
Language (Formalisms) For Ontology Building Neda Alipanah 22 October 2012.
Advertisements

인터넷기술 강혜원 Java 를 이용한 RDF Process 인터넷기술 012ITI01 강혜원.
Jena a introduction Semantic Web Tools. Originally devised by HP Labs in Bristol, it was developed by Brian McBride of Hewlett-Packard and was derived.
ESDSWG2011 – Semantic Web session Semantic Web Sub-group Session ESDSWG 2011 Meeting – Semantic Web sub-group session Wednesday, November 2, 2011 Norfolk,
Master Informatique 1 Semantic Technologies Part 4Jena Werner Nutt.
JENA –A SEMANTIC WEB TOOL by Ranjani Sankaran & krishna Priyanka Chebrolu.
Jena Sparql 4/11/2017.
Progress Update Semantic Web, Ontology Integration, and Web Query Seminar Department of Computing David George.
Quick RDF Introduction Scott Streit Terminology – RDF Triple (Also the triple form used in SPARQL) RDF Triple  (Resource, Property,
Triple Stores
Semantic Web Tools Vagan Terziyan Department of Mathematical Information Technology, University of Jyvaskyla ;
Incremental Materialization of RDF Graph Closures for Stream Reasoning Alexandre Mello Ferreira (PhD student) 22/11/2010.
RDF(S) Tools Adrian Pop, Programming Environments Laboratory Linköping University.
Jena --- A Java API for RDF Jing deng CSCI 7818 Web Technologies Computer Science Department University of Colorado at Boulder Wednesday, October 31, 2001.
Internet Technologies1 RDF Bibliography: “XML How To Program” by Deitel, Deitel, Nieto, Lin and Sadhu. “XML Bible” by Elliotte Rusty Harold. HP’s Jena.
Internet Technologies 1 Master of Information System Management Internet Technologies The Resource Description Framework (RDF)
Jena 4/17/2017.
1 An Introduction to RDF and the Jena RDF API. 2 Outline Introduction Statements Writing RDF Reading RDF Navigating a Graph Querying a Graph Operations.
Using Java in Linked Data Applications Fuming Shih Oct 12.
Triple Stores.
Managing Large RDF Graphs (Infinite Graph) Vaibhav Khadilkar Department of Computer Science, The University of Texas at Dallas FEARLESS engineering.
RDF Triple Stores Nipun Bhatia Department of Computer Science. Stanford University.
Practical RDF Chapter 1. RDF: An Introduction
Reducing Search Space Scheme using RDF-Schema Domain and Range Information for Efficient RDF Query Processing Sungtae Kim SNU OOPSLA Lab. December 3, 2004.
Co-funded by the European Union Semantic CMS Community Semantic Data Access Copyright IKS Consortium 1 SRDC Ltd. August, 2011.
Practical RDF Ch.7 Editing, Parsing, and Browsing RDF/XML Kim, Ki-Sung SNU OOPSLA Lab. Shelley Powers, O’Reilly August 24, 2004.
Data Intensive Query Processing for Large RDF Graphs Using Cloud Computing Tools Mohammad Farhan Husain, Latifur Khan, Murat Kantarcioglu and Bhavani Thuraisingham.
Introduction to Java Prepared by: Ahmed Hefny. Outline Classes Access Levels Member Initialization Inheritance and Polymorphism Interfaces Inner Classes.
The Jena RDF Framework Konstantinos Tzonas. Contents What is Jena Capabilities of Jena Basic notions RDF concepts in Jena Persistence Ontology management.
Ontology Query. What is an Ontology Ontologies resemble faceted taxonomies but use richer semantic relationships among terms and attributes, as well as.
SPARQL All slides are adapted from the W3C Recommendation SPARQL Query Language for RDF Web link:
 Open source RDF framework in Java.  Supports RDF Schema inferencing and querying.  Supports SPARQL 1.1 query, update, federated query.
Presentation : Konstantinos Kanaris.  What is Jena?  Usage of Jena  Main Concepts  Main Components  Storage Models  OWL API  RDF API  Reasoning.
Jena2: a semantic web toolkit
Of 41 lecture 4: rdf – basics and language. of 41 RDF basic ideas the fundamental concepts of RDF  resources  properties  statements ece 720, winter.
INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 11 (part 2): MDI I, Part II: Semantic Web.
Semantic Web Programming in Python an Introduction Biju B Jaganath G.
ISIM’06, Přerov ; Corporate Memory Corporate Memory: A framework for supporting tools for acquisition, organization and maintenance of information.
Efficient RDF Storage and Retrieval in Jena2 Written by: Kevin Wilkinson, Craig Sayers, Harumi Kuno, Dave Reynolds Presented by: Umer Fareed 파리드.
Semantic Web Exam 1 Review.
Practical RDF Ch.6 Creating an RDF Vocabulary DongHyuk Im SNU OOPSLA Lab. Shelley Powers, O’Reilly August 19, 2004.
1 Tutorial on the Semantic Web (Last update: 26 May 2009) adapted from (C) Ivan Herman, W3C Given at WE course by Peter Dolog Adapted: October 2010.
© Copyright 2008 STI INNSBRUCK Semantic Web Repositories and SPARQL Dieter Fensel Federico Facca.
Practical RDF Chapter 10. Querying RDF: RDF as Data Shelley Powers, O’Reilly SNU IDB Lab. Hyewon Lim.
Practical RDF Ch.10 Querying RDF: RDF as Data Taewhi Lee SNU OOPSLA Lab. Shelley Powers, O’Reilly August 27, 2004.
* RDF from the Java Perspective. 2 AstroGrid-D Workshop, Garching Tobias Scholl Three-Step Recipe Create RDF metadata in Java. Serialize my.
Triple Stores. What is a triple store? A specialized database for RDF triples Can ingest RDF in a variety of formats Supports a query language – SPARQL.
Doc.: IEEE /0169r0 Submission Joe Kwak (InterDigital) Slide 1 November 2010 Slide 1 Overview of Resource Description Framework (RFD/XML) Date:
Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 Jena: A Semantic Web Framework for Java Reporter C.F.Liao ( 廖峻鋒 ) May 17,2007.
RDF storages and indexes Maciej Janik September 1, 2005 Enterprise Integration – Semantic Web.
RDF languages and storages part 2 - indexing semi-structure data Maciej Janik Conrad Ibanez CSCI 8350, Fall 2004.
Other RDF Capabilities. Exercise: Write the following information into a set of statements (triples) and then draw them into and RDF graph The article.
OOPSLA Lab1 Chapter 7 Java Binding Prof. Hyoung-Joo Kim OOPSLA Lab. Dept. of Computer Engineering Seoul National University.
Semantic Web In Depth Resource Description Framework Dr Nicholas Gibbins –
Alistair Miles Rutherford Appleton Laboratory Alistair Miles Brian Matthews Michael Wilson Making Thesauri Work for the Semantic Web.
1 Knowledge Representation XI – IKT437 Knowledge Representation XI – IKT437 Part I RDF Jan Pettersen Nytun, UiA Apache Jena.
1 Efficient Processing of Transitive Closure Queries in Ontology Store using Graph Labeling Kim, Jongnam SNU OOPSLA Lab. Dec. 3, 2004.
Knowledge Representation XI – IKT437 Part II OWL, SPARQL, …
Dr. Mohammad Farhan Husain (Amazan; Facebook)
Jena 6/8/2018.
SPARQL ดร.มารุต บูรณรัช
Introduction to the Semantic Web (tutorial) 2009 Semantic Technology Conference San Jose, California, USA June 15, 2009 Ivan Herman, W3C
Knowledge Representation Part II
Encoding of EPOS Semantics
Jena Sparql (for Mac) 9/22/2018.
Triple Stores.
The Jena RDF Framework Konstantinos Tzonas.
Semantic Web Basics (cont.)
Triple Stores.
Presentation transcript:

CHAPTER 8 – Jena:RDF in Java 박형우 SNU OOPSLA Lab. August 27, 2004

2 목차  Introduction  Jena Architecture  Writing RDF  Reading RDF  Navigating a Model  Querying a Model  Operations on Models  Containers  Creating and Using Wrapper Class  Persistent Model Storage

3 Introduction  A Java Framework for RDF, DAML and OWL  Developed by Brian McBride of HP Labs  Derived from SiRPACSiRPAC  Can create, parse, navigate and search RDF, DAML and OWL model  Easy to use  Current Jena release: 2.1  Available at

4 Jena Architecture Network API Joseki Readers ARP n-triple N3 Inference DAML APIRDFS API Storages Memory Berkeley DB RDBMS Ontology API Query SesameEngineRDQL Sesame Writers ARP n-triple N3 OWL API

5 Writing RDF(1/3)  model.write(System.out);  model 을 화면에 출력  model.write(System.out, “RDF/XML-ABBREV”);  model 을 축약된 형태로 출력  model.write(System.out, “N-TRIPLE”);  model 을 N-Triples 형식으로 출력

6 Writing RDF(2/3)  예제 (1/2) Model model=ModelFactory.createDefaultModel(); Resource res=model.createResource(“ Property prop=model.createProperty(“ res.addProperty(prop, “child”); <rdf:RDF xmlns:rdf=“ xmlns:phw=“ child

7 Writing RDF(3/3)  예제 (2/2) child

8 Reading RDF public class MyClass{ … Model model = ModelFactory.createDefaultModel(); InputStream in = MyClass.class.getClassLoader().getResourceAsStrea m(“myrdf.rdf”); model.read(new InputStreamReader(in), “”); … }

9 Navigating a Model(1/5)  model.getResource(uri : String) : Resource  URI 가 uri 인 resource 를 리턴 ( 존재할 경우 ) 하거나 새로 생성하여 리턴 ( 존재하지 않는 경우 )  resource.getProperty(p : Property) : Statement  resource 가 속성 p 를 가지면 진술 (resource, p, O) 를 리턴하고, 속성 p 를 갖지 않으면 null 을 리턴 ※ Property 를 리턴하지 않고 Statement 를 리턴한다는 점에 주의

10 Navigating a Model(2/5)  statement.getObject( ) : RDFNode  statement 의 object node 를 리턴  statement.getResource() : Resource  statement 의 object 가 Resource 이면 그것을 리턴, Resource 가 아니면 exception 발생  statement.getString() : String  statement 의 object 가 Literal 이면 그것을 리턴, Literal 이 아니면 exception 발생 ※ RDFNode 는 Resource, Literal 의 상위 인터페이스임

11 Navigating a Model(3/5)  resource.listProperties(p : Property) : StmtIterator  getProperty(p) 는 단 하나의 진술을 리턴하는 반면 이 함수는 해당되는 속성 p 를 갖는 진술들 전체의 iterator 리턴

12 Navigating a Model(4/5)  예제 (1/2) Resource vcard = model.getResource(“ Resource name = vcard.getProperty(VCARD.N).getResource( ); StmtIterator iter = vcard.listProperties(VCARD.NICKNAME); Statement st; while(iter.hasNext()){ st = iter.nextStatement(); if(st instanceof Literal){ System.out.println(“ ” + st.getString()); }

13 Navigating a Model(5/5)  예제 (2/2)  출력결과 Smithy Adman Smithy John Smith vcard:NICKNAME vcard:N Adman vcard:NICKNAME

14 Querying a Model(1/2)  SimpleSelector(s : Resource, p : Property, o : RDFNode)  subject 가 s 이고 predicate 가 p 이며 object 가 o 인 진술만 선택  selects(s : Statement) : boolean  SimpleSelector 는 subject 가 s 이고 predicate 가 p 이며 object 가 o 인지 검사한 뒤 selects(s) 의 리턴값이 참인지 검사한다. 따라서 이 함수는 추가적인 필터링을 수행한다.

15 Querying a Model(2/2)  예제 StmtIterator iter = model.listStatements( new SimpleSelector(null, VCARD.FN, (RDFNode) null) { public boolean selects(Statement s) {return s.getString().endsWith("Smith");} });  predicate 가 VCARD.FN 이고 object 가 Smith 로 끝나는 문자열 ( 리터럴 ) 인 진술들만 iterate

16 Operations on Models(1/2)  model 1.union(model2 : Model) : Model  model 1 과 model2 를 merge 한 결과를 리턴

17 Operations on Models(2/2)  예제 model1model2 model1.union(model2)

18 Containers(1/3)  model.createBag( ) : Bag  Bag 을 생성  model.createSeq( ) : Seq  Seq 을 생성  model.createAlt( ) : Alt  Alt 를 생성  bag.add(r : RDFNode) : Container  Bag 에 항목 추가  seq.add(index : int, r : Object) : Seq  Seq 에 항목 추가  alt.add(r : RDFNode) : Container  Alt 에 항목 추가

19 Containers(2/3)  예제 model.createBag().add(model.createResource(“ ).add(model.createResource(“

20 Containers(3/3)  출력결과 rdf:type rdf:Baghttp://somewhere/Peter rdf:_1 rdf:_2

21 Creating and Using Wrapper Class  예제  wrapper class 구현 package com.hp.hpl.jena.vocabulary; … public class VCARD{ protected static final String uri =" … public static final Property FN = m.createProperty(uri, "FN" ); … }  wrapper class 이용 import com.hp.hpl.jena.vocabulary.VCARD; … resource.addProperty(VCARD.FN, “John Smith”); …

22 Persistent Model Storage  예제  RDF/XML 을 데이터베이스에 저장 … Class.forName(“com.mysql.jdbc.Driver”); IDBConnection conn = new DBConnection(“jdbc:mysql://localhost/test”, “test”, “”, “MySQL”); Model m = ModelRDB.createModel(conn, “one”); …  데이터베이스에서 RDF/XML 읽기 … Class.forName(“com.mysql.jdbc.Driver”); IDBConnection conn = new DBConnection(“jdbc:mysql://localhost/test”, “test”, “”, “MySQL”); Model m = ModelRDB.open(conn, “one”); …