Part A1: Primer
All knowledge is just a set of statements
<#pat> <#knows> <#jo> .
Here a local URI but could point to ANY document
Verb known as predicate in the statement
<#pat> <#knows> <#jo> . <#pat> <#age> "24" .
Note: noun form "age" preferred to the verb style "knows" for predicates.
<#pat> has <#child> <#al> .
Just to make reading easier; no meaning. But...
<#al> is <#child> of <#pat> .
is
and of
reverse the direction
Saves having inverse relationships for everything (eg parent)
<#pat> <#child> <#al>, <#chaz>, <#mo> ; <#age> "24" ; <#eyecolor> "blue" .
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" .
<#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" ].
You can now write RDF data in N3.
Semantic Web culture:
Writing authoritative documents about shared concepts is useful.
<> <#title> "A simple example of N3".
Who or what knows what <#title> is?
<> <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
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 ].
Classes can be the type of an object
rdf:type is just a property, abbreviated to
"a"
in N3
Equivalent:
:Person rdf:type rdfs:Class :Person a rdfs:Class.
which we could use with data;
:Pat a :Person.
: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
= in N3 is short for daml:equivalentTo
daml:
will become owl
::Woman = foo:FemaleAdult . :title a rdf:Property; = dc:title .
Do publish definition of local concepts in the file itself.
Using OWL terms makes query systems smarter.
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)