NoSQL (Not only SQL)

Size: px
Start display at page:

Download "NoSQL (Not only SQL)"

Transcription

1 NoSQL (Not only SQL) - Many distributed application in the Web, don t need much of the guarantees and features of relation databases, and of SQL. - These guarantees and features usually come at a high price! - Take Amazon e-commerce platform Hundreds of services; millions of simultaneous customers at peek time; tens of thousands servers in geographically distributed server Most services only require read/write by primary key; complex queries are mostly unnecessary; availability is usually more crucial than consistency - NoSQL movement - abandon some of the guarantees and features, for having performance boosts Big Web 2.0 companies developed and use NoSQL systems (e.g. Google, Facebook, Amazon) José Alferes - Adaptado de Database System Concepts - 6 th Edition 364

2 CAP conjecture - Conjecture [Eric Brewer, PODC 2000]: It is impossible for a webservice to provide the 3 guarantees of: Consistency: all nodes should see the same data at the same time; Availability: node failures do not prevent others from continuing to operate (read and write); Partition-tolerance: the system continues to operate despite network partition - Devise systems that have: highly availability; high performance; scalability. José Alferes - Adaptado de Database System Concepts - 6 th Edition 365

3 CAP - Pick two José Alferes - Adaptado de Database System Concepts - 6 th Edition 366

4 The relational model vs key-value - The relational model is sometimes too rigid the attributes of objects may vary it is hard (or impossible) to anticipate which are the needed attributes for objects of a given type - Adopted a much simpler model - Key-Value (e.g. Amazon s Dinamo) (persistent) objects are accessible by a key, and have a value (which may be complex) API with: get(key) - return the value of the object(s) with the key put(key,context,value) - creates/updates an object with the key to have the value; context contains metadata about the object Objects can further be ordered and linked José Alferes - Adaptado de Database System Concepts - 6 th Edition 367

5 Keyspace based key-value - Group objects in keyspaces e.g. Cassandra - Keyspace are similar to schemas - API: insert(table,key,rowmutation) get(table,key,columnname) delete(table,key,columnname) José Alferes - Adaptado de Database System Concepts - 6 th Edition 368

6 Document based key-value - View each object as a document, and group objects in collections (similar to keyspaces) e.g. MongoDB - Insert objects in a collection: E.g. db.insert.customer(id: 1234, name: John, ) - More elaborate constructs to find objects (not only by key) db.customer.find() - returns all costumers db.customer.find( {name= A } ) - returns all customer whose name is John Also patterns for conjunctions, disjunctions, distinct values, etc José Alferes - Adaptado de Database System Concepts - 6 th Edition 369

7 More complex queries - For joins, use (more low-level) cursors, to iterate over different collections - For aggregations use map-reduce map function determines a list for each group reduce function determines what to do with each group - Example (sum of balances of accounts per branch) db.accounts.mapreduce( function () { emit(this.branch, this.balance) } function (key, values) { return Array.sum(value) }. {out: balances_sum } ) José Alferes - Adaptado de Database System Concepts - 6 th Edition 370

8 NoSQL evolution José Alferes - Adaptado de Database System Concepts - 6 th Edition 371

9 NoSQL evolution José Alferes - Adaptado de Database System Concepts - 6 th Edition 371

10 NoSQL evolution José Alferes - Adaptado de Database System Concepts - 6 th Edition 371

11 NoSQL evolution José Alferes - Adaptado de Database System Concepts - 6 th Edition 371

12 NoSQL evolution José Alferes - Adaptado de Database System Concepts - 6 th Edition 371

13 NoSQL evolution :-) José Alferes - Adaptado de Database System Concepts - 6 th Edition 371

14 Web of Data José Júlio Alferes ISCTEM - janeiro de 2017

15 Linked Data José Júlio Alferes ISCTEM - janeiro de 2017

16 Semantic Web José Júlio Alferes ISCTEM - janeiro de 2017

17 Web of Data José Júlio Alferes ISCTEM - janeiro de 2017

18 A Web of Documents Most of today s Web content is organised in a big graph of Documents Even Web content that is generated automatically is usually then processed and presented as a document, without the original structural information (e.g. from databases) Typical usage of this graph of documents requires people - for seeking and making use of information, - searching for and getting in touch with other people, - reviewing catalogues of online stores and ordering products by filling out forms, ISCTEM - janeiro 2017

19 A Web of Documents Most of today s Web content is organised in a big graph of Documents Even Web content that is generated automatically is usually then processed and presented as a document, without the original structural information (e.g. from databases) Typical usage of this graph of documents requires people - for seeking and making use of information, - searching for and getting in touch with other people, - reviewing catalogues of online stores and ordering products by filling out forms, A Web in machines, for humans usage ISCTEM - janeiro 2017

20 Planning a trip ISCTEM - janeiro 2017

21 Planning a trip One has to consult several sites, with different styles, purposes, languages,... Mentally integrate the data and understand it Apply personal preferences ISCTEM - janeiro 2017

22 Planning a trip One has to consult several sites, with different styles, purposes, languages,... Mentally integrate the data and understand it Apply personal preferences How could we do a program to perform such a task? Note that those pages most likely are already based in structured data, but one can t access it (easily) ISCTEM - janeiro 2017

23 Querying the Web Google is great! - for keyword search ISCTEM - janeiro 2017

24 Querying the Web Google is great! - for keyword search ISCTEM - janeiro 2017

25 Querying the Web Google is great! - for keyword search ISCTEM - janeiro 2017

26 Querying the Web Google is great! - for keyword search What if we want to make more elaborate queries? - Similar to what you may do in databases. ISCTEM - janeiro 2017

27 Querying the Web Google is great! - for keyword search What if we want to make more elaborate queries? - Similar to what you may do in databases. ISCTEM - janeiro 2017

28 Querying the Web Google is great! - for keyword search What if we want to make more elaborate queries? - Similar to what you may do in databases. What about very specialised queries? - E.g. in specific domains - What are the genes and phenotypes associated with OMIM (Online Mendelian Inheritance in Man) diseases? - Again similar to those to databases. ISCTEM - janeiro 2017

29 A Web of Linked Data For these queries, what we need is a Web of (raw) Data ISCTEM - janeiro 2017

30 A Web of Linked Data For these queries, what we need is a Web of (raw) Data Use the Linked Data in the same way we do with linked documents - be able to link data independently of presentation - use the data to query it, present it, mine it - have data in a machine processable format ISCTEM - janeiro 2017

31 A Web of Linked Data For these queries, what we need is a Web of (raw) Data Use the Linked Data in the same way we do with linked documents - be able to link data independently of presentation - use the data to query it, present it, mine it - have data in a machine processable format And we need this in a way that makes it easy to write applications using the linked combined data - Opens the way for a whole new range of applications! ISCTEM - janeiro 2017

32 A Semantic Web of Data ISCTEM - janeiro 2017

33 A Semantic Web of Data But if we have all that data, highly distribute and built in a highly collaborative way, how can we know its meaning? ISCTEM - janeiro 2017

34 A Semantic Web of Data But if we have all that data, highly distribute and built in a highly collaborative way, how can we know its meaning? In the Web, the data must be accompanied by its meaning! - The meaning of Web documents is not readily machineaccessible: lack of semantics - Natural language processing cannot be the answer in such a huge scale ISCTEM - janeiro 2017

35 A Semantic Web of Data But if we have all that data, highly distribute and built in a highly collaborative way, how can we know its meaning? In the Web, the data must be accompanied by its meaning! - The meaning of Web documents is not readily machineaccessible: lack of semantics - Natural language processing cannot be the answer in such a huge scale The Web of Data must come with a machine processable model of what the data means. - It must be a Semantic Web ISCTEM - janeiro 2017

36 The Semantic Web Vision I have a dream for the Web [in which computers] become capable of analyzing all the data on the Web the content, links, and transactions between people and computers. A Semantic Web, which should make this possible, has yet to emerge, but when it does, the day-to-day mechanisms of trade, bureaucracy and our daily lives will be handled by machines talking to machines. The intelligent agents people have touted for ages will finally materialize. Tim Berners-Lee, 1999 ISCTEM - janeiro 2017

37 The Semantic Web Vision Represent Web content in a form that is more easily machine-processable. Use intelligent techniques to take advantage of these representations. Have a Web of Data, together with a Web of Documents ISCTEM - janeiro 2017

38 The Semantic Web Vision Represent Web content in a form that is more easily machine-processable. Use intelligent techniques to take advantage of these representations. Have a Web of Data, together with a Web of Documents A Web in machines, for humans and machines usage Evolving into a Web of Data ISCTEM - janeiro 2017

39 An example of integration Consider the following data(base) on a bookstore, to be published in a Web page ISCTEM - janeiro 2017

40 Data Integration Example Besides publishing the data on a nice Web page, also export data as relations - Relations form a graph, where nodes refer to either data or identifiers (URI) ISCTEM - janeiro 2017

41 Data Integration Example Data in another bookstore: ISCTEM - janeiro 2017

42 Data Integration Example ISCTEM - janeiro 2017

43 Data Integration Example ISCTEM - janeiro 2017

44 Data Integration Example ISCTEM - janeiro 2017

45 Data Integration Example What if we have additional knowledge? E.g. - we could know that a:author is the same as f:auteur - we could know that in both cases they represent persons In other words, we could have - ontologies describing the concepts and relations - mappings of our relations into the ontologies ISCTEM - janeiro 2017

46 Data Integration Example ISCTEM - janeiro 2017

47 Data Integration Example With this merged information, richer queries are possible: - The second bookstore can query what is the web page of the author of the book - Possibly can ask about other information on the author, or translator via foaf - The first bookstore can query information about the translator - ISCTEM - janeiro 2017

48 A Web of Data Example ISCTEM - janeiro 2017

49 Automatic data integration This process of merging knowledge is done easily by users in the Web For doing it automatically, some more rigour is needed - Have data structured in the web - Name relations in a standard manner - Have ontologies for describing general concepts - Refer to the ontologies when exporting relations The Semantic Web provides technologies to make all this possible - For structuring data; defining relations; defining ontologies; querying data; reasoning over data; ISCTEM - janeiro 2017

50 The Semantic Web Cake ISCTEM - janeiro 2017

51 A new Model for Data Having tables (relations) to store the data is not adequate in this setting - parts of similar information are in different places - different places may have different ways to organise local data Data must be organised as a (huge) graph - a labeled digraph, linking small pieces of data at different places A standard language for expressing the labeled digraphs - RDF (Resource Description Framework) - Statements are triples of the form - <objectnode> <propertyedge> <subjectnode> - Sometimes also viewed as property(object,subject) ISCTEM - janeiro 2017

52 RDF Challenges How to access data organised in huge digraphs? ISCTEM - janeiro 2017

53 RDF Challenges How to access data organised in huge digraphs? - How to detect patterns in graphs that span across different sites? ISCTEM - janeiro 2017

54 RDF Challenges How to access data organised in huge digraphs? - How to detect patterns in graphs that span across different sites? - How to grab the data in this distributed framework? ISCTEM - janeiro 2017

55 RDF Challenges How to access data organised in huge digraphs? - How to detect patterns in graphs that span across different sites? - How to grab the data in this distributed framework? - How can this be done efficiently? - With what algorithms? - With what data structures to ease the (local and global) access? ISCTEM - janeiro 2017

56 RDF Challenges How to access data organised in huge digraphs? - How to detect patterns in graphs that span across different sites? - How to grab the data in this distributed framework? - How can this be done efficiently? - With what algorithms? - With what data structures to ease the (local and global) access? Studying properties of data is like studying properties of graphs - And, as we shall see, there are huge graphs to play with ISCTEM - janeiro 2017

57 A vocabulary for RDF How do we know the vocabulary used by data, to associate to it, or to query it? - We can have global vocabularies defined somewhere, so that people can adhere to it ISCTEM - janeiro 2017

58 A vocabulary for RDF How do we know the vocabulary used by data, to associate to it, or to query it? - We can have global vocabularies defined somewhere, so that people can adhere to it We need a language for defining vocabularies - describe properties and classes of RDF data - allow typing objects and properties - provide semantics for generalisation hierarchies of properties and classes ISCTEM - janeiro 2017

59 A vocabulary for RDF How do we know the vocabulary used by data, to associate to it, or to query it? - We can have global vocabularies defined somewhere, so that people can adhere to it We need a language for defining vocabularies - describe properties and classes of RDF data - allow typing objects and properties - provide semantics for generalisation hierarchies of properties and classes RDFS is a standard language for defining vocabularies - RDFS is itself encoded as RDF - So, the definition of the vocabulary is itself a graph ISCTEM - janeiro 2017

60 Beyond vocabularies In general, a vocabulary (in RDFS) is not enough to characterise the objects and properties For really connecting data, and make joint use of it, one may need to know, e.g. - that one concept is a subconcept of another (e.g. authors are persons) - that two concepts are equivalent, or disjoint, or complementary (e.g. author and auter are the same concept) - that some logical relations exist between objects (e.g. a country must have a capital) - Value and cardinality restriction (e.g. min and max value, etc) A richer ontology language is needed ISCTEM - janeiro 2017

61 Ontology language We need a language that - is formal - to be machine processable - is able to express properties about object - comes with procedures for knowing what follows from the ontology and the data - comes with procedures to check whether the data complies with the ontology (and to test whether the ontology alone is correct) ISCTEM - janeiro 2017

62 Ontology language We need a language that - is formal - to be machine processable - is able to express properties about object - comes with procedures for knowing what follows from the ontology and the data - comes with procedures to check whether the data complies with the ontology (and to test whether the ontology alone is correct) What about First Order Logic? ISCTEM - janeiro 2017

63 Ontology language We need a language that - is formal - to be machine processable - is able to express properties about object - comes with procedures for knowing what follows from the ontology and the data - comes with procedures to check whether the data complies with the ontology (and to test whether the ontology alone is correct) What about First Order Logic? Good for every requirement, as expressed above ISCTEM - janeiro 2017

64 Ontology language We need a language that - is formal - to be machine processable - is able to express properties about object - comes with procedures for knowing what follows from the ontology and the data - comes with procedures to check whether the data complies with the ontology (and to test whether the ontology alone is correct) What about First Order Logic? Good for every requirement, as expressed above But not good enough, if I had added efficient before procedures - They aren t even decidable! ISCTEM - janeiro 2017

65 Fragments of FOL But maybe we don t need the full power of FOL ISCTEM - janeiro 2017

66 Fragments of FOL But maybe we don t need the full power of FOL Challenge: Use fragments of FOL: - that are decidable - are still expressive enough for the applications - when possible, allow for efficient proof procedures ISCTEM - janeiro 2017

67 Fragments of FOL But maybe we don t need the full power of FOL Challenge: Use fragments of FOL: - that are decidable - are still expressive enough for the applications - when possible, allow for efficient proof procedures Example: - If we only use binary and unary predicates - and all formulas are either facts or of the form x a(x) F[x], where a is a unary predicate and F[x] is a formula such that: - it doesn't use disjunction nor negation - and quantifiers are only used in formulas of the form - y r(y,x) b(x) - y r(y,x) b(x) - then the language is decidable and tractable ISCTEM - janeiro 2017

68 Description Logics Study of decidable fragments of FOL, their computational complexity/expressivity, and of corresponding proof procedures The language that I described is usually not good enough for ontologies in the Web - We have to add some more things - But if we add too much, procedures become intractable - And if we add even more, they may become undecidable What is needed depends on the application domain - E.g. if we have languages for which the complexity of the procedures depend more on the ontology than on the data, use them for domains with small ontologies and lots of data ISCTEM - janeiro 2017

69 Web Ontology Language OWL is a family of languages for defining ontologies for linked data in the Web - It is a standard set of languages, all of them based on Description Logics (basically it is DL written with another syntax!) - Different languages with different complexity, for different uses - All of them with proof procedures There are plenty of tools for OWL - Theorem provers (for knowing what follows from the ontology and the data) - Consistency checker (for testing the correctness of the ontology, and compliance of the data with the ontology) - Ontology editors - ISCTEM - janeiro 2017

70 Query Languages For querying the data and ontology, we could just use the ontology language itself - build a concept with the conditions that specify the desired result - use the theorem provers to get the object in that concept ISCTEM - janeiro 2017

71 Query Languages For querying the data and ontology, we could just use the ontology language itself - build a concept with the conditions that specify the desired result - use the theorem provers to get the object in that concept But this is not good enough! ISCTEM - janeiro 2017

72 Query Languages For querying the data and ontology, we could just use the ontology language itself - build a concept with the conditions that specify the desired result - use the theorem provers to get the object in that concept But this is not good enough! Things we want to use in querying were thrown way - E.g. join conditions (quite typical in database queries) - a,b,n author(b,a) name(a,n) result(b,n) - This, together with basic things for defining ontologies, immediately makes the language undecidable ISCTEM - janeiro 2017

73 Query Languages For querying the data and ontology, we could just use the ontology language itself - build a concept with the conditions that specify the desired result - use the theorem provers to get the object in that concept But this is not good enough! Things we want to use in querying were thrown way - E.g. join conditions (quite typical in database queries) - a,b,n author(b,a) name(a,n) result(b,n) - This, together with basic things for defining ontologies, immediately makes the language undecidable We need a more expressive query language, on top of the ontology language ISCTEM - janeiro 2017

74 SPARQL (Sparql Protocol And Rdf Query Language) For queries, use an algebra on graphs - Define operators that given graphs (the data, and consequences from the ontology) return graphs (the result) - A query is an algebraic expression it that algebra - This is similar to databases, where the query language is relational algebra Then have a nice, CS-like, language - In the same way that in databases we have SQL - In fact SPARQL looks a lot like SQL ISCTEM - janeiro 2017

75 SPARQL (Sparql Protocol And Rdf Query Language) For queries, use an algebra on graphs - Define operators that given graphs (the data, and consequences from the ontology) return graphs (the result) - A query is an algebraic expression it that algebra - This is similar to databases, where the query language is relational algebra Then have a nice, CS-like, language - In the same way that in databases we have SQL - In fact SPARQL looks a lot like SQL PREFIX dc: < PREFIX ns: < SELECT?title?price WHERE {?x ns:price?price. FILTER (?price < 30).?x dc:title?title. } ISCTEM - janeiro 2017

76 The Semantic Web at work Until recently, all of this was mainly a vision for a future, better, Web Today it is a reality! The Semantic Web can only work if there is enough linked web data out there, and enough ontologies to go with it - The same could have been said about the Web, in its beginning Today there is plenty of Linked Data in the Web ISCTEM - janeiro 2017

77 Linked Open Data Project An open initiative project Exposing, sharing, and connecting pieces of data, information, and knowledge on the Semantic Web using URIs and RDF. Large number of datasets with connections between them Billions of triples, millions of links! See at ISCTEM - janeiro 2017

78 Linked Open Data Project An open initiative project Exposing, sharing, and connecting pieces of data, information, and knowledge on the Semantic Web using URIs and RDF. Large number of datasets with connections between them Billions of triples, millions of links! See at ISCTEM - janeiro 2017

79 Linked Open Data Project An open initiative project Exposing, sharing, and connecting pieces of data, information, and knowledge on the Semantic Web using URIs and RDF. Large number of datasets with connections between them Billions of triples, millions of links! See at ISCTEM - janeiro 2017

80 Linked Open Data Project An open initiative project Exposing, sharing, and connecting pieces of data, information, and knowledge on the Semantic Web using URIs and RDF. Large number of datasets with connections between them Billions of triples, millions of links! See at ISCTEM - janeiro 2017

81 Linked Open Data Project And there are quite large datasets! - E.g. bio2rdf has 5 billion triples, dbpedia has 3 billion, An open has initiative project geonames 100 million, dblp has 88 millions Exposing, sharing, and connecting pieces of data, information, and knowledge on the Semantic Web using URIs and RDF. Large number of datasets with connections between them Billions of triples, millions of links! See at ISCTEM - janeiro 2017

82 Linked Open Data Project And there are quite large datasets! - E.g. bio2rdf has 5 billion triples, dbpedia has 3 billion, An open has initiative project geonames 100 million, dblp has 88 millions Exposing, sharing, and connecting pieces of data, information, knowledge on the Number ofand axioms in 2011 Semantic Web using URIs and RDF. Large number of datasets with connections between them Billions of triples, millions of links! See at ISCTEM - janeiro 2017

83 DBpedia It is one of the nodes in that Linked Data graph Includes (up-to-date) raw data extracted from wikipedia (infobox) Interlinks with other datasets on the linked open data ISCTEM - janeiro 2017

84 DBpedia It is one of the nodes in that Linked Data graph Includes (up-to-date) raw data extracted from wikipedia (infobox) Interlinks with other datasets on the linked open data ISCTEM - janeiro 2017

85 DBpedia It is one of the nodes in that Linked Data graph Includes (up-to-date) raw data extracted from wikipedia (infobox) Interlinks with other datasets on the linked open data ISCTEM - janeiro 2017

86 Brief intro to RDF Resource Description Framework

87 Brief intro to RDF Resource Description Framework

88 A bit of history RDF was created by the W3C in 1999 as a format for structuring metadata about web pages (title, author, modification date, ) It has been designed to allow information to be exchanged without loss of meaning It became a general data format/model for data in general (rather than only metadata) - Proposed in 2001 as the model for data exchange in the Semantic Web - Nowadays there are quite big data stores in RDF - The today s data model of Semantic Technologies!

89 Basic Ideas of RDF Represent the meaning independently of the syntax Basic building block: object-attribute-value triple - It is called a statement - In the example, object is José Alferes, attribute is lectures, value is Semantic Web Fundamental concepts in RDF are: - Resources (like the object and value above) - Properties (like the attribute above) - Statements (the triple above)

90 RDF syntax With these basic ideas, an RDF dataset is a labeled directed graph - Modelling data as a graph, rather than modelling as a set of relations (in databases), or as a tree (in XML) There are several syntaxes for writing such a graph: - N3 (Notation 3) comprehensive formalism - N-Triples: fraction of N3 - Turtle (Terse RDF Triple Language) A standard encoding of RDF into XML has also been defined - Facilitates usage of XML tools - RDF should not be confused with its XML syntactical representation!

91 First RDF example (in Turtle)

92 Resources A resource is just any thing, an object we want to refer to - E.g. an author, a book, a place, a person, a hotel, etc In RDF, every resource has a unique identifier - Unique identifiers are crucial to disambiguate resources! - On the Web we already have unique identifiers, and RDF just uses them URIs will be used as identifiers

93 Properties Properties describe relations between resources - E.g. written by, has age, has title, etc. Each property is itself also a resource - So, properties are also identified by URIs Advantages of using identifying URIs: - Α global, worldwide, unique naming scheme - Reduces the homonym problem of distributed data representation - (Basically, with URIs everything is guaranteed to be uniquely identified, by a key)

94 Statements Statements assert properties of resources - Relate resources via properties In RDF, a statement is an object-attribute-value triple - It consists of a resource, a property, and a value They can be seen as binary predicates: attribute(object,value) Values can be resources or literals - Literals are just atomic values (e.g. strings), that don t need to have a URI.

95 Representation of statements A statement can be viewed as: - A triple (Object, Property, Value) - An arc connecting two nodes in a graph - A piece of XML code, representing the triple Accordingly, an RDF document can be viewed as: - A set of triples - A graph (semantic net) - An XML document with the triples represented according to a given predefined syntax

96 Representing triples in a graph centria.di.fct.unl.pt/~jja site-owner José Alferes This piece of a graph is representing the triple: - (centria.di.fct.unl.pt/~jja, site-owner, José Alferes ) - Or the predicate site-owner(centria.di.fct.unl.pt/~jja, José Alferes ) (these things are not proper URIs, but for the sake of the example ) An RDF document can be seen as a directed graph with labeled nodes and arcs - from the resource (the subject of the statement) - to the value (the object of the statement) Known in AI as a semantic net

97 An example of RDF graph centria.di.fct.unl.pt/~jja site-owner José Alferes has-phone is-friend-of uses João Leite site-owner ssdi.di.fct.unl.pt/bd The owner of the site ~jja is José Alferes who has phone and is a friend of João Leite, who owns /bd web page; José Alferes uses this web page

98 RDF as a data model A schema-less data model - Based on a graph - With unambiguous identifiers - With named relations between pair of resources The graph structure trivialises merging data with shared identifiers Triples act as least common identifier for expressing data Eases navigation through data in different locations

99 A bit of (Turtle) syntax Turtle was defined to be a simple syntax for RDF, and is standardised by W3C since February 2014 (see - Triples are directed lists: Subject Property Object - URI are in <angle brackets> - End with. - White spaces are ignored - Prefixes (simple string concatenation) - Grouping of triples with the same subject with ; - Grouping of triples with the same subject and property with,

100 Turtle example

101 Literals Represent data values - Encoded as strings but can be interpreted by means of datatypes - Literals without any type are treated as strings - A literal without a type is called a plain literal, and may have a language tag Datatypes are borrowed from XML Schema (XSD) - RDF does not require an implementation of datatypes, though systems usually implement most of XSD datatypes Some examples - Typed literals - Bay State ^^xsd:string or ^^xsd:integer - Plain literals - Germany or

102 Blank nodes bnodes are used for resources that do not need to be universally identified Just like existentially quantified ex:< ex:john ex:hascourse _:id1; ex:hascourse _:id2. _:id1 ex:course course1 ; ex:withgrade 12. _:id2 ex:course course1 ; ex:withgrade 12.

103 Blank nodes bnodes are used for resources that do not need to be universally identified Just like existentially quantified ex:< ex:john ex:hascourse [ex:course course1 ;ex:withgrade 12 ], [ex:course course2 ;ex:withgrade 15 ].

104 Blank ex:< ex:john ex:hascourse [ex:course course1 ;ex:withgrade 12 ], [ex:course course2 ;ex:withgrade 15 ].

105 Blank ex:< ex:john ex:hascourse [ex:course course1 ;ex:withgrade 12 ], [ex:course course2 ;ex:withgrade 15 ] course course2 15

106 RDF Schema Defining schemas for RDF data

107 RDF Schema Defining schemas for RDF data

108 Why a schema language Like in databases, to understand the data one needs some formalisation of what it is about - what classes, with each types of attributes, with what relationship between classes, etc - this is especially important when the data is highly distributed, and provided in a collaborative way RDF provides a data model to state propositions about individual resources In a schema language we need to state propositions about generic sets of individuals - and also logical interdependencies between them

109 RDF Schema (RDFS) - RDF is a universal language that lets users describe resources - It does not assume any meaning for the vocabulary used - It does not assume, nor does it define semantics of any particular application domain RDFS allows for specifying terminological knowledge, that RDF data can refer to - It is a language for describing (simple) semantics of arbitrary RDF - Uses RDF itself (with dedicated vocabulary) RDFS is part of RDF s W3C recommendation - xmlns:rdfs = - Notice: The relation between RDF Schema and RDF is not the same as that between XML Schema and XML

110 RDFS Basic Ideas Schemas are specified with: - Classes and Properties - Class (and Property) hierarchies and inheritance - Property Restriction (e.g. stating that authors of a book must be persons) Classes and Instances - Instances (defined in RDF) refer to concrete individual objects (e.g. me, this book) - Classes denote sets of individuals sharing some properties (e.g. persons, books) - In RDFS classes are also seen as objects (with URIs) - The relationship between instances and classes is made via special attribute rdf:type of the instance - amalgamating data and meta-data

111 First Schema example ex:jja ex:name Jose Alferes ; ex:teaches ex:sw; rdf:type uni:professor. The last statement characterises me as an instance of class professor. - An individual can belong to more than one class. E.g. uni:professor rdf:type ex:sw ex:teaches ex:jja ex:name Jose Alferes

112 First Schema example ex:jja ex:name Jose Alferes ; ex:teaches ex:sw; rdf:type uni:professor. The last statement characterises me as an instance of class professor. - An individual can belong to more than one class. E.g. ex:jja rdf:type rel:father. rel:father uni:professor rdf:type rdf:type ex:sw ex:teaches ex:jja ex:name Jose Alferes

113 The class of all classes In the example ex:professor and ex:father are objects whose type is rdfs:class rdfs:class is also of type rdfs:class (the class of all classes) - The triple rdfs:class rdf:type rdfs:class virtually belongs to all dataset (already some kind of semantics) rel:father rdf:type uni:professor rdf:type rdfs:class rdf:type rdf:type rdf:type ex:sw ex:teaches ex:jja ex:name Jose Alferes

114 Class Hierarchies Suppose we are searching for all Academic Staff - jja should be considered This can be done by having a general statement, saying that all professors are academic staff (with refs:subclassof) rdfs:subclassof is - a property - it is reflexive and transitive - can be used to enforce that two URIs refer to the same class - with A rdfs:subclassof B and B rdfs:subclassof A

115 Simple taxonomy rdf:type is like rdfs:subclassof is like uni:members rdfs:subclassof uni:student uni:academicstaff uni:administrative rdfs:subclassof rel:father uni:professor uni:associate uni:assistant rdf:type rdf:type ex:sw ex:teaches ex:jja ex:name Jose Alferes

116 Properties Properties specify in which ways two resources are related - usually appear in the predicate position of triples - mathematically represented as binary relations (sets of pairs) - their rdf:type is rdf:property Hierarchical relationships may also be defined for properties - E.g., teaches is a sub-property of isinvolvedin - If a professor P teaches course C, then P is involved in C P rdf:subpropertyof Q, if Q(x,y) is true whenever P(x,y) is true

117 Property restriction Defined by rdfs:domain and rdfs:range Restrict the kind of resources that can be related via the property - E.g. a property teaches only makes sense if it is relating an academic staff to a course - It can also be used to declare datatypes for literals ex:teaches rdfs:domain uni:academicstaff; rdfs:range uni:course. ex:name rdf:range xsd:string.

118 Property restriction Property restriction are interpreted globally and conjunctively - E.g. ex:teaches rdfs:domain uni:professor; rdfs:domain uni:associate. ex:cd rdf:teaches ex:sbd. - entails that ex:cd is both a uni:professor and a uni:associate. In this case (and in general) this is not what is wanted! - When designing the schema, choose the most general class for domain and range!

119 An example schema

120 An example schema ex:teaches ex:name ex:sw ex:jja Jose Alferes

121 An example schema rdf:type uni:professor uni:course ex:teaches ex:name ex:sw ex:jja Jose Alferes

122 An example schema rdf:type rdfs:subclassof uni:members uni:student uni:academicstaff uni:administrative uni:professor uni:associate uni:assistant uni:course ex:teaches ex:name ex:sw ex:jja Jose Alferes

123 An example schema rdf:type rdfs:subclassof uni:members uni:student uni:academicstaff uni:administrative rdfs:domain uni:professor uni:associate uni:assistant uni:course xsd:string rdfs:range rdfs:range ex:teaches ex:name ex:sw ex:jja Jose Alferes

124 An example schema rdf:type rdfs:subclassof uni:members rdfs:subpropertyof rdfs:domain uni:student uni:academicstaff uni:administrative ex:isinvolvedin rdfs:range rdfs:domain uni:professor uni:associate uni:assistant uni:course xsd:string rdfs:range rdfs:range ex:teaches ex:name ex:sw ex:jja Jose Alferes

125 An example schema rdf:type rdfs:subclassof uni:members rdfs:subpropertyof rdfs:domain uni:student uni:academicstaff uni:administrative ex:isinvolvedin rdfs:range rdfs:domain uni:professor uni:associate uni:assistant uni:course xsd:string rdfs:range ex:teaches ex:name rdfs:range Schema ex:sw ex:jja Jose Alferes Instance

126 An example schema ex:jja ex:teaches ex:sw. ex:jja rdf:type uni:professor. ex:sw rdf:type uni:course. uni:professor rdfs:subclassof uni:academicstaff. uni:associate rdfs:subclassof uni:academicstaff. uni:assistant rdfs:subclassof uni:academicstaff uni:academicstaff rdfs:subclassof uni:member. uni:student rdfs:subclassof uni:member. uni:administrative rdfs:subclassof uni:member. ex:teaches rdf:domain uni:academicstaff; rdf:range uni:course; rdf:subpropertyof ex:isinvolvedin. ex:isinvolvedin rdf:domain uni:member; rdf:range uni:course; ex:name rdf:range xsd:string.

127 And also ex:jja ex:teaches ex:sw. ex:jja rdf:type uni:professor. ex:sw rdf:type uni:course. uni:professor rdfs:subclassof uni:academicstaff. uni:associate rdfs:subclassof uni:academicstaff. uni:assistant rdfs:subclassof uni:academicstaff uni:academicstaff rdfs:subclassof uni:member. uni:student rdfs:subclassof uni:member. uni:administrative rdfs:subclassof uni:member. ex:teaches rdf:domain uni:academicstaff; rdf:range uni:course; rdf:subpropertyof ex:isinvolvedin. ex:isinvolvedin rdf:domain uni:member; rdf:range uni:course; ex:name rdf:range xsd:string.

128 And also ex:jja ex:teaches ex:sw. ex:jja rdf:type uni:professor. ex:sw rdf:type uni:course. uni:professor rdfs:subclassof uni:academicstaff. uni:associate rdfs:subclassof uni:academicstaff. uni:assistant rdfs:subclassof uni:academicstaff uni:academicstaff rdfs:subclassof uni:member. uni:student rdfs:subclassof uni:member. uni:administrative rdfs:subclassof uni:member. ex:teaches rdf:domain uni:academicstaff; rdf:range uni:course; rdf:subpropertyof ex:isinvolvedin. ex:isinvolvedin rdf:domain uni:member; rdf:range uni:course; ex:name rdf:range xsd:string. uni:professor rdf:type rdfs:class. uni:associate rdf:type rdfs:class. uni:assistant rdf:type rdfs:class. uni:academicstaff rdf:type rdfs:class. uni:administrative rdf:type rdfs:class. uni:administrative rdf:type rdfs:class. uni:member rdf:type rdfs:class. ex:teaches rdf:type rdfs:property. ex:isinvolvedin rdf:type rdfs:property.

129 And also ex:jja ex:teaches ex:sw. ex:jja rdf:type uni:professor. ex:sw rdf:type uni:course. uni:professor rdfs:subclassof uni:academicstaff. uni:associate rdfs:subclassof uni:academicstaff. uni:assistant rdfs:subclassof uni:academicstaff uni:academicstaff rdfs:subclassof uni:member. uni:student rdfs:subclassof uni:member. uni:administrative rdfs:subclassof uni:member. ex:teaches rdf:domain uni:academicstaff; rdf:range uni:course; rdf:subpropertyof ex:isinvolvedin. ex:isinvolvedin rdf:domain uni:member; rdf:range uni:course; ex:name rdf:range xsd:string. uni:professor rdf:type rdfs:class. uni:associate rdf:type rdfs:class. uni:assistant rdf:type rdfs:class. uni:academicstaff rdf:type rdfs:class. uni:administrative rdf:type rdfs:class. uni:administrative rdf:type rdfs:class. uni:member rdf:type rdfs:class. ex:teaches rdf:type rdfs:property. ex:isinvolvedin rdf:type rdfs:property. rdfs:class rdf:type rdfs:class. rdfs:property rdf:type rdfs:class. rdf:type rdf:type rdfs:property. rdf:domain rdf:type rdfs:property. rdfs:subclassof rdf:type rdfs:property. rdfs:subpropertyof rdf:type rdfs:property. rdfs:class rdfs:subclassof rdfs:resource. rdfs:property rdfs:subclassof rdfs:resource. Not up to the user to define. Meaning assigned by RDFS semantics.

130 Core Classes of RDF(S) rdfs:resource, the class of all resources rdfs:class, the class of all classes rdfs:literal, the class of all literals rdf:property, the class of all properties. rdf:statement, the class of all reified statements

131 Core Properties rdf:type, which relates a resource to its class - The resource is declared to be an instance of that class rdfs:subclassof, which relates a class to one of its superclasses - All instances of a class are instances of its superclass rdfs:subpropertyof, relates a property to one of its super-properties

132 SPARQL Querying the Semantic Web

133 SPARQL Querying the Semantic Web

134

135 SPARQL Query Language SPARQL - Sparql Protocol And Rdf Query Language (read as sparkle) provides facilities to: - extract information in the form of URIs, blank nodes, plain and typed literals. - extract RDF sub-graphs. - construct new RDF graphs based on information in the queried graphs. RDF graphs can be obtained from several sources, including middleware capable of generating RDF data. SPARQL is based on matching of graph patterns, using variables in the patterns - Results can come as binding of variables to RDF terms (URIs, literals or blank nodes) in a tabular form

136 Query forms SPARQL has four query forms: - SELECT, returns variable bindings - ASK, returns a boolean indicating whether a query pattern matches or not - DESCRIBE, returns a RDF graph that describes the resources found - CONSTRUCT, returns RDF graphs by substituting variables in a set of triple templates

137 Simple SELECT query The query consists of two parts, the SELECT clause and the WHERE clause. - The SELECT clause identifies the variables to appear in the query results. - The WHERE specifies the graph pattern to match against the RDF data graph. The simplest form of graph patterns are triple patterns - a triple pattern is an RDF triple with optional query variables in any place of the triple. Basic Graph Patterns (BGPs) are sets of triple patterns, in Turtle syntax

138 Our first SPARQL query PREFIX uni: < PREFIX ex: < PREFIX rdf: < SELECT?x?name WHERE {?x ex:teaches ex:sw.?x rdf:type uni:professor.?x ex:name?name } Professor who teach ex:sw, and their names Syntax: - Abbreviated URIs with PREFIX - Variable names signalled by? (or by $) - Literals are as in turtle - ; and, can be used as in Turtle

139 Our first SPARQL query SELECT?x?name WHERE {?x ex:teaches ex:sw ; rdf:type uni:professor ; ex:name?name } - Professors who teach ex:sw, and their names Determines the parts of the graph that match the BGP in the WHERE clause Returns the bindings of variables in the SELECT clause?x?name < Jose Alferes

140 Variables everywhere! Variables are allowed in subject, object and also in predicate positions of triples - E.g. what are the relations between a guy called José Alferes and the object ex:sw? SELECT?relation WHERE {?x ex:name Jose Alferes.?x?relation ex:sw }?relation <

141 Blank nodes Can be used in query patterns - As in RDF, cannot be used in predicates - Act like variables, but cannot be selected - Remember the semantics of bnodes in RDF - Have arbitrary ID, and cannot be reused in different BGP Can be returned in results (if they are bnodes in the original graph) - Placeholders for unknown elements - With arbitrary IDs, with the scope limited to the result, that can be different from those in the input RDF - But repeated occurrences in the result denote the same element SELECT?name WHERE {_:a ex:teaches ex:sw ; rdf:type uni:professor ; ex:name?name }

142 Datatypes Exact match for the datatypes is required - E.g. {?x ex:p test.} does not match with ex:ex1 ex:p test ^^xsd:string. But abbreviation for numbers are allowed - E.g. {?x ex:p 123.} matches with ex:ex1 ex:p 123^^xsd:integer. - The datatype is determined from the syntax - xsd:integer (e.g. 123) - xsd:decimal (e.g ) - xsd:double (e.g. 1.23e2)

143 Some syntactic simplifications Collections - RDF collections can be written using the syntax ( element1 element2 ) - rdf:nil can be replaced by () - E.g. {(1?x) ex:p w } is the same as rdf:first 1 ; rdf:rest _:b. {_:a _:b rdf:fist?x; rdf:rest rdf:nil. ex:p w } _:a rdf:type - Can be replaced by a. E.g. {?x a uni:professor} - Reads better

144 RDF Datasets When compared with SQL, what is missing?

145 RDF Datasets When compared with SQL, what is missing? - The FROM clause

146 RDF Datasets When compared with SQL, what is missing? - The FROM clause No FROM clause is required in SPARQL - A SPARQL query is executed against an RDF Dataset which represents a collection of graphs - RDF data stores hold multiple RDF graphs, and record information about each graph, allowing an application to make queries that involve information from more than one graph (a collection of graphs) But more (named) graphs can be specified

147 Graph provenance SPARQL can use the keywords FROM and FROM NAMED, to specify the default graph and named graphs, respectively. The FROM and FROM NAMED are followed by an URI. The graphs retrieved by FROM (NAMED) clauses are merged for constructing the default graph The GRAPH construct can be used to obtain the provenance of results, or to query a particular named graph

148 FROM NAMED example SELECT?name?mbox FROM NAMED < FROM NAMED < WHERE { [ foaf:name?name; foaf:mbox?mbox ] } Returns all names and mailboxes in the result of merging the default graph with the graphs in < a> and in <

149 Provenance example SELECT?graph?name?mbox FROM NAMED < FROM NAMED < WHERE { GRAPH?graph { [ foaf:name?name; foaf:mbox?mbox ] } }?graph?name?mbox < Jose <mailto:j@example.pt> < Maria <mailto:m@example.pt> < Ana <mailto:a@example.pt> < Jose <mailto:j@example.pt>

150 Provenance example SELECT?name?mbox FROM NAMED < FROM NAMED < WHERE { GRAPH < { [ foaf:name?name; foaf:mbox?mbox ] } GRAPH < { [ foaf:name?name; foaf:mbox?mbox ] } }?name Jose?mbox <mailto:j@example.pt>

151 Multiple BGP and UNION BGP can be grouped, and several can be used. {} stand for the empty BGP, and matches any graph UNION between BGPs stand for the union (disjunction) of the BGPs. - E.g. Who are the associate or full professors SELECT?x WHERE { {?x a uni:professor } UNION {?x a uni:associate } }

152 Unbound results UNION may give rise to unbound results. - E.g. What are the names or nomes of courses? SELECT?x?name?nome WHERE {?x a uni:course. {?x ex:name?name } UNION {?x ex:nome?nome} }

153 Unbound results UNION may give rise to unbound results. - E.g. What are the names or nomes of courses? SELECT?x?name?nome WHERE {?x a uni:course. {?x ex:name?name } UNION {?x ex:nome?nome} }?x?name?nome ex:sw Semantic Web ex:sw ex:sbd Web Sistemas de

154 OPTIONAL patterns Another keyword that may return unbound results is OPTIONAL It allows for the specification of optional parts of a graph - E.g. What are the nomes of courses, and names if they exist?

155 OPTIONAL patterns Another keyword that may return unbound results is OPTIONAL It allows for the specification of optional parts of a graph - E.g. What are the nomes of courses, and names if they exist? SELECT?x?name?nome WHERE {?x a uni:course.?x ex:nome?nome OPTIONAL {?x ex:name?name} }

156 OPTIONAL patterns Another keyword that may return unbound results is OPTIONAL It allows for the specification of optional parts of a graph - E.g. What are the nomes of courses, and names if they exist? SELECT?x?name?nome WHERE {?x a uni:course.?x ex:nome?nome OPTIONAL {?x ex:name?name} }?x?name?nome ex:sw Semantic Web Web ex:sbd Sistemas de

157 Combination of UNION and OPTIONAL When used in combination UNION has higher precedence - I.e. X UNION Y OPTIONAL Z is to be interpreted as {X UNION Y} OPTIONAL Z - E.g. The names of either authors or editors of ex:swbook, and also the when available?

158 Combination of UNION and OPTIONAL When used in combination UNION has higher precedence - I.e. X UNION Y OPTIONAL Z is to be interpreted as {X UNION Y} OPTIONAL Z - E.g. The names of either authors or editors of ex:swbook, and also the when available? SELECT?name? WHERE {?x ex:name?name. {ex:swbook ex:author?x } UNION {ex:swbook ex:edit?x } OPTIONAL {?x ex: ? } }

159 Combination of UNION and OPTIONAL When used in combination UNION has higher precedence - I.e. X UNION Y OPTIONAL Z is to be interpreted as {X UNION Y} OPTIONAL Z - E.g. The names of either authors or editors of ex:swbook, and also the when available? SELECT?name? WHERE {?x ex:name?name. { {ex:swbook ex:author?x } UNION {ex:swbook ex:edit?x } } OPTIONAL {?x ex: ? } }

160 Filters Even with complex graph patterns, some quite reasonable queries are not expressible: - Who are the professors aged more than 50? - Professors with a name started by A? FILTER allows us to specify conditions over variables, restricting the solutions to those that satisfy the condition SELECT?prof WHERE {?prof a uni:professor; ex:age?age. FILTER{?age > 50 } }

161 Filter conditions Conditions evaluate to truth values (booleans) Usual comparison operator are allowed - = and!= for all RDF types - >, <, <= and >= for numerical datatypes, dates, string and booleans Function can be used - Arithmetic function (+, -, *, /) for numerical datatypes - e.g. FILTER {?x /?y >?z } - XQuery and XPath functions - Specific SPARQL functions

162 Specific functions BOUND(A) ISURI(A) ISBLANK(A) ISLITERAL(A) SAMETERM(A,B) REGEX(A,B) DATATYPE(A) LANG(A) returns true if A is a bound variable returns true if A is (bound to) a URI returns true if A a bnode returns true if A a literal returns true if A and B are the same RDF term returns true if the string A matches the regular expression B returns the datatype of A returns the language tag of A (or if none exists) Several more functions, especially in SPARQL Check the manual/specification

163 Combining conditions Conditions can be combined - Conjunctively, by adding multiple filters - Disjunctively, with UNION But boolean operators &&, and! are also available - E.g. Professors between 20 and 30, or not younger than 50? SELECT?prof WHERE {?prof a uni:professor; ex:age?age. FILTER{ (?age > 20 &&?age < 30 )!(?age < 50) } }

164 Solution modifiers The result of a SELECT query is a bag of tuples (a table) - But one can view it as a sequence of tuples, and consider their order - Or as a set, without repeated elements Similarly to SQL, there can be an ORDER BY clause, and select only DISTINCT values - By default the order is ascending - For descending, use DESC - String and numbers are sorted as usual - URIs are sorted as strings - unbound variables < bnodes < URIs < Literals One can also LIMIT the number of results, and define an OFFSET for the first result shown

165 Modifiers examples 10 oldest professors sorted by age, from oldest to younger:

166 Modifiers examples 10 oldest professors sorted by age, from oldest to younger: SELECT?prof?age WHERE {?prof a uni:professor; ex:age?age} ORDER DESC(?age) LIMIT 10

167 Modifiers examples 10 oldest professors sorted by age, from oldest to younger: SELECT?prof?age WHERE {?prof a uni:professor; ex:age?age} ORDER DESC(?age) LIMIT 10 Second oldest professor:

168 Modifiers examples 10 oldest professors sorted by age, from oldest to younger: SELECT?prof?age WHERE {?prof a uni:professor; ex:age?age} ORDER DESC(?age) LIMIT 10 Second oldest professor: SELECT?prof?age WHERE {?prof a uni:professor; ex:age?age} ORDER DESC(?age) LIMIT 1 OFFSET 2

169 Modifiers examples 10 oldest professors sorted by age, from oldest to younger: SELECT?prof?age WHERE {?prof a uni:professor; ex:age?age} ORDER DESC(?age) LIMIT 10 Second oldest professor: SELECT?prof?age WHERE {?prof a uni:professor; ex:age?age} ORDER DESC(?age) LIMIT 1 OFFSET 2 Ages of professors

170 Modifiers examples 10 oldest professors sorted by age, from oldest to younger: SELECT?prof?age WHERE {?prof a uni:professor; ex:age?age} ORDER DESC(?age) LIMIT 10 Second oldest professor: SELECT?prof?age WHERE {?prof a uni:professor; ex:age?age} ORDER DESC(?age) LIMIT 1 OFFSET 2 Ages of professors SELECT DISTINCT?age WHERE { [] a uni:professor; ex:age?age}

171 Aggregates SPARQL 1.1 includes aggregates and aggregate functions - As in SQL, aggregates group solutions and compute values over the groups - Groups are defined by a GROUP BY clause - There can be filters over groups, with HAVING Available aggregate function: - COUNT, MIN, MAX, SUM, AVG are as usual in SQL - SAMPLE, picks one random value from the group - GROUP_CONCAT, concatenate strings in the group

172 Aggregates examples How many courses does each lecturer who teach more than 2, teach

173 Aggregates examples How many courses does each lecturer who teach more than 2, teach SELECT?prof COUNT(?course) AS?ncourses WHERE {?prof ex:teaches?course } GROUP BY?prof HAVING?ncourses > 2 - Note the renaming of results with AS

174 Aggregates examples How many courses does each lecturer who teach more than 2, teach SELECT?prof COUNT(?course) AS?ncourses WHERE {?prof ex:teaches?course } GROUP BY?prof HAVING?ncourses > 2 - Note the renaming of results with AS String with list of professors names by age

175 Aggregates examples How many courses does each lecturer who teach more than 2, teach SELECT?prof COUNT(?course) AS?ncourses WHERE {?prof ex:teaches?course } GROUP BY?prof HAVING?ncourses > 2 - Note the renaming of results with AS String with list of professors names by age SELECT?age GROUP_CONCAT(?name, separator=, ) WHERE { _:x a uni:professor; ex:age?age; ex:name?name } GROUP BY?age

176 Subqueries In SPARQL 1.1 one can have subqueries, whose results are conjunctively joined with the remainder BGP - E.g. name of courses that are taught by exactly two lecturers

177 Subqueries In SPARQL 1.1 one can have subqueries, whose results are conjunctively joined with the remainder BGP - E.g. name of courses that are taught by exactly two lecturers SELECT?cname WHERE {?course ex:name?cname. { SELECT?course COUNT(?lect) AS?nl WHERE {?lect ex:teaches?course } GROUP BY?course HAVING?nl = 2 } }

178 Variable BINDing In SPARQL 1.1 variables can be bound to expressions with BIND and AS SELECT?name?yearBirth WHERE { [] a uni:professor; ex:age?age BIND ((2015 -?age) AS?yearBirth) }

179 Variable BINDing In SPARQL 1.1 variables can be bound to expressions with BIND and AS SELECT?name?yearBirth WHERE { [] a uni:professor; ex:age?age BIND ((2015 -?age) AS?yearBirth) } Or SELECT?name (2015 -?age) AS?yearBirth WHERE { [] a uni:professor; ex:age?age }

180 Property paths Another feature of SPARQL 1.1 is property paths - Extend patterns from simple tripes to paths, eventually with arbitrary length Property paths are built with regular expressions over predicates - Alternative paths:?s (exp1 expn)?o - Inverse paths:?s ^exp?o (the same as?o exp?s) - Negation of paths:?s!exp?o - Sequence of paths:?s exp1/ /expn?o - Paths with arbitrary length:?s exp+?o,?s exp*?o, and?s exp??o - Paths with fixed size:?s exp{n}?o,?s exp{n,}?o, and?s exp{,n}?o,?s exp{n,m}?o

181 Property paths example The ancestors of ex:jja:

182 Property paths example The ancestors of ex:jja: SELECT?ans WHERE { ex:jja (ex:mother ex:father)+?ans }

183 Property paths example The ancestors of ex:jja: SELECT?ans WHERE { ex:jja (ex:mother ex:father)+?ans } The descendants of ex:jja:

184 Property paths example The ancestors of ex:jja: SELECT?ans WHERE { ex:jja (ex:mother ex:father)+?ans } The descendants of ex:jja: SELECT?desc WHERE { ex:jja (^ex:mother ^ex:father)+?desc }

185 Property paths example The ancestors of ex:jja: SELECT?ans WHERE { ex:jja (ex:mother ex:father)+?ans } The descendants of ex:jja: SELECT?desc WHERE { ex:jja (^ex:mother ^ex:father)+?desc } The classes to which ex:jja belongs:

186 Property paths example The ancestors of ex:jja: SELECT?ans WHERE { ex:jja (ex:mother ex:father)+?ans } The descendants of ex:jja: SELECT?desc WHERE { ex:jja (^ex:mother ^ex:father)+?desc } The classes to which ex:jja belongs: SELECT?class WHERE { ex:jja rdf:type/rdfs:subclassof*?class}

187 Property paths example The ancestors of ex:jja: SELECT?ans WHERE { ex:jja (ex:mother ex:father)+?ans } The descendants of ex:jja: SELECT?desc WHERE { ex:jja (^ex:mother ^ex:father)+?desc } The classes to which ex:jja belongs: SELECT?class WHERE { ex:jja rdf:type/rdfs:subclassof*?class} The object to which ex:jja is related to, except for its type:

188 Property paths example The ancestors of ex:jja: SELECT?ans WHERE { ex:jja (ex:mother ex:father)+?ans } The descendants of ex:jja: SELECT?desc WHERE { ex:jja (^ex:mother ^ex:father)+?desc } The classes to which ex:jja belongs: SELECT?class WHERE { ex:jja rdf:type/rdfs:subclassof*?class} The object to which ex:jja is related to, except for its type: SELECT?o WHERE { ex:jja!(rdf:type)?o }

189 Negation SPARQL 1.1 includes two forms of negation, besides the negation in filter conditions - Test for patterns that do not exist - Set difference between patterns The first with FILTER NOT EXISTS {BGP} The second with MINUS between BGPs

190 Negation examples Professors for which there is no age

191 Negation examples Professors for which there is no age SELECT?prof WHERE {?prof a uni:professor. FILTER NOT EXISTS {?prof ex:age _:a} }

192 Negation examples Professors for which there is no age SELECT?prof WHERE {?prof a uni:professor. FILTER NOT EXISTS {?prof ex:age _:a} } Can also be done with MINUS

193 Negation examples Professors for which there is no age SELECT?prof WHERE {?prof a uni:professor. FILTER NOT EXISTS {?prof ex:age _:a} } Can also be done with MINUS SELECT?prof WHERE {?prof a uni:professor. MINUS {?prof ex:age?age} }

194 Testing for existence If instead of wanting to know the results (variable bindings) one is only interested in knowing whether there are results, we can simply use ASK Results of ASK are yes or no E.g. Is any lecturer of ex:sw called Jose Alferes?

195 Testing for existence If instead of wanting to know the results (variable bindings) one is only interested in knowing whether there are results, we can simply use ASK Results of ASK are yes or no E.g. Is any lecturer of ex:sw called Jose Alferes? ASK WHERE {?prof ex:name Jose Alferes ; ex:teaches ex:sw }

196 Returning graphs SELECT takes a (set of) RDF graph(s), and returns a table - In this sense, it is not algebraic SPARQL includes two commands that are algebraic - DESCRIBE: given a set of URIs returns the graph with all edge departing from that URI - CONSTRUCT: Similar to SELECT, but returning the result in the form of an RDF graph

197 Describe If given just a URI, returns all the direct data about the resource. E.g. - DESCRIBE < It can also be used to describe the result of a query that returns just one variable, which is always bound to URIs - E.g. The data about those that teach ex:sw DESCRIBE?prof WHERE {?prof ex:teaches ex:sw }

198 Construct CONSTRUCT constructs an RDF graph from a given graph template, using the variables of a query E.g. graph with name (as nome) and year of birth of lecturers of ex:sw CONSTRUCT {?prof my_ex:nome?name; my_ex:birth?year } WHERE {?prof ex:teaches ex:sw; ex:age?age; ex:name?name BIND ((2015-?age) AS?year)}

199 Construct CONSTRUCT constructs an RDF graph from a given graph template, using the variables of a query E.g. graph with name (as nome) and year of birth of lecturers of ex:sw CONSTRUCT {?prof my_ex:nome?name; my_ex:birth?year } WHERE {?prof ex:teaches ex:sw; ex:age?age; ex:name?name BIND ((2015-?age) AS?year)} E.g. all data from lecturers of ex:sw

200 Construct CONSTRUCT constructs an RDF graph from a given graph template, using the variables of a query E.g. graph with name (as nome) and year of birth of lecturers of ex:sw CONSTRUCT {?prof my_ex:nome?name; my_ex:birth?year } WHERE {?prof ex:teaches ex:sw; ex:age?age; ex:name?name BIND ((2015-?age) AS?year)} E.g. all data from lecturers of ex:sw CONSTRUCT {?prof?prop?obj } WHERE {?prof ex:teaches ex:sw;?prop?obj }

201 SPARQL Updates SPARQL update make it possible to - insert and delete contents to graph stores - manage the lifecycle of graph stores - Somehow, similar to DML of SQL INSERT and DELETE insert or delete a given set of triple into a store - Like in CONSTRUCT - Delete cannot be applied to bnodes INSERT {?person ex:birth?year } DELETE {?person ex:age?age} WHERE {?person a ex:person; ex:age?age. BIND ((2015-?age) AS?year)}

202 Managing graph stores There are extra construct to manage RDF stores - LOAD <URI1> [INTO GRAPH <URI2>] loads all the triples in URI1 to the store [in URI2] - CLEAR [GRAPH <URI>] deletes all the triples in the store [in URI] - COPY GRAPH <URI1> TO <URI2> copies and overwrites - MOVE GRAPH <URI1> TO <URI2> moves and overwrites - CREATE GRAPH <URI> - DROP GRAPH <URI>

203 Revisiting Queries We can query, e.g. inside a program, the Web of Data Let s try it (in a SPARQL query web interface) - The countries in Europe with less population than Portugal ISCTEM - janeiro 2017

204 Revisiting Queries We can query, e.g. inside a program, the Web of Data Let s try it (in a SPARQL query web interface) - The countries in Europe with less population than Portugal SELECT?Pais?Populacao WHERE {?Pais rdf:type db-owl:country ; dbpedia2:populationestimate?populacao ; purl:subject dbcat:countries_in_europe. :Portugal dbpedia2:populationestimate?populacaopt. FILTER (?Populacao <?PopulacaoPT). } ISCTEM - janeiro 2017

205 Revisiting Queries We can query, e.g. inside a program, the Web of Data Let s try it (in a SPARQL query web interface) - The countries in Europe with less population than Portugal SELECT?Pais?Populacao WHERE {?Pais rdf:type db-owl:country ; dbpedia2:populationestimate?populacao ; purl:subject dbcat:countries_in_europe. :Portugal dbpedia2:populationestimate?populacaopt. FILTER (?Populacao <?PopulacaoPT). } ISCTEM - janeiro 2017

206 Revisiting Queries We can query, e.g. inside a program, the Web of Data Let s try it (in a SPARQL query web interface) - The countries in Europe with less population than Portugal SELECT?Pais?Populacao WHERE {?Pais rdf:type db-owl:country ; dbpedia2:populationestimate?populacao ; purl:subject dbcat:countries_in_europe. :Portugal dbpedia2:populationestimate?populacaopt. FILTER (?Populacao <?PopulacaoPT). } - What are the genes and phenotypes associated with OMIM diseases? ISCTEM - janeiro 2017

207 Revisiting Queries We can query, e.g. inside a program, the Web of Data Let s try it (in a SPARQL query web interface) - The countries in Europe with less population than Portugal SELECT?Pais?Populacao WHERE {?Pais rdf:type db-owl:country ; dbpedia2:populationestimate?populacao ; purl:subject dbcat:countries_in_europe. :Portugal dbpedia2:populationestimate?populacaopt. FILTER (?Populacao <?PopulacaoPT). } - What are the genes and phenotypes associated with OMIM diseases? ISCTEM - janeiro 2017

208 Applications are popping up Development and querying application - Yagoo - isparql - OpenLink data Explorer;... Application making use of data - Relation Finder - DBpedia mobile - GoPubMed - TrialX; A lot of prototypes at: - ISCTEM - janeiro 2017

209 Applications are popping up Development and querying application - Yagoo - isparql - OpenLink data Explorer;... Application making use of data - Relation Finder - DBpedia mobile - GoPubMed - TrialX; A lot of prototypes at: - ISCTEM - janeiro 2017

210 Applications are popping up Development and querying application - Yagoo - isparql - OpenLink data Explorer;... Application making use of data - Relation Finder - DBpedia mobile - GoPubMed - TrialX; A lot of prototypes at: - ISCTEM - janeiro 2017

211 Applications are popping up Development and querying application - Yagoo - isparql - OpenLink data Explorer;... Application making use of data - Relation Finder - DBpedia mobile - GoPubMed - TrialX; A lot of prototypes at: - ISCTEM - janeiro 2017

212 Applications are popping up Development and querying application - Yagoo - isparql - OpenLink data Explorer;... Application making use of data - Relation Finder - DBpedia mobile - GoPubMed - TrialX; A lot of prototypes at: - ISCTEM - janeiro 2017

213 Applications are popping up Development and querying application - Yagoo - isparql - OpenLink data Explorer;... Application making use of data - Relation Finder - DBpedia mobile - GoPubMed - TrialX; A lot of prototypes at: - ISCTEM - janeiro 2017

214 Applications are popping up Development and querying application - Yagoo - isparql - OpenLink data Explorer;... Application making use of data - Relation Finder - DBpedia mobile - GoPubMed - TrialX; A lot of prototypes at: - ISCTEM - janeiro 2017

215 Applications are popping up Development and querying application - Yagoo - isparql - OpenLink data Explorer;... Application making use of data - Relation Finder - DBpedia mobile - GoPubMed - TrialX; A lot of prototypes at: - ISCTEM - janeiro 2017

216 Applications are popping up Development and querying application - Yagoo - isparql - OpenLink data Explorer;... Application making use of data - Relation Finder - DBpedia mobile - GoPubMed - TrialX; A lot of prototypes at: - ISCTEM - janeiro 2017

217 Applications are popping up Development and querying application - Yagoo - isparql - OpenLink data Explorer;... Application making use of data - Relation Finder - DBpedia mobile - GoPubMed - TrialX; A lot of prototypes at: - ISCTEM - janeiro 2017

RDF AND SPARQL. Part IV: Syntax of SPARQL. Dresden, August Sebastian Rudolph ICCL Summer School

RDF AND SPARQL. Part IV: Syntax of SPARQL. Dresden, August Sebastian Rudolph ICCL Summer School RDF AND SPARQL Part IV: Syntax of SPARQL Sebastian Rudolph ICCL Summer School Dresden, August 2013 Agenda 1 Introduction and Motivation 2 Simple SPARQL Queries 3 Complex Graph Pattern 4 Filters 5 Solution

More information

Ontological Modeling: Part 2

Ontological Modeling: Part 2 Ontological Modeling: Part 2 Terry Halpin LogicBlox This is the second in a series of articles on ontology-based approaches to modeling. The main focus is on popular ontology languages proposed for the

More information

SPARQL: An RDF Query Language

SPARQL: An RDF Query Language SPARQL: An RDF Query Language Wiltrud Kessler Institut für Maschinelle Sprachverarbeitung Universität Stuttgart Semantic Web Winter 2015/16 This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike

More information

Today: RDF syntax. + conjunctive queries for OWL. KR4SW Winter 2010 Pascal Hitzler 3

Today: RDF syntax. + conjunctive queries for OWL. KR4SW Winter 2010 Pascal Hitzler 3 Today: RDF syntax + conjunctive queries for OWL KR4SW Winter 2010 Pascal Hitzler 3 Today s Session: RDF Schema 1. Motivation 2. Classes and Class Hierarchies 3. Properties and Property Hierarchies 4. Property

More information

Querying RDF & RDFS. Several query languages exist to retrieve

Querying RDF & RDFS. Several query languages exist to retrieve Knowledge management: Querying with SPARQL 1 Querying RDF & RDFS Several query languages exist to retrieve resulting triples from RDF RDQL SERQL SPARQL These languages use triple patterns as input and

More information

Semantic Web In Depth: Resource Description Framework. Dr Nicholas Gibbins 32/4037

Semantic Web In Depth: Resource Description Framework. Dr Nicholas Gibbins 32/4037 Semantic Web In Depth: Resource Description Framework Dr Nicholas Gibbins 32/4037 nmg@ecs.soton.ac.uk RDF syntax(es) RDF/XML is the standard syntax Supported by almost all tools RDF/N3 (Notation3) is also

More information

RDF(S) Resource Description Framework (Schema)

RDF(S) Resource Description Framework (Schema) RDF(S) Resource Description Framework (Schema) Where are we? OWL Reasoning DL Extensions Scalability OWL OWL in practice PL/FOL XML RDF(S) Practical Topics 2 Where are we? PL, FOL, XML Today: RDF Purposes?

More information

LECTURE 09 RDF: SCHEMA - AN INTRODUCTION

LECTURE 09 RDF: SCHEMA - AN INTRODUCTION SEMANTIC WEB LECTURE 09 RDF: SCHEMA - AN INTRODUCTION IMRAN IHSAN ASSISTANT PROFESSOR AIR UNIVERSITY, ISLAMABAD THE SEMANTIC WEB LAYER CAKE 2 SW S16 09- RDFs: RDF Schema 1 IMPORTANT ASSUMPTION The following

More information

MI-PDB, MIE-PDB: Advanced Database Systems

MI-PDB, MIE-PDB: Advanced Database Systems MI-PDB, MIE-PDB: Advanced Database Systems http://www.ksi.mff.cuni.cz/~svoboda/courses/2015-2-mie-pdb/ Lecture 11: RDF, SPARQL 3. 5. 2016 Lecturer: Martin Svoboda svoboda@ksi.mff.cuni.cz Author: Martin

More information

Contents. G52IWS: The Semantic Web. The Semantic Web. Semantic web elements. Semantic Web technologies. Semantic Web Services

Contents. G52IWS: The Semantic Web. The Semantic Web. Semantic web elements. Semantic Web technologies. Semantic Web Services Contents G52IWS: The Semantic Web Chris Greenhalgh 2007-11-10 Introduction to the Semantic Web Semantic Web technologies Overview RDF OWL Semantic Web Services Concluding comments 1 See Developing Semantic

More information

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES Semantics of RDF(S) Sebastian Rudolph Dresden, 25 April 2014 Content Overview & XML Introduction into RDF RDFS Syntax & Intuition Tutorial 1 RDFS Semantics RDFS

More information

Querying the Semantic Web

Querying the Semantic Web Querying the Semantic Web CSE 595 Semantic Web Instructor: Dr. Paul Fodor Stony Brook University http://www3.cs.stonybrook.edu/~pfodor/courses/cse595.html Lecture Outline SPARQL Infrastructure Basics:

More information

RDF /RDF-S Providing Framework Support to OWL Ontologies

RDF /RDF-S Providing Framework Support to OWL Ontologies RDF /RDF-S Providing Framework Support to OWL Ontologies Rajiv Pandey #, Dr.Sanjay Dwivedi * # Amity Institute of information Technology, Amity University Lucknow,India * Dept.Of Computer Science,BBA University

More information

Semantic Web Fundamentals

Semantic Web Fundamentals Semantic Web Fundamentals Web Technologies (706.704) 3SSt VU WS 2018/19 with acknowledgements to P. Höfler, V. Pammer, W. Kienreich ISDS, TU Graz January 7 th 2019 Overview What is Semantic Web? Technology

More information

RDF AND SPARQL. Part III: Semantics of RDF(S) Dresden, August Sebastian Rudolph ICCL Summer School

RDF AND SPARQL. Part III: Semantics of RDF(S) Dresden, August Sebastian Rudolph ICCL Summer School RDF AND SPARQL Part III: Semantics of RDF(S) Sebastian Rudolph ICCL Summer School Dresden, August 2013 Agenda 1 Motivation and Considerations 2 Simple Entailment 3 RDF Entailment 4 RDFS Entailment 5 Downsides

More information

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES Semantics of RDF(S) Sebastian Rudolph Dresden, 16 April 2013 Agenda 1 Motivation and Considerations 2 Simple Entailment 3 RDF Entailment 4 RDFS Entailment 5 Downsides

More information

Formalising the Semantic Web. (These slides have been written by Axel Polleres, WU Vienna)

Formalising the Semantic Web. (These slides have been written by Axel Polleres, WU Vienna) Formalising the Semantic Web (These slides have been written by Axel Polleres, WU Vienna) The Semantics of RDF graphs Consider the following RDF data (written in Turtle): @prefix rdfs: .

More information

Semantic Web Test

Semantic Web Test Semantic Web Test 24.01.2017 Group 1 No. A B C D 1 X X X 2 X X 3 X X 4 X X 5 X X 6 X X X X 7 X X 8 X X 9 X X X 10 X X X 11 X 12 X X X 13 X X 14 X X 15 X X 16 X X 17 X 18 X X 19 X 20 X X 1. Which statements

More information

Semantic Web and Linked Data

Semantic Web and Linked Data Semantic Web and Linked Data Petr Křemen December 2012 Contents Semantic Web Technologies Overview Linked Data Semantic Web Technologies Overview Semantic Web Technology Stack from Wikipedia. http://wikipedia.org/wiki/semantic_web,

More information

Logic and Reasoning in the Semantic Web (part I RDF/RDFS)

Logic and Reasoning in the Semantic Web (part I RDF/RDFS) Logic and Reasoning in the Semantic Web (part I RDF/RDFS) Fulvio Corno, Laura Farinetti Politecnico di Torino Dipartimento di Automatica e Informatica e-lite Research Group http://elite.polito.it Outline

More information

Semantic Web Technologies

Semantic Web Technologies 1/57 Introduction and RDF Jos de Bruijn debruijn@inf.unibz.it KRDB Research Group Free University of Bolzano, Italy 3 October 2007 2/57 Outline Organization Semantic Web Limitations of the Web Machine-processable

More information

SPARQL. Dr Nicholas Gibbins

SPARQL. Dr Nicholas Gibbins SPARQL Dr Nicholas Gibbins nmg@ecs.soton.ac.uk Semantic Web Applications Technologies considered so far allow us to create representation schemes (RDFS, OWL) and to represent data (RDF) We can put data

More information

The Logic of the Semantic Web. Enrico Franconi Free University of Bozen-Bolzano, Italy

The Logic of the Semantic Web. Enrico Franconi Free University of Bozen-Bolzano, Italy The Logic of the Semantic Web Enrico Franconi Free University of Bozen-Bolzano, Italy What is this talk about 2 What is this talk about A sort of tutorial of RDF, the core semantic web knowledge representation

More information

Semantic Web. MPRI : Web Data Management. Antoine Amarilli Friday, January 11th 1/29

Semantic Web. MPRI : Web Data Management. Antoine Amarilli Friday, January 11th 1/29 Semantic Web MPRI 2.26.2: Web Data Management Antoine Amarilli Friday, January 11th 1/29 Motivation Information on the Web is not structured 2/29 Motivation Information on the Web is not structured This

More information

Knowledge Representation for the Semantic Web

Knowledge Representation for the Semantic Web Knowledge Representation for the Semantic Web Winter Quarter 2012 Pascal Hitzler Slides 2 01/05/2011 Kno.e.sis Center Wright State University, Dayton, OH http://www.knoesis.org/pascal/ KR4SW Winter 2012

More information

Semantic Web Technologies: RDF + RDFS

Semantic Web Technologies: RDF + RDFS Semantic Web Technologies: RDF + RDFS RDF Language RDF Schema The limits of my language are the limits of my world. Ludwig Wittgenstein RDF Expressiveness & Semantics RDF Programming Introduction The Semantic

More information

Unit 2 RDF Formal Semantics in Detail

Unit 2 RDF Formal Semantics in Detail Unit 2 RDF Formal Semantics in Detail Axel Polleres Siemens AG Österreich VU 184.729 Semantic Web Technologies A. Polleres VU 184.729 1/41 Where are we? Last time we learnt: Basic ideas about RDF and how

More information

RDF. Charlie Abela Department of Artificial Intelligence

RDF. Charlie Abela Department of Artificial Intelligence RDF Charlie Abela Department of Artificial Intelligence charlie.abela@um.edu.mt Last Lecture Introduced XPath and XQuery as languages that allow for accessing and extracting node information from XML Problems?

More information

INF3580/4580 Semantic Technologies Spring 2017

INF3580/4580 Semantic Technologies Spring 2017 INF3580/4580 Semantic Technologies Spring 2017 Lecture 9: Model Semantics & Reasoning Martin Giese 13th March 2017 Department of Informatics University of Oslo Today s Plan 1 Repetition: RDF semantics

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 12 (Wrap-up) http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2411

More information

Knowledge Representation for the Semantic Web

Knowledge Representation for the Semantic Web Knowledge Representation for the Semantic Web Winter Quarter 2011 Pascal Hitzler Slides 4 01/13/2010 Kno.e.sis Center Wright State University, Dayton, OH http://www.knoesis.org/pascal/ KR4SW Winter 2011

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Semester 1, 2017 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 12 (Wrap-up) http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2457

More information

Multi-agent and Semantic Web Systems: RDF Data Structures

Multi-agent and Semantic Web Systems: RDF Data Structures Multi-agent and Semantic Web Systems: RDF Data Structures Fiona McNeill School of Informatics 31st January 2013 Fiona McNeill Multi-agent Semantic Web Systems: RDF Data Structures 31st January 2013 0/25

More information

Day 2. RISIS Linked Data Course

Day 2. RISIS Linked Data Course Day 2 RISIS Linked Data Course Overview of the Course: Friday 9:00-9:15 Coffee 9:15-9:45 Introduction & Reflection 10:30-11:30 SPARQL Query Language 11:30-11:45 Coffee 11:45-12:30 SPARQL Hands-on 12:30-13:30

More information

BUILDING THE SEMANTIC WEB

BUILDING THE SEMANTIC WEB BUILDING THE SEMANTIC WEB You might have come across the term Semantic Web Applications often, during talks about the future of Web apps. Check out what this is all about There are two aspects to the possible

More information

SPARQL. Fausto Giunchiglia and Mattia Fumagallli. University of Trento

SPARQL. Fausto Giunchiglia and Mattia Fumagallli. University of Trento SPARQL Fausto Giunchiglia and Mattia Fumagallli University of Trento Roadmap Introduction Basic query forms SELECT CONSTRUCT ASK DESCRIBE Other clauses and modifiers SPARQL Federated Query Exercises 2

More information

Outline RDF. RDF Schema (RDFS) RDF Storing. Semantic Web and Metadata What is RDF and what is not? Why use RDF? RDF Elements

Outline RDF. RDF Schema (RDFS) RDF Storing. Semantic Web and Metadata What is RDF and what is not? Why use RDF? RDF Elements Knowledge management RDF and RDFS 1 RDF Outline Semantic Web and Metadata What is RDF and what is not? Why use RDF? RDF Elements RDF Schema (RDFS) RDF Storing 2 Semantic Web The Web today: Documents for

More information

2. RDF Semantic Web Basics Semantic Web

2. RDF Semantic Web Basics Semantic Web 2. RDF Semantic Web Basics Semantic Web Prof. Dr. Bernhard Humm Faculty of Computer Science Hochschule Darmstadt University of Applied Sciences Summer semester 2011 1 Agenda Semantic Web Basics Literature

More information

KNOWLEDGE GRAPHS. Lecture 3: Modelling in RDF/Introduction to SPARQL. TU Dresden, 30th Oct Markus Krötzsch Knowledge-Based Systems

KNOWLEDGE GRAPHS. Lecture 3: Modelling in RDF/Introduction to SPARQL. TU Dresden, 30th Oct Markus Krötzsch Knowledge-Based Systems KNOWLEDGE GRAPHS Lecture 3: Modelling in RDF/Introduction to SPARQL Markus Krötzsch Knowledge-Based Systems TU Dresden, 30th Oct 2018 Review: RDF Graphs The W3C Resource Description Framework considers

More information

Mustafa Jarrar: Lecture Notes on RDF Schema Birzeit University, Version 3. RDFS RDF Schema. Mustafa Jarrar. Birzeit University

Mustafa Jarrar: Lecture Notes on RDF Schema Birzeit University, Version 3. RDFS RDF Schema. Mustafa Jarrar. Birzeit University Mustafa Jarrar: Lecture Notes on RDF Schema Birzeit University, 2018 Version 3 RDFS RDF Schema Mustafa Jarrar Birzeit University 1 Watch this lecture and download the slides Course Page: http://www.jarrar.info/courses/ai/

More information

RDF Schema. Philippe Genoud, UFR IM2AG, UGA Manuel Atencia Arcas, UFR SHS, UGA

RDF Schema. Philippe Genoud, UFR IM2AG, UGA Manuel Atencia Arcas, UFR SHS, UGA RDF Schema Philippe Genoud, UFR IM2AG, UGA Manuel Atencia Arcas, UFR SHS, UGA 1 RDF Schema (RDF-S) Introduc)on Classes in RDF- S Proper@es in RDF- S Interpreta@on of RDF- S statements Descrip@on of classes

More information

BASI DI DATI II 2 modulo Parte VIII: SPARQL

BASI DI DATI II 2 modulo Parte VIII: SPARQL BASI DI DATI II 2 modulo Parte VIII: SPARQL Prof. Riccardo Torlone Università Roma Tre Outline Querying RDF SPARQL Query Languages: SQL A language for querying collections of tuples: SELECT SALARY, HIRE_DATE

More information

Transforming Data from into DataPile RDF Structure into RDF

Transforming Data from into DataPile RDF Structure into RDF Transforming Data from DataPile Structure Transforming Data from into DataPile RDF Structure into RDF Jiří Jiří Dokulil Charles Faculty of University, Mathematics Faculty and Physics, of Mathematics Charles

More information

Proposal for Implementing Linked Open Data on Libraries Catalogue

Proposal for Implementing Linked Open Data on Libraries Catalogue Submitted on: 16.07.2018 Proposal for Implementing Linked Open Data on Libraries Catalogue Esraa Elsayed Abdelaziz Computer Science, Arab Academy for Science and Technology, Alexandria, Egypt. E-mail address:

More information

KNOWLEDGE GRAPHS. Lecture 4: Introduction to SPARQL. TU Dresden, 6th Nov Markus Krötzsch Knowledge-Based Systems

KNOWLEDGE GRAPHS. Lecture 4: Introduction to SPARQL. TU Dresden, 6th Nov Markus Krötzsch Knowledge-Based Systems KNOWLEDGE GRAPHS Lecture 4: Introduction to SPARQL Markus Krötzsch Knowledge-Based Systems TU Dresden, 6th Nov 2018 Review We can use reification to encode complex structures in RDF graphs: Film Actor

More information

Semantic Web Information Management

Semantic Web Information Management Semantic Web Information Management Norberto Fernández ndez Telematics Engineering Department berto@ it.uc3m.es.es 1 Motivation n Module 1: An ontology models a domain of knowledge n Module 2: using the

More information

SPAR-QL. Mario Arrigoni Neri

SPAR-QL. Mario Arrigoni Neri SPAR-QL Mario Arrigoni Neri 1 Introduction 2 SPARQL = SPARQL Protocol and RDF Query Language SPARQL - query language to manipulate information in RDF graphs. It provides support to: extract information

More information

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES RDFS Rule-based Reasoning Sebastian Rudolph Dresden, 16 April 2013 Content Overview & XML 9 APR DS2 Hypertableau II 7 JUN DS5 Introduction into RDF 9 APR DS3 Tutorial

More information

Semantic Web and Python Concepts to Application development

Semantic Web and Python Concepts to Application development PyCon 2009 IISc, Bangalore, India Semantic Web and Python Concepts to Application development Vinay Modi Voice Pitara Technologies Private Limited Outline Web Need better web for the future Knowledge Representation

More information

Web Science & Technologies University of Koblenz Landau, Germany. RDF Schema. Steffen Staab. Semantic Web

Web Science & Technologies University of Koblenz Landau, Germany. RDF Schema. Steffen Staab. Semantic Web Web Science & Technologies University of Koblenz Landau, Germany RDF Schema RDF Schemas Describe rules for using RDF properties Are expressed in RDF Extends original RDF vocabulary Are not to be confused

More information

XML and Semantic Web Technologies. III. Semantic Web / 1. Ressource Description Framework (RDF)

XML and Semantic Web Technologies. III. Semantic Web / 1. Ressource Description Framework (RDF) XML and Semantic Web Technologies XML and Semantic Web Technologies III. Semantic Web / 1. Ressource Description Framework (RDF) Prof. Dr. Dr. Lars Schmidt-Thieme Information Systems and Machine Learning

More information

Implementing and extending SPARQL queries over DLVHEX

Implementing and extending SPARQL queries over DLVHEX Implementing and extending SPARQL queries over DLVHEX Gennaro Frazzingaro Bachelor Thesis Presentation - October 5, 2007 From a work performed in Madrid, Spain Galway, Ireland Rende, Italy How to solve

More information

Semantic Web Fundamentals

Semantic Web Fundamentals Semantic Web Fundamentals Web Technologies (706.704) 3SSt VU WS 2017/18 Vedran Sabol with acknowledgements to P. Höfler, V. Pammer, W. Kienreich ISDS, TU Graz December 11 th 2017 Overview What is Semantic

More information

2. Knowledge Representation Applied Artificial Intelligence

2. Knowledge Representation Applied Artificial Intelligence 2. Knowledge Representation Applied Artificial Intelligence Prof. Dr. Bernhard Humm Faculty of Computer Science Hochschule Darmstadt University of Applied Sciences 1 Retrospective Introduction to AI What

More information

Semantic Web Systems Querying Jacques Fleuriot School of Informatics

Semantic Web Systems Querying Jacques Fleuriot School of Informatics Semantic Web Systems Querying Jacques Fleuriot School of Informatics 5 th February 2015 In the previous lecture l Serialising RDF in XML RDF Triples with literal Object edstaff:9888 foaf:name Ewan Klein.

More information

CHAPTER 1 INTRODUCTION

CHAPTER 1 INTRODUCTION 1 CHAPTER 1 INTRODUCTION Most of today s Web content is intended for the use of humans rather than machines. While searching documents on the Web using computers, human interpretation is required before

More information

The Formal Syntax and Semantics of Web-PDDL

The Formal Syntax and Semantics of Web-PDDL The Formal Syntax and Semantics of Web-PDDL Dejing Dou Computer and Information Science University of Oregon Eugene, OR 97403, USA dou@cs.uoregon.edu Abstract. This white paper formally define the syntax

More information

Building Blocks of Linked Data

Building Blocks of Linked Data Building Blocks of Linked Data Technological foundations Identifiers: URIs Data Model: RDF Terminology and Semantics: RDFS, OWL 23,019,148 People s Republic of China 20,693,000 population located in capital

More information

The Semantic Web. What is the Semantic Web?

The Semantic Web. What is the Semantic Web? The Semantic Web Alun Preece Computing Science, University of Aberdeen (from autumn 2007: School of Computer Science, Cardiff University) What is the Semantic Web, and why do we need it now? How does the

More information

COMPUTER AND INFORMATION SCIENCE JENA DB. Group Abhishek Kumar Harshvardhan Singh Abhisek Mohanty Suhas Tumkur Chandrashekhara

COMPUTER AND INFORMATION SCIENCE JENA DB. Group Abhishek Kumar Harshvardhan Singh Abhisek Mohanty Suhas Tumkur Chandrashekhara JENA DB Group - 10 Abhishek Kumar Harshvardhan Singh Abhisek Mohanty Suhas Tumkur Chandrashekhara OUTLINE Introduction Data Model Query Language Implementation Features Applications Introduction Open Source

More information

Interacting with Linked Data Part I: General Introduction

Interacting with Linked Data Part I: General Introduction Interacting with Linked Data Part I: General Introduction Agenda Part 0: Welcome Part I: General Introduction to Semantic Technologies Part II: Advanced Concepts Part III: OWLIM Part IV: Information Workbench-

More information

Semantic Web Technologies: Assignment 1. Axel Polleres Siemens AG Österreich

Semantic Web Technologies: Assignment 1. Axel Polleres Siemens AG Österreich Semantic Web Technologies: Assignment 1 Siemens AG Österreich 1 The assignment: 2 FOAF: 1. Create your own FOAF file. You can use a generator tool such as FOAF- a- Ma>c to generate a skeleton. 2. Make

More information

Logical reconstruction of RDF and ontology languages

Logical reconstruction of RDF and ontology languages Logical reconstruction of RDF and ontology languages Jos de Bruijn 1, Enrico Franconi 2, and Sergio Tessaris 2 1 Digital Enterprise Research Institute, University of Innsbruck, Austria jos.debruijn@deri.org

More information

WHY WE NEED AN XML STANDARD FOR REPRESENTING BUSINESS RULES. Introduction. Production rules. Christian de Sainte Marie ILOG

WHY WE NEED AN XML STANDARD FOR REPRESENTING BUSINESS RULES. Introduction. Production rules. Christian de Sainte Marie ILOG WHY WE NEED AN XML STANDARD FOR REPRESENTING BUSINESS RULES Christian de Sainte Marie ILOG Introduction We are interested in the topic of communicating policy decisions to other parties, and, more generally,

More information

SPARQL By Example: The Cheat Sheet

SPARQL By Example: The Cheat Sheet SPARQL By Example: The Cheat Sheet Accompanies slides at: http://www.cambridgesemantics.com/semantic-university/sparql-by-example Comments & questions to: Lee Feigenbaum VP

More information

RDF Schema. Mario Arrigoni Neri

RDF Schema. Mario Arrigoni Neri RDF Schema Mario Arrigoni Neri Semantic heterogeneity Standardization: commitment on common shared markup If no existing application If market-leaders can define de-facto standards Translation: create

More information

Main topics: Presenter: Introduction to OWL Protégé, an ontology editor OWL 2 Semantic reasoner Summary TDT OWL

Main topics: Presenter: Introduction to OWL Protégé, an ontology editor OWL 2 Semantic reasoner Summary TDT OWL 1 TDT4215 Web Intelligence Main topics: Introduction to Web Ontology Language (OWL) Presenter: Stein L. Tomassen 2 Outline Introduction to OWL Protégé, an ontology editor OWL 2 Semantic reasoner Summary

More information

SPARQL Protocol And RDF Query Language

SPARQL Protocol And RDF Query Language SPARQL Protocol And RDF Query Language WS 2011/12: XML Technologies John Julian Carstens Department of Computer Science Communication Systems Group Christian-Albrechts-Universität zu Kiel March 1, 2012

More information

SEMANTIC WEB 03 RDF DATA MODEL RESOURCE DESCRIPTION FRAMEWORK IMRAN IHSAN ASSISTANT PROFESSOR, AIR UNIVERSITY, ISLAMABAD

SEMANTIC WEB 03 RDF DATA MODEL RESOURCE DESCRIPTION FRAMEWORK IMRAN IHSAN ASSISTANT PROFESSOR, AIR UNIVERSITY, ISLAMABAD SEMANTIC WEB 03 RDF DATA MODEL RESOURCE DESCRIPTION FRAMEWORK IMRAN IHSAN ASSISTANT PROFESSOR, AIR UNIVERSITY, ISLAMABAD WWW.IMRANIHSAN.COM MOTIVATION How do you encode the piece of knowledge: or

More information

The Semantic Web Revisited. Nigel Shadbolt Tim Berners-Lee Wendy Hall

The Semantic Web Revisited. Nigel Shadbolt Tim Berners-Lee Wendy Hall The Semantic Web Revisited Nigel Shadbolt Tim Berners-Lee Wendy Hall Today sweb It is designed for human consumption Information retrieval is mainly supported by keyword-based search engines Some problems

More information

WebGUI & the Semantic Web. William McKee WebGUI Users Conference 2009

WebGUI & the Semantic Web. William McKee WebGUI Users Conference 2009 WebGUI & the Semantic Web William McKee william@knowmad.com WebGUI Users Conference 2009 Goals of this Presentation To learn more about the Semantic Web To share Tim Berners-Lee's vision of the Web To

More information

Helmi Ben Hmida Hannover University, Germany

Helmi Ben Hmida Hannover University, Germany Helmi Ben Hmida Hannover University, Germany 1 Summarizing the Problem: Computers don t understand Meaning My mouse is broken. I need a new one 2 The Semantic Web Vision the idea of having data on the

More information

SEMANTIC WEB AN INTRODUCTION. Luigi De https://elite.polito.it

SEMANTIC WEB AN INTRODUCTION. Luigi De https://elite.polito.it SEMANTIC WEB AN INTRODUCTION Luigi De Russis @luigidr https://elite.polito.it THE WEB IS A WEB OF DOCUMENT FOR PEOPLE, NOT FOR MACHINES 2 THE WEB IS A WEB OF DOCUMENT 3 THE SEMANTIC WEB IS A WEB OF DATA

More information

H1 Spring B. Programmers need to learn the SOAP schema so as to offer and use Web services.

H1 Spring B. Programmers need to learn the SOAP schema so as to offer and use Web services. 1. (24 points) Identify all of the following statements that are true about the basics of services. A. If you know that two parties implement SOAP, then you can safely conclude they will interoperate at

More information

Linked Data and RDF. COMP60421 Sean Bechhofer

Linked Data and RDF. COMP60421 Sean Bechhofer Linked Data and RDF COMP60421 Sean Bechhofer sean.bechhofer@manchester.ac.uk Building a Semantic Web Annotation Associating metadata with resources Integration Integrating information sources Inference

More information

Linked Data and RDF. COMP60421 Sean Bechhofer

Linked Data and RDF. COMP60421 Sean Bechhofer Linked Data and RDF COMP60421 Sean Bechhofer sean.bechhofer@manchester.ac.uk Building a Semantic Web Annotation Associating metadata with resources Integration Integrating information sources Inference

More information

What is the Semantic Web? 17 XBRL International Conference Eindhoven, the Netherlands 5st May, Ivan Herman, W3C

What is the Semantic Web? 17 XBRL International Conference Eindhoven, the Netherlands 5st May, Ivan Herman, W3C What is the Semantic Web? th 17 XBRL International Conference Eindhoven, the Netherlands 5st May, 2008 Ivan Herman, W3C (2) > Towards a Semantic Web The current Web represents information using natural

More information

Deep integration of Python with Semantic Web technologies

Deep integration of Python with Semantic Web technologies Deep integration of Python with Semantic Web technologies Marian Babik, Ladislav Hluchy Intelligent and Knowledge Technologies Group Institute of Informatics, SAS Goals of the presentation Brief introduction

More information

Introducing Linked Data

Introducing Linked Data Introducing Linked Data (Part of this work was funded by PlanetData NoE FP7/2007-2013) Irini Fundulaki 1 1 Institute of Computer Science FORTH & W3C Greece Office Manager EICOS : 4th Meeting, Athens, Greece

More information

From the Web to the Semantic Web: RDF and RDF Schema

From the Web to the Semantic Web: RDF and RDF Schema From the Web to the Semantic Web: RDF and RDF Schema Languages for web Master s Degree Course in Computer Engineering - (A.Y. 2016/2017) The Semantic Web [Berners-Lee et al., Scientific American, 2001]

More information

OWL a glimpse. OWL a glimpse (2) requirements for ontology languages. requirements for ontology languages

OWL a glimpse. OWL a glimpse (2) requirements for ontology languages. requirements for ontology languages OWL a glimpse OWL Web Ontology Language describes classes, properties and relations among conceptual objects lecture 7: owl - introduction of#27# ece#720,#winter# 12# 2# of#27# OWL a glimpse (2) requirements

More information

RDFS. Suresh Manandhar* & Dimitar Kazakov

RDFS. Suresh Manandhar* & Dimitar Kazakov ARIN KR Lecture 3 RDFS Suresh Manandhar* & Dimitar Kazakov *Several of these slides are based on tutorial by Ivan Herman (W3C) reproduced here with kind permission. All changes and errors are mine. 1 Lecture

More information

Introduction to Semantic Web Databases. Version 1 Prepared By: Amgad Madkour Ph.D. Candidate Purdue University April 2018

Introduction to Semantic Web Databases. Version 1 Prepared By: Amgad Madkour Ph.D. Candidate Purdue University April 2018 Introduction to Semantic Web Databases Version 1 Prepared By: Amgad Madkour Ph.D. Candidate Purdue University April 2018 Semantic Web Motivation Represents the next generation of the the world wide web

More information

OWL 2 Profiles. An Introduction to Lightweight Ontology Languages. Markus Krötzsch University of Oxford. Reasoning Web 2012

OWL 2 Profiles. An Introduction to Lightweight Ontology Languages. Markus Krötzsch University of Oxford. Reasoning Web 2012 University of Oxford Department of Computer Science OWL 2 Profiles An Introduction to Lightweight Ontology Languages Markus Krötzsch University of Oxford Reasoning Web 2012 Remark for the Online Version

More information

Today s Plan. INF3580 Semantic Technologies Spring Model-theoretic semantics, a quick recap. Outline

Today s Plan. INF3580 Semantic Technologies Spring Model-theoretic semantics, a quick recap. Outline Today s Plan INF3580 Semantic Technologies Spring 2011 Lecture 6: Introduction to Reasoning with RDF 1 Martin Giese 1st March 2010 2 3 Domains, ranges and open worlds Department of Informatics University

More information

Resource Description Framework (RDF)

Resource Description Framework (RDF) Where are we? Semantic Web Resource Description Framework (RDF) # Title 1 Introduction 2 Semantic Web Architecture 3 Resource Description Framework (RDF) 4 Web of data 5 Generating Semantic Annotations

More information

RDF. Mario Arrigoni Neri

RDF. Mario Arrigoni Neri RDF Mario Arrigoni Neri WEB Generations Internet phase 1: static contents HTML pages FTP resources User knows what he needs and where to retrieve it Internet phase 2: web applications Custom presentation

More information

Semantic Web Engineering

Semantic Web Engineering Semantic Web Engineering Gerald Reif reif@ifi.unizh.ch Fr. 10:15-12:00, Room 2.A.10 RDF Schema Trust Proof Logic Ontology vocabulary RDF + RDF Schema XML + NS + XML Schema Unicode URI Digital Signature

More information

SPARQL เอกสารหล ก ใน มคอ.3

SPARQL เอกสารหล ก ใน มคอ.3 SPARQL SLIDES REFERENCE: SEMANTIC WEB PRIMER BOOK เอกสารหล ก ใน มคอ.3 Why an RDF Query Language? Different XML Representations XML at a lower level of abstraction than RDF There are various ways of syntactically

More information

Making BioPAX SPARQL

Making BioPAX SPARQL Making BioPAX SPARQL hands on... start a terminal create a directory jena_workspace, move into that directory download jena.jar (http://tinyurl.com/3vlp7rw) download biopax data (http://www.biopax.org/junk/homosapiens.nt

More information

Linked data and its role in the semantic web. Dave Reynolds, Epimorphics

Linked data and its role in the semantic web. Dave Reynolds, Epimorphics Linked data and its role in the semantic web Dave Reynolds, Epimorphics Ltd @der42 Roadmap What is linked data? Modelling Strengths and weaknesses Examples Access other topics image: Leo Oosterloo @ flickr.com

More information

OSM Lecture (14:45-16:15) Takahira Yamaguchi. OSM Exercise (16:30-18:00) Susumu Tamagawa

OSM Lecture (14:45-16:15) Takahira Yamaguchi. OSM Exercise (16:30-18:00) Susumu Tamagawa OSM Lecture (14:45-16:15) Takahira Yamaguchi OSM Exercise (16:30-18:00) Susumu Tamagawa TBL 1 st Proposal Information Management: A Proposal (1989) Links have the following types: depends on is part of

More information

Semantic Web Technologies and Automated Auctions

Semantic Web Technologies and Automated Auctions Semantic Web Technologies and Automated Auctions Papers: "Implementing Semantic Interoperability in Electronic Auctions" - Juha Puustjarvi (2007) "Ontologies for supporting negotiation in e-commerce" -

More information

Labeled graph homomorphism and first order logic inference

Labeled graph homomorphism and first order logic inference ECI 2013 Day 2 Labeled graph homomorphism and first order logic inference Madalina Croitoru University of Montpellier 2, France croitoru@lirmm.fr What is Knowledge Representation? Semantic Web Motivation

More information

CS Knowledge Representation and Reasoning (for the Semantic Web)

CS Knowledge Representation and Reasoning (for the Semantic Web) CS 7810 - Knowledge Representation and Reasoning (for the Semantic Web) 04 - RDF Semantics Adila Krisnadhi Data Semantics Lab Wright State University, Dayton, OH September 13, 2016 Adila Krisnadhi (Data

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Semester 2, 2017 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 5 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2465 1 Semantic

More information

Uncertain Data Models

Uncertain Data Models Uncertain Data Models Christoph Koch EPFL Dan Olteanu University of Oxford SYNOMYMS data models for incomplete information, probabilistic data models, representation systems DEFINITION An uncertain data

More information

Semantic Web Modeling Languages Part I: RDF

Semantic Web Modeling Languages Part I: RDF Semantic Web Modeling Languages Part I: RDF Markus Krötzsch & Sebastian Rudolph ESSLLI 2009 Bordeaux slides available at http://semantic-web-book.org/page/esslli09_lecture Outline A Brief Motivation RDF

More information

Orchestrating Music Queries via the Semantic Web

Orchestrating Music Queries via the Semantic Web Orchestrating Music Queries via the Semantic Web Milos Vukicevic, John Galletly American University in Bulgaria Blagoevgrad 2700 Bulgaria +359 73 888 466 milossmi@gmail.com, jgalletly@aubg.bg Abstract

More information

An Introduction to the Semantic Web. Jeff Heflin Lehigh University

An Introduction to the Semantic Web. Jeff Heflin Lehigh University An Introduction to the Semantic Web Jeff Heflin Lehigh University The Semantic Web Definition The Semantic Web is not a separate Web but an extension of the current one, in which information is given well-defined

More information