DOC PREVIEW
UT Dallas SE 5V81 - SPARQL

This preview shows page 1-2-3-4-30-31-32-33-34-61-62-63-64 out of 64 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

PowerPoint PresentationSlide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Slide 36Slide 37Slide 38Slide 39Slide 40Slide 41Slide 42Slide 43Slide 44Slide 45Slide 46Slide 47Slide 48Slide 49Slide 50Slide 51Slide 52Slide 53Slide 54Slide 55Slide 56Slide 57Slide 58Slide 59Slide 60Slide 61Slide 62Slide 63Slide 64Chapter 3 A Semantic Web Primer1SPARQLGrigoris AntoniouFrank van HarmelenChapter 3 A Semantic Web PrimerBrowsing info on the Semantic WebNavigating the Semantic Web via RDF browsers - OpenLink RDF Browser, Disco, and others - These browsers are very buggy, based on my experiences - Even if they worked well, it would be an unordered, Web-surfing-like method of discovering semantic infoChapter 3 A Semantic Web PrimerSearching the Semantic WebUse a Semantic Web Search Engine!These crawl the Web and Semantic Web looking for new ontologies (OWL, RDFS, etc.)Ontologies are indexed and made searchableOne can also search for specific properties and RDF triplesExamples: Swoogle, SWSE, Sindice, Watson and FalconsChapter 3 A Semantic Web PrimerQuerying for RDF on the Semantic WebNavigation and Searching for RDF on the Semantic Web is often not precise enough for a userUser often needs to query for specific RDF data over multiple triple stores, where subject, predicate or object of the triples of interest have a particular valueEnter SPARQL: SPARQL Protocol and RDF Query LanguageAbout SPARQLSPARQL is both an RDF query language and a protocolSPARQL defines the syntax of the query language, which is issued to retrieved triples from RDF storesSPARQL is also a protocol – it describes how a SPARQL client (like a Web browser) talks to a SPARQL processor (aka SPARQL endpoint)A SPARQL endpoint is a service that accepts a SPARQL query, processes it, and returns results depending on the query formChapter 3 A Semantic Web Primer6Why an RDF Query Language instead of an XML query language?XML at a lower level of abstraction than RDFThere are various ways of syntactically representing an RDF statement in XMLThus we would require several XPath queries, e.g.–//uni:lecturer/uni:title if uni:title element–//uni:lecturer/@uni:title if uni:title attribute–Both XML representations equivalent!SPARQL Basic QueriesSPARQL is based on matching graph patternsThe simplest graph pattern is the triple pattern :-like an RDF triple, but with the possibility of a variable instead of an RDF term in the subject, predicate, or object positionsVariables are called “bound variables”, and these are like the attribute names in SQL queriesResults returned are called “solutions”, and they are the bound variables associated with each triple that matched the queryChapter 3 A Semantic Web Primer8Using select-from-where As in SQL, SPARQL queries have a SELECT-FROM-WHERE structure:–SELECT specifies the projection: the subject, predicate and/or object of triples that are returned as results–FROM is used to specify the source being queried (optional)–WHERE imposes constraints on possible solutions in the form of graph pattern templates and boolean constraintsRetrieve all phone numbers of staff members:SELECT ?x ?yWHERE { ?x uni:phone ?y .}Here ?x and ?y are variables, and ?x uni:phone ?y represents a resource-property-value triple patternExamplesPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>SELECT ?cWHERE{?c rdf:type rdfs:Class .}Retrieves all triple patterns, where:-the property is rdf:type-the object is rdfs:ClassWhich means that it retrieves all classesExamples (2)Get all instances of a particular class (e.g. course) :(declaration of rdf, rdfs prefixes omitted for brevity)PREFIX uni: <http://www.mydomain.org/uni-ns#>SELECT ?iWHERE{?i rdf:type uni:course .}DBPedia SPARQL EndpointYou can practice SPARQL all you want at various public SPARQL endpoints!DBPedia’s SPARQL endpoint: http://dbpedia.org/sparqlEnter SPARQL queries using Turtle syntaxQuery for all locations named after George Washington-Note the @en language tag after “George Washington”-Notice that namespaces are NOT used in this query, so no PREFIX statements are necessaryRDF Graph Pattern of QueryQuery Results in HTML formatA couple of notesThe results of a SPARQL query are not necessarily ordered.A variable is bound to a URI, literal value or a blank nodeIf a query returns no solutions for a particular variable, then there are no bindings for that variableFoundational Query FormsSELECT queries – Like SQL select queries, SPARQL SELECT queries instruct endpoints to bind RDF terms to variables based on given graph patternCONSTRUCT queries – Allows one to create RDF graphs, as long as each triple specified is valid. One can transform RDF graphs from one form to anotherASK queries – Does a particular graph exist? Returns true or false resultChapter 3 A Semantic Web PrimerFoundational Query Forms (cont)DESCRIBE queries – Returns RDF graph determined solely by the query processor with limited query input from a client. The endpoint decides what precise RDF data is returned to the client. This query is useful when the client has only a vague familiarity with the data, and does not know exactly what RDF triples are presentSPARQL’s SELECT *To return all known variable bindings in a SPARQL query as output, use “SELECT *” as follows:Chapter 3 A Semantic Web Primer19Implicit Join Retrieve all lecturers and their phone numbers:SELECT ?x ?yWHERE{ ?x rdf:type uni:Lecturer ; uni:phone ?y . }Implicit join: We restrict the second pattern only to those triples, the resource of which is in the variable ?x– Here we use a syntax shorcut as well: a semicolon indicates that the following triple shares its subject with the previous oneImplicit join (2)The previous query is equivalent to writing:SELECT ?x ?yWHERE{?x rdf:type uni:Lecturer .?x uni:phone ?y .}Another Implicit Join Example# A punk rock examplePREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>PREFIX dbprop: <http://dbpedia.org/property/>PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dbobject: <http://dbpedia.org/resource/> SELECT *WHERE {?person rdf:type ?class ; dbprop:alias ?label ;


View Full Document

UT Dallas SE 5V81 - SPARQL

Download SPARQL
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view SPARQL and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view SPARQL 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?