Semantic Web Tutorial

Part A1: Primer

Text of this part

The Semantic Web

Subject, verb and object

All knowledge is just a set of statements

<#pat> <#knows> <#jo> .

Object can be literal

<#pat> <#knows> <#jo> .
<#pat> <#age> "24" .

Note: noun form "age" preferred to the verb style "knows" for predicates.

Alternative forms

<#pat> has <#child> <#al> .

Just to make reading easier; no meaning. But...

<#al> is <#child> of <#pat> .

isand of reverse the direction

Saves having inverse relationships for everything (eg parent)

Saving space: the comma and semicolon

<#pat> <#child>  <#al>, <#chaz>, <#mo> ;
       <#age>    "24" ;
       <#eyecolor> "blue" .

Data .. eg a table

age eyecolor
pat 24 blue
al 3 green
jo 5 green
  <#pat>   <#age> 24;  <#eyecolor> "blue" .
  <#al>    <#age>  3;  <#eyecolor> "green" .
  <#jo>    <#age>  5;  <#eyecolor> "green" .

Unnamed things: Square brackets

<#pat> <#child> [ <#age> 4 ] , [ <#age> 3 ].

Note:

  [ <#name> "Pat"; <#age> 24;  <#eyecolor> "blue"  ].
  [ <#name> "Al" ; <#age>  3;  <#eyecolor> "green" ].
  [ <#name> "Jo" ; <#age>  5;  <#eyecolor> "green" ].

Congratulations.

You can now write RDF data in N3.

Sharing concepts

Semantic Web culture:

Local concept

<> <#title>  "A simple example of N3".

Who or what knows what <#title> is?

Shared concept

<> <http://purl.org/dc/elements/1.1/title>
 "Primer - Getting into the Semantic Web and RDF using N3".

To save space:

@prefix dc:  <http://purl.org/dc/elements/1.1/> .
<> dc:title
  "Primer - Getting into the Semantic Web and RDF using N3".

Note

Assumed prefixes

in this tutorial:

@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:  <http://www.w3.org/2002/07/owl#> .

and also

@prefix : <#> .

eg

:pat :child [ :age 4 ] , [ :age 3 ].

Making vocabularies

Equivalent:

:Person rdf:type  rdfs:Class

:Person a rdfs:Class.

which we could use with data;

:Pat a :Person.

Classes

Examples: class and property

:Woman a rdfs:Class; rdfs:subClassOf :Person .

and a property:

:sister a rdf:Property.

Something about the Property :sister::

:sister rdfs:domain :Person; 
        rdfs:range :Woman.

Use:

:Pat  :sister  :Jo.

Note

Best practice: Sharing

:Woman = foo:FemaleAdult .
:title a rdf:Property; = dc:title .

Best practice: Publishing

Congratulations

You can now define new vocabularies for new applications.

You can link together vocabularies which you and others have made.

You can start to weave the semantic web.

(end of section)