Presentation is loading. Please wait.

Presentation is loading. Please wait.

Presentation : Konstantinos Kanaris.  What is Jena?  Usage of Jena  Main Concepts  Main Components  Storage Models  OWL API  RDF API  Reasoning.

Similar presentations


Presentation on theme: "Presentation : Konstantinos Kanaris.  What is Jena?  Usage of Jena  Main Concepts  Main Components  Storage Models  OWL API  RDF API  Reasoning."— Presentation transcript:

1 Presentation : Konstantinos Kanaris

2  What is Jena?  Usage of Jena  Main Concepts  Main Components  Storage Models  OWL API  RDF API  Reasoning  Application-oriented issues

3  Open source Semantic Web framework for Java based on W3C recommendations for RDF and OWL  Provides a suitable programming environment for RDF, RDFS, OWL, SPARQL and an integrated rule-based inference mechanism

4  Import of owl ontologies, RDF, DAML into suitable models (persistent or in-memory)  Processing of these models  Export of these models to owl, rdf, daml files

5  Almost all ontology concepts:  Classes: A class is a definition of a group of individuals that belong together because they share common properties. For example John and Mary both belong to the class “person”.  Instances: Instances are what the classes consist of; their members, they inherit class characteristics and properties may be used to relate to one another

6  Properties: binary relations  Object Properties: relations between instances of two classes  Datatype Properties: relations between instances of classes and RDF literals and XML Schema datatypes

7  com.hp.hpl.jena.rdf.model: package for creating and manipulating RDF graphs  Model: RDF model  ModelMaker: ModelMaker contains a collection of named models, methods for creating new models [both named and anonymous] and opening previously-named models, removing models, and accessing a single "default" Model for this Maker.  Literal: RDF Literal  Statement: RDF Statement

8  com.hp.hpl.jena.ontology: package that provides a set of abstractions and convenience classes for accessing and manipluating ontologies represented in RDF  OntModel: An enhanced view of a Jena model that is known to contain ontology data, under a given ontology vocabulary (such as OWL)  OntClass: Interface that represents an ontology node characterising a class description  ComplementClass  IntersectionClass  UnionClass

9  OntResource: Provides a common super-type for all of the abstractions in this ontology representation package  OntModelSpec: Encapsulates a description of the components of an ontology model, including the storage scheme, reasoner and language profile  ObjectProperty: Interface encapsulating properties whose range values are restricted to individuals (as distinct from datatype valued properties)  DatatypeProperties: Interface that encapsulates the class of properties whose range values are datatype values (as distinct from ObjectProperty whose values are individuals)

10  com.hp.hpl.jena.reasoner.Reasoner: reasoner subsystem designed to allow a range of inference engines to be plugged into Jena  com.hp.hpl.jena.reasoner.ReasonerRegistry: global registry of known reasoner modules

11  Persistent Storage  Example Source Code:  OntModelSpec spec = new OntModelSpec(OntModelSpec.OWL_DL_MEM); IDBConnection conn = new DBConnection(dbURL, username, password, dbType); ModelMaker maker = ModelFactory.createModelRDBMaker(conn); Model m = maker.createModel("http://www.icsd.aegean.gr/ai- lab/projects/grid4all/ontology/grid4allOnto", false); m.read("file:G4Aonto-example.owl"); conn.close();

12  In Memory  Source Code Example:  ModelMaker modelMaker = ModelFactory.createMemModelMaker(); Model model 1 = modelMaker.createModel("myBase"); java.io.InputStream in=FileManager.get().open(fc.getCurrentDirectory().getAbsolutePath()+"\\" +fc.getSelectedFile().getName()); model1.read(in, ""); OntModelSpec spec = new OntModelSpec(OntModelSpec.OWL_DL_MEM ); com.hp.hpl.jena.reasoner.Reasoner reasoner1 = PelletReasonerFactory.theInstance().create(); spec.setReasoner( reasoner1 ); OntModel ontTestModel = ModelFactory.createOntologyModel(spec, myModel);

13

14  Source Code Example:  private ObjectProperty[] getAllPropertiesWithSameDomainAs(ObjectProperty oP){ ObjectProperty[] oPz=new ObjectProperty[0]; OntClass[] domainClasses=listDomainClasses(oP); OntModel oM=oP.getOntModel(); ExtendedIterator it=oM.listObjectProperties(); while(it.hasNext()){ ObjectProperty oP2=(ObjectProperty)it.next(); if(oP2.getLocalName().compareTo(oP.getLocalName())!=0){ OntClass[] domainClasses2=listDomainClasses(oP2); if(isSubclass(domainClasses,domainClasses2)){ oPz=extendArray(oPz,oP2); } it.close(); return oPz; }

15

16  private String[] getAllSiblingClasses(OntClass Class2){ OntClass supClass=Class2.getSuperClass(); int iNoOfSubClasses=supClass.listSubClasses().toList().size(); String[] siblings = new String[iNoOfSubClasses-1]; int iCounter=0; for(int i=0; i<iNoOfSubClasses; i++){ OntClass oC=(OntClass)supClass.listSubClasses().toList().get(i); if(!oC.equals(Class2)){ siblings[iCounter]=oC.getLocalName(); iCounter++; } return siblings; }

17

18 ExtendedIterator iter = ontModel1.listDatatypeProperties(); while(iter.hasNext()){ DatatypeProperty dP= (DatatypeProperty)iter.next(); if(dP.getRange().getLocalName().compareTo("int")==0 || dP.getRange().getLocalName().compareTo("double")==0){ String[] sProt=new String[4]; ExtendedIterator iter3= ontModel1.listIndividuals(); while(iter3.hasNext()){ OntResource oRes =(OntResource)iter3.next(); NodeIterator sit=oRes.listPropertyValues(dP); while(sit.hasNext()){ com.hp.hpl.jena.rdf.model.impl.LiteralImpl pr=(com.hp.hpl.jena.rdf.model.impl.LiteralImpl)sit.next(); String sSubject=oRes.getLocalName(); String sObject=pr.getString(); String sPredicate=dP.getLocalName();

19  Internal Reasoning  com.hp.hpl.jena.reasoner.ReasonerRegistry,mediocre reasoning ability  Source Code Example:  OntModelSpec spec = new OntModelSpec( OntModelSpec.OWL_DL_MEM ); com.hp.hpl.jena.reasoner.Reasoner reasoner1 = ReasonerRegistry.getOWLReasoner(); spec.setReasoner( reasoner1 ); ontTestModel = ModelFactory.createOntologyModel(spec, myModel);  External Reasoning  E.g.:Pellet Reasoner, complete reasoning ability  Source Code Example  OntModelSpec spec = new OntModelSpec( OntModelSpec.OWL_DL_MEM ); com.hp.hpl.jena.reasoner.Reasoner reasoner1 = PelletReasonerFactory.theInstance().create();spec.setReasoner( reasoner1 ); ontTestModel = ModelFactory.createOntologyModel(spec, myModel);

20  Jena 2.5.4 used  One in memory RDF model used  A persistent model approach was initially introduced but was rejected  Two in memory ontology models used  One with a reasoner attached  One without reasoner  Pellet 1.5.1 reasoner used is some occasions only to determine subsumptions between subclasses and superclasses and their individuals respectively

21  Only ontology files imported (OWL-DL)  No alterations on the imported ontology  Only Knowledge Extraction  Use of this knowledge to create Multiple Choice Questions  No SPARQL Queries developed

22  Limited use of the RDF API  Used only to create ontology models and in some occasions to detect certain statements.  Extended use of the Ontology API  Knowledge extracted concerning:  Classes  Individuals  Object Properties  Datatype Properties

23  ??????????????????????????????????????????????? ??????????????????__________?????????????????? ?????????????????/__________\???????????????? ????????????????/_/?????????\_\?????????????? ????????????????\_\?????????/_/?????????????? ?????????????????\_\??????/_/???????????????? ?????????????????????????/_/?????????????????? ???????????????????????/_/???????????????????? ??????????????????????|_|????????????????????? ??????????????????????????????????????????????? ??????????????????????????????????????????????? ??????????????????????|_|?????????????????????


Download ppt "Presentation : Konstantinos Kanaris.  What is Jena?  Usage of Jena  Main Concepts  Main Components  Storage Models  OWL API  RDF API  Reasoning."

Similar presentations


Ads by Google