Jena Ontology API http www srdc metu edu

  • Slides: 51
Download presentation
Jena Ontology API http: //www. srdc. metu. edu. tr/webp age/documents/jena_doc/ontolog y/index. html 11/6/2020 1

Jena Ontology API http: //www. srdc. metu. edu. tr/webp age/documents/jena_doc/ontolog y/index. html 11/6/2020 1

Necessary Files l Is on Canvas (FA 16: DATA SEMANTICS: 33360, and FA 16:

Necessary Files l Is on Canvas (FA 16: DATA SEMANTICS: 33360, and FA 16: DATA SEMANTICS: 35326) 11/6/2020 2

Setting up l l Following Starting. Eclipse. Jena. ppt set up. Drag and Drop

Setting up l l Following Starting. Eclipse. Jena. ppt set up. Drag and Drop Unzip 11/6/2020 3

General concepts l l Jena allows a programmer to specify, in an open, meaningful

General concepts l l Jena allows a programmer to specify, in an open, meaningful way the concepts and relationships that collectively characterise some domain. l E. g. red wine, grape varieties, vintage years, wineries --- wine domain classes l E. g. wineries produce wines, wines have a year of production – wine domain relationships The advantage of an ontology is that it is an explicit, first-class description, it can be published and reused for different purposes. l A winery may uses the wine ontology to link production schedule to the stock system l A wine recommendation program may use the wine ontology to recommend wines for different menus. 11/6/2020 4

Ontology languages and Jena Ontology API l l Jena 1 tightly bound Java classes

Ontology languages and Jena Ontology API l l Jena 1 tightly bound Java classes to the specific ontology languages, While Jena ontology API is language-neutral. l Each language has its profile, which lists the permitted constructs and the URI’s of the classes and properties. l URI object property for § § § 11/6/2020 OWL: Object. Property RDFS null (as RDFS does not define object properties) DAML daml: Object. Property 5

Ontology Model l l Ontology Model allows to access to the statements in a

Ontology Model l l Ontology Model allows to access to the statements in a collection of RDF data. The profile is bound to an ontology model, which extends this by adding supports to handle: l l Classes (in a class hierarchy): Ont. Class has list. Super. Classes() method Properties (in a property hierarchy): Individuals: Worth emphasizing: l l 11/6/2020 No information is stored in the Ont. Class object itself. When list. Super. Class() method is called, the information is retrieved from the underlying RDF statements. 6

Ontology Model l The statements that the ontology Java objects see: l l l

Ontology Model l The statements that the ontology Java objects see: l l l The asserted statements in the underlying RDF graph The statement inferred by the reasoner being used. Each module works with the Graph Interface which allows us: l l 11/6/2020 To build models with no or different reasoners without changing ontology model The RDF graph can be in memory store, persistent store without affecting the ontology model. 7

RDF-level polymorphism and Jena l An ontology class: (relative)URI#Digital. Camera <rdfs: Class rdf: ID=“Digital.

RDF-level polymorphism and Jena l An ontology class: (relative)URI#Digital. Camera <rdfs: Class rdf: ID=“Digital. Camera”></rdfs: Class> l An OWL Restriction (subclass of rdfs: Class): #Digital. Camera <rdfs: Class rdf: ID=“Digital. Camera”> <rdf: type owl: Restriction /> l </rdfs: Class> #Digital. Camera is a class and a property <rdfs: Class rdf: ID=“Digital. Camera”> <rdf: type owl: Object. Property /> </rdfs: Class> How to change them in run-time? Jena 2 provide solution – as() 11/6/2020 8

RDF-level polymorphism and Jena l l Jena accepts this basic characteristic of polymorphism at

RDF-level polymorphism and Jena l l Jena accepts this basic characteristic of polymorphism at the RDF level by considering that the Java abstraction (Ont. Class, Restriction, Datatype. Property, etc. ) is just a view or facet of the resource. as() method Resource r = my. Model. get. Resource(my. NS + “Digital. Camera” ); Ont. Class cls = (Ont. Class) r. as( Ont. Class. class ); Restriction rest = (Restriction) cls. as( Restriction. class ); This RDF-level polymorphism is used extensively in the Jena ontology API to allow maximum flexibility in handling ontology data 11/6/2020 9

Example: the camera ontology l This is an example drawn from a Roger Costello’s

Example: the camera ontology l This is an example drawn from a Roger Costello’s camera ontology which deals with the domain of still-picture cameras. 11/6/2020 10

Creating ontology models l l An ontology model is an extension of the Jena

Creating ontology models l l An ontology model is an extension of the Jena RDF model that provides extra capabilities for handling ontology data sources. Ontology models are created through the Jena Model. Factory. Ont. Model m = Model. Factory. create. Ontology. Model(); l Ont. Model. Spec is used to configure a ontology model, such as: l l l 11/6/2020 The ontology language in use, the reasoner, and the means of handling compound documents Ont. Model. Spec. OWL_MEM: a ontology model using the OWL FULL profile, an in-memory storage model, and no reasoner. Ont. Model. Spec. OWL_MEM_RDFS_INF: a ontology model same as above + using RDFS rule-based reasoner (which include entailments from subclass and sub-property hierarchies, and domain and range constraints, but not entailments from the disjointness of classes 11

Creating ontology models l To create a model with a given specification, Ont. Model

Creating ontology models l To create a model with a given specification, Ont. Model m = Model. Factory. create. Ontology. Model( Ont. Model. Spec. OWL_MEM, null ); l To create a custom model specification, try to copy the existing specification and then updates it as necessary: Ont. Model. Spec s = new Ont. Model. Spec( Ont. Model. Spec. OWL_MEM ); s. set. Document. Manager( my. Doc. Mgr ); Ont. Model m = Model. Factory. create. Ontology. Model( s, null ); 11/6/2020 12

URI of the ontology language Ontology language URI RDFS http: //www. w 3. org/2000/01/rdf-schema#

URI of the ontology language Ontology language URI RDFS http: //www. w 3. org/2000/01/rdf-schema# DAML+OIL http: //www. daml. org/2001/03/daml+oil# OWL Full http: //www. w 3. org/2002/07/owl# OWL DL http: //www. w 3. org/TR/owl-features/#term_OWLDL OWL Lite http: //www. w 3. org/TR/owl-features/#term_OWLLite 11/6/2020 13

Handling ontology documents and imports l l Using the “read” method to load an

Handling ontology documents and imports l l Using the “read” method to load an ontology document into an ontology model The ontology “Document. Manager” assist to handle ontology import. It is important to hold each import as a separate graph structure so that we can know where a statement came from. When we update ontology, only base RDF changes 11/6/2020 14

Read method l There are several variants on read that handle differences in the

Read method l There are several variants on read that handle differences in the souce of the document (to be read from a resolvable URL or directly from an input stream or reader), the base URI that will resolve any relative URI’s in the source document: l l l 11/6/2020 read( String url ) read( Reader reader, String base ) read( Input. Stream reader, String base ) read( String url, String lang ) read( Reader reader, String base, String Lang ) read( Input. Stream reader, String base, String Lang ) 15

Ontology Tutorial 01 l Read ontology and output ontology l 11/6/2020 Read camera. owl

Ontology Tutorial 01 l Read ontology and output ontology l 11/6/2020 Read camera. owl (in. /data/camera. owl) and output it 16

Ontology Tutorial 01 import import java. util. List; java. io. *; org. apache. jena.

Ontology Tutorial 01 import import java. util. List; java. io. *; org. apache. jena. ontology. *; org. apache. jena. rdf. model. *; org. apache. jena. util. File. Manager; public class ontologytutorial 01 extends Object { static final String input. File. Name = "camera. owl"; public static void main (String args[]) { // Create an empty in-memory ontology model Ont. Document. Manager mgr = new Ont. Document. Manager(); Ont. Model. Spec s = new Ont. Model. Spec( Ont. Model. Spec. RDFS_MEM ); s. set. Document. Manager( mgr ); Ont. Model m = Model. Factory. create. Ontology. Model( s, null ); // use the File. Manager to open the ontology from the filesystem Input. Stream in = File. Manager. get(). open(input. File. Name); if (in == null) { throw new Illegal. Argument. Exception( "File: " + input. File. Name + " not found"); } // read the ontology file m. read( in, "" ); // write it to standard out (RDF/XML) m. write(System. out); } } 11/6/2020 Ontologytutorial 01. java 17

ontology document manager l l Each ontology model has an associated document manager that

ontology document manager l l Each ontology model has an associated document manager that assists with the processing and handling of ontology documents. There is one global document manager that is used by default by ontology models. Ont. Document. Manager mgr = new Ont. Document. Manager(); // set the mgr’s properties now. . . Ont. Model. Spec s = new Ont. Model. Spec( Ont. Model. Spec. RDFS_MEM ); s. set. Document. Manager( mgr ); Ont. Model m = Model. Factory. create. Ontology. Model( s, null ); 11/6/2020 18

Document manager policy l The document manager has a large number of configurable options.

Document manager policy l The document manager has a large number of configurable options. There are two ways to setting them: l l Using Java code to set them Using document manager to load values for the parameters from ont-policy. rdf <Document. Manager. Policy> <!-- policy for controlling the document manager's behaviour --> <process. Imports rdf: datatype="&xsd; boolean">true</process. Imports> <cache. Models rdf: datatype="&xsd; Boolean">true</cache. Models> </Document. Manager. Policy> 11/6/2020 19

Model. Maker l l The Model. Maker is a simple interface that allows different

Model. Maker l l The Model. Maker is a simple interface that allows different kinds of models (in memory, from file, in persistent database, etc. ) For database, this may include passing the database user-name and password and other connection parameters. New model makers can be created via Model. Factory. The default specificaiton in Ont. Model. Spec that begin MEM_ use in-memory model 11/6/2020 20

Controlling imports processing l l l To load an ontology without building the imports

Controlling imports processing l l l To load an ontology without building the imports closure, call the method set. Process. Imports( false) To ignore certain URI’s when loading the imported documents, call the method add. Ignore. Import( String uri ) To solve the firewall problem of importing online ontologies, the ontology manager allows a local copy of such imported ontologies <Ontology. Spec> <!-- local version of the RDFS vocabulary --> <public. URI rdf: resource="http: //www. w 3. org/2000/01/rdf-schema" /> <alt. URL rdf: resource="file: vocabularies/rdf-schema. rdf" /> <language rdf: resource="http: //www. w 3. org/2000/01/rdf-schema" /> <prefix rdf: datatype="&xsd; string">rdfs</prefix> </Ontology. Spec> 11/6/2020 21

Specifying prefixes l l A model keeps a table of URI prefixes that can

Specifying prefixes l l A model keeps a table of URI prefixes that can be used to render relative URIs The ontology model’s prefix table can be initialized by the document manger, to prevent such, l l 11/6/2020 use the property use. Declared. Ns. Prefixes in the policy file (with value “false”), or call the method set. Use. Declared. Prefixes on the ontology object. 22

Caching models l l l Suppose two ontologies, A and B both import ontology

Caching models l l l Suppose two ontologies, A and B both import ontology C. It would be nice not to have to read C twice when loading A and B. The document manager supports this use case by optionally caching C’s model. To turn model catching on or off, l l use the policy property cache. Models, or call the method set. Cache. Models( Boolean caching ). The default is caching on. Model cache can be cleared at any time by calling clear. Cache(). Ont. Model m = Model. Factory. create. Ontology. Model(); Ont. Document. Manager dm = m. get. Document. Manager(); dm. add. Alt. Entry( "http: //www. xfront. com/owl/ontologies/camera/", "file: " + JENA + "doc/user-manual/ontology/data/camera. owl" ); m. read( "http: //www. xfront. com/owl/ontologies/camera/" ); 11/6/2020 23

The generic ontology type: Ont. Resource l l l All the classes in the

The generic ontology type: Ont. Resource l l l All the classes in the ontology API that represent ontology values have Ont. Resource as a common super-class. This makes Ont. Resource a good place to put shared functionality for all such classes. The Java interface Ont. Resource extends Jena’s RDF Resource interface. 11/6/2020 24

Common Attributes of Ont. Resource Attribute Meaning version. Info A string documenting the version

Common Attributes of Ont. Resource Attribute Meaning version. Info A string documenting the version or history of this resource comment A general comment associated with this value label A human-readable label see. Also Another web location to consult for more information about this resource is. Defined. By A specialisation of see. Also that is intended to supply a definition of this resource same. As Denotes another resource that this resource is equivalent to different. From Denotes another resource that is distinct from this resource (by definition) 11/6/2020 25

Methods for Attributes of Ont. Resource Method Effect add<property> Add an additional value for

Methods for Attributes of Ont. Resource Method Effect add<property> Add an additional value for the given property set<property> Remove any existing values for the property, then add the given value list<property> Return an iterator ranging over the values of the property get<property> Return the value for the given property, if the resource has one. If not, return null. If it has more than one value, an arbitrary selection is made. has<property> Return true if there is at least one value for the given property. Depending on the name of the property, this is sometimes is<property> remove<property> Removes a given value from the values of the property on this resource. Has no effect if the resource does not have that value. 11/6/2020 26

Ont. Resource other methods l l l To find out how many values a

Ont. Resource other methods l l l To find out how many values a resource has for a given property: get. Cardinality( Property p ) Delete a resource: remove() Set the value of a given property: add. Property. Value( Property p, RDFNode value) Get the value of a given property: get. Property. Value( Property p ) List the RDF types of a resource: list. RDFTypes() l E. g. , class B is the subclass of class A, resource x rdf: type is B, l l l 11/6/2020 Without reasoner, x’s RDF types is B Reasoners with subclass hierarchy, x’s RDF types are B and A, Complete reasoners, x’s RDF types are B, A, owl: Thing, rdf: Resource 27

rdf: type inference l l list. RDFTypes() // assumes not-direct list. RDFTypes( Boolean direct

rdf: type inference l l list. RDFTypes() // assumes not-direct list. RDFTypes( Boolean direct ) //if true, show only direct relationships 11/6/2020 28

Handling ontology components: basic class expressions l l A simple class is represented in

Handling ontology components: basic class expressions l l A simple class is represented in Jena as an Ont. Class object, which is the a facet of an RDF resource Get an ontology class String cam. NS = "http: //www. xfront. com/owl/ontologies/camera/#"; Resource r = m. get. Resource( cam. NS + "Camera" ); Ont. Class camera = (Ont. Class) r. as( Ont. Class. class ); Or Ont. Class camera = m. get. Ont. Class( cam. NS + "Camera" ); l Create a new ontology class Ont. Class pin. Camera = m. create. Class( cam. NS + "Pinhole. Camera" ); l Create an anonymous class Ont. Class anon. Class = m. create. Class(); 11/6/2020 29

Handling ontology components: basic class expressions l The collection of methods for class are:

Handling ontology components: basic class expressions l The collection of methods for class are: l l set, add, get, test, list and remove values Similar methods of class can be used to: l 11/6/2020 sub. Class, super. Class, equivalent. Class, disjoint. With 30

Ontology Tutorial 02 l List the subclasses of class Camera Ont. Class camera =

Ontology Tutorial 02 l List the subclasses of class Camera Ont. Class camera = m. get. Ont. Class( cam. NS + "Camera" ); for (Iterator i = camera. list. Sub. Classes(); i. has. Next(); ) { Ont. Class c = (Ont. Class) i. next(); System. out. print( c. get. Local. Name() + " " ); } 11/6/2020 31

Ontology Tutorial 02 import java. util. List; import java. io. *; import import org.

Ontology Tutorial 02 import java. util. List; import java. io. *; import import org. apache. jena. ontology. *; org. apache. jena. rdf. model. *; org. apache. jena. util. File. Manager; org. apache. jena. util. *; org. apache. jena. util. iterator. Extended. Iterator; public class ontologytutorial 02 extends Object { static final String input. File. Name = "camera. owl"; static String cam. NS = "http: //www. xfront. com/owl/ontologies/camera/#"; public static void main (String args[]) { // Create an empty in-memory ontology model Ont. Document. Manager mgr = new Ont. Document. Manager(); Ont. Model. Spec s = new Ont. Model. Spec( Ont. Model. Spec. OWL_MEM ); s. set. Document. Manager( mgr ); Ont. Model m = Model. Factory. create. Ontology. Model( s, null ); 11/6/2020 32

Ontology Tutorial 02 // use the File. Manager to open the ontology from the

Ontology Tutorial 02 // use the File. Manager to open the ontology from the filesystem Input. Stream in = File. Manager. get(). open(input. File. Name); if (in == null) { throw new Illegal. Argument. Exception( "File: " + input. File. Name + " not found"); } // read the ontology file m. read( in, "" ); // list the subclass of class Camera Ont. Class camera = m. get. Ont. Class( cam. NS + "Camera" ); for (Extended. Iterator i = camera. list. Sub. Classes(); i. has. Next(); ) { Ont. Class c = (Ont. Class) i. next(); System. out. println( c. get. Local. Name() + " subclass of class Camera " ); } } } 11/6/2020 Ontologytutorial 02. java 33

Ontology Tutorial 02 l Ont. Model. Spec s = new Ont. Model. Spec( Ont.

Ontology Tutorial 02 l Ont. Model. Spec s = new Ont. Model. Spec( Ont. Model. Spec. OWL_MEM ); 11/6/2020 34

Handling ontology components: properties l l The class for representing ontology properties in Jena

Handling ontology components: properties l l The class for representing ontology properties in Jena is Ont. Property. It can add, set, get, list, has and remove methods. 11/6/2020 35

Ont. Property Attribute Meaning sub. Property A sub property of this property; i. e.

Ont. Property Attribute Meaning sub. Property A sub property of this property; i. e. a property which is declared to be a sub. Property. Of this property. If p is a sub property of q, and we know that A p B is true, we can infer that A q B is also true. super. Property A super property of this property, i. e. a property that this property is a sub. Property. Of domain Denotes the class or classes that form the domain of this property. Multiple domain values are interpreted as a conjunction. The domain denotes the class of value the property maps from. range Denotes the class or classes that form the range of this property. Multiple range values are interpreted as a conjunction. The range denotes the class of values the property maps to. equivalent. Property Denotes a property that is the same as this property. inverse Denotes a property that is the inverse of this property. Thus if q is the inverse of p, and we know that A q B, then we can infer that B p A. 11/6/2020 36

Create property l In camera ontology, the property body is a sub-property of part,

Create property l In camera ontology, the property body is a sub-property of part, and has domain Camera and range Body. We can create such property as: Ont. Model new. M = Model. Factory. create. Ontology. Model(); Ont. Class Camera = new. M. create. Class( cam. NS + "Camera" ); Ont. Class Body = new. M. create. Class( cam. NS + "Body" ); Object. Property part = new. M. create. Object. Property( cam. NS + "part" ); Object. Property body = new. M. create. Object. Property( cam. NS + "body" ); body. add. Super. Property( part ); body. add. Domain( Camera ); body. add. Range( Body ); 11/6/2020 37

More properties l Use as() to change an object property facet to different kinds

More properties l Use as() to change an object property facet to different kinds of property facet. l l public 11/6/2020 Functional. Property: for a given individual in the domain, the range value will be the same. Inverse. Functional. Property: for a given range element, the domain value is unique Transitive. Property: if p is transitive, and we know A p B and also B p C, then A p C (e. g. , has. Brother) Symmetric. Property: if p is symmetric, and we know A p B, then B p A Transitive. Property as. Transitive. Property(); Functional. Property as. Functional. Property(); Symmetric. Property as. Symmetric. Propery(); Inverse. Functional. Property as. Inverse. Functional. Property(); 38

Handling ontology components: more complex class expressions l There a number of additional class

Handling ontology components: more complex class expressions l There a number of additional class expressions that allow richer and more expressive descriptions of concepts, such as l l 11/6/2020 Restriction class expression: l has value, all values from, some values from, cardinality, min cardinality, max cardinality, Boolean expression: l and, or, not – intersection, union, and complement List expression l Seq, Alt and Bag Enumerated classes 39

Examples Ont. Class c = m. create. Class( Ns + "C" ); Object. Property

Examples Ont. Class c = m. create. Class( Ns + "C" ); Object. Property p = m. create. Object. Property( Ns + "p" ); // use a null URI to create an anonymous restriction All. Values. From. Restriction rst = m. create. All. Values. From. Restriction( null, p, c ); Restriction class Ont. Model Ont. Class m = Model. Factory. create. Ont. Model(); c 0 = m. create. Class( Ns + "c 0" ); c 1 = m. create. Class( Ns + "c 1" ); c 2 = m. create. Class( Ns + "c 2" ); RDF List RDFList cs = m. create. List( new RDFNode[] {c 0, c 1, c 2} ); 11/6/2020 40

Ontology Tutorial 03 l Create Ontology Camera l Here we show to create the

Ontology Tutorial 03 l Create Ontology Camera l Here we show to create the complex class “SLR” <owl: Class rdf: ID="SLR"> <owl: intersection. Of rdf: parse. Type="Collection"> <owl: Class rdf: about="#Camera"/> <owl: Restriction> <owl: on. Property rdf: resource="#viewfinder"/> <owl: has. Value rdf: resource="#Through. The. Lens"/> </owl: Restriction> </owl: intersection. Of> </owl: Class> 11/6/2020 41

Ontology Tutorial 03 import java. io. *; org. apache. jena. ontology. *; org. apache.

Ontology Tutorial 03 import java. io. *; org. apache. jena. ontology. *; org. apache. jena. rdf. model. *; org. apache. jena. vocabulary. *; public class Create. Ontology extends Object { public static void main (String args[]) throws Exception{ String cam. NS = "http: //www. xfront. com/owl/ontologies/camera/#"; String xmlbase = "http: //www. xfront. com/owl/ontologies/camera/"; // create an Ontology model Ont. Model m = Model. Factory. create. Ontology. Model(Ont. Model. Spec. OWL_MEM); Resource NAMESPACE = m. create. Resource( cam. NS ); m. set. Ns. Prefix( "camera", cam. NS); RDFWriter rdfw=m. get. Writer("RDF/XML-ABBREV"); rdfw. set. Property("xmlbase", xmlbase); // class Camera Ont. Class Camera = m. create. Class( cam. NS + "Camera" ); Ontologytutorial 03. java 11/6/2020 42

Ontology Tutorial 03 // create through. The. Lens window instance Ont. Class Window =

Ontology Tutorial 03 // create through. The. Lens window instance Ont. Class Window = m. create. Class( cam. NS + "Window" ); Individual through. The. Lens = m. create. Individual( cam. NS + "Through. The. Lens", Window ); // create the viewfinder property Object. Property viewfinder = m. create. Object. Property( cam. NS + "viewfinder" ); // now the anonymous has. Value restriction Has. Value. Restriction view. Through. Lens = m. create. Has. Value. Restriction( null, viewfinder, through. The. Lens ); // finally create the intersection class to define SLR Intersection. Class SLR = m. create. Intersection. Class( cam. NS + "SLR", m. create. List( new RDFNode[] {view. Through. Lens, Camera} ) ); // now write the model in XML form to a file File. Output. Stream camera_File = new File. Output. Stream("C: /Jena/Tutorial/camera 1. owl"); //Output. Stream out = (Output. Stream) camera_File; m. write(camera_File, "RDF/XML-ABBREV", xmlbase); } } 11/6/2020 Ontologytutorial 03. java 43

Check Output File. /camera 1. owl 11/6/2020 44

Check Output File. /camera 1. owl 11/6/2020 44

Ontology Tutorial 03 <rdf: RDF xmlns: rdf="http: //www. w 3. org/1999/02/22 -rdf-syntax-ns#" xmlns: owl="http:

Ontology Tutorial 03 <rdf: RDF xmlns: rdf="http: //www. w 3. org/1999/02/22 -rdf-syntax-ns#" xmlns: owl="http: //www. w 3. org/2002/07/owl#" xmlns: xsd="http: //www. w 3. org/2001/XMLSchema#" xmlns: camera="http: //www. xfront. com/owl/ontologies/camera/#" xmlns: rdfs="http: //www. w 3. org/2000/01/rdf-schema#"> <owl: Class rdf: ID="Window"/> <owl: Class rdf: ID="SLR"> <owl: intersection. Of rdf: parse. Type="Collection"> <owl: Restriction> <owl: has. Value> <camera: Window rdf: ID="Through. The. Lens"/> </owl: has. Value> <owl: on. Property> <owl: Object. Property rdf: ID="viewfinder"/> </owl: on. Property> </owl: Restriction> <owl: Class rdf: ID="Camera"/> </owl: intersection. Of> </owl: Class>. /camera 1. owl </rdf: RDF> 11/6/2020 45

Instances (individuals) l The method create. Individual( Resource cls ) creates an anonymous individual

Instances (individuals) l The method create. Individual( Resource cls ) creates an anonymous individual belonging to the given class. Ont. Class c = m. create. Class( Ns + "C" ); Individual inst = m. create. Individual( Ns + "foo", c ); 11/6/2020 46

Ontology meta-data l l The metadata about the ontology itself is attached to an

Ontology meta-data l l The metadata about the ontology itself is attached to an instance of class Ontology. It normally contains: l Version, Author, Comment, import Ontology ont = m. get. Ontology( base. URI ); ont. add. Property( DC. creator, "John Smith" ); 11/6/2020 47

Ontology inference l l Ontology inference by Jena is handled by Ontology Model. Jena

Ontology inference l l Ontology inference by Jena is handled by Ontology Model. Jena framework also aligns with other reasoners, such as Pellet. 11/6/2020 48

Inference and storage for ontology model Ont. Model. Spec Language Storage Reasoner OWL_MEM OWL

Inference and storage for ontology model Ont. Model. Spec Language Storage Reasoner OWL_MEM OWL full in-memory none OWL_MEM_TRANS_INF OWL full in-memory transitive class-hierarchy inference OWL_MEM_RULE_INF OWL full in-memory rule-based reasoner with OWL rules OWL_MEM_MICRO_RULE_INF OWL full in-memory optimised rule-based reasoner with OWL rules OWL_MEM_MINI_RULE_INF OWL full in-memory rule-based reasoner with subset of OWL rules OWL_DL_MEM OWL DL in-memory none OWL_DL_MEM_RDFS_INF OWL DL in-memory rule reasoner with RDFS-level entailment-rules OWL_DL_MEM_TRANS_INF OWL DL in-memory transitive class-hierarchy inference OWL_DL_MEM_RULE_INF OWL DL in-memory rule-based reasoner with OWL rules OWL_LITE_MEM OWL Lite in-memory none OWL_LITE_MEM_TRANS_INF OWL Lite in-memory transitive class-hierarchy inference OWL_LITE_MEM_RDFS_INF OWL Lite in-memory rule reasoner with RDFS-level entailment-rules OWL_LITE_MEM_RULES_INF OWL Lite in-memory rule-based reasoner with OWL rules RDFS_MEM RDFS in-memory none RDFS_MEM_TRANS_INF RDFS in-memory transitive class-hierarchy inference RDFS_MEM_RDFS_INF RDFS in-memory rule reasoner with RDFS-level entailment-rules 11/6/2020 49

Ontology Tutorial 04 l l Test different inference models Based on ontology tutorial 02:

Ontology Tutorial 04 l l Test different inference models Based on ontology tutorial 02: List the subclass of Camera l Ont. Model. Spec. OWL_MEM_RULE_INF l l Ont. Model. Spec. OWL_DL_MEM_RDFS_INF l l Digital, Large-Format Ont. Model. Spec. RDFS_MEM_RDFS_INF l 11/6/2020 SLR, Digital, Large-Format, null Ontologytutorial 04. java Digital, Large-Format 50

Summary l l Practicing and mastering all the Jena ontology API tutorials on your

Summary l l Practicing and mastering all the Jena ontology API tutorials on your own. Be able to create similar tutorials using your own examples. 11/6/2020 51