ΑΝΑΠΑΡΑΣΤΑΣΗ ΓΝΩΣΗΣ ΣΤΟΝ ΠΑΓΚΟΣΜΙΟ ΙΣΤΟ

Post on 23-Feb-2016

52 views 0 download

description

ΑΝΑΠΑΡΑΣΤΑΣΗ ΓΝΩΣΗΣ ΣΤΟΝ ΠΑΓΚΟΣΜΙΟ ΙΣΤΟ. OWL. Αναπαράσταση Γνώσης στον Παγκόσμιο Ιστό. http://aigroup.ceid.upatras.gr/index.php/el/krweb. RDF-RDFS Limitations. Binary ground predicates Only subclass & subproperty hierarchy Domain and range definitions. RDF doesn’t support…. - PowerPoint PPT Presentation

Transcript of ΑΝΑΠΑΡΑΣΤΑΣΗ ΓΝΩΣΗΣ ΣΤΟΝ ΠΑΓΚΟΣΜΙΟ ΙΣΤΟ

ΑΝΑΠΑΡΑΣΤΑΣΗ ΓΝΩΣΗΣ ΣΤΟΝ ΠΑΓΚΟΣΜΙΟ ΙΣΤΟ

OWL

Αναπαράσταση Γνώσης στον Παγκόσμιο Ιστόhttp://aigroup.ceid.upatras.gr/index.php/el/krweb

RDF-RDFS Limitations• Binary ground predicates• Only subclass & subproperty hierarchy• Domain and range definitions

RDF doesn’t support…

• Local scope of properties.• Disjointness of classes.• Boolean combinations of classes.• Cardinality restrictions.• Special characteristics of properties.

OWL

• OWL Full fully compatible with RDF• OWL DL efficient reasoning• OWL Lite easier to grasp/implement

OWL Header<rdf:RDF

xmlns:owl ="http://www.w3.org/2002/07/owl#"xmlns:rdf ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"xmlns:xsd ="http://www.w3.org/2001/XMLSchema#">

<owl:Ontology rdf:about=""><rdfs:comment>An example OWL ontology</rdfs:comment><owl:priorVersion

rdf:resource="http://www.mydomain.org/uni-ns-old"/><owl:imports

rdf:resource="http://www.mydomain.org/persons"/><rdfs:label>University Ontology</rdfs:label>

</owl:Ontology>

Class Element<owl:Class rdf:ID="associateProfessor">

<rdfs:subClassOf rdf:resource="#academicStaffMember"/></owl:Class>

Disjointness<owl:Class rdf:about="#associateProfessor">

<owl:disjointWith rdf:resource="#professor"/><owl:disjointWith rdf:resource="#assistantProfessor"/>

</owl:Class>

Equivalence<owl:Class rdf:ID="faculty">

<owl:equivalentClass rdf:resource="#academicStaffMember"/></owl:Class>

Predefined Classesevery class is a subclass of owl:Thing

every class is a superclass of owl:Nothing

Properties• Object properties,

relates objects to other objects• Data type properties,

relates objects to data type values

<owl:DatatypeProperty rdf:ID="age"> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#nonNegativeInteger"/></owl:DatatypeProperty>

<owl:ObjectProperty rdf:ID="isTaughtBy"><rdfs:domain rdf:resource="#course"/><rdfs:range rdf:resource="#academicStaffMember"/><rdfs:subPropertyOf rdf:resource="#involves"/>

</owl:ObjectProperty>

Inverse Properties<owl:ObjectProperty rdf:ID="teaches">

<rdfs:range rdf:resource="#course"/><rdfs:domain rdf:resource="#academicStaffMember"/><owl:inverseOf rdf:resource="#isTaughtBy"/>

</owl:ObjectProperty>

Equivalent Properties<owl:ObjectProperty rdf:ID="lecturesIn">

<owl:equivalentProperty rdf:resource="#teaches"/></owl:ObjectProperty>

Property Restrictions<owl:Class rdf:about="#firstYearCourse">

<rdfs:subClassOf><owl:Restriction>

<owl:onProperty rdf:resource="#isTaughtBy"/><owl:allValuesFrom rdf:resource="#Professor"/>

</owl:Restriction></rdfs:subClassOf>

</owl:Class>Every person that teaches a first Year Course is a professor (universal restriction)

First-year courses are taught by professors only

<owl:Class rdf:about="#mathCourse"><rdfs:subClassOf>

<owl:Restriction><owl:onProperty rdf:resource="#isTaughtBy"/><owl:hasValue rdf:resource="#949318"/>

</owl:Restriction></rdfs:subClassOf>

</owl:Class>Mathematics Courses are taught only by professor #949318

Property Restrictions<owl:Class rdf:about="#academicStaffMember"> <rdfs:subClassOf> <owl:Restriction>

<owl:onProperty rdf:resource="#teaches"/><owl:someValuesFrom rdf:resource="#undergraduateCourse"/>

</owl:Restriction> </rdfs:subClassOf></owl:Class>

For every academic Staff member there exists an undergraduate course that is taught by him (existential restriction)

All academic staff members must teach at least one undergraduate course

Cardinality Restriction<owl:Class rdf:about="#course"> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#isTaughtBy"/> <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">

1 </owl:minCardinality> </owl:Restriction> </rdfs:subClassOf></owl:Class>

A course is taught by at least one Person

Cardinality Restriction<owl:Class rdf:about="#department"> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasMember"/> <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger"> 10 </owl:minCardinality> </owl:Restriction> </rdfs:subClassOf> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasMember"/> <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger"> 30 </owl:maxCardinality> </owl:Restriction> </rdfs:subClassOf></owl:Class>

A department must have at least 10 members but no more than 30.

Special Properties• owl:TransitiveProperty

“is taller than”, or “is ancestor of”

• owl:SymmetricProperty“is sibling of”.

• owl:FunctionalPropertya property that has at most one value for each object“has_mother”

• owl:InverseFunctionalPropertya property for which two different objects cannot have the same value“has_IDnumber”

Special Properties<owl:ObjectProperty rdf:ID="hasSameGradeAs">

<rdf:type rdf:resource="&owl;TransitiveProperty" /><rdf:type rdf:resource="&owl;SymmetricProperty" /><rdfs:domain rdf:resource="#student" /><rdfs:range rdf:resource="#student" />

</owl:ObjectProperty>

Boolean Combinations<owl:Class rdf:about="#course"> <rdfs:subClassOf> <owl:Class> <owl:complementOf rdf:resource="#staffMember"/> </owl:Class> </rdfs:subClassOf></owl:Class>

<owl:Class rdf:ID="peopleAtUni"> <owl:unionOf rdf:parseType="Collection"> <owl:Class rdf:about="#staffMember"/> <owl:Class rdf:about="#student"/> </owl:unionOf></owl:Class>

Boolean Combinations<owl:Class rdf:ID="facultyInCS"> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:about="#faculty"/> <owl:Restriction> <owl:onProperty rdf:resource="#belongsTo"/> <owl:hasValue rdf:resource="#CSDepartment"/> </owl:Restriction> </owl:intersectionOf></owl:Class>

Boolean Combinations<owl:Class rdf:ID="adminStaff"> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:about="#staffMember"/> <owl:Class> <owl:complementOf> <owl:Class> <owl:unionOf rdf:parseType="Collection"> <owl:Class rdf:about="#faculty"/> <owl:Class rdf:about="#techSupportStaff"/> </owl:unionOf> </owl:Class> </owl:complementOf> </owl:Class> </owl:intersectionOf></owl:Class>

administrative staff are those staff members that are neither faculty nor technical support staff

Enumerations<owl:Class rdf:ID="weekdays"> <owl:oneOf rdf:parseType="Collection"> <owl:Thing rdf:about="#Monday"/> <owl:Thing rdf:about="#Tuesday"/> <owl:Thing rdf:about="#Wednesday"/> <owl:Thing rdf:about="#Thursday"/> <owl:Thing rdf:about="#Friday"/> <owl:Thing rdf:about="#Saturday"/> <owl:Thing rdf:about="#Sunday"/> </owl:oneOf></owl:Class>

Instances (RDF)<rdf:Description rdf:ID="949352"> <rdf:type rdf:resource="#academicStaffMember"/></rdf:Description>

or

<academicStaffMember rdf:ID="949352"/>

We can also provide further details, such as:

<academicStaffMember rdf:ID="949352"> <uni:age rdf:datatype="&xsd;integer">39</uni:age></academicStaffMember>

Instances (RDF)Just because two instances have a different name or ID does not imply that they are different individuals.

To ensure that different individuals are indeed recognized as such, we must explicitly assert their inequality:

<lecturer rdf:ID="949318"> <owl:differentFrom rdf:resource="#949352"/></lecturer>

to state the inequality of a large number of individuals:

<owl:AllDifferent> <owl:distinctMembers rdf:parseType="Collection"> <lecturer rdf:about="#949318"/> <lecturer rdf:about="#949352"/> <lecturer rdf:about="#949111"/> </owl:distinctMembers></owl:AllDifferent>

Layering of OWL• OWL Full• OWL DL

– Vocabulary partitioning.– Explicit typing.– Property separation.– No transitive cardinality restrictions.– Restricted anonymous classes.

• OWL Lite– The constructors owl:oneOf, owl:disjointWith, owl:unionOf, owl:complementOf, and owl:hasValue

are not allowed.– Cardinality statements can only be made on the values 0 or 1 and no longer on arbitrary non-

negative integers.– owl:equivalentClass statements can no longer be made between anonymous classes but only

between class identifiers.

• open-world assumption – we may not deduce falsity from the absence of truth

• non-unique-name assumption– Just because two instances have a different name or ID does not imply

that they are different individuals

Παραδείγματα από travel.owl<owl:Class rdf:ID="Sunbathing"> <rdfs:subClassOf> <owl:Class rdf:about="#Relaxation"/> </rdfs:subClassOf></owl:Class>

<owl:Class rdf:ID="QuietDestination"> <owl:equivalentClass> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:ID="Destination"/> <owl:Class> <owl:complementOf> <owl:Class rdf:about="#FamilyDestination"/> </owl:complementOf> </owl:Class> </owl:intersectionOf> </owl:Class> </owl:equivalentClass> <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"> A destination that is not frequented by noisy families. </rdfs:comment></owl:Class>

Παραδείγματα από travel.owl<owl:Class rdf:ID="BackpackersDestination“> <owl:equivalentClass> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Destination"/> <owl:Restriction> <owl:onProperty> <owl:ObjectProperty rdf:about="#hasAccommodation"/> </owl:onProperty> <owl:someValuesFrom> <owl:Class rdf:about="#BudgetAccommodation"/> </owl:someValuesFrom> </owl:Restriction> <owl:Restriction> <owl:someValuesFrom> <owl:Class> <owl:unionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Sports"/> <owl:Class rdf:about="#Adventure"/> </owl:unionOf> </owl:Class> </owl:someValuesFrom> <owl:onProperty> <owl:ObjectProperty rdf:about="#hasActivity"/> </owl:onProperty> </owl:Restriction> </owl:intersectionOf> </owl:Class> </owl:equivalentClass> <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"> A destination that provides budget accommodation and offers sport or adventure activities. </rdfs:comment></owl:Class>

Παραδείγματα από african.owl <owl:Class rdf:ID="herbivore"> <owl:equivalentClass> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:ID="animal"/> <owl:Restriction> <owl:someValuesFrom> <owl:Class> <owl:unionOf rdf:parseType="Collection"> <owl:Class rdf:ID="plant"/> <owl:Restriction> <owl:allValuesFrom> <owl:Class rdf:about="#plant"/> </owl:allValuesFrom> <owl:onProperty> <owl:TransitiveProperty rdf:ID="is-part-of"/> </owl:onProperty> </owl:Restriction> </owl:unionOf> </owl:Class> </owl:someValuesFrom> <owl:onProperty> <owl:ObjectProperty rdf:ID="eats"/> </owl:onProperty> </owl:Restriction> </owl:intersectionOf> </owl:Class> </owl:equivalentClass> </owl:Class>

<owl:Class rdf:ID="lion"> <rdfs:subClassOf> <owl:Class rdf:ID="carnivore"/> </rdfs:subClassOf> <rdfs:subClassOf> <owl:Restriction> <owl:allValuesFrom rdf:resource="#herbivore"/> <owl:onProperty> <owl:ObjectProperty rdf:about="#eats"/> </owl:onProperty> </owl:Restriction> </rdfs:subClassOf> </owl:Class>

<owl:Class rdf:about="#carnivore"> <owl:equivalentClass> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> <owl:Restriction> <owl:onProperty> <owl:TransitiveProperty rdf:about="#is-part-of"/> </owl:onProperty> <owl:someValuesFrom> <owl:Class rdf:about="#animal"/> </owl:someValuesFrom> </owl:Restriction> <owl:Class rdf:about="#animal"/> </owl:intersectionOf> </owl:Class> </owl:equivalentClass> </owl:Class>

Παραδείγματα από african.owl<owl:ObjectProperty rdf:about="#eats"> <owl:inverseOf> <owl:ObjectProperty rdf:about="#eaten-by"/> </owl:inverseOf> <rdfs:domain rdf:resource="#animal"/> </owl:ObjectProperty>

<owl:ObjectProperty rdf:about="#eaten-by"> <owl:inverseOf rdf:resource="#eats"/> <rdfs:range rdf:resource="#animal"/> </owl:ObjectProperty>

<owl:TransitiveProperty rdf:about="#is-part-of"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/> </owl:TransitiveProperty>

Παραδείγματα από generations.owl<owl:Class rdf:ID="GrandFather"> <owl:equivalentClass> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Person"/> <owl:Restriction> <owl:onProperty> <owl:ObjectProperty rdf:about="#hasChild"/> </owl:onProperty> <owl:someValuesFrom> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Person"/> <owl:Restriction> <owl:someValuesFrom rdf:resource="#Person"/> <owl:onProperty> <owl:ObjectProperty rdf:about="#hasChild"/> </owl:onProperty> </owl:Restriction> </owl:intersectionOf> </owl:Class> </owl:someValuesFrom> </owl:Restriction> <owl:Restriction> <owl:onProperty> <owl:FunctionalProperty rdf:ID="hasSex"/> </owl:onProperty> <owl:hasValue> <Sex rdf:ID="MaleSex"/> </owl:hasValue> </owl:Restriction> </owl:intersectionOf> </owl:Class> </owl:equivalentClass> </owl:Class>

<owl:Class rdf:ID="Sibling"> <owl:equivalentClass> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Person"/> <owl:Restriction> <owl:someValuesFrom rdf:resource="#Person"/> <owl:onProperty> <owl:SymmetricProperty rdf:about="#hasSibling"/> </owl:onProperty> </owl:Restriction> </owl:intersectionOf> </owl:Class> </owl:equivalentClass> </owl:Class>

Protégé-OWL

The Protégé-OWL editor enables users to:

• Load and save OWL and RDF ontologies.• Edit and visualize classes, properties, and SWRL rules.• Define logical class characteristics as OWL expressions.• Execute reasoners such as description logic classifiers.• Edit OWL individuals for Semantic Web markup.

http://protege.cim3.net/cgi-bin/wiki.pl?SWRLTab

http://protege.cim3.net/cgi-bin/wiki.pl?SWRLLanguageFAQ

SWRL

Semantic Web Rule Language (SWRL) is an expressive OWL-based rule language. SWRL allows users to write rules that can be expressed in terms of OWL concepts to provide more powerful deductive reasoning capabilities than OWL alone.

Example: A person with a male sibling has a brother.

Person(?p) ^ hasSibling(?p,?s) ^ Man(?s) -> hasBrother(?p,?s)

Jena-OWL API

The Jena Framework includes:

• an API for reading, processing and writing RDF data in XML, N-triples and Turtle formats;

• an ontology API for handling OWL and RDFS ontologies;• a rule-based inference engine for reasoning with RDF and OWL data

sources;• stores to allow large numbers of RDF triples to be efficiently stored on

disk;• a query engine compliant with the latest SPARQL specification• servers to allow RDF data to be published to other applications using a

variety of protocols, including SPARQ

Jena-OWL API

OntModel m = ModelFactory.createOntologyModel( OntModelSpec.OWL_DL_MEM_RULE_INF);

OntModelSpec Language profile ReasonerOWL_MEM OWL full none

OWL_MEM_TRANS_INF OWL full transitive class-hierarchy inference

OWL_MEM_RULE_INF OWL full rule-based reasoner with OWL rules

OWL_MEM_MICRO_RULE_INF OWL full optimised rule-based reasoner with OWL rules

OWL_MEM_MINI_RULE_INF OWL full rule-based reasoner with subset of OWL rules

OWL_DL_MEM OWL DL none

OWL_DL_MEM_RDFS_INF OWL DL rule reasoner with RDFS-level entailment-rules

OWL_DL_MEM_TRANS_INF OWL DL transitive class-hierarchy inference

OWL_DL_MEM_RULE_INF OWL DL rule-based reasoner with OWL rules

OWL_LITE_MEM OWL Lite none

OWL_LITE_MEM_TRANS_INF OWL Lite transitive class-hierarchy inference

OWL_LITE_MEM_RDFS_INF OWL Lite rule reasoner with RDFS-level entailment-rules

OWL_LITE_MEM_RULES_INF OWL Lite rule-based reasoner with OWL rules

RDFS_MEM RDFS none

RDFS_MEM_TRANS_INF RDFS transitive class-hierarchy inference

RDFS_MEM_RDFS_INF RDFS rule reasoner with RDFS-level entailment-rules

• Δημιουργία OWL μοντέλου

http://jena.apache.org/documentation/ontology/index.html

Other Java APIs

• Protégé-OWL API http://protegewiki.stanford.edu/wiki/ProtegeOWL_API_Programmers_Guide

• OWL APIhttp://owlapi.sourceforge.net/