Jena – A Semantic Web Framework for Java
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Jena – A Semantic Web Framework for Java

  • 7,752 views
Uploaded on

 

More in: Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
7,752
On Slideshare
7,734
From Embeds
18
Number of Embeds
3

Actions

Shares
Downloads
343
Comments
0
Likes
5

Embeds 18

http://www.slideshare.net 12
http://www.linkedin.com 5
https://www.linkedin.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Introduction Semantic Web technologies Jena Jena – A Semantic Web Framework for Java Aleksander Pohl Katedra Informatyki, Akademia Górniczo-Hutnicza 2. luty 2009 Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 2. Introduction Semantic Web technologies Jena Agenda Introduction Semantic Web technologies Jena Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 3. Introduction Semantic Web technologies Jena Agenda Introduction Semantic Web technologies Jena Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 4. Introduction Semantic Web technologies Jena What is the Semantic Web? The Semantic Web is an: ... extension of current web in which ◮ ... information is given well defined meaning ◮ ... better enabling people and computers to work in ◮ cooperations. The Semantic Web, Tim Barners-Lee, James Hendler and Ora Lassil Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 5. Introduction Semantic Web technologies Jena Motivation providing information about Web resources and the ◮ systems that use them allowing data to be processed outside the particular ◮ environment in which it was created combining data from several applications to arrive at new ◮ information Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 6. Introduction Semantic Web technologies Jena Agenda Introduction Semantic Web technologies Jena Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 7. Introduction Semantic Web technologies Jena Core Semantic Web technologies RDF – Resource Description Framework ◮ RDFS – RDF Schema (vocabulary) ◮ OWL – Web Ontology Language ◮ SPARQL – Query Language for RDF ◮ Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 8. Introduction Semantic Web technologies Jena RDF – Resource Description Framework based on XML and URIs ◮ directed, labeled graph format for representing ◮ information in the web formal semantics allows well founded deductions in RDF ◮ data extensible vocabulary ◮ Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 9. Introduction Semantic Web technologies Jena RDF – graph data model any expression in RDF is a collection of triples ◮ every triple consists of a subject, a predicate and an object ◮ the arc direction is significant – it always points toward the ◮ object assertion of an RDF triple says that some relationship, ◮ indicated by the predicate, holds between the things denoted by subject and object of the triple meaning of an RDF graph is the conjunction (logical AND) ◮ of the statements corresponding to all the triples it contains Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 10. Introduction Semantic Web technologies Jena RDF – subject, predicate & object nodes of an RDF graph are its subjects and objects ◮ a node may be: ◮ URI with optional fragment identifier, eg. ◮ http://www.example.org/staffid/1234#xyz literal, eg. quot;Georgequot; ◮ blank ◮ the subject of a triple might be only URI reference or ◮ a blank node the predicate of the triple must be URI reference ◮ Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 11. Introduction Semantic Web technologies Jena RDF – example <rdf:Description rdf:about=quot;http://www.ivan-herman.netquot;> <foaf:name>Ivan</foaf:name> <abc:myCalendar rdf:resource=quot;http://.../myCalendarquot;/> <foaf:surname>Herman</foaf:surname> </rdf:Description> Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 12. Introduction Semantic Web technologies Jena RDFS – RDF Vocabulary Description Language RDF itself provides no means for defining ◮ application-specific classes and properties They are described in RDFS – RDF Vocabulary ◮ Description Language (aka RDF Schema) RDF Schema provides a type system for RDF, similar to ◮ type systems in programming languages: allows resources to be defined as instances of one or more ◮ classes allows classes to be organized in a hierarchical fashion ◮ URIref prefix ◮ http://www.w3.org/2000/01/rdf-schema#, conventionally associated with the QName prefix rdfs: Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 13. Introduction Semantic Web technologies Jena RDFS – basic notions (1) Classes are described using the RDFS resources: ◮ rdfs:Class ◮ rdfs:Resource ◮ and the properties: ◮ rdf:type ◮ rdfs:subClassOf ◮ Example: ◮ ex:MotorVehicle rdf:type rdfs:Class. ◮ Java: class MotorVehicle {· · · } exthings:myCar rdf:type ex:MotorVehicle. ◮ Java: myCar = new MotorVehicle(); ex:Van rdfs:subClassOf ex:MotorVehicle. ◮ Java: class Van extends MotorVehicle {· · · } Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 14. Introduction Semantic Web technologies Jena OWL – Web Ontology Language Intended to be used when the information needs to be ◮ processed by applications (not merely presented to humans) Provides additional vocabulary along with a formal ◮ semantics Sublanguages: ◮ Lite – classification hierarchy and simple constraints ◮ (extension of restricted RDF) DL (Description Logic) – maximum expressiveness while ◮ retaining computational completeness (extension of restricted RDF) Full – maximum expressiveness and the syntactic freedom ◮ of RDF with no computational guarantees (real extension of RDF) Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 15. Introduction Semantic Web technologies Jena OWL Lite additions (In)Equality: equivalentClass, ◮ equivalentProperty, sameAs, differentFrom, ... Property characteristics: inverseOf, ◮ TransitiveProperty, SymmetricProperty, ... Restricted Cardinality: minCardinality, ◮ maxCardinality, cardinality Annotation Properties: rdfs:label, rdfs:comment, ◮ rdfs:seeAlso, rdfs:isDefinedBy, AnnotationProperty, OntologyProperty Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 16. Introduction Semantic Web technologies Jena Semantic Web – ontologies overview Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 17. Introduction Semantic Web technologies Jena SPARQL – overview SPARQL is a query language for RDF ◮ It is similar to SQL in terms of purpose and syntax, but ◮ different in terms of application (relational data vs. graph based data) Human-friendly syntax ◮ Data integration and aggregation – multiple sources ◮ supported by default Allows to make yes/no questions ◮ Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 18. Introduction Semantic Web technologies Jena SPARQL Example Data: ◮ <http://example.org/book/book1> <http://purl.org/dc/elements/1.1/title> ”SPARQL Tutorial” . Query: ◮ SELECT ?title WHERE { <http://example.org/book/book1> <http://purl.org/dc/elements/1.1/title> ?title . } Result: ◮ title ”SPARQL Tutorial” Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 19. Introduction Semantic Web technologies Jena Agenda Introduction Semantic Web technologies Jena Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 20. Introduction Semantic Web technologies Jena Jena2 – overview Developed by HP Laboratories ◮ Open-source Java implementation of core Semantic Web ◮ technologies: RDF graph manipulation API ◮ RDFS and OWL reasoning API ◮ Includes the de facto reference RDF/XML parser ◮ RDF/XML, N3 and N-triple Input/Output ◮ SPQRQL query engine ◮ rule-based inference engine ◮ In-memory or persistent storage ◮ Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 21. Introduction Semantic Web technologies Jena RDF API example // some definitions 1 static String personURI = quot;http://somewhere/JohnSmithquot;; 2 static String fullName = quot;John Smithquot;; 3 4 // create an empty Model 5 Model model = ModelFactory.createDefaultModel(); 6 7 // create the resource 8 Resource johnSmith = model.createResource(personURI); 9 10 // add the property 11 johnSmith.addProperty(VCARD.FN, fullName); 12 Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 22. Introduction Semantic Web technologies Jena SPARQL API example Model model = ... ; 1 String queryString = quot; .... quot; ; 2 Query query = QueryFactory.create(queryString) ; 3 QueryExecution qexec = QueryExecutionFactory.create(query, model) ; 4 try { 5 ResultSet results = qexec.execSelect() ; 6 for ( ; results.hasNext() ; ) 7 { 8 QuerySolution soln = results.nextSolution() ; 9 // Get a result variable by name. 10 RDFNode x = soln.get(quot;varNamequot;) ; 11 // Get a result variable - must be a resource 12 Resource r = soln.getResource(quot;VarRquot;) ; 13 // Get a result variable - must be a literal 14 Literal l = soln.getLiteral(quot;VarLquot;) ; 15 } 16 } finally { qexec.close() ; } 17 Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 23. Introduction Semantic Web technologies Jena Jena comparison Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 24. Introduction Semantic Web technologies Jena Bibliography (1) Brickley, Dan; Guha, Ramanathan (2004). RDF Vocabulary ◮ Description Language 1.0: RDF Schema, http://www.w3.org/TR/rdf-schema/ Carroll, Jeremy J.; Dickinson, Ian; Dollin, Chris; Reynolds, ◮ Dave; Seaborne, Andy; Wilkinson, Kevin (2003). Jena: Implementing the Semantic Web Recommendations, HP Laboratories, Bristol, technical report HPL-2003-146. Herman, Ivan Questions (and Answers) on the semantic ◮ Web, http://www.w3.org/People/Ivan/- CorePresentations/SW_QA Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java
  • 25. Introduction Semantic Web technologies Jena Bibliography (2) Klyne, Graham; Carroll, Jeremy J. (2004). Resource ◮ Description Framework (RDF): Concepts and Abstract Syntax http://www.w3.org/TR/rdf-concepts/ McBride, Brian (2002), The Semantic Web, HP ◮ Laboratories, Bristol, Euroweb 2002 invited talk. McGuinness, Deborah; van Harmelen, Frank (2004). OWL ◮ Web Ontology Language Overview, http://www.w3.org/TR/owl-features/ Aleksander Pohl KI AGH Jena – A Semantic Web Framework for Java