330 likes | 544 Views
ΑΝΑΠΑΡΑΣΤΑΣΗ ΓΝΩΣΗΣ ΣΤΟΝ ΠΑΓΚΟΣΜΙΟ ΙΣΤΟ. 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….
E N D
ΑΝΑΠΑΡΑΣΤΑΣΗ ΓΝΩΣΗΣ ΣΤΟΝ ΠΑΓΚΟΣΜΙΟ ΙΣΤΟ 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 Classes every 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:Classrdf:about="#firstYearCourse"> <rdfs:subClassOf> <owl:Restriction> <owl:onPropertyrdf:resource="#isTaughtBy"/> <owl:allValuesFromrdf: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:Classrdf:about="#mathCourse"> <rdfs:subClassOf> <owl:Restriction> <owl:onPropertyrdf:resource="#isTaughtBy"/> <owl:hasValuerdf:resource="#949318"/> </owl:Restriction> </rdfs:subClassOf> </owl:Class> Mathematics Courses are taught only by professor #949318
Property Restrictions <owl:Classrdf:about="#academicStaffMember"> <rdfs:subClassOf> <owl:Restriction> <owl:onPropertyrdf:resource="#teaches"/> <owl:someValuesFromrdf: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:Classrdf:about="#course"> <rdfs:subClassOf> <owl:Restriction> <owl:onPropertyrdf:resource="#isTaughtBy"/> <owl:minCardinalityrdf:datatype="&xsd;nonNegativeInteger"> 1 </owl:minCardinality> </owl:Restriction> </rdfs:subClassOf> </owl:Class> A course is taught by at least one Person
Cardinality Restriction <owl:Classrdf:about="#department"> <rdfs:subClassOf> <owl:Restriction> <owl:onPropertyrdf:resource="#hasMember"/> <owl:minCardinalityrdf:datatype="&xsd;nonNegativeInteger"> 10 </owl:minCardinality> </owl:Restriction> </rdfs:subClassOf> <rdfs:subClassOf> <owl:Restriction> <owl:onPropertyrdf:resource="#hasMember"/> <owl:maxCardinalityrdf: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:FunctionalProperty a property that has at most one value for each object“has_mother” • owl:InverseFunctionalProperty a 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:Classrdf:ID="adminStaff"> <owl:intersectionOfrdf:parseType="Collection"> <owl:Classrdf:about="#staffMember"/> <owl:Class> <owl:complementOf> <owl:Class> <owl:unionOfrdf:parseType="Collection"> <owl:Classrdf:about="#faculty"/> <owl:Classrdf: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:Classrdf:ID="Sunbathing"> <rdfs:subClassOf> <owl:Classrdf:about="#Relaxation"/> </rdfs:subClassOf> </owl:Class> <owl:Classrdf:ID="QuietDestination"> <owl:equivalentClass> <owl:Class> <owl:intersectionOfrdf:parseType="Collection"> <owl:Classrdf:ID="Destination"/> <owl:Class> <owl:complementOf> <owl:Classrdf:about="#FamilyDestination"/> </owl:complementOf> </owl:Class> </owl:intersectionOf> </owl:Class> </owl:equivalentClass> <rdfs:commentrdf: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: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> <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>
Παραδείγματα από 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.
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) http://protege.cim3.net/cgi-bin/wiki.pl?SWRLTab http://protege.cim3.net/cgi-bin/wiki.pl?SWRLLanguageFAQ
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 • Δημιουργία OWL μοντέλου OntModel m = ModelFactory.createOntologyModel( OntModelSpec.OWL_DL_MEM_RULE_INF); 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 API • http://owlapi.sourceforge.net/