Notation 3 (N3) is a language for representing information in graphs or triples with subjects, predicates, and objects. It allows defining vocabularies to classify things and properties between them. Prefixes can represent long URIs as shorthand. Equivalences show when terms in one vocabulary are the same in another. Vocabularies should be published on servers with committed URI spaces to maintain them over time.
3. Introduction
RDF just collection of objects in subject, verb and object form
Everything represented by URI
Object may be literal
More readable
<#Ram> <#Knows> <#Sita>
<#Ram> <#age> 25.
<#pat> has <#child> <#jo>.
<#jo> is <#child> of <#pat>.
4. Introduction
Several statements about same subjects
Semicolon (;) : describing property of same subject.
Comma(,) : Another object with same predicate and subject.
<#pat> <#child> <#al>, <#chez>, <#jo>;
<#age> 24;
<#eyecolor> blue.
5. Example:
Age Eye Color
Ram 24 blue
Hari 28 green
Shyam 6 green
<#Hari> <#age> 24;<#eyecolor> blue.
<#Ram> <#age> 28;<#eyecolor> green.
<#Ram> <#age> 6;<#eyecolor> green.
6. Square Braces [ ]
Something exists with given properties but don't give you a way to
refer to it elsewhere in this or another document
Example
<#pat> <#child> [<#age> 4, <#age> 3].
8. Sharing concepts
Semantic Web Can not define in one document what something means.
Uses URI for concepts
<> <#title> Semantic Web Introduction.
N3 allows a shorthand prefix for long part namespace
<>< http://purl.org/dc/element/1.1/title > Semantic Web
Introduction
@prefix dc: <http://purl.org/dc/element/1.1>
<> dc:title Semantic Web Introduction
9. Conventions on using prefix
Use colon and dc and titile
No angular brackets
Prefix can be used for rest of file
Well known namespaces
@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#> .
11. Making Vocabularies
Define new classes of things and new properties
What type of thing is X ???
Answer: X belongs to ClassName
Property what type of something is ? Rdf:type a
** Define a class Person
:Person a rdfs:class.
** Create a object of class Person
:pat a :Person.
12. Making Vocabularies
An object may be of many classes
Example
:Woman a rdfs:Class; rdfs:SubClassOf :Person.
Property declares relationship between two things
Example
:sister a rdf:Property
13. Domain and Range
When subject of property must be in a class, that class is domain of
the property
When object must be in a class that class is range of property
:sister rdfs:domain :Person;
rdfs:range :Woman.
Class identifiers start with capitals and properties small letters
14. Equivalence
One or more terms in one vocabulary may be same in another
vocabulary
Very Useful
:Woman=foo:FemaleAdult
:Title a rdf:Property;=dc:title.
Interchange of Data
15. Choosing Namespace and Publishing your
Vocabulary
RDF Schema and OWL Vocabularies Machine Readable
Create URI as vocabulary terms that work on browsers
ex: http://example.com/terms
Publish on server and portion of URI space of organization that
commit to maintain on future too..
16. Shorthand for common predicates
a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
= <http://www.w3.org/2002/07/owl#sameAs>
=> <http://www.w3.org/2000/10/swap/log#implies>
<= <http://www.w3.org/2000/10/swap/log#implies> but in the inverse direction
17. Example
There is person, Pat, known as "Pat Smith" and "Patrick Smith". Pat
has a pet dog named "Rover".
@prefix : <http://www.w3.org/2000/10/swap/test/demo1/about-pat#> .
@prefix bio: <http://www.w3.org/2000/10/swap/test/demo1/biology#> .
@prefix per: <http://www.w3.org/2000/10/swap/test/demo1/friends-vocab#>.
:pat a bio:Human;
per:name "Pat Smith", "Patrick Smith";
per:pet [
a bio:Dog; per:name "Rover"
] .