N3
From BC$ MobileTV Wiki
Notation 3 (also known as Triple Notation; commonly abbreviated as n3, N3) is a subset of RDF which syntactically represents triples with a simplistic yet comprehensive syntax. N3 also supports inference.
Contents
Specifications
- Notation3 (N3) - A readable RDF syntax: http://www.w3.org/TeamSubmission/n3/
- Notation3 (by Tim Berners-Lee): http://www.w3.org/DesignIssues/Notation3
Turtle
Turtle or turtle) is a metadata standard for representing RDF as triples in a simple, text-based language with namespaces.[1]
- Turtle - Terse RDF Triple Language: http://www.w3.org/TeamSubmission/turtle/
N-Triples
N-Triples is a line-based, plain text format for encoding an RDF graph. It was designed to be a fixed subset of N3.
- N-Triples: http://www.w3.org/TR/rdf-testcases/#ntriples
Examples
Basic example recommendation in N3 using MobileTV + BBC Programmes + Recommendation + Similarity + Music + FOAF + Dublin Core reference ontologies:
@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#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix sim <http://purl.org/ontology/similarity/> . @prefix rec:<http://purl.org/ontology/rec/core#> . @prefix mo <http://purl.org/ontology/mo/> . @prefix po: <http://purl.org/ontology/po/> . @prefix mobiletv: <http://bcmoney-mobiletv.com/ontology/mobiletv#> . :me a foaf:Person ; foaf:name "Bryan Copeland" ; foaf:homepage <http://bryancopeland.com> ; rdfs:seeAlso <http://bcmoney-mobiletv.com/bryan/foaf> . :theDailyShow a po:programme ; rdfs:seeAlso <http://dbpedia.org/page/The_Daily_Show> . :theColbertReport a po:programme ; rdfs:seeAlso <http://dbpedia.org/page/The_Colbert_Report> . :myObviousSimilarity a mobiletv:programme ; a sim:Similarity ; sim:element :theDailyShow ; sim:element :theColbertReport ; sim:weight "0.95" ; dc:description "These shows are really just two sides of the same coin. Though the hosts pretend to have a long-standing rivalry due to differing political views, their friendship is noticeable, and the differing political views mostly imaginary. Many members of the original Daily Show production moved across the street to the set of The Colbert Report to bring the same production qualities and style to the newer show. Colbert has proven the more aggressive but Stewart still holds his own and subtly gets the best of Colbert (as per the script... but hey, I love it anyway as long as their exchanges are worth a laugh)." ; foaf:maker :me . mobiletv:episodeRecommendation a rec:Recommendation ; rec:recommender <http://openrecommender.org> ; rec:recommendation_audience mobiletv:friends ; sim:subject :theDailyShow ; rec:recommendation_object :theColbertReport ; rec:for :theDailyShow ; sim:method :myObviousSimilarity .
Example 2 - The same as above as calculated algorithmically via a Recommendation Engine (OpenRecommender), with much greater detail:
@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#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix tl: <http://purl.org/NET/c4dm/timeline.owl#> . @prefix sim <http://purl.org/ontology/similarity/> . @prefix rec:<http://purl.org/ontology/rec/core#> . @prefix mo <http://purl.org/ontology/mo/> . @prefix po: <http://purl.org/ontology/po/> . @prefix mobiletv: <http://bcmoney-mobiletv.com/ontology/mobiletv#> . :me a foaf:Person ; foaf:name "Bryan Copeland" ; foaf:homepage <http://bryancopeland.com> ; rdfs:seeAlso <http://bcmoney-mobiletv.com/bryan/foaf> . :dailyShowThemeSong a mo:Track ; mo:soundtrack :myFavoriteShow ; dc:id "183d6ef6-e161-47ff-9085-063c8b897e97#dog_on_fire" ; dc:title "Dog On Fire" ; dc:link <http://tmbw.net/wiki/Dog_On_Fire> ; dc:description "With the first 17 seconds of the opening riff acting as the opening theme song for 'The Daily Show', and an extended version acting as the closing theme for the show. The song was written by Bob Mould, whose version was used as The Daily Show's theme for Craig Kilborn's tenure as host. When Jon Stewart took over the show, They Might Be Giants' re-recorded version was used." ; foaf:maker <http://www.bbc.co.uk/music/artists/183d6ef6-e161-47ff-9085-063c8b897e97#artist> . <http://www.bbc.co.uk/music/artists/183d6ef6-e161-47ff-9085-063c8b897e97#artist> a mo:MusicArtist ; foaf:name "They Might Be Giants" ; foaf:homepage <http://www.tmbg.com/> ; mo:bio <http://tmbw.net/wiki/They_Might_Be_Giants> ; mo:discography <> ; dc:link <http://en.wikipedia.org/wiki/They_Might_Be_Giants> ; rdfs:seeAlso <http://dbpedia.org/page/They_Might_Be_Giants> ; owl:sameAs <http://musicbrainz.org/artist/183d6ef6-e161-47ff-9085-063c8b897e97.html> ; <http://tmbw.net/wiki/Dog_On_Fire> a mo:Track ; dc:title "Dog On Fire" ; foaf:maker <http://www.bbc.co.uk/music/artists/183d6ef6-e161-47ff-9085-063c8b897e97#artist> ; mo:writtenBy <http://en.wikipedia.org/wiki/Bob_Mould> ; mo:lyrics "This song is an instrumental and has no lyrics." ; mo:guitarSheetMusic <http://tmbw.net/wiki/Guitar_Tab:Dog_On_Fire> ; mo:bassSheetMusic <http://tmbw.net/wiki/Bass_Tab:Dog_On_Fire> ; mo:pianoSheetMusic <http://es.tabnabber.com/view_piano_sheet_music.asp?song=They_Might_Be_Giants-Dog_on_Fire_(Jon_Stewart_Theme).txt> ; mo:recording <http://theynow.com/files/byrequest/They-Might-Be-Giants_-_Dog-on-Fire.mp3> ; mo:encoding "MP3 CBR @ 128kbps" ; mobiletv:download <http://www.youtube.com/get_video?video_id=wPANE9GnAuE&rv.5.title=dog+on+fire&rv.6.rating=4.91857798165&sk=l7agMXYSk40s0tL0qCVsPfXIbTWB3X2sC&rv.1.title=The+Original+Stephen+Colbert+Song&rv.7.view_count=5010&rv.3.length_seconds=163&rv.5.author=tatatataiyou\> ; mobiletv:embed <http://www.youtube.com/oembed?url=http%3A//youtube.com/watch%3Fv%3DwPANE9GnAuE&format=json> ; mobiletv:watch <http://www.youtube.com/watch?v=wPANE9GnAuE> ; mobiletv:fullscreen <http://www.youtube.com/e/wPANE9GnAuE> ; mobiletv:stream <rtsp://v1.cache3.c.youtube.com/CiILENy73wIaGQnhAqfREw3wwBMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp> ; mobiletv:comments <http://gdata.youtube.com/feeds/api/videos/wPANE9GnAuE/comments> ; mobiletv:share <http://bcmoney-mobiletv.com/api/recommend/?category=music&artist=They+Might+Be+Giants&title=Dog+On+Fire> . [ a mo:Record ; dc:title "Unreleased" ; mo:track <http://tmbw.net/wiki/Dog_On_Fire> ] . [ a mobiletv:videoResponse ; mobiletv:videoResponseMethod "POST" ; mobiletv:videoResponseURL <http://gdata.youtube.com/feeds/api/videos/wPANE9GnAuE/responses> ; mobiletv:contentLength: "100" ; mobiletv:AuthorizationType: "AuthSub token" ; mobiletv:AuthorizationToken: "AUTHORIZATION_TOKEN" ; mobiletv:apiKeyName "X-GData-Key" ; mobiletv:apiKey "DEVELOPER_KEY" ; mobiletv:videoResponseBody "<?xml version=\"1.0\" encoding=\"UTF-8\"?><entry xmlns=\"http://www/w3.org/2005/Atom\"><id>RESPONSE_VIDEO_ID</id></entry>" . ] ; [ a mobiletv:textResponse ; mobiletv:textResponseMethod "POST" ; mobiletv:textResponseURL <http://gdata.youtube.com/feeds/api/videos/wPANE9GnAuE/comments> ; mobiletv:contentLength: "100" ; mobiletv:AuthorizationType: "AuthSub token" ; mobiletv:AuthorizationToken: "AUTHORIZATION_TOKEN" ; mobiletv:apiKeyName "X-GData-Key" ; mobiletv:apiKey "DEVELOPER_KEY" ; mobiletv:textResponseBody "<?xml version=\"1.0\" encoding=\"UTF-8\"?><entry xmlns=\"http://www/w3.org/2005/Atom\"><content>My comment would go here.</content></entry>" ] . :theDailyShow a po:programme ; mobiletv:themeSong :dailyShowThemeSong ; mobiletv: ; rdfs:seeAlso <http://dbpedia.org/page/The_Daily_Show> . :theColbertReport a po:programme ; rdfs:seeAlso <http://dbpedia.org/page/The_Colbert_Report> . :mySimilarity a mobiletv:programme ; a sim:Similarity ; sim:element :theDailyShow ; sim:element :theColbertReport ; sim:weight "0.95" ; foaf:maker :me .
Tools
- RDF/N3 Converter: http://www.mindswap.org/2002/rdfconvert/
Resources
- Notation 3 Resources: http://www.w3.org/DesignIssues/N3Resources
Tutorials
- Primer - Getting into RDF & Semantic Web using N3: http://www.w3.org/2000/10/swap/Primer
- <> a :RoughGuide; :to :Notation3 .: http://infomesh.net/2002/notation3/
External Links
- wikipedia: Notation3
- Syntax Comparison of N3 and Turtle: http://jenawiki.hpl.hp.com/wiki/Syntax_Comparison_of_N3_and_Turtle
- RDF Media Types: http://www.w3.org/2008/01/rdf-media-types
References
- ↑ A Plug-in Mechanism for N3/Turtle: http://composing-the-semantic-web.blogspot.com/2006/11/plug-in-mechanism-for-n3turtle.html
See Also
Semantic Web | RDF | OWL | SPARQL