Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Resource Description Framework: RDF RDF Schema SPARQL Based on Slides By: Grigoris Antoniou Frank van Harmelen.

Similar presentations


Presentation on theme: "1 Resource Description Framework: RDF RDF Schema SPARQL Based on Slides By: Grigoris Antoniou Frank van Harmelen."— Presentation transcript:

1 1 Resource Description Framework: RDF RDF Schema SPARQL Based on Slides By: Grigoris Antoniou Frank van Harmelen

2 Semantic Web Layers 2

3 3 uXML layer wSyntactic basis uRDF layer wRDF basic data model for facts wRDF Schema simple ontology language uOntology layer wMore expressive languages than RDF Schema wCurrent Web standard: OWL

4 4 Basic Ideas of RDF uThe fundamental concepts of RDF are: wresources wproperties wstatements

5 5 Resources uWe can think of a resource as an object, a “thing” we want to talk about wE.g. authors, books, publishers, places, people, hotels uEvery resource has a URI, a Universal Resource Identifier uA URI can be wa URL (Web address) or wsome other kind of unique identifier

6 6 Properties uProperties are a special kind of resources uThey describe relations between resources wE.g. “written by”, “age”, “title”, etc. uProperties are also identified by URIs uAdvantages of using URIs: wΑ global, worldwide, unique naming scheme wReduces the homonym problem of distributed data representation

7 7 Statements uStatements assert the properties of resources uA statement is an subject-predicate- object triple wIt consists of a resource, a property, and a value uValues can be resources or literals wLiterals are atomic values (strings)

8 8 Example RDF Structure <rdf:type rdf:resource= "http://www.mydomain.org/uni- ns#course"/> Discrete Maths <rdf:type rdf:resource= "http://www.mydomain.org/uni- ns#lecturer"/> David Billington Associate Professor

9 9 Abbreviated Syntax: Example uOriginal RDF : <rdf:type rdf:resource= "http://www.mydomain.org/uni-ns#course"/> Discrete Maths uSimplified RDF:

10 10 Basic Ideas of RDF Schema uRDF is a universal language that lets users describe resources in their own vocabularies wRDF does not assume, nor does it define semantics of any particular application domain uThe user can do so in RDF Schema using: wClasses and Properties wClass Hierarchies and Inheritance wProperty Hierarchies

11 11 Class Hierarchies uClasses can be organised in hierarchies wA is a subclass of B if every instance of A is also an instance of B wThen B is a superclass of A u A subclass graph need not be a tree uA class may have multiple superclasses

12 12 Property Hierarchies uHierarchical relationships for properties wE.g., “is taught by” is a subproperty of “involves” wIf a course C is taught by an academic staff member A, then C also involves Α uThe converse is not necessarily true wE.g., A may be the teacher of the course C, or wa tutor who marks student homework but does not teach C uP is a subproperty of Q, if Q(x,y) is true whenever P(x,y) is true

13 13 RDF Layer vs RDF Schema Layer

14 14 Example: A University The class of lecturers. All lecturers are academic staff members.

15 15 Example: A University (2) The class of courses Inherits its domain ("course") and range ("lecturer") from its superproperty "involves"

16 16 Example: A University (3) It relates only courses to lecturers. It is a property of staff members and takes literals as values. <rdfs:range rdf:resource= "http://www.w3.org/2000/01/rdf- schema#Literal"/>

17 17 Semantics based on Inference Rules uSemantics in terms of RDF triples instead of restating RDF in terms of first-order logic u… and sound and complete inference systems uThis inference system consists of inference rules of the form: IF E contains certain triples THEN add to E certain additional triples uwhere E is an arbitrary set of RDF triples

18 18 Examples of Inference Rules IF E contains the triple (?x,?p,?y) THEN E also contains (?p,rdf:type,rdf:property) IF E contains the triples (?u,rdfs:subClassOf,?v) and (?v,rdfs:subclassOf,?w) THEN E also contains the triple (?u,rdfs:subClassOf,?w) IF E contains the triples (?x,rdf:type,?u) and (?u,rdfs:subClassOf,?v) THEN E also contains the triple (?x,rdf:type,?v)

19 19 Examples of Inference Rules (2) uAny resource ?y which appears as the value of a property ?p can be inferred to be a member of the range of ?p wThis shows that range definitions in RDF Schema are not used to restrict the range of a property, but rather to infer the membership of the range IF E contains the triples (?x,?p,?y) and (?p,rdfs:range,?u) THEN E also contains the triple (?y,rdf:type,?u)

20 20 Why an RDF Query Language? Different XML Representations uXML at a lower level of abstraction than RDF uThere are various ways of syntactically representing an RDF statement in XML uThus we would require several XPath queries, e.g. w//uni:lecturer/uni:title if uni:title element w//uni:lecturer/@uni:title if uni:title attribute wBoth XML representations equivalent!

21 21 Example: Different XML for Same RDF uOriginal RDF : <rdf:type rdf:resource= "http://www.mydomain.org/uni-ns#course"/> Discrete Maths uApplication of First Simplification Rule: <rdf:Description rdf:ID="CIT1111" uni:courseName="Discrete Maths"> <rdf:type rdf:resource= "http://www.mydomain.org/uni-ns#course"/> uApplication of 2nd Simplification Rule:

22 SPARQL Basic Queries uSPARQL is based on matching graph patterns uThe simplest graph pattern is the triple pattern: wlike an RDF triple, but with the possibility of a variable instead of an RDF term in the subject, predicate, or object positions uCombining triple patterns gives a basic graph pattern, where an exact match to a graph is needed to fulfill a pattern

23 Examples PREFIX rdf: PREFIX rdfs: SELECT ?c WHERE { ?c rdf:type rdfs:Class. } uRetrieves all triple patterns, where: wthe property is rdf:type wthe object is rdfs:Class uWhich means that it retrieves all classes

24 Examples (2) uGet all instances of a particular class (e.g. course) : (declaration of rdf, rdfs prefixes omitted for brevity) PREFIX uni: SELECT ?i WHERE { ?i rdf:type uni:course. }

25 25 Using select-from-where uAs in SQL, SPARQL queries have a SELECT-FROM-WHERE structure: wSELECT specifies the projection: the number and order of retrieved data wFROM is used to specify the source being queried (optional) wWHERE imposes constraints on possible solutions in the form of graph pattern templates and boolean constraints uRetrieve all phone numbers of staff members: SELECT ?x ?y WHERE { ?x uni:phone ?y.} uHere ?x and ?y are variables, and ?x uni:phone ?y represents a resource-property-value triple pattern

26 26 Implicit Join uRetrieve all lecturers and their phone numbers: SELECT ?x ?y WHERE { ?x rdf:type uni:Lecturer ; uni:phone ?y. } uImplicit join: We restrict the second pattern only to those triples, the resource of which is in the variable ?x w Here we use a syntax shorcut as well: a semicolon indicates that the following triple shares its subject with the previous one

27 Implicit join (2) uThe previous query is equivalent to writing: SELECT ?x ?y WHERE { ?x rdf:type uni:Lecturer. ?x uni:phone ?y. }

28 28 Explicit Join uRetrieve the name of all courses taught by the lecturer with ID 949352 SELECT ?n WHERE { ?x rdf:type uni:Course ; uni:isTaughtBy :949352. ?c uni:courseName ?n. FILTER (?c = ?x). }

29 Optional Patterns Grigoris Antoniou David Billington david@work.example.org uFor one lecturer it only lists the name uFor the other it also lists the email address 29

30 Optional Patterns (2) uAll lecturers and their email addresses: SELECT ?name ?email WHERE {?x rdf:type uni:Lecturer ; uni:name ?name ; uni:email ?email. } 30

31 Optional Patterns (3) uThe result of the previous query would be: uGrigoris Antoniou is listed as a lecturer, but he has no e-mail address 31 ?name?email David Billingtondavid@work.example.org

32 Optional Patterns (4) uAs a solution we can adapt the query to use an optional pattern: SELECT ?name ?email WHERE {?x rdf:type uni:Lecturer ; uni:name ?name. OPTIONAL { x? uni:email ?email } } 32

33 Optional Patterns (5) uThe meaning is roughly “give us the names of lecturers, and if known also their e-mail address” uThe result looks like this: 33 ?name?email Grigoris Antoniou David Billingtondavid@work.example.org

34 34 Summary uRDF provides a foundation for representing and processing metadata uRDF has a graph-based data model uRDF has an XML-based syntax to support syntactic interoperability wXML and RDF complement each other because RDF supports semantic interoperability uRDF has a decentralized philosophy and allows incremental building of knowledge, and its sharing and reuse

35 35 Summary (2) uRDF is domain-independent - RDF Schema provides a mechanism for describing specific domains uRDF Schema is a primitive ontology language wIt offers certain modelling primitives with fixed meaning uKey concepts of RDF Schema are class, subclass relations, property, subproperty relations, and domain and range restrictions uThere exist query languages for RDF and RDFS, including SPARQL

36 Web Ontology Language: OWL

37 37 Expressive Power of RDF Schema uClasses and Sub-classes uProperties and sub-properties uRange and domain restriction on properties uInstances of classes

38 38 Limitations of the Expressive Power of RDF Schema uLocal scope of properties wrdfs:range defines the range of a property (e.g. eats) for all classes wIn RDF Schema we cannot declare range restrictions that apply to some classes only wE.g. we cannot say that cows eat only plants, while other animals may eat meat, too

39 39 Limitations of the Expressive Power of RDF Schema (2) uDisjointness of classes wSometimes we wish to say that classes are disjoint (e.g. male and female) uBoolean combinations of classes wSometimes we wish to build new classes by combining other classes using union, intersection, and complement wE.g. person is the disjoint union of the classes male and female

40 40 Limitations of the Expressive Power of RDF Schema (3) uCardinality restrictions wE.g. a person has exactly two parents, a course is taught by at least one lecturer uSpecial characteristics of properties wTransitive property (like “greater than”) wUnique property (like “is mother of”) wA property is the inverse of another property (like “eats” and “is eaten by”)

41 41 Lecture Outline 1.Basic Ideas of OWL 2.The OWL Language 3.Examples

42 42 Requirements for Ontology Languages uOntology languages allow users to write explicit, formal conceptualizations of domain models uThe main requirements are: wa well-defined syntax wefficient reasoning support wa formal semantics wsufficient expressive power wconvenience of expression

43 43 Tradeoff between Expressive Power and Efficient Reasoning Support uThe richer the language is, the more inefficient the reasoning support becomes uSometimes it crosses the border of noncomputability uWe need a compromise: wA language supported by reasonably efficient reasoners wA language that can express large classes of ontologies and knowledge.

44 44 Reasoning About Knowledge in Ontology Languages uClass membership wIf x is an instance of a class C, and C is a subclass of D, then we can infer that x is an instance of D uEquivalence of classes wIf class A is equivalent to class B, and class B is equivalent to class C, then A is equivalent to C, too

45 45 Reasoning About Knowledge in Ontology Languages (2) uConsistency wX instance of classes A and B, but A and B are disjoint wThis is an indication of an error in the ontology uClassification wCertain property-value pairs are a sufficient condition for membership in a class A; if an individual x satisfies such conditions, we can conclude that x must be an instance of A

46 46 Uses for Reasoning uReasoning support is important for wchecking the consistency of the ontology and the knowledge wchecking for unintended relationships between classes wautomatically classifying instances in classes uChecks like the preceding ones are valuable for wdesigning large ontologies, where multiple authors are involved wintegrating and sharing ontologies from various sources

47 47 Reasoning Support for OWL uSemantics is a prerequisite for reasoning support uFormal semantics and reasoning support are usually provided by wmapping an ontology language to a known logical formalism wusing automated reasoners that already exist for those formalisms uOWL is (partially) mapped on a description logic, and makes use of reasoners such as FaCT and RACER uDescription logics are a subset of predicate logic for which efficient reasoning support is possible

48 48 Three Species of OWL uW3C’s Web Ontology Working Group defined OWL as three different sublanguages: wOWL Full wOWL DL wOWL Lite uEach sublanguage geared toward fulfilling different aspects of requirements

49 49 OWL Full uIt uses all the OWL languages primitives uIt allows the combination of these primitives in arbitrary ways with RDF and RDF Schema uOWL Full is fully upward-compatible with RDF, both syntactically and semantically uOWL Full is so powerful that it is undecidable wNo complete (or efficient) reasoning support

50 50 OWL DL uOWL DL (Description Logic) is a sublanguage of OWL Full that restricts application of the constructors from OWL and RDF wApplication of OWL’s constructors’ to each other is disallowed wTherefore it corresponds to a well studied description logic uOWL DL permits efficient reasoning support uBut we lose full compatibility with RDF: wNot every RDF document is a legal OWL DL document. wEvery legal OWL DL document is a legal RDF document.

51 51 OWL Lite uAn even further restriction limits OWL DL to a subset of the language constructors wE.g., OWL Lite excludes enumerated classes, disjointness statements, and arbitrary cardinality. uThe advantage of this is a language that is easier to wgrasp, for users wimplement, for tool builders uThe disadvantage is restricted expressivity

52 52 OWL Compatibility with RDF Schema uAll varieties of OWL use RDF for their syntax uInstances are declared as in RDF, using RDF descriptions uand typing information OWL constructors are specialisations of their RDF counterparts

53 53 Lecture Outline 1.Basic Ideas of OWL 2.The OWL Language 3.Examples

54 54 OWL XML/RDF Syntax: 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/ XLMSchema#"> uAn OWL ontology may start with a collection of assertions for housekeeping purposes using owl:Ontology element

55 55 owl:Ontology An example OWL ontology <owl:priorVersion rdf:resource="http://www.mydomain.org/uni-ns- old"/> <owl:imports rdf:resource="http://www.mydomain.org/persons "/> University Ontology uowl:imports is a transitive property

56 56 Classes uClasses are defined using owl:Class wowl:Class is a subclass of rdfs:Class uDisjointness is defined using owl:disjointWith

57 57 Classes (2) uowl:equivalentClass defines equivalence of classes uowl:Thing is the most general class, which contains everything uowl:Nothing is the empty class

58 58 Properties uIn OWL there are two kinds of properties wObject properties, which relate objects to other objects E.g. is-TaughtBy, supervises wData type properties, which relate objects to datatype values E.g. phone, title, age, etc.

59 59 Datatype Properties uOWL makes use of XML Schema data types, using the layered architecture of the Semantic Web <rdfs:range rdf:resource= "http://www.w3.org/2001/XLMS chema #nonNegativeInteger"/>

60 60 Object Properties uUser-defined data types

61 61 Inverse Properties

62 62 Equivalent Properties owl:equivalentProperty

63 63 Property Restrictions uIn OWL we can declare that the class C satisfies certain conditions wAll instances of C satisfy the conditions uThis is equivalent to saying that C is subclass of a class C', where C' collects all objects that satisfy the conditions wC' can remain anonymous

64 64 Property Restrictions (2) uA (restriction) class is achieved through an owl:Restriction element uThis element contains an owl:onProperty element and one or more restriction declarations uOne type defines cardinality restrictions (at least one, at most 3,…)

65 65 Property Restrictions (3) uThe other type defines restrictions on the kinds of values the property may take wowl:allValuesFrom specifies universal quantification wowl:hasValue specifies a specific value wowl:someValuesFrom specifies existential quantification

66 66 owl:allValuesFrom

67 67 owl:hasValue

68 68 owl:someValuesFrom

69 69 Cardinality Restrictions uWe can specify minimum and maximum number using owl:minCardinality and owl:maxCardinality uIt is possible to specify a precise number by using the same minimum and maximum number uFor convenience, OWL offers also owl:cardinality

70 70 Cardinality Restrictions (2) 1

71 71 Special Properties uowl:TransitiveProperty (transitive property) wE.g. “has better grade than”, “is ancestor of” uowl:SymmetricProperty (symmetry) wE.g. “has same grade as”, “is sibling of” uowl:FunctionalProperty defines a property that has at most one value for each object wE.g. “age”, “height”, “directSupervisor” uowl:InverseFunctionalProperty defines a property for which two different objects cannot have the same value

72 72 Special Properties (2)

73 73 Boolean Combinations uWe can combine classes using Boolean operations (union, intersection, complement) <owl:complementOf rdf:resource= "#staffMember"/>

74 74 Boolean Combinations (2) uThe new class is not a subclass of the union, but rather equal to the union wWe have stated an equivalence of classes

75 75 Boolean Combinations (3)

76 76 Nesting of Boolean Operators

77 77 Enumerations with owl:oneOf

78 78 Declaring Instances uInstances of classes are declared as in RDF: 39

79 79 No Unique-Names Assumption uOWL does not adopt the unique-names assumption of database systems wIf two instances have a different name or ID does not imply that they are different individuals uSuppose we state that each course is taught by at most one staff member, and that a given course is taught by two staff members wAn OWL reasoner does not flag an error wInstead it infers that the two resources are equal

80 80 Distinct Objects uTo ensure that different individuals are indeed recognized as such, we must explicitly assert their inequality:

81 81 Distinct Objects (2) uOWL provides a shorthand notation to assert the pairwise inequality of all individuals in a given list

82 82 Data Types in OWL uXML Schema provides a mechanism to construct user-defined data types wE.g., the data type of adultAge includes all integers greater than 18 uSuch derived data types cannot be used in OWL wThe OWL reference document lists all the XML Schema data types that can be used wThese include the most frequently used types such as string, integer, Boolean, time, and date.

83 83 Combination of Features uIn different OWL languages there are different sets of restrictions regarding the application of features uIn OWL Full, all the language constructors may be used in any combination as long as the result is legal RDF

84 84 Restriction of Features in OWL DL uVocabulary partitioning wAny resource is allowed to be only a class, a data type, a data type property, an object property, an individual, a data value, or part of the built-in vocabulary, and not more than one of these uExplicit typing wThe partitioning of all resources must be stated explicitly (e.g. a class must be declared if used in conjunction with rdfs:subClassOf)

85 85 Restriction of Features in OWL DL (2) uProperty Separation wThe set of object properties and data type properties are disjoint wTherefore the following can never be specified for data type properties: owl:inverseOf owl:FunctionalProperty owl:InverseFunctionalProperty owl:SymmetricProperty

86 86 Restriction of Features in OWL DL (3) uNo transitive cardinality restrictions wNo cardinality restrictions may be placed on transitive properties uRestricted anonymous classes: Anonymous classes are only allowed to occur as: wthe domain and range of either owl:equivalentClass or owl:disjointWith wthe range (but not the domain) of rdfs:subClassOf

87 87 Restriction of Features in OWL Lite uRestrictions of OWL DL and more uowl:oneOf, owl:disjointWith, owl:unionOf, owl:complementOf and owl:hasValue are not allowed uCardinality statements (minimal, maximal, and exact cardinality) can only be made on the values 0 or 1 uowl:equivalentClass statements can no longer be made between anonymous classes but only between class identifiers

88 88 Lecture Outline 1.Basic Ideas of OWL 2.The OWL Language 3.Examples

89 89 An African Wildlife Ontology – Class Hierarchy

90 90 An African Wildlife Ontology – Schematic Representation Βranches are parts of trees

91 91 An African Wildlife Ontology – Properties

92 92 An African Wildlife Ontology – Plants and Trees Plants form a class disjoint from animals. Trees are a type of plant.

93 93 An African Wildlife Ontology – Branches Branches are parts of trees.

94 94 An African Wildlife Ontology – Leaves Leaves are parts of branches.

95 95 An African Wildlife Ontology – Carnivores Carnivores are exactly those animals that eat animals.

96 96 An African Wildlife Ontology – Giraffes Giraffes are herbivores, and they eat only leaves.

97 97 An African Wildlife Ontology – Lions Lions are animals that eat only herbivores.

98 98 Summary uOWL is the proposed standard for Web ontologies uOWL builds upon RDF and RDF Schema: w(XML-based) RDF syntax is used wInstances are defined using RDF descriptions wMost RDFS modeling primitives are used

99 99 Summary (2) uFormal semantics and reasoning support is provided through the mapping of OWL on logics wPredicate logic and description logics have been used for this purpose uWhile OWL is sufficiently rich to be used in practice, extensions are in the making wThey will provide further logical features, including rules


Download ppt "1 Resource Description Framework: RDF RDF Schema SPARQL Based on Slides By: Grigoris Antoniou Frank van Harmelen."

Similar presentations


Ads by Google