Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 Jena a introduction Semantic Web Tools

2 Originally devised by HP Labs in Bristol, it was developed by Brian McBride of Hewlett-Packard and was derived from the SiRPAC API which offered only a command line interface. The framework is open-source and is offered under the BSD license. Jena - Background

3 Jena is built on java and gives the semantic web developers an assortment of tools at his or her disposal. Vast use of interfaces allow developers to extend Jena’s functionality by using the plugin interface. Introduction

4 Architecture

5 Here we plug in a RFDa reader that allows Jena to parse the extracted RDF into a model. This works as it conforms to a Jena interface and hence extends theramework. Jena Interfaces and Pluggable API https://github.com/shellac/java-rdfa

6 We have just shown how to extend a parser to create a model. Here we can read and write to an stream via RDF/XML RDF/XML-ABBREV N-TRIPLE N3 - Notation3 TTL or Turtle Parsers and Writers

7 Parsers and Writers example http://www.w3.org/2001/sw/grddl-wg/td/hCardFabien-RDFa.html

8 Parsers and Writers example Here we read an RDFa document and write out in N3 notation.

9 Jena manipulates RDF data in directed graph structures also called models. The RDF API is extendable to include reasoners to allow for inference of extended RDF data in a newly created model. RDF API

10 RDF API - continued

11 Supported in Jena - Transitive DAML + OIL RDFS General Rule Based OWL Full(Limits) (only as an external) OWL Lite (partially implemented) OWL Micro (one of the partial implementations) Ontologies

12 The following code shows loading some data and a schema from disk then how simple it is to create an inference model in Jena that could be interrogated by a reasoner: Ontology Api: Creating RDFS inference model Model schema = FileManager.get().loadModel("file:data/rdfsDemoSchema.rdf"); Model data = FileManager.get().loadModel("file:data/rdfsDemoData.rdf"); InfModel infmodel = ModelFactory.createRDFSModel(schema, data); http://openjena.org/inference/#rdfs

13 Where an RDFS inference model only requires the schema and data an OWL inference model needs a reasoner which in turn uses the OWL schema. Ontology Api: Creating an OWL inference model Model schema = FileManager.get().loadModel("file:data/owlDemoSchema.owl"); Model data = FileManager.get().loadModel("file:data/owlDemoData.rdf"); Reasoner reasoner = ReasonerRegistry.getOWLReasoner(); reasoner = reasoner.bindSchema(schema); InfModel infmodel = ModelFactory.createInfModel(reasoner, data); http://openjena.org/inference/#owl

14 @prefix rdfs:. @prefix rdf:. @prefix :. :Mammal rdf:type rdfs:Class. :Person rdfs:subClassOf :Mammal. :Male rdfs:subClassOf :Person. :Female rdfs:subClassOf :Person. :parent rdf:type rdf:Property. :mother rdfs:subPropertyOf :parent; rdfs:range :Female; rdfs:domain :Person. :father rdfs:subPropertyOf :parent; rdfs:range :Male; rdfs:domain :Person. Ontology API (RDFS - schema)

15 @prefix fam:. @prefix :. :Mary a fam:Mammal. :Mary a fam:Female. :Frank a fam:Male. Ontology API (RDF data)

16 Below we look at build an inferred RDFS model and show the results specific to our inference about the resource 'Male' Ontology API

17 Jena allows pluggable or standard reasoners to extend its graph of connected resources or models. Using the reasoners, additional RDF data is added to give return an inferred model. Inference API - Reasoners

18 SPARQL implementation in Jena resembles a striking similarity with that of the JDBC API. SPARQL API

19 A REST style SPARQL web service. SPARQL 1.1 queries can be called over the HTTP protocol. Uses lightweight Jetty as a Web Servlet container. There are plans to create a war archive to allow other servlet engines to be able to host Fuseki. Fuseki

20 TDB - a ACID compliant dedicated triple store written in Java that includes an inbuilt query optimiser. Memory - a volatile store. SDB - an adapter library that allows for RDF data to be persisted to a conventional relational database. Custom - custom implementations can be created to store triples such as text files or some other binary format. Store API

21 Querying a database in Jena is very similar to querying a regular relational database in java, we need a database connection with which to run queries and update the database. Due to the modular design of Java we are free to use whatever connector that will suit our data source Querying a Database

22 Some sample code using the MySQL JDBC database connector to build a model from an MySQL relational database Querying a persistent store http://www.ibm.com/developerworks/xml/library/j-jena/

23 Protégé-OWL has always had a close relationship with Jena. The Jena ARP parser is still used in the Protégé-OWL parser, and various other services such as species validation and data type handling have been reused from Jena. Protégé

24 A library which aims to simplify the process of creating rdf data. Jenabean attempts to resolve the following Jena pain points You need to create unique URI’s for every entity. You must specify the type of each primitive value. Properties must be created for each bean property. JenaBean

25 Three annotations to help describe RDF data from Java Beans. @Id specifies unique field @Namespace provides a domain @RdfProperty maps java properties to RDF properties JenaBean

26 Bean2RDF or RDF2Bean can be used to parse and write. These are wrapper classes around the Jena library. By annotating objects/beans data can be retrieved from any source and have RDF data added. This allows for flexibility when using in conjunction with legacy data stores. JenaBean

27 Provides access to relational databases as RDF graphs. This allows users to publish linked data to the web and has the ability to be queried via SPARQL. D2RQ includes a mapping interface to help convert/translate relational data into RDF. D2RQ

28 D2RQ overview Mapping files are read by the D2RQ engine that converts relational database data into RDF format. D2R server then provides an interface for presenting or querying of data.

29 Provides a fine framework for creating semantic web applications. It serves as a base to allow for other libraries extend its capabilities allowing developers to keep up with changes of the various protocols. In order to fully utilise Jena in a web app we can use tools such as Protege to design schema's for inference and then have this stored for use with Jena's Ontology. Jena Summary


Download ppt "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."

Similar presentations


Ads by Google