Semantic Web Basics

25
Semantic Web Basics Dominic DiFranzo PhD Student/Research Assistant Rensselaer Polytechnic Institute Tetherless World Constellation

description

Semantic Web Basics. Dominic DiFranzo PhD Student/Research Assistant Rensselaer Polytechnic Institute Tetherless World Constellation. http://tw.rpi.edu/portal/Mashathon. Interwebs?. Internet – graph of computers connected to one another Web – graph of documents hyper-linked to one another - PowerPoint PPT Presentation

Transcript of Semantic Web Basics

Page 1: Semantic Web Basics

Semantic Web Basics

Dominic DiFranzoPhD Student/Research AssistantRensselaer Polytechnic InstituteTetherless World Constellation

Page 3: Semantic Web Basics

Interwebs?

Internet – graph of computers connected to one another

Web – graph of documents hyper-linked to one another

Semantic web – graph of concepts/ideas/data linked together by named relations.

Page 4: Semantic Web Basics

RDF•Triple: Subject Predicate Object

•Use URI for universal naming

•New York has the postal abbreviation NY

•<urn:x-states:New%20York> <http://purl.org/dc/terms/alternative> "NY" .

Page 5: Semantic Web Basics

Linked Open Data

Page 6: Semantic Web Basics

serialize in many ways

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcterms="http://purl.org/dc/terms/">

<rdf:Description rdf:about="urn:x-states:New%20York"> <dcterms:alternative>NY</dcterms:alternative>

</rdf:Description></rdf:RDF>

Page 7: Semantic Web Basics

Linking

•I found a new dataset and it has the following triple

•<http://dbpedia.org/page/New_York> <http://dbpedia.org/ontology/Place/otherName> “The Empire State” .

Page 8: Semantic Web Basics

owl:sameAS

•<urn:x-states:New%20York> <http://www.w3.org/2002/07/owl#sameAs> <http://dbpedia.org/page/New_York> .

Page 9: Semantic Web Basics

Semantic Mashup Workflow

•Take data (CSV, XSL)

•Convert it to RDF

•Load in triple store

•Query with Sparql

•Visualize results using standard off-the-shelf visualization tools (Google viz, Exhibit, etc)

Page 10: Semantic Web Basics
Page 11: Semantic Web Basics

Conversion to RDF

Page 12: Semantic Web Basics

Sparql

•SPARQL is a query language for the Semantic Web.

Page 13: Semantic Web Basics

Sparql

SELECT ?node ?title WHERE{  ?node <http://purl.org/dc/elements/1.1/title> ?title . } LIMIT 1

Page 14: Semantic Web Basics

Long! SELECT ?node ?name WHERE{  ?node <http://xmlns.com/foaf/0.1/givenname> ?name .  ?node <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> . } LIMIT 10

Page 15: Semantic Web Basics

PrefixPREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?node ?name WHERE{  ?node foaf:givenname ?name .  ?node rdf:type foaf:Person . } LIMIT 10

Page 16: Semantic Web Basics

Shortcuts PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?node ?name WHERE{  ?node foaf:givenname ?name ; rdf:type foaf:Person . } LIMIT 10

Page 17: Semantic Web Basics

Graphs

Page 18: Semantic Web Basics

Named Graph

PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?graph ?node ?title WHERE{ GRAPH ?graph{  ?node dc:title ?title . } } LIMIT 3

Page 19: Semantic Web Basics

Named GraphPREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT  ?node8 ?desc8 ?node401 ?desc401 WHERE{ GRAPH <http://data-gov.tw.rpi.edu/vocab/Dataset_401>{  ?node401 dc:description ?desc401 . } GRAPH <http://data-gov.tw.rpi.edu/vocab/Dataset_8>{  ?node8 dc:description ?desc8 . } } LIMIT 3

Page 20: Semantic Web Basics

Union PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT  ?node8 ?desc8 ?node401 ?desc401 WHERE{ { GRAPH <http://data-gov.tw.rpi.edu/vocab/Dataset_401>{  ?node401 dc:description ?desc401 . } }UNION{ GRAPH <http://data-gov.tw.rpi.edu/vocab/Dataset_8>{  ?node8 dc:description ?desc8 . } } } LIMIT 3

Page 21: Semantic Web Basics

Optional

PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT  ?node ?name ?givenname WHERE{  ?node foaf:name ?name . OPTIONAL{  ?node foaf:givenname ?givenname . } }

Page 22: Semantic Web Basics

Filter

PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT  ?node ?name ?givenname WHERE{  ?node foaf:name ?name .  ?node foaf:givenname ?givenname . FILTER regex(?name, "Biden") . }

Page 23: Semantic Web Basics

Try some on your own

Page 24: Semantic Web Basics
Page 25: Semantic Web Basics

Questions?