Semantic Web Tutorial Using N3

37
Yuhana Yuhana - - N3 N3 1 1 Semantic Web Tutorial Semantic Web Tutorial Using N3 Using N3 Speaker : Speaker : (UMI LAILI YUHANA) (UMI LAILI YUHANA) 5/3/2007 5/3/2007

Transcript of Semantic Web Tutorial Using N3

Page 1: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 11

Semantic Web Tutorial Semantic Web Tutorial Using N3Using N3

Speaker : Speaker : 伍伍 妮妮 (UMI LAILI YUHANA)(UMI LAILI YUHANA)5/3/2007 5/3/2007

Page 2: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 22

Hiper Text Mark up Language (HTML)

Page 3: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 33

In Browser

XML

Page 4: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 44

RDFRDF(review)(review)

Page 5: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 55

RDF ElementRDF Element

Root elementRoot elementdefinesdefines the the XML documentXML document to be an to be an RDF RDF document. document. contains a reference to the contains a reference to the RDF namespaceRDF namespace

Description elementDescription elementidentifies a resource with the identifies a resource with the about attributeabout attributecontains contains elementselements that that describe the resourcedescribe the resource

Page 6: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 66

RDF Element (cont.)RDF Element (cont.)

Root element

Description Element

Page 7: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 77

RDF Element (cont.)RDF Element (cont.)

Define XML document To be RDF Document

RDF namespace

About Attributeelements that describe the resource

Page 8: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 88

RDF ModelRDF Model

Model is a set of StatementModel is a set of StatementRDF statement : RDF statement :

combination of combination of a resourcea resource, , a propertya property, and a , and a property valueproperty valueKnown as Known as subjectsubject, , predicatepredicate and and objectobject

RDF use web identifier (URI) to identify RDF use web identifier (URI) to identify resourcesresources

Page 9: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 99

RDF Statement and RDF ModelRDF Statement and RDF Model

Triple: Triple: TT(subject, attribute, values) (subject, attribute, values)

Subject Objectpredicate

Example :Example :The artistThe artist of of Empire Empire BurlesqueBurlesque is is Bob DylanBob DylanThe artistThe artist of of http://http://www.recshop.fake/cd/www.recshop.fake/cd/EmpireEmpire BurlesqueBurlesqueis is Bob DylanBob Dylan

Identify resource with URI

Page 10: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 1010

RDF Graph of Data Model ExampleRDF Graph of Data Model Examplehttp://www.w3.org/RDF/Validator/Use validator in : ( )

Subject

Property

Object

Page 11: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 1111

N3N3

Page 12: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 1212

N3N3

Stand for Stand for Notation 3Notation 3Proposed by Proposed by ““Tim BernersTim Berners--Lee Lee ”” in 1998 in 1998 (first version)(first version)

Page 13: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 1313

N3 (cont.)N3 (cont.)

Language to write data Language to write data Alternative to RDF's XML syntaxAlternative to RDF's XML syntaxBasically Basically equivalent to RDFequivalent to RDF in its in its XMLXMLsyntax syntax

Page 14: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 1414

Why use N3Why use N3

SimplySimplyEasierEasierIt can be converted to RDF/XML with It can be converted to RDF/XML with CWM (Closed World Machine)CWM (Closed World Machine)

Page 15: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 1515

S S ++ VV ++ OO

All knowledge is just a set of statementsAll knowledge is just a set of statementsSubject+Verb+ObjectSubject+Verb+Object

Verb = predicate = property (in RDF)Verb = predicate = property (in RDF)

Page 16: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 1616

Resource (Subject) Property (Verb)

Value (Object)

Page 17: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 1717

RDF

N3

Page 18: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 1818

Object can be a literal Object can be a literal (string or Integer)(string or Integer)

Page 19: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 1919

Saving space: the comma and Saving space: the comma and semicolonsemicolon

SemicolonSemicolon: another predicate for same : another predicate for same subject. subject. CommaComma: another object for same subject & : another object for same subject & predicate predicate Aim? Easy scribbling of data. Aim? Easy scribbling of data.

Page 20: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 2020

S P OSemicolonSemicolon: another predicate for same subject.: another predicate for same subject.

Page 21: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 2121

CommaComma: : another object for same subject & predicateanother object for same subject & predicate

Page 22: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 2222

Sharing ConceptSharing Concept

Using the sameUsing the same URIsURIs is effort but valuable is effort but valuable For anything For anything ---- including predicates. including predicates. URIsURIs tend to be long so use namespaces. tend to be long so use namespaces.

Page 23: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 2323

Local ConceptLocal Concept

<> : empty URI <> : empty URI refers to the document refers to the document it is written init is written in

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

Local concept : concept title (<#title>) is only known by this document

Page 24: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 2424

SharedShared ConceptConcept

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

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

Use @prefix to save space:Use @prefix to save space:

Shared concept : concept title define by dublin core, make the same assumption about title in every document

Page 25: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 2525

Shorthand @prefix for namespaceShorthand @prefix for namespace

RDF

N3

Page 26: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 2626

Making VocabularyMaking Vocabulary

A set of shared concepts A set of shared concepts PropertiesProperties are things to use as predicates are things to use as predicates (verbs) (verbs) ClassesClasses can be the type of an objectcan be the type of an objectWe can make our vocabularyWe can make our vocabulary

Page 27: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 2727

Making Vocabulary (cont.)Making Vocabulary (cont.)

rdf:typerdf:type is just a property, abbreviated to is just a property, abbreviated to "a" in N3"a" in N3IInvent them and describe Properties and nvent them and describe Properties and Classes. Classes.

Page 28: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 2828

ExampleExample

Page 29: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 2929

ReferencesReferences

http://www.w3.org/2000/10/swap/doc/http://www.w3.org/2000/10/swap/doc/http://www.w3.org/DesignIssues/Notation3http://www.w3.org/DesignIssues/Notation3

Page 30: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 3030

Page 31: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 3131

Next Page is The Basic Next Page is The Basic Knowledge RequirementKnowledge Requirement

Page 32: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 3232

URIURI

Uniform Resource IdentifierUniform Resource IdentifierEvery resource has URIEvery resource has URIResource : Resource : ““thingthing”” we want to talk about we want to talk about (e.g. authors, lectures, books, etc)(e.g. authors, lectures, books, etc)URI can be URL (Uniform Resource URI can be URL (Uniform Resource Locator or web address) or some other Locator or web address) or some other kind of unique identifierkind of unique identifierIn general, assume that URI is the In general, assume that URI is the identifier of a web resourceidentifier of a web resource

Page 33: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 3333

Resource (Subject)

Resource

URI

Every Resource has URI

Resource

Page 34: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 3434

HTMLHTML

HTML stand for HTML stand for HHyper yper TText ext MMarkup arkup LLanguageanguageAn HTML file is a text file containing small An HTML file is a text file containing small markup tagsmarkup tagsThe markup tags tell the Web Browser The markup tags tell the Web Browser how to how to displaydisplay the pagethe pageAn HTML file must have an An HTML file must have an htmhtm or or html html file file extensionextensionAn HTML file can be created using a An HTML file can be created using a simple simple text editortext editor

Page 35: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 3535

XMLXMLXML stands for XML stands for EEXXtensibletensible MMarkup arkup LLanguage anguage XML is a XML is a markup languagemarkup language much like HTML much like HTML XML was designed to XML was designed to describe datadescribe dataXML tags are not predefined. We must XML tags are not predefined. We must define define our own tagsour own tagsXML uses a XML uses a Document Type DefinitionDocument Type Definition (DTD) (DTD) or an or an XML SchemaXML Schema to describe the data to describe the data XML with a DTD or XML Schema is designed to XML with a DTD or XML Schema is designed to be be selfself--descriptivedescriptiveXML is a W3C Recommendation XML is a W3C Recommendation

Page 36: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 3636

Aim of N3Aim of N3

to optimize expression of data and logic in to optimize expression of data and logic in the same language, the same language, to allow RDF to be expressed, to allow RDF to be expressed, to allow rules to be integrated smoothly to allow rules to be integrated smoothly with RDF, with RDF, to allow quoting so that statements about to allow quoting so that statements about statements can be made, and statements can be made, and to be as readable, natural, and to be as readable, natural, and symmetrical as possible. symmetrical as possible.

Page 37: Semantic Web Tutorial Using N3

YuhanaYuhana--N3N3 3737

Feature in N3 to achieve aimFeature in N3 to achieve aimURI abbreviation using prefixes which are bound to a URI abbreviation using prefixes which are bound to a namespace (using @prefix) a bit like in XML, namespace (using @prefix) a bit like in XML, Repetition of another object for the same subject and Repetition of another object for the same subject and predicate using a comma "," predicate using a comma "," Repetition of another predicate for the same subject Repetition of another predicate for the same subject using a semicolon ";" using a semicolon ";" BnodeBnode syntax with a certain properties just put the syntax with a certain properties just put the properties between [ and ] properties between [ and ] Formulae allowing N3 graphs to be quoted within N3 Formulae allowing N3 graphs to be quoted within N3 graphs using { and } graphs using { and } Variables and quantification to allow rules, etc to be Variables and quantification to allow rules, etc to be expressed expressed A simple and consistent grammar. A simple and consistent grammar.