Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 Jena: A Semantic Web Framework for Java Reporter C.F.Liao ( 廖峻鋒 ) May 17,2007.

Slides:



Advertisements
Similar presentations
MEMS Thermal & Fluid Control Lab. 國立台灣大學機械工程系微機械熱流控制實驗室 Department of Mechanical Engineering National Taiwan University, Taipei, Taiwan Department of Mechanical.
Advertisements

SPARQL Dimitar Kazakov, with references to material by Noureddin Sadawi ARIN, 2014.
© 2006 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice Use Case: Populating Business Objects.
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.
Bayesian Networks Bucket Elimination Algorithm 主講人:虞台文 大同大學資工所 智慧型多媒體研究室.
Quick RDF Introduction Scott Streit Terminology – RDF Triple (Also the triple form used in SPARQL) RDF Triple  (Resource, Property,
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.
A Simulation Study of the PWM Strategy for Inverters
Cloud based linked data platform for Structural Engineering Experiment Xiaohui Zhang
Using Java in Linked Data Applications Fuming Shih Oct 12.
Triple Stores.
© 2006 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice Publishing data on the Web (with.
Managing Large RDF Graphs (Infinite Graph) Vaibhav Khadilkar Department of Computer Science, The University of Texas at Dallas FEARLESS engineering.
Information Integration Intelligence with TopBraid Suite SemTech, San Jose, Holger Knublauch
CSCI 6962: Server-side Design and Programming
Google Maps Android API v2 吳俊興 國立高雄大學 資訊工程學系 CSF645 – Mobile Computing 行動計算
資訊工程系智慧型系統實驗室 iLab 南台科技大學 1 Optimizing Cloud MapReduce for Processing Stream Data using Pipelining 出處 : 2011 UKSim 5th European Symposium on Computer Modeling.
Practical RDF Chapter 1. RDF: An Introduction
-By Mohamed Ershad Junaid UTD ID :
Introduction For some compiler, the intermediate code is a pseudo code of a virtual machine. Interpreter of the virtual machine is invoked to execute the.
An Introduction to the Resource Description Framework Eric Miller Online Computer Library Center, Inc. Office of Research Dublin, Ohio 元智資工所 系統實驗室 楊錫謦.
Database Support for Semantic Web Masoud Taghinezhad Omran Sharif University of Technology Computer Engineering Department Fall.
The Jena RDF Framework Konstantinos Tzonas. Contents What is Jena Capabilities of Jena Basic notions RDF concepts in Jena Persistence Ontology management.
Master Informatique 1 Semantic Technologies Part 11Direct Mapping Werner Nutt.
 Open source RDF framework in Java.  Supports RDF Schema inferencing and querying.  Supports SPARQL 1.1 query, update, federated query.
智慧型系統實驗室 iLab 南台資訊工程 1 Evaluation for the Test Quality of Dynamic Question Generation by Particle Swarm Optimization for Adaptive Testing Department of.
Presentation : Konstantinos Kanaris.  What is Jena?  Usage of Jena  Main Concepts  Main Components  Storage Models  OWL API  RDF API  Reasoning.
Steven Seida D2RQ Blog Integration Lab. Data to RDF Integration Approaches* 1 of 2 *Summarized from Ch 9 of Semantiic Web Programming, 2009, by Hebeler.
8 Apr, 2005 OWLIM - OWL DLP support within Sesame Damyan Ognyanov Ontotext Lab, Sirma AI.
Semantic Web Programming in Python an Introduction Biju B Jaganath G.
Efficient RDF Storage and Retrieval in Jena2 Written by: Kevin Wilkinson, Craig Sayers, Harumi Kuno, Dave Reynolds Presented by: Umer Fareed 파리드.
Lecture 1: A Formal Model of Computation 虞台文 大同大學資工所 智慧型多媒體研究室.
DReSS Engineering a Replay Application Based on RDF and OWL Chris Greenhalgh, Andy French, Jan Humble, Paul Tennent School of Computer Science, University.
Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 Service Behavior Consistency in the OSGi Platform Authors Y.Qin, H.Hao,L.Jun, G.Jidong and L.Jian Proceedings.
The Foundations of Ubiquitous Computing
Introduction to the Semantic Web and Linked Data Module 1 - Unit 2 The Semantic Web and Linked Data Concepts 1-1 Library of Congress BIBFRAME Pilot Training.
The LSAM Proxy Cache - a Multicast Distributed Virtual Cache Joe Touch USC / Information Sciences Institute 元智大學 資訊工程研究所 系統實驗室 陳桂慧
CFTP - A Caching FTP Server Mark Russell and Tim Hopkins Computing Laboratory University of Kent Canterbury, CT2 7NF Kent, UK 元智大學 資訊工程研究所 系統實驗室 陳桂慧.
R Store Angelique Moscicki Oshani Seneviratne Sergio Herrero-Lopez.
A Semantic Web Approach for the Third Provenance Challenge Tetherless World Rensselaer Polytechnic Institute James Michaelis, Li Ding,
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.
RDF and Relational Databases
Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 Managing Quality of Context in Pervasive Computing Authors Y.Bu, T.Gu, X.Tao, J.Li, S.Chen, and J.Lu Proceedings.
Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 Brainstorming Principles Reporter Chun-Feng Liao Sep 12,2005 Source D.Bellin and S.S.Simone, ”Brainstorming: A.
Steven Perry Dave Vieglais. W a s a b i Web Applications for the Semantic Architecture of Biodiversity Informatics Overview WASABI is a framework for.
© The ATHENA Consortium. Susan Thomas SAP AG, Research Department How do you do semantics? Semantic Web Drawings by Sebastian Cremers Unit 3:
Lecture 2: Limiting Models of Instruction Obeying Machine 虞台文 大同大學資工所 智慧型多媒體研究室.
RDF storages and indexes Maciej Janik September 1, 2005 Enterprise Integration – Semantic Web.
Copyright © 2010, Install OpenFlow Mininet 指導教授:王國禎 學生:洪維藩 國立交通大學資訊科學與工程研究所 行動計算與寬頻網路實驗室.
RDF languages and storages part 2 - indexing semi-structure data Maciej Janik Conrad Ibanez CSCI 8350, Fall 2004.
Sesame A generic architecture for storing and querying RDF and RDFs Written by Jeen Broekstra, Arjohn Kampman Summarized by Gihyun Gong.
NTHU CS ISLAB 國立清華大學 資訊工程研究所 資訊安全實驗室 Semantically Rich Application- Centric Security in Android Machigar Ongtang, Stephen McLaughlin, William Enck and.
Managing Large RDF Graphs Vaibhav Khadilkar Dr. Bhavani Thuraisingham Department of Computer Science, The University of Texas at Dallas December 2008.
Setting the stage: linked data concepts Moving-Away-From-MARC-a-thon.
1 Knowledge Representation XI – IKT437 Knowledge Representation XI – IKT437 Part I RDF Jan Pettersen Nytun, UiA Apache Jena.
OWL (Ontology Web Language and Applications) Maw-Sheng Horng Department of Mathematics and Information Education National Taipei University of Education.
Triple Stores.
Jena 6/8/2018.
Middleware independent Information Service
Triple Stores.
The Jena RDF Framework Konstantinos Tzonas.
Triple Stores.
Triple Stores.
Longest Common Subsequence (LCS)
Edit Distance 張智星 (Roger Jang)
Presentation transcript:

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 Jena: A Semantic Web Framework for Java Reporter C.F.Liao ( 廖峻鋒 ) May 17,2007

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 2 About Me  Education Ph.D. Candidate, CSIE,NTU Advisor: Prof. Li-Chen Fu Research interests: Middleware for the smart living spaces.  Professional Services SCJP / SCWCD Lecturer, SL-750, Learning Services, Sun Microsystems Taiwan, Inc. Columnist (Java EE), RUN! PC Magazine Reviewer, Core JSF CHT edition …

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 3 Outline  Introduction  Installing and Running Jena  RDF Model Operations  Inference Mechanisms  (Optional) SPARQL Joseki  Conclusion

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 4 Introduction  What is Jena? An open source semantic web framework written in Java  Jena is composed of RDF Processing API OWL Processing API A rule-based reasoning engine SPARQL query engine

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 5 RDF and OWL Processing API Model RDF Files Console Model I/O Model CRUD OWL

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 6 Jena Inference Mechanism Original Model Reasoner Rules Inferred Model OWL ReasonerVocabulary

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 7 SPARQL (W3C Standard) Model SELECT ?x WHERE { ?x locatedIn classroom} … ?x = {Jane, Mary, and Peter} SPARQL Query Engine SPARQL Query Engine

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 8 Review: The RDF Network Light Switch1 state on Literal Resource Bedroom locatedIn size 9 contains TV1 Property

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 9 Key Abstractions Light Switch1 status on RDFNode Bedroom locatedIn Browse the Jena Javadoc

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 10 Recommended Development Environment  JDK  Eclipse 3.2 +, JST (J2EE Standard Tools)  MySQL 4.x (optional)

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 11 Installing and Running Jena 1. Download JDK 5 2. Download and install Eclipse 3. Download Jena 4. Tuning your Eclipse 5. Create a java project 6. Append Jena libraries to your classpath 7. Use Jena API to create some RDFs demo

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 12 Downloading Jena 

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 13 Typical Jena Usage Scenario RDF Consumer (Jena) query RDF Files RDF Producer (Jena) Model (Memory) load add

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 14 Advanced Jena Usage Scenario Persistent RDF Model (Relational Database) RDF Publishing Server (Joseki) SPARQL over HTTP RDF Producer (Jena) Remote RDF Consumer (Jena)

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 15 Lab Creating a Simple RDF Model

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 16 Objectives RDF Producer Model (Memory) addprint  Creating a simple RDF statement  Placing this RDF into a Model  Dumping the Model to system console

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 17 Creating RDF  2 ways Using Jena API Load from file

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 18 Creating a RDF statement // declare URI prefix // declare URI prefix String ns = " String ns = " Model model = ModelFactory.createDefaultModel(); Model model = ModelFactory.createDefaultModel(); Resource light = model.createResource(ns+"light1"); Resource light = model.createResource(ns+"light1"); Property lightStatus = model.createProperty(ns+"status"); Property lightStatus = model.createProperty(ns+"status"); Literal statusValue = model.createLiteral("off"); Literal statusValue = model.createLiteral("off"); light.addProperty(lightStatus, statusValue); light.addProperty(lightStatus, statusValue); model.write(System.out,"N-TRIPLE"); model.write(System.out,"N-TRIPLE"); light1 status off Model (light,status,off) ex1 demo

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 19 Lab Model I/O

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 20 Model I/O model.read("file:./bin/advai/rdf/smarthome.nt", "N-TRIPLE"); model.write(new FileWriter("test.nt"),"N-TRIPLE"); Model System.out FileWriter

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 21 Loading RDF from an External File Model model = FileManager.get().loadModel( “file:./bin/advai/rdf/smarthome.nt", "N-TRIPLE"); src advai rdf smarthome.nt ReadRdfFromFileTest.java MyJenaProject bin ReadRdfFromFileTest.class ex2 demo

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 22 Dumping the Model model.write(System.out,"N-TRIPLE"); model.write(System.out,"N3"); model.write(new FileWriter("test.nt"),“RDF/XML"); model.write(new FileWriter("test.nt"),“RDF/XML-ABBREV"); Model System.out FileWriter ex3 demo

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 23 Lab Model CRUD

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 24 Model CRUD  Create  Retrieve  Update  Delete RDF Consumer (Jena) Model query

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 25 Navigating a Model for(Iterator it = model.listStatements();it.hasNext();) { Statement stmt = (Statement) it.next(); System.out.println(stmt.getSubject().getLocalName()); Statement stmt = (Statement) it.next(); System.out.println(stmt.getSubject().getLocalName());} RDF Consumer Model query Reification Subject Property Object ex4 demo

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 26 Querying Model “ Select * from MODEL where SUBJECT=‘Jane’ ” Resource jane = model.getResource(" Selector selector = new SimpleSelector(jane, (Property)null, (Resource)null); new SimpleSelector(jane, (Property)null, (Resource)null); for(Iterator it = model.listStatements(selector);it.hasNext();){ …} RDF Consumer Model Reification selector ex5 demo

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 27 Updating Model Using Statement’s changeObject() method: Resource jane = model.getResource(" Resource home = model.getResource(" model.getResource(" Property locatedIn = model.getProperty(" model.getProperty(" jane.getProperty(locatedIn).changeObject(home); RDF Consumer New object ex6 demo

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 28 Removing a Statement from Model Using Statement’s remove() method: Resource jane = model.getResource(" Property locatedIn = model.getProperty(" model.getProperty(" jane.getProperty(locatedIn).remove; ex7 demo

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 29 Lab Basic Inference

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 30 Jena Inference Mechanism Data (Model) ReasonerRegistry RDFSReasoner GenericReasoner OwlReasoner Application ModelFactory InfModel Existing Model + Reasoner New Model (InfModel) ModelFactory

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 31 A Simple RDFS Reasoner Example Property teachesAtProp = data.createProperty(ns, "teachesAt"); Property worksAtProp = data.createProperty(ns, "worksAt"); data.add(teachesAtProp, RDFS.subPropertyOf, worksAtProp); data.createResource(ns + "jane").addProperty(teachesAtProp, "NTU"); Reasoner reasoner = ReasonerRegistry.getRDFSReasoner(); InfModel infModel = ModelFactory.createInfModel(reasoner, data); (Jane, teachesAt, NTU) RDFS Example demo teachesAt worksAt (Jane, worksAt, NTU)

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 32 Lab Ontological Inference

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 33 Modeling a Domain with Schema and Data Schema Level Data Level

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 34 Separating Schema and Data Data (Model) Schema (OntModel) ReasonerRegistry RDFSReasoner GenericReasoner OwlReasoner Application ModelFactory InfModel

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 35 Example: The Smart Home Ontology locatedIn contains inverse transitive Building Room Person Light type Home Bedroom Jane type light1 contains locatedIn

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 36 Creating OntModel with Ontology API OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM); ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM); m.createClass(ns + "Building"); m.createClass(ns + "Building"); m.createClass(ns + "Room"); m.createClass(ns + "Room"); m.createClass(ns + "Person"); m.createClass(ns + "Person"); m.createClass(ns + “Light"); ObjectProperty contains = ObjectProperty contains = m.createObjectProperty(ns + "contains", true).convertToTransitiveProperty(); m.createObjectProperty(ns + "contains", true).convertToTransitiveProperty(); ObjectProperty locatedIn = ObjectProperty locatedIn = m.createObjectProperty(ns + "locatedIn").convertToTransitiveProperty(); m.createObjectProperty(ns + "locatedIn").convertToTransitiveProperty(); contains.setInverseOf(locatedIn); contains.setInverseOf(locatedIn); ex8 demo Create 4 Class Definitions Inverse relationship properties Model Configuration

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 37 A Ont Reasoner Example OntModel schema = ModelFactory.createOntologyModel(…); OntModel schema = ModelFactory.createOntologyModel(…); schema.read("file:./bin/advai/schema.owl"); schema.read("file:./bin/advai/schema.owl"); Model data = Model data = FileManager.get().loadModel("file:./bin/advai/data.rdf"); FileManager.get().loadModel("file:./bin/advai/data.rdf"); Reasoner reasoner = ReasonerRegistry.getOWLReasoner(); Reasoner reasoner = ReasonerRegistry.getOWLReasoner(); InfModel infModel = InfModel infModel = ModelFactory.createInfModel(reasoner, schema, data); ModelFactory.createInfModel(reasoner, schema, data); ex10 demo

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 38 Lab Cascading Inference

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 39 Combining Generic and OWL Reasoners Data (Model) Schema (OntModel) GenericReasoner OwlReasoner ontInfModel ModelFactory infModel ModelFactory Rules

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 40 An “Openlight” [openlight: (?a h:locatedIn h:bedroom) (?a rdf:type h:Person) (?b rdf:type h:Light) (?b h:status 'off') -> drop(3) (?b h:status 'on') ] “if a person is in the bedroom then open all light”

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 41 Cascading Reasoners OntModel schema = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_TRANS_INF); schema.read("file:./bin/advai/inf/schema-inf-owl.owl"); Model data = FileManager.get().loadModel("file:./bin/advai/inf/data-inf-owl.rdf"); Reasoner owlReasoner = ReasonerRegistry.getOWLReasoner(); InfModel owlInfModel = ModelFactory.createInfModel(owlReasoner, schema, data); GenericRuleReasoner reasoner = new GenericRuleReasoner(Rule.rulesFromURL("file:./bin/advai/inf/myrule.rule")); reasoner.setDerivationLogging(true); InfModel infModel = ModelFactory.createInfModel(reasoner, owlInfModel); ex11 demo

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 42 Summary  What we have learned RDF / Model CRUD OWL OWL inference OWL + Generic Rule engine inference  Further readings Jena Javadocs Be sure to understand the meaning of advanced configuration mechanisms of models and reasoners.

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 43 Querying Model with SPARQL Query query = …(Query String); QueryExecution qexec = QueryExecutionFactory.create(query, model); try { ResultSet results = qexec.execSelect(); for (; results.hasNext();) { QuerySolution soln = results.nextSolution(); …// the solutions may be Resources or Literals } finally { qexec.close(); } Sparql Demo

Intelligent Space 國立台灣大學資訊工程研究所 智慧型空間實驗室 44 Persisting RDF Model  Download required bundles MySQL DB MySQL JDBC Driver  Install MySQL database  Create jenadb create database jenatest character set utf8 ;  Persist with ModelMaker