1 of 12

Intro to Semantic Web, Web Services, and Semantic Web Services

Ben Vandervalk

James Hogg Research Centre, Heart + Lung Institute

University of British Columbia

ben.vvalk@gmail.com

June 2012

2 of 12

The Semantic Web

  • Idea
    • a global, machine-readable "web of data"
    • analogous to the WWW
      • WWW: web pages link to other web pages
      • Semantic Web: data sets link to other data sets
    • a general-purpose framework for data integration and data processing�
  • W3C Standards
    • Representing Data: Resource Description Framework (RDF)
    • Query Language: SPARQL Protocol and RDF Query Language (SPARQL)
    • Vocabularies and Logical Reasoning: Web Ontology Language (OWL)

Tim Berners-Lee, Wikimedia Commons, picture taken by Paul Clarke, 2010.

The Semantic Web, Scientific American, 2001.

3 of 12

Resource Description Framework (RDF)

  • Universal language for data on the Semantic Web
  • An RDF document is a set of triples
  • A triple makes a statement
  • A triple consists of 3 parts: subject, predicate, object
  • every subject/predicate/object has a globally unique identifier (URI)

@prefix facebook: <http://www.facebook.com/people/> .

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

@prefix foaf: <http://xmlns.com/foaf/0.1/> .

# triples...

facebook:BenVandervalk rdf:type foaf:Person .

facebook:BenVandervalk foaf:mbox mailto:ben@gmail.com .

An example RDF document, in N3 format.

4 of 12

RDF is a Graph-Based Data Model

@prefix facebook: <http://www.facebook.com/people/> .

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

@prefix foaf: <http://xmlns.com/foaf/0.1/> .

# triples...

facebook:BenVandervalk rdf:type foaf:Person .

facebook:BenVandervalk foaf:mbox mailto:ben.vvalk@gmail.com .

facebook:BenVandervalk

foaf:Person

mailto:ben@gmail.com

rdf:type

foaf:mbox

5 of 12

Merging RDF Datasets

facebook:BenVandervalk

foaf:Person

mailto:ben@gmail.com

rdf:type

foaf:mbox

facebook:PeterVandervalk

foaf:Person

mailto:peter@gmail.com

rdf:type

foaf:mbox

facebook:BenVandervalk

foaf:knows

facebook:BenVandervalk

foaf:Person

mailto:ben@gmail.com

rdf:type

foaf:mbox

facebook:PeterVandervalk

foaf:Person

mailto:peter@gmail.com

rdf:type

foaf:mbox

foaf:knows

6 of 12

Merging RDF Datasets

facebook:BenVandervalk rdf:type foaf:Person .

facebook:BenVandervalk foaf:mbox mailto:ben.vvalk@gmail.com .

merged with

yields

facebook:PeterVandervalk rdf:type foaf:Person .

facebook:PeterVandervalk foaf:mbox mailto:peter@gmail.com .

facebook:PeterVandervalk foaf:knows facebook:BenVandervalk .

facebook:BenVandervalk rdf:type foaf:Person .

facebook:BenVandervalk foaf:mbox mailto:ben.vvalk@gmail.com .

facebook:PeterVandervalk rdf:type foaf:Person .

facebook:PeterVandervalk foaf:mbox mailto:peter@gmail.com .

facebook:PeterVandervalk foaf:knows facebook:BenVandervalk .

Just concatenate the two lists of triples! (and remove duplicates)

7 of 12

SPARQL Protocol and RDF Query Language (SPARQL)

facebook:BenVandervalk rdf:type foaf:Person .

facebook:BenVandervalk foaf:mbox mailto:ben.vvalk@gmail.com .

facebook:PeterVandervalk rdf:type foaf:Person .

facebook:PeterVandervalk foaf:mbox mailto:peter@gmail.com .

facebook:PeterVandervalk foaf:knows facebook:BenVandervalk .

SELECT ?person ?mbox

WHERE {

?person rdf:type foaf:Person .

?person foaf:mbox ?mbox .

}

dataset

query

solutions

?person

?mbox

facebook:BenVandervalk

mailto:ben@gmail.com

facebook:PeterVandervalk

mailto:peter@gmail.com

8 of 12

Web Ontology Language (OWL)

  • OWL is a language for describing logical constraints in RDF data
  • Many types of axioms are supported. Examples:
    • Subproperties:
      • (x, brother, y) => (x, related, y)
      • brother is a subproperty of related
      • note: "property" is synonym "predicate"
    • Classes:
      • (x, is a, father) <=> (x, sex, male) AND (∃y (x, child, y))
      • fathers are male and have at least one child
  • A formal ontology is a set of logical axioms that describes a certain domain
    • At the same time, it provides vocabulary (URIs) for encoding data in that domain
  • An OWL reasoner answers questions about an ontology and related data, e.g.:
    • Which individuals are fathers?
    • Are John and Joe related?

9 of 12

Web Ontology Language (OWL)

<owl:Class rdf:ID="Father">

<owl:equivalentClass> <!-- if and only if -->

<owl:Class>

<owl:intersectionOf rdf:parseType="Collection"> <!-- logical AND -->

<!-- sex is male -->

<owl:Restriction>

<owl:onProperty rdf:resource="#sex"/>

<owl:hasValue rdf:resource="#male"/>

</owl:Restriction>

<!-- at least one child -->

<owl:Restriction>

<owl:onProperty rdf:resource="#child"/>

<owl:minCardinality rdf:datatype="&xsd;integer">1</owl:minCardinality>

</owl:Restriction>

</owl:intersectionOf>

</owl:Class>

</owl:equivalentClass>

</owl:Class>

...

(x, is a, father) <=> (x, sex, male) AND (∃y (x, child, y))

"Fathers are male and have at least one child."

10 of 12

That's all about the Semantic Web for now.

Topic #2: Web Services

(short)

11 of 12

Web Services

  • Web Service: an interface that enables software to remotely access a resource (e.g. a program, a database) over the web
    • analogous to subroutines
    • example: Google Maps API
  • RESTful services (Representation State Transfer)
    • encode request parameters in an URL:
      • request: http://helloworld.com/hello?name=John
      • response: "Hello, John!"
  • WSDL services (Web Service Description Language)
    • WSDL is an XML syntax for describing web services:
      • supported "operations" of a web service (e.g. deposit, withdraw)
      • messages exchanged between client and service for each operation (usually XML)
    • advantage:
      • automatically generate code for clients and services (Apache Axis)

12 of 12

Semantic Web Services

  • OWL-S
    • formally models stateful web services:
      • preconditions - state of the world before
      • effects - state of the world after
    • world state is modeled using an AI planning type of approach
      • world states are expressed as boolean formulae over input/output variables and state variables
    • complicated standard!
    • input and output data is not necessarily RDF
      • best-documented use case is WSDL/XML!
  • WSMO: competitor of OWL-S, very similar in approach