![Page 1: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/1.jpg)
1
Knowledge RepresentationXI – IKT437
PartII
OWL, SPARQL, …Jan Pettersen Nytun, UiA
Apache Jena
![Page 2: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/2.jpg)
SOP
This presentation is based on:
Jena Ontology API http://jena.apache.org/documentation/ontology/
Jan Pettersen Nytun, UIA, page 2
![Page 3: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/3.jpg)
3
… Jena is fundamentally an RDF platform, … limited to ontology formalisms built on top of RDF.
… this means RDFS, the varieties of OWL.
![Page 4: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/4.jpg)
4
The OWL language is sub-divided into three syntax classes:
OWL Lite, OWL DL and OWL Full.
[Wikipedia]:• Every legal OWL Lite ontology is a legal
OWL DL ontology.• Every legal OWL DL ontology is a legal
OWL Full ontology.
![Page 5: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/5.jpg)
5
[Wikipedia]:
OWL Lite was originally intended to support those users primarily needing a classification hierarchy and simple constraints … Development of OWL Lite tools has … proven almost as difficult as development of tools for OWL DL, and OWL Lite is not widely used.
![Page 6: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/6.jpg)
6
[Wikipedia]:
OWL DL is designed to provide the maximum expressiveness possible while retaining computational completeness, decidability, and the availability of practical reasoning algorithms.
OWL DL includes all OWL language constructs, but they can be used only under certain restrictions …
![Page 7: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/7.jpg)
SOP Completeness
In mathematical logic, a theory is complete if it is a maximal consistent set of sentences, i.e., if it is consistent, and none of its proper extensions is consistent. For theories in logics which contain classical propositional logic, this is equivalent to asking that for every sentence φ in the language of the theory it contains either φ itself or its negation ¬φ.
Jan Pettersen Nytun, UIA, page 7
[Wikipedia]:
![Page 8: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/8.jpg)
SOP Gödel's incompleteness theore
mRecursively axiomatizable first-order theories that are rich enough to allow general mathematical reasoning to be formulated cannot be complete, as demonstrated by Gödel's incompleteness theorem.… For any such system, there will always be statements about the natural numbers that are true, but that are unprovable within the system.
Jan Pettersen Nytun, UIA, page 8
[Wikipedia]:
![Page 9: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/9.jpg)
SOP Decidability
The logically valid formulas of a system are sometimes called the theorems of the system, …
A logical system is decidable if there is an effective method for determining whether arbitrary formulas are theorems of the logical system.
Jan Pettersen Nytun, UIA, page 9
[Wikipedia]:
![Page 10: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/10.jpg)
10
[Wikipedia]:
OWL Full[edit] … a class can be treated simultaneously as a collection of individuals and as an individual in its own right ... OWL Full allows an ontology to augment the meaning of the pre-defined (RDF or OWL) vocabulary.OWL Full is undecidable, so no reasoning software is able to perform complete reasoning for it.
![Page 11: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/11.jpg)
SOP The Jena Ontology API is language-
neutral
Jan Pettersen Nytun, UIA, page 11
• The Java class names are not specific to the underlying language. For example, the OntClass Java class can represent an OWL class or RDFS class.
• To represent the differences between the various representations, each of the ontology languages has a profile, which lists the permitted constructs and the names of the classes and properties.
![Page 12: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/12.jpg)
SOP The Profile
• The profile is bound to an ontology model, which is an extended version of Jena's Model class.
• The base Model allows access to the statements in a collection of RDF data.
• OntModel extends this by adding support for the kinds of constructs expected to be in an ontology: classes (in a class hierarchy), properties (in a property hierarchy) and individuals.
Jan Pettersen Nytun, UIA, page 12
![Page 13: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/13.jpg)
SOP The Profile Continues …
• The ontology API doesn't change the RDF representation of ontologies.
• It adds a set of convenience classes and methods that make it easier for you to write programs that manipulate the underlying RDF triples.
Jan Pettersen Nytun, UIA, page 13
![Page 14: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/14.jpg)
SOP OntClass
• The predicate names defined in the ontology language correspond to the accessor methods on the Java classes in the API. For example, an OntClass has a method to list its super-classes, which corresponds to the values of the subClassOf property in the RDF representation.
• This point is worth re-emphasizing: no information is stored in the OntClass object itself. When you call the OntClass listSuperClasses() method, Jena will retrieve the information from the underlying RDF triples. Similarly, adding a subclass to an OntClass asserts an additional RDF triple, typically with predicate rdfs:subClassOf into the model.
Jan Pettersen Nytun, UIA, page 14
![Page 15: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/15.jpg)
SOP Jena Graph Interface
Graph is an internal Jena interface that supports the composition of sets of RDF triples. The asserted statements, which may have been read in from an ontology document, are held in the base graph.
Jan Pettersen Nytun, UIA, page 15
![Page 16: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/16.jpg)
SOP
The reasoner, or inference engine, can use the contents of the base graph and the semantic rules of the language to show a more complete set of base and entailed triples. This is also presented via a Graph interface, so the OntModel works only with the outermost interface.
Jan Pettersen Nytun, UIA, page 16
![Page 17: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/17.jpg)
SOP
The base graph can be an in-memory store, a database-backed persistent store, or some other storage structure altogether …
Jan Pettersen Nytun, UIA, page 17
![Page 18: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/18.jpg)
SOP RDF-level polymorphism and Java
At the same time the following may be “true” (Restriction is a subclass of Class) :
page 18
![Page 19: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/19.jpg)
SOP RDF-level polymorphism and Java Continues …
The problem we then have is that Java does not allow us to dynamically change the Java class of the object representing this resource.
Jena accepts this basic characteristic of polymorphism at the RDF level by considering that the Java abstraction (OntClass, Restriction, DatatypeProperty, etc.) is just a view or facet of the resource.
If the resource is typed as an owl:Class, it can present the OntClass facet; given other types, it can present other facets. Jena provides the .as() method to efficiently map from an RDF object to one of its allowable facets.
page 19
![Page 20: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/20.jpg)
SOP RDF-level polymorphism and Java Continues …
Resource r = myModel.getResource( myNS + "DigitalCamera" );OntClass cls = r.as( OntClass.class );
If a given RDFNode will not support the conversion to a given facet, it will raise a ConversionException. We can test whether .as() will succeed for a given facet with canAs().
page 20
![Page 21: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/21.jpg)
SOP Creating Ontology Models
OntModel m = ModelFactory.createOntologyModel();
This will create an ontology model with the default settings:• OWL-Full language• in-memory storage• RDFS inference, which principally produces
entailments from the sub-class and sub-property hierarchies.
Jan Pettersen Nytun, UIA, page 21
![Page 22: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/22.jpg)
SOP
In many applications, such as driving a GUI, RDFS inference is too strong. An OWL model that performs no reasoning at all can be created with:
OntModel m = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM );
Jan Pettersen Nytun, UIA, page 22
![Page 23: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/23.jpg)
SOP
Jan Pettersen Nytun, UIA, page 23
![Page 24: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/24.jpg)
SOP Testing Reasoning in Jena
Input Ontology@prefix : <http://www.uia.no/janpettersennytun/inference#> .@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix owl: <http://www.w3.org/2002/07/owl#> .@prefix xml: <http://www.w3.org/XML/1998/namespace> .@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
:hasApprovedId a owl:DatatypeProperty ; rdfs:subPropertyOf :hasSomeId .:hasSomeId a owl:DatatypeProperty .:hasHusband a owl:ObjectProperty ; owl:inverseOf :hasWife .:hasWife a owl:ObjectProperty .
:Man a owl:Class ; rdfs:subClassOf :Human .:Woman a owl:Class ; rdfs:subClassOf :Human .:Human a owl:Class .
:Homer a owl:NamedIndividual , :Man ; :hasSomeId "Homer_ID1_SomeID" .:Marge a owl:NamedIndividual , :Woman ; :hasApprovedId "Marge_ID1_Approved" ; :hasHusband :Homer .
Jan Pettersen Nytun, UIA, page 24
![Page 25: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/25.jpg)
SOP
Testing Reasoning in Jena
Application Headingpackage testreasoners;
import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.InputStream;import java.io.OutputStream;import java.util.ArrayList;import java.util.Collections;import java.util.List;
import org.apache.jena.ontology.OntModel;import org.apache.jena.ontology.OntModelSpec;import org.apache.jena.rdf.model.Model;import org.apache.jena.rdf.model.ModelFactory;import org.apache.jena.rdf.model.Property;import org.apache.jena.rdf.model.RDFNode;import org.apache.jena.rdf.model.Resource;import org.apache.jena.rdf.model.Statement;import org.apache.jena.rdf.model.StmtIterator;import org.apache.jena.util.FileManager;
Jan Pettersen Nytun, UIA, page 25
![Page 26: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/26.jpg)
SOP
public class TestReasoners {
private static String inputFileName = "InferenceTest__InputFile.ttl"; private static String outputFileName = "InferenceTest__OutputFile.ttl";
public static void main(String[] args){ … }
public static List<String> getSortedTriples(Model model){ … }
public static OntModel readFile(OntModelSpec ontModelSpec){ … }
}
Jan Pettersen Nytun, UIA, page 26
Testing Reasoning in Jena
Method Overview
![Page 27: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/27.jpg)
SOP
public static OntModel readFile(OntModelSpec ontModelSpec){
OntModel ontModel = ModelFactory.createOntologyModel(ontModelSpec);
InputStream in = FileManager.get().open( inputFileName ); if (in == null) { System.out.println("File: " + inputFileName + " not found"); System.exit(1); }
// read the Turtle file ontModel.read(in, null, "Turtle"); //ontModel.write(System.out, "Turtle");
return ontModel;}
Jan Pettersen Nytun, UIA, page 27
Testing Reasoning in Jena
readFile - Method
![Page 28: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/28.jpg)
SOP
public static List<String> getSortedTriples(Model model){ List<String> triples = new ArrayList<String>(); StmtIterator iter = model.listStatements();
String format = "%-20s";
String defaultNamespace = model.getNsPrefixMap().get(""); if (defaultNamespace == null) return triples;
Jan Pettersen Nytun, UIA, page 28
Testing Reasoning in Jena
getSortedTriples- Method
![Page 29: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/29.jpg)
while (iter.hasNext()) { Statement stmt = iter.nextStatement(); // get next statement Resource subject = stmt.getSubject(); // get the subject String namespace = subject.getNameSpace(); if (namespace == null || !namespace.equals(defaultNamespace)) continue;
Property predicate = stmt.getPredicate(); // get the predicate RDFNode object = stmt.getObject(); // get the object
String tripleAsString = String.format(format, subject.getLocalName().toString()); tripleAsString = tripleAsString + String.format(format, predicate.getLocalName().toString());
if (object instanceof Resource) { tripleAsString = tripleAsString + object.asResource().getLocalName().toString() + " ."; } else { // object is a literal tripleAsString = tripleAsString + " \"" + object.toString() + "\"" + " ."; } triples.add(tripleAsString); }Collections.sort(triples); return triples; } Jan Pettersen Nytun, UIA, page 29
![Page 30: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/30.jpg)
SOP
public static void main(String[] args){ OntModel model_OWL_DL_MEM = readFile(OntModelSpec.OWL_DL_MEM); List<String> triples_OWL_DL_MEM = getSortedTriples(model_OWL_DL_MEM);
System.out.println("Triple found in model_OWL_DL_MEM"); System.out.println("............................................................................."); for (String oneTriple : triples_OWL_DL_MEM) System.out.println(oneTriple); System.out.println(".............................................................................\n");
model_OWL_DL_MEM.close();…
Jan Pettersen Nytun, UIA, page 30
![Page 31: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/31.jpg)
Triple found in model_OWL_DL_MEM................................................................Homer hasSomeId "Homer_ID1_SomeID" .Homer type Man .Homer type NamedIndividual .Human type Class .Man subClassOf Human .Man type Class .Marge hasApprovedId "Marge_ID1_Approved" .Marge hasHusband Homer .Marge type NamedIndividual .Marge type Woman .Woman subClassOf Human .Woman type Class .hasApprovedId subPropertyOf hasSomeId .hasApprovedId type DatatypeProperty .hasHusband inverseOf hasWife .hasHusband type ObjectProperty .hasSomeId type DatatypeProperty .hasWife type ObjectProperty .................................................................
![Page 32: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/32.jpg)
OntModel model_OWL_DL_MEM_RDFS_INF = readFile(OntModelSpec.OWL_DL_MEM_RDFS_INF);List<String> triples_OWL_DL_MEM_RDFS_INF = getSortedTriples(model_OWL_DL_MEM_RDFS_INF);
System.out.println("Triple found in model_OWL_DL_MEM_RDFS_INF");System.out.println(".............................................................................");for (String oneTriple : triples_OWL_DL_MEM_RDFS_INF) { System.out.println(oneTriple);}
System.out.println(".............................................................................\n");
model_OWL_DL_MEM_RDFS_INF.close();
Jan Pettersen Nytun, UIA, page 32
![Page 33: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/33.jpg)
Triple found in model_OWL_DL_MEM_RDFS_INF.................................................................Homer hasSomeId "Homer_ID1_SomeID" .Homer type Human .Homer type Man .Homer type NamedIndividual .Human subClassOf Human .Human type Class .Human type Class .Human type Resource .Man subClassOf Human .Man subClassOf Man .Man type Class .Man type Class .Man type Resource .Marge hasApprovedId "Marge_ID1_Approved" .Marge hasHusband Homer .Marge hasSomeId "Marge_ID1_Approved" .Marge type Human .Marge type NamedIndividual .Marge type Woman .
![Page 34: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/34.jpg)
Woman subClassOf Human .Woman subClassOf Woman .Woman type Class .Woman type Class .Woman type Resource .hasApprovedId subPropertyOf hasApprovedId .hasApprovedId subPropertyOf hasSomeId .hasApprovedId type DatatypeProperty .hasApprovedId type Property .hasApprovedId type Resource .hasHusband inverseOf hasWife .hasHusband type ObjectProperty .hasSomeId subPropertyOf hasSomeId .hasSomeId type DatatypeProperty .hasSomeId type Property .hasSomeId type Resource .hasWife type ObjectProperty ..........................................................
Jan Pettersen Nytun, UIA, page 34
![Page 35: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/35.jpg)
OntModel model_OWL_DL_MEM_RULE_INF = readFile(OntModelSpec.OWL_DL_MEM_RULE_INF); List<String> triples_OWL_DL_MEM_RULE_INF = getSortedTriples(model_OWL_DL_MEM_RULE_INF);
System.out.println("Triple found in model_OWL_DL_MEM_RULE_INF"); System.out.println("............................................................................."); for (String oneTriple : triples_OWL_DL_MEM_RULE_INF) System.out.println(oneTriple); System.out.println(".............................................................................\n");
try { OutputStream outFile = new FileOutputStream(outputFileName); model_OWL_DL_MEM_RULE_INF.write(outFile,"Turtle"); } catch (FileNotFoundException e) { e.printStackTrace(); }
model_OWL_DL_MEM_RULE_INF.close();
}
Jan Pettersen Nytun, UIA, page 35
![Page 36: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/36.jpg)
Triple found in model_OWL_DL_MEM_RULE_INF.................................................... Homer hasSomeId "Homer_ID1_SomeID" .Homer hasWife Marge .Homer sameAs Homer .Homer type Human .Homer type Man .Homer type NamedIndividual .Homer type Resource .Homer type Thing .Human equivalentClass Human .Human subClassOf Human .Human subClassOf Resource .Human subClassOf Thing .Human type Class .Human type Class .Human type Resource .
Jan Pettersen Nytun, UIA, page 36
![Page 37: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/37.jpg)
Man equivalentClass Man .Man subClassOf Human .Man subClassOf Man .Man subClassOf Resource .Man subClassOf Thing .Man type Class .Man type Class .Man type Resource .Marge hasApprovedId "Marge_ID1_Approved" .Marge hasHusband Homer .Marge hasSomeId "Marge_ID1_Approved" .Marge sameAs Marge .Marge type Human .Marge type NamedIndividual .Marge type Resource .Marge type Thing .Marge type Woman .
Jan Pettersen Nytun, UIA, page 37
![Page 38: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/38.jpg)
Woman equivalentClass Woman .Woman subClassOf Human .Woman subClassOf Resource .Woman subClassOf Thing .Woman subClassOf Woman .Woman type Class .Woman type Class .Woman type Resource .hasApprovedId subPropertyOf hasApprovedId .hasApprovedId subPropertyOf hasSomeId .hasApprovedId type DatatypeProperty .hasApprovedId type Property .hasApprovedId type Resource .
Jan Pettersen Nytun, UIA, page 38
![Page 39: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/39.jpg)
hasHusband domain Resource .hasHusband domain Thing .hasHusband inverseOf hasWife .hasHusband range Resource .hasHusband range Thing .hasHusband subPropertyOf hasHusband .hasHusband type ObjectProperty .hasHusband type Property .hasHusband type Resource .hasSomeId subPropertyOf hasSomeId .hasSomeId type DatatypeProperty .hasSomeId type Property .hasSomeId type Resource .
Jan Pettersen Nytun, UIA, page 39
![Page 40: PowerPoint Presentationgrimstad.uia.no/.../slides/NEW______KR_1… · PPT file · Web view · 2015-10-11Apache Jena. This presentation is based on:Jena Ontology API / Jan Pettersen](https://reader036.vdocument.in/reader036/viewer/2022070609/5ad5b8cd7f8b9a6d708d388a/html5/thumbnails/40.jpg)
hasWife domain Resource .hasWife domain Thing .hasWife inverseOf hasHusband .hasWife range Resource .hasWife range Thing .hasWife subPropertyOf hasWife .hasWife type ObjectProperty .hasWife type Property .hasWife type Resource ....................................................
Jan Pettersen Nytun, UIA, page 40