The Vision and Basic Technologies of the Semantic Web. The Semantic Web – Part 1 Lecturer Organization Date of presentation The Vision and Basic Technologies of the Semantic Web. Copyright IKS Consortium
Part III: Methodologies Part II: Semantic Content Management Part III: Methodologies Knowledge Interaction and Presentation Designing Interactive Ubiquitous IS Knowledge Representation and Reasoning Semantifying your CMS Semantic Lifting Reference Architecture for Semantic CMS Storing and Accessing Semantic Data Requirements Engineering for Semantic CMS Part I: Foundations Content Management The Semantic Web Copyright IKS Consortium
What is this Lecture about? Semantic web technologies as a possible solution for improving the „state of play“ in content management by making semantics expressable in machine-readable way The Semantic Web The vision behind the semantic web Underlying technologies of the Semantic Web Part I: Foundations Content Management The Semantic Web Copyright IKS Consortium
Web Engineering WT 2006/07 Chapter 4: Web Services 11.04.2017 Web evolution Web 3.0 Web 4.0 A digital library (1.0, the Web of Documents) A document library with hyperlinks A database, an application platform (1.0, evolved) A shared portal through which applications can be web accessible A multimedia and social platform (2.0, the Social Web) A radio, a trailer, a telephone, a tv, a public place, a position anywhere in the world. Collaboration, “web editing” A naming scheme (3.0, the Web of Data) Unique identity for all entities: documents, persons, services, physical things, metadata, ... URI-based data integration is the key use-case for the semantic web A Global Giant Graph (4.0. the actual Semantic Web) A place where people work, interact, and produce interpretations assisted by computers Web 2.0 Web 1.0 Slide by Nova Spivack, Radar Networks Copyright IKS Consortium © Gregor Engels University of Paderborn
The Semantic Web The vision of the Semantic Web has been originally proposed by Tim Berners-Lee “The Semantic Web is not a separate Web but an extension of the current one, in which information is given well-defined meaning, better enabling computers and people to work in cooperation.” [The Semantic Web, 2001] Standardized specification techniques for the semantic annotation of content (RDF, OWL, ...) Copyright IKS Consortium
Semantic Web Stack W3C provides standardized specifications for Semantic Web technologies Semantic Web Layer Cake as a conceptual architecture describes an hierarchy of languages Each layer exploits and uses capabilities of the layers below Semantic Web Layer Cake, Image source: http://www.w3.org/2007/03/layerCake.svg Copyright IKS Consortium
Unique Identification of Resources “...more fundamental than either HTTP or HTML are URIs, which are simple text strings that refer to Internet resources -- documents, resources, people, and indirectly to anything. URIs are the glue that binds the Web together. IRIs extend and strengthen the glue, by allowing people to identify Web resources in their own language.” In a “Web of Data” the unique identification of entities is required Copyright IKS Consortium
How to identify resources? Web Engineering WT 2006/07 Chapter 4: Web Services 11.04.2017 How to identify resources? URI – Uniform Resource Identifier [RFC 3986] “A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource.” A URI consists of five parts: scheme, authority, path, query and fragment URI = scheme ":" authority "/" path [ "?" query ] [ "#" fragment ] Example: http://user@example.com:8042/over/there?name=ferret#nose scheme authority path query fragment Copyright IKS Consortium © Gregor Engels University of Paderborn
How to identify resources? IRI – Internationalized Resource Identifier [RFC 3987] “IRIs are defined similarly to URIs in [RFC3986], but the class of unreserved characters is extended by adding the characters of the UCS (Universal Character Set, [ISO10646]) ..” Extends the character set used by URIs and thereby allows the consideration of language specific syntaxes (e.g. Japanese, Chinese, ...) Example Logical Hebrew http://ab.גדהוזח.ij/kl/mn/op.html ASCII notation http://ab.CDEFGH.ij/kl/mn/op.html Copyright IKS Consortium
Structuring Data XML – Extensible Markup Language XML can be used to specify the syntactical structure of documents or complex data objects in a machine-readable form <car> <brand>Jaguar</brand> <model>XF</model> <dimensions> <length>4961</length> <width>2070</width> </dimensions> <engine>5.0 L V8 Petrol</engine> </car> Copyright IKS Consortium
The difference in meaning is only recognized by a human. Why isn´t XML enough? XML tags are only defining the structure of a document For a machine the tags have no semantics! <car> <brand>Jaguar</brand> ... </car> <cat> <brand>Jaguar</brand> ... </cat> The difference in meaning is only recognized by a human. Copyright IKS Consortium
Why isn´t XML enough? The relation among the different tags is not expressed explicitly <car> <brand>Jaguar</brand> ... </car> The relation between “car”, “brand” and “Jaguar” is only recognizable by a human. Copyright IKS Consortium
What do we need? We want to express the statement: We need ... “The brand of the car is Jaguar.” We need ... ...a way to address the concrete resource car. ... to express the property brand of the resource car. ... to define the property value Jaguar for the property brand. Copyright IKS Consortium
Resource Description Framework (RDF) “The Resource Description Framework (RDF) identifies things using Web identifiers (URIs), and describes resources with properties and property values.” A Resource is an object that can be identified by an URI, e.g. “http://example.org/Car”. A Property describes an aspect of a resource, e.g. “http://example.org/Brand”. The property is also identified by an URI. The Property value assigns a concrete value to a property, e.g. “Jaguar” or ““http://example.org/Jaguar”. http://www.w3schools.com/rdf/ Copyright IKS Consortium
RDF Statements RDF statements consist of subject (resource), predicate (property) and object (property value) Subjects (except Blank Nodes) and Predicates are always defined by URIs Objects can be defined by URIs and literals Predicate Subject Object (URI) Predicate Object (literal) Copyright IKS Consortium
RDF Statements - Example Exemplary statements: “The brand of the car is Jaguar.” “The model of the car is XF.” Subject Predicate Object http://example.org/rel/Brand http://example.org/Car http://example.org/Jaguar http://example.org/rel/Model XF Predicate Object Copyright IKS Consortium
Resource Description Framework (RDF) “The Resource Description Framework (RDF) is a language for representing information about resources...” [RDF Primer] W3C Standard (http://www.w3.org/RDF) RDF provides a graph-based data model for representing metadata for describing the semantics of information in a machine-accessible way Copyright IKS Consortium
RDF Serialization Formats RDF/XML N3 N-Triples TRiG TRiX Turtle JSON JSON-LD RDFa Copyright IKS Consortium
RDF/XML RDF/XML is the most common serialization format for RDF statements Example: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rel="http://example.org/rel/"> <rdf:Description rdf:about="http://example.org/Car"> <rel:Brand rdf:resource="http://example.org/Jaguar"/> </rdf:Description> <rel:Model>XF</rel:Model> </rdf:RDF> http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/ Copyright IKS Consortium
Root Element and Namespaces Root element of the RDF/XML document. <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rel="http://example.org/rel/"> .... </rdf:RDF> Defined namespaces <rdf:RDF> Root element of RDF documents xmlns:rdf Specifies that elements with the “rdf” prefix are using the namespace “..” xmlns:abc Specifies that elements with the “abc” prefix are using the namespace “..” Copyright IKS Consortium
Description Element Node element Assigns a resource to <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rel="http://example.org/rel/"> <rdf:Description rdf:about="http://example.org/Car"> ... </rdf:Description> </rdf:RDF> Assigns a resource to the node element. <rdf:Description> Introduces node element (subject). <rdf:about> Defines the URI reference for the node element. Copyright IKS Consortium
Objects defined by Resources Assigning resources to objects (property values) in RDF/XML <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rel="http://example.org/rel/"> <rdf:Description rdf:about="http://example.org/Car"> <rel:Brand rdf:resource="http://example.org/Jaguar"/> </rdf:Description> </rdf:RDF> Defines predicate “Brand” in namespace “rel”. The object is defined by a resource. http://example.org/Car http://example.org/Jaguar http://example.org/rel/Brand Copyright IKS Consortium
Objects defined by Literals Definition of objects (properties) with constant values (literals) <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rel="http://example.org/rel/"> <rdf:Description rdf:about="http://example.org/Car"> <rel:Model>XF</rel:Model> </rdf:Description> </rdf:RDF> http://example.org/Car XF http://example.org/rel/Model The object is defined by a literal. Copyright IKS Consortium
RDF Container Elements “A container is a resource that contains things. The contained things are called members. The members of a container may be resources (including blank nodes) or literals.” Container provide the ability to describe groups of things, e.g. several authors of a book RDF defines three types of containers: Bag Sequence Alternatives http://www.w3.org/TR/2004/REC-rdf-primer-20040210/ Copyright IKS Consortium
Container Element - Bag “A Bag (a resource having type rdf:Bag) represents a group of resources or literals, possibly including duplicate members, where there is no significance in the order of the members.” Example: Describe equipment features of the car. http://www.w3.org/TR/2004/REC-rdf-primer-20040210/ Copyright IKS Consortium
Container Element - Bag http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag http://example.org/Car http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://example.org/features#equipment http://example.org/AC http://www.w3.org/1999/02/22-rdf-syntax-ns#_1 http://www.w3.org/1999/02/22-rdf-syntax-ns#_2 http://example.org/CarRadio Blank Node http://www.w3.org/1999/02/22-rdf-syntax-ns#_3 http://example.org/SeatHeating Copyright IKS Consortium
Container Element - Bag The subject “Car” is described by the predicate “equipment”. <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:e="http://example.org/features#"> <rdf:Description rdf:about="http://example.org/Car"> <e:equipment> <rdf:Bag> <rdf:li rdf:resource="http://example.org/AC"/> <rdf:li rdf:resource="http://example.org/CarRadio"/> <rdf:li rdf:resource="http://example.org/SeatHeating"/> </rdf:Bag> </e:equipment> </rdf:Description> </rdf:RDF> The different members of the Bag container are listed. The object is a container of type “Bag” <x:xyz> Defines predicate “xyz” in namespace “x”. <rdf:Bag> Defines a container of type “Bag”. <rdf:li> Defines members of the Bag container. Copyright IKS Consortium
Container Element - Sequence “A Sequence or Seq (a resource having type rdf:Seq) represents a group of resources or literals, possibly including duplicate members, where the order of the members is significant.” Example: Describe a list of previous owners of the car in chronological order. http://www.w3.org/TR/2004/REC-rdf-primer-20040210/ Copyright IKS Consortium
Container Element - Sequence http://example.org/Car http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://example.org/owner#preOwners http://example.org/JohnDoe http://www.w3.org/1999/02/22-rdf-syntax-ns#_1 http://www.w3.org/1999/02/22-rdf-syntax-ns#_2 http://example.org/RickMiller http://www.w3.org/1999/02/22-rdf-syntax-ns#_3 http://example.org/SarahHouse Copyright IKS Consortium
Container Element - Sequence The subject “Car” is described by the predicate “preOwners”. <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:p="http://example.org/owner#"> <rdf:Description rdf:about="http://example.org/Car"> <p:preOwners> <rdf:Seq> <rdf:li rdf:resource="http://example.org/JohnDoe"/> <rdf:li rdf:resource="http://example.org/RickMiller"/> <rdf:li rdf:resource="http://example.org/SarahHouse"/> </rdf:Seq> </p:preOwners> </rdf:Description> </rdf:RDF> The different members of the Sequence container are listed. The object is a container of type “Sequence”. <x:xyz> Defines predicate “xyz” in namespace “x”. <rdf:Seq> Defines a container of type “Sequence”. <rdf:li> Defines members of Sequence container. Copyright IKS Consortium
Container Element - Alternative “An Alternative or Alt (a resource having type rdf:Alt) represents a group of resources or literals that are alternatives (typically for a single value of a property).” Example: Describe a list of possible colors of the car. http://www.w3.org/TR/2004/REC-rdf-primer-20040210/ Copyright IKS Consortium
Container Element - Alternative http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt http://example.org/Car http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://example.org/exterior#colors http://example.org/Black http://www.w3.org/1999/02/22-rdf-syntax-ns#_1 http://www.w3.org/1999/02/22-rdf-syntax-ns#_2 http://example.org/White http://www.w3.org/1999/02/22-rdf-syntax-ns#_3 http://example.org/Green Copyright IKS Consortium
Container Element - Alternative The subject “Car” is described by the predicate “colors”. <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:c="http://example.org/exterior#" <rdf:Description rdf:about="http://example.org/Car"> <c:colors> <rdf:Alt> <rdf:li rdf:resource="http://example.org/Black"/> <rdf:li rdf:resource="http://example.org/White"/> <rdf:li rdf:resource="http://example.org/Green"/> </rdf:Alt> </c:colors> </rdf:Description> </rdf:RDF> The different members of the Alternative container are listed. The object is a container of type “Alternative”. <x:xyz> Defines predicate “xyz” in namespace “x”. <rdf:Alt> Defines a container of type “Alternative”. <rdf:li> Defines members of Alternative container. Copyright IKS Consortium
RDF Collections A RDF Container can be used to define groups, but lacks the ability to “close” them. That means to define that "these are all the members of the container". RDF Collections provide the ability to describe groups, that contain only the specified resources. “An RDF collection is a group of things represented as a list structure in the RDF graph.” Example: All equipment features of a car. http://www.w3.org/TR/2004/REC-rdf-primer-20040210/ Copyright IKS Consortium
RDF Collection http://example.org/Car http://example.org/features#equipment http://www.w3.org/1999/02/22-rdf-syntax-ns#_first http://example.org/AC http://www.w3.org/1999/02/22-rdf-syntax-ns#rest http://www.w3.org/1999/02/22-rdf-syntax-ns#_first http://example.org/CarRadio http://www.w3.org/1999/02/22-rdf-syntax-ns#rest http://www.w3.org/1999/02/22-rdf-syntax-ns#_first http://example.org/SeatHeating http://www.w3.org/1999/02/22-rdf-syntax-ns#rest http://www.w3.org/1999/02/22-rdf-syntax-ns#nil Copyright IKS Consortium
The predicate “equipment” is described by a Collection. RDF Collection The predicate “equipment” is described by a Collection. <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:e="http://example.org/features#"> <rdf:Description rdf:about="http://example.org/Car"> <e:equipment rdf:parseType="Collection"> <rdf:Description rdf:about="http://example.org/AC"/> <rdf:Description rdf:about="http://example.org/CarRadio"/> <rdf:Description rdf:about="http://example.org/SeatHeating"/> </e:equipment> </rdf:Description> </rdf:RDF> <x:xyz rdf:parseType=“Collection”> Defines that the predicate “xyz” is described by a collection. Copyright IKS Consortium
Validation Tool http://www.w3.org/RDF/Validator/ Copyright IKS Consortium http://www.w3.org/RDF/Validator/
Semantic Layer Web Cake Web Engineering WT 2006/07 Chapter 4: Web Services 11.04.2017 Semantic Layer Web Cake A model for describing resources with properties and property values. A format for specifying structured data in a machine-readable form Unique identification of resources Semantic Web Layer Cake, Image source: http://www.w3.org/2007/03/layerCake.svg Copyright IKS Consortium © Gregor Engels University of Paderborn
How do I get all black Jaguars? RDF RDF provides a model for describing resources with properties and property values. @prefix ex: <http://www.example.org/>. ex:Car1 ex:Brand ex:Jaguar ex:Car1 ex:Colour “Black” ex:Car2 ex:Brand ex:Jaguar ex:Car2 ex:Colour “White” ex:Car3 ex:Brand ex:VW ex:Car3 ex:Colour “Black” How do I get all black Jaguars? Copyright IKS Consortium
SPARQL SPARQL Protocol and RDF Query Language W3C Recommendation since 2008 SPARQL provides a standard for querying information, that is specified in RDF SPARQL consists of three specifications Query language Query results XML format Data access protocol Copyright IKS Consortium
Exemplary SPARQL Query Web Engineering WT 2006/07 Chapter 4: Web Services 11.04.2017 Exemplary SPARQL Query “Return the models and prices for all cars of brand ‘Jaguar’ ” SPARQL Query: Exemplary Result: Declares namespaces for abbreviated resources identifiers. PREFIX ex: <http://example.org/> SELECT ?model ?price WHERE { ?car ex:Brand ex:Jaguar . ?car ex:Model ?model . ?car ex:Price ?price . } Identifies the variables to appear in the query results. Provides the basic graph pattern to match against the data graph. Model Price “XJ” “79.750,00” “XF” “44.900,00” Copyright IKS Consortium © Gregor Engels University of Paderborn
Basic Graph Patterns (BGP) A SPARQL query contains a set of triple patterns called a basic graph pattern Triple patterns are like RDF triples except that each of the subject, predicate and object may be a variable. A basic graph pattern matches a subgraph of the RDF data when RDF terms from that subgraph may be substituted for the variables and the result is a RDF graph equivalent to the subgraph. Variables are defined by “?varname” or “$varname” WHERE { ?car ex:Brand ex:Jaguar . ?car ex:Model ?model . ?car ex:Price ?price . } Copyright IKS Consortium
Group Graph Patterns “For a Group Graph Pattern, a set of graph patterns must all match” In a SPARQL query string, a group graph pattern is delimited with braces: {...} PREFIX ex: <http://example.org/> SELECT ?model ?price WHERE { { ?car ex:Brand ex:Jaguar . ?car ex:Model ?model . } ?car ex:Price ?price . } Copyright IKS Consortium
Optional Pattern Matching Basic graph patterns allow applications to make queries where the entire query pattern must match. It is useful to be able to have queries that allow information to be added to the solution where the information is available, but do not reject the solution because some part of the query pattern does not match. If the optional part does not match, it creates no bindings but does not eliminate the solution. Copyright IKS Consortium http://www.w3.org/TR/rdf-sparql-query
Optional Pattern Matching Web Engineering WT 2006/07 Chapter 4: Web Services 11.04.2017 Optional Pattern Matching Example: Result PREFIX ex: <http://example.org/> SELECT ?model ?price WHERE { ?car ex:Brand ex:Jaguar . ?car ex:Model ?model . OPTIONAL { ?car ex:Price ?price . } } Model Price “XJ” “79.750,00” “XF” “44.900,00” “S-Type” Copyright IKS Consortium © Gregor Engels University of Paderborn
Scope of Filters “A constraint, expressed by the keyword FILTER, is a restriction on solutions over the whole group in which the filter appears.” Result: PREFIX ex: <http://example.org/> SELECT ?model ?price WHERE { ?car ex:Brand ex:Jaguar . ?car ex:Model ?model . ?car ex:Price ?price . FILTER (?price < 50.000,00) } Model Price “XF” “44.900,00” Copyright IKS Consortium
Unary Operators (1/2) Operator Type(A) Result Type BOUND(A) variable xsd:boolean IsURI(A) RDF term isBLANK(A) isLITERAL(A) Copyright IKS Consortium
Unary Operators (2/2) Operator Type(A) Result Type STR(A) literal simple literal URI / IRI LANG(A) DATATYPE(A) typed literal Copyright IKS Consortium
Binary Operators (1/2) Operator Type(A) Type(B) Result Type A = B numeric simple literal xsd:string xsd:boolean xsd:dateTime A != B A < B A > B A <= B A >= B Copyright IKS Consortium
Binary Operators (2/2) Operator Type(A) Type(B) Result Type sameTERM (A,B) RDF term xsd:boolean langMATCHES(A,B) simple literal REGEX Filter can be combined by “&&” or “||” Copyright IKS Consortium
Alternative Graph Patterns “SPARQL provides a means of combining graph patterns so that one of several alternative graph patterns may match. If more than one of the alternatives matches, all the possible pattern solutions are found.” Pattern alternatives are syntactically specified with the UNION keyword. PREFIX ex: <http://example.org/> SELECT ?office WHERE { ?x rdf:type ex:CarManufacturer . { ?x ex:Headquarter ?office . } UNION { ?x ex:Office ?office . } } Copyright IKS Consortium
Solution Sequences and Modifiers “Query patterns generate an unordered collection of solutions. These solutions are then treated as a sequence (a solution sequence), initially in no specific order; any sequence modifiers are then applied to create another sequence.” There are several use cases in which the results shall be presented in a defined order, e.g. alphabetical order Shall duplicates be presented or deleted? Copyright IKS Consortium
Order By “Following the ORDER BY clause is a sequence of order comparators, composed of an expression and an optional order modifier (either ASC() or DESC()). Each ordering comparator is either ascending (indicated by the ASC() modifier or by no modifier) or descending (indicated by the DESC() modifier).” PREFIX ex: <http://example.org/> SELECT ?constructionYear ?price WHERE { ?car ex:Brand ex:Jaguar . ?car ex:ConstructionYear ?constructionYear . ?car ex:Price ?price . } ORDER BY DESC(?constructionYear) ?price . Copyright IKS Consortium
Some more Solution Sequence Modifiers Web Engineering WT 2006/07 Chapter 4: Web Services 11.04.2017 Some more Solution Sequence Modifiers LIMIT “The LIMIT clause puts an upper bound on the number of solutions returned. If the number of actual solutions is greater than the limit, then at most the limit number of solutions will be returned.” OFFSET “OFFSET causes the solutions generated to start after the specified number of solutions. An OFFSET of zero has no effect.” SELECT DISTINCT “The DISTINCT solution modifier eliminates duplicate solutions. Duplicates are eliminated before either limit or offset is applied.” Copyright IKS Consortium © Gregor Engels University of Paderborn
Semantic Web Layer Cake Web Engineering WT 2006/07 Chapter 4: Web Services 11.04.2017 Semantic Web Layer Cake A language for querying information specified in RDF. A model for describing resources with properties and property values. A format for specifying structured data in a machine-readable form Unique identification of resources Semantic Web Layer Cake, Image source: http://www.w3.org/2007/03/layerCake.svg Copyright IKS Consortium © Gregor Engels University of Paderborn
Lessons Learned Now you should know ... ... the general idea of the Semantic Web and the differences to the World Wide Web. ... the underlying technologies of the Semantic Web. ... how resources can be identified and specified. .. the importance of XML for expressing data in a machine-readable way. ... the concept of the RDF and the way it is expressed (e.g.: RDF/XML). ... how SPARQL can used to query data specified in RDF. Copyright IKS Consortium
References and Additional Material Introduction to RDF http://www.w3schools.com/rdf/rdf_intro.asp RDF Syntax Specification http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210 RDF Validation Tool http://www.w3.org/RDF/Validator/ Copyright IKS Consortium