Apache Jena Framework. Philippe Genoud Université Joseph Fourier Grenoble (France)

Similar documents
Contributed by Tong Zhao

Today s Plan. 1 Repetition: RDF. 2 Jena: Basic Datastructures. 3 Jena: Inspecting Models. 4 Jena: I/O. 5 Example. 6 Jena: ModelFactory and ModelMaker

Today s Plan. 1 Repetition: RDF. 2 Jena: Basic Datastructures. 3 Jena: Inspecting Models. 4 Jena: I/O. 5 Example. 6 Jena: ModelFactory and ModelMaker

JENA: A Java API for Ontology Management

Knowledge management: The Jena API. Mohamed Sellami Département INFormatique TELECOM SudParis

The MEG Metadata Schemas Registry Schemas and Ontologies: building a Semantic Infrastructure for GRIDs and digital libraries Edinburgh, 16 May 2003

Orchestrating Music Queries via the Semantic Web

Programming THE SEMANTIC WEB. Build an application upon Semantic Web models. Brief overview of Apache Jena and OWL-API.

1 Performance test source code

COMPUTER AND INFORMATION SCIENCE JENA DB. Group Abhishek Kumar Harshvardhan Singh Abhisek Mohanty Suhas Tumkur Chandrashekhara

Package rrdf. R topics documented: February 15, Type Package

Semantic Technologies and CDISC Standards. Frederik Malfait, Information Architect, IMOS Consulting Scott Bahlavooni, Independent

Semantic Integration with Apache Jena and Apache Stanbol

Knowledge Representation. Apache Jena Part II. Jan Pettersen Nytun, UiA

Semantic Web. Lecture 12: SW Programming Dr. Knarig Arabshian

Implementing and extending SPARQL queries over DLVHEX

A short tutorial on rrdf

Welcome to INFO216: Advanced Modelling

Semantic Web. MPRI : Web Data Management. Antoine Amarilli Friday, January 11th 1/29

BUILDING THE SEMANTIC WEB

Deep integration of Python with Semantic Web technologies

Extracting knowledge from Ontology using Jena for Semantic Web

RDF Next Version. Ivan Herman and Sandro Hawke W3C

From the Web to the Semantic Web: RDF and RDF Schema

RDF and RDB 2 D2RQ. Mapping Relational data to RDF D2RQ. D2RQ Features. Suppose we have data in a relational database that we want to export as RDF

An Architecture For RDF Storing And Querying For Messages

Mapping Relational data to RDF

Table of Contents. iii

Presented By Aditya R Joshi Neha Purohit

Semantic Web Rules. - Tools and Languages - Holger Knublauch. Tutorial at Rule ML 2006, Athens, GA

Semantics. Matthew J. Graham CACR. Methods of Computational Science Caltech, 2011 May 10. matthew graham

SPARQLMotion TM. Tutorial. Version 1.1. April 5, SPARQLMotion, Copyright TopQuadrant, Inc. 1 of 31

Semantic Web Information Management

Comparative Study of RDB to RDF Mapping using D2RQ and R2RML Mapping Languages

Welcome to INFO216: Advanced Modelling

Semantic Web Technologies

Semantic Web Fundamentals

geospatial querying ApacheCon Big Data Europe 2015 Budapest, 28/9/2015

Prototype Implementation Progress

Generating of RDF graph from a relational database using Jena API

BIOLOGICAL PATHWAYS AND THE SEMANTIC WEB

CHAPTER 1 INTRODUCTION

DC-Text - a simple text-based format for DC metadata

Language Specification

Semantic Web: Core Concepts and Mechanisms. MMI ORR Ontology Registry and Repository

Building Blocks of Linked Data

Semantic Web Technologies: RDF + RDFS

Semantic Web Programming

Finding Similarity and Comparability from Merged Hetero Data of the Semantic Web by Using Graph Pattern Matching

Europeana update: aspects of the data

Semantic Web Fundamentals

Knowledge Representation RDF Turtle Namespace

Querying the Semantic Web

Ontology Servers and Metadata Vocabulary Repositories

F-OWL: An OWL Reasoner in Flora-2 Youyong Zou, Harry Chen, Tim Finin, Lalana Kagal

Semantic Web and Python Concepts to Application development

Library of Congress BIBFRAME Pilot. NOTSL Fall Meeting October 30, 2015

From Raw Sensor Data to Semantic Web Triples Information Flow in Semantic Sensor Networks

Chapter 13: Advanced topic 3 Web 3.0

RESOURCES DESCRIPTION FRAMEWORK: RDF

Making BioPAX SPARQL

Introduction to RDF and the Semantic Web for the life sciences

An overview of RDB2RDF techniques and tools

The Butterfly Effect. A proposal for distribution and management for butterfly data programs. Dave Waetjen SESYNC Butterfly Workshop May 10, 2012

The Semantic Web Revisited. Nigel Shadbolt Tim Berners-Lee Wendy Hall

Linked Data. Department of Software Enginnering Faculty of Information Technology Czech Technical University in Prague Ivo Lašek, 2011

A Formal Definition of RESTful Semantic Web Services. Antonio Garrote Hernández María N. Moreno García

CSc 8711 Report: OWL API

A Semantic Web-Based Approach for Harvesting Multilingual Textual. definitions from Wikipedia to support ICD-11 revision

WICKED COOL JAVA. Code Bits, Open-Source Libraries, and Project Ideas. by Brian D. Eubanks. San Francisco

Linked data and its role in the semantic web. Dave Reynolds, Epimorphics

Structure of This Presentation

H1 Spring B. Programmers need to learn the SOAP schema so as to offer and use Web services.

Semantic Web. RDF and RDF Schema. Morteza Amini. Sharif University of Technology Spring 90-91

Introduction to Linked Data

Digital Public Space: Publishing Datasets

Representing Linked Data as Virtual File Systems

Approach for Mapping Ontologies to Relational Databases

Enabling Semantic Web Programming by Integrating RDF and Common Lisp

Developing markup metaschemas to support interoperation among resources with different markup schemas

INF3580/4580 Semantic Technologies Spring 2015

Enhancing Security Exchange Commission Data Sets Querying by Using Ontology Web Language

Semantic Web and Natural Language Processing

Contents. G52IWS: The Semantic Web. The Semantic Web. Semantic web elements. Semantic Web technologies. Semantic Web Services

Semantic Web In Depth: Resource Description Framework. Dr Nicholas Gibbins 32/4037

APPLYING KNOWLEDGE BASED AI TO MODERN DATA MANAGEMENT. Mani Keeran, CFA Gi Kim, CFA Preeti Sharma

Querying Description Logics

On the use of Abstract Workflows to Capture Scientific Process Provenance

The Semantic Web DEFINITIONS & APPLICATIONS

Rajashree Deka Tetherless World Constellation Rensselaer Polytechnic Institute

Semantic Web Test

OWL-DBC The Arrival of Scalable and Tractable OWL Reasoning for Enterprise Knowledge Bases

Open And Linked Data Oracle proposition Subtitle

SPARQL: An RDF Query Language

Today: RDF syntax. + conjunctive queries for OWL. KR4SW Winter 2010 Pascal Hitzler 3

WHY WE NEED AN XML STANDARD FOR REPRESENTING BUSINESS RULES. Introduction. Production rules. Christian de Sainte Marie ILOG

Chapter 4 Research Prototype

Publishing OWL ontologies with Presto

ISWC 2017 Tutorial: Semantic Data Management in Practice

COMBINING X3D WITH SEMANTIC WEB TECHNOLOGIES FOR INTERIOR DESIGN

Transcription:

Apache Jena Framework Philippe Genoud Université Joseph Fourier Grenoble (France) (Philippe.Genoud@imag.fr) Astrakhan State University November 2012 1

What is Jena? Introduction An open source semantic web framework written in Java developed at HP-Labs (Bristol-UK) now an apache project : http://jena.apache.org/ November 2010: adopted by the Apache Software Foundation (incubation) April 2012: graduated as a top-level project 2

Jena is composed of Introduction an API for reading, processing and writing RDF data in XML, N-triples and Turtle formats; an ontology API for handling OWL and RDFS ontologies; a rule-based inference engine for reasoning with RDF and OWL data sources; stores to allow large numbers of RDF triples to be efficiently stored on disk; a query engine compliant with the latest SPARQL specification servers to allow RDF data to be published to other applications using a variety of protocols, including SPARQL 3

Model interface com.hp.hpl.jena.rdf.model.model represent an RDF Graph RDF model is a set of Statements (triples). Methods are provided for creating resources, properties and literals creating the Statements (triples) which link them, for adding statements to and removing them from a model, for querying a model set operations for combining models. 4

Model Factory design pattern to create models com.hp.hpl.jena.rdf.model.modelfactory static Model createdefaultmodel() Answer a new memory based Model (RDF Graph) static ModelMaker createfilemodelmaker(string root) Answer a ModelMaker that constructs memory-based Models that are backed by files static OntModel createontologymodel() Answer a new ontology model which will process in-memory models of ontologies expressed the default ontology language (OWL) 5

Light Switch1 status RDFNodes on locatedin Bedroom <interface> RDFNode each element of a RDF statement is a RDFNode <interface> Resource <interface> Literal <interface> Property com.hp.hpl.jena.rdf.model.model offers methods to create elements Resource createresource( ) Literal createliteral( ) Property createproperty(string namespace, String localname) 6

Triples to create an RDF triple in a Model a Property or a Literal must be "added" to a Resource. Resource methods to create triples with the resource (this) as subject. Resource addproperty(property p, RDFNode o) addproperty(property p, RDFNode o) addproperty(property p, java.lang.string o) Resource addliteral( ) addliteral(property p, Literal o) addliteral(property value, double d) 7

Triples addproperty and addliteral methods return the Resource (this) facilitates creation of multiple triples with the same subject Resource johnsmith = model.createresource(personuri).addproperty(vcard.fn, fullname).addproperty(vcard.title, "Officer"); vcard : a standard file format for electronic business cards e.g. vcards are often attached to e-mail messages http://www.w3.org/tr/vcard-rdf/ RDF vocabulary corresponding to vcard com.hp.hpl.jena.vocabulary : package containing constant classes with predefined constant objects for classes and properties defined in well known vocabularies. com.hp.hpl.jena.vocabulary.vcard : vcard static Property NAME. com.hp.hpl.jena.vocabulary.rdf : The standard RDF vocabulary static Property type... com.hp.hpl.jena.vocabulary.dc : Dublin Core... 8

Statement Statement object to access the components of a triple Resource getsubject() Property getpredicate() RDFNode getobject()list all statements of the model StatementIterator to access statements asserted in a RDF Model Model methods to get a StatementIterator StmtIterator liststatements() List all statements of the model StmtIterator liststatements(resource s, Property p, RDFNode o) List all the statements matching a pattern for(statementiterator it = model.liststatements();it.hasnext();) { } Statement stmt = it.nextstatement(); System.out.println(stmt.getSubject().getLocalName()); 9

Navigating a Model for(statementiterator it = model.liststatements();it.hasnext();) { } Statement stmt = it.nextstatement(); System.out.println(stmt.getSubject().getLocalName()); Reification Subject query Property Object RDF Consumer Model animation from www.try.idv.tw/try/files/070517-jena.ppt C.F.Liao ( 廖峻鋒 )

Model I/O read and write methods of Model interface e.g. write(java.io.outputstream out, java.lang.string lang, java.lang.string base) lang : output format "RDF/XML" (default), "RDF/XML-ABBREV", "N3", "TURTLE", "N-TRIPLE" base : The base uri for relative URI calculations. null means use only absolute URI's URL FileWriter FileReader Model System.out 11

Lab Creating a Simple RDF Model 12

Objectives Creating a simple RDF statement Placing this RDF into a Model Dumping the Model to system console print add Model (Memory) RDF Producer

Creating a RDF statement // declare URI prefix String ns = "http://www.ispace.tw/smarthome#"; ex1 demo Model model = ModelFactory.createDefaultModel(); Resource light = model.createresource(ns+"light1"); Property lightstatus = model.createproperty(ns+"status"); Literal statusvalue = model.createliteral("off"); light.addproperty(lightstatus, statusvalue); model.write(system.out,"n-triple"); Model status (light,status,off) light1 off