semantic web basics

Post on 31-Dec-2015

20 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

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

Semantic Web Basics

Dominic DiFranzoPhD Student/Research AssistantRensselaer Polytechnic InstituteTetherless World Constellation

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.

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" .

Linked Open Data

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>

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” .

owl:sameAS

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

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)

Conversion to RDF

Sparql

•SPARQL is a query language for the Semantic Web.

Sparql

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

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

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

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

Graphs

Named Graph

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

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

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

Optional

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

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") . }

Try some on your own

Questions?

top related