[TITLE: RDFa Basics] [SUBTITLE: (or: How to procrastinate at work by learning RDFa)] Semantic information helps computers understand what we put on the web. RDFa empowers bloggers and web designers to add semantic information to web pages. I'm assuming that you already know how to write HTML and have a basic understanding of the semantic web. In this introduction, you will learn how to easily add semantics to webpages using RDFa. ------------------------------------------------------------------------ [TITLE: RDF Primer] [SUBTITLE: Representing all Human Knowledge] RDFa is based on RDF. RDF stands for the Resource Description Framework. That's a fancy way of saying that it can describe any concept, relationship or thing that exists in the universe. The idea behind RDF is simple and is thus, very easy to grasp. There are three things in RDF: subjects, predicates and objects. If you remember waaaay back to your third grade english class, this should sound familiar to you. The subject-predicate-object approach is how most western languages create basic sentences. The subject refers to the thing that you are describing. The predicate refers to an attribute of the thing that you are describing. The object is the thing that you are referring to with the predicate. In this case we have constructed a simple statement. 'Dave' is the subject, 'likes' is the predicate, and 'cookies' is the object. Using this simple idea, we can describe anything - so, that is what RDF enables us to do. ------------------------------------------------------------------------ [TITLE: CURIE Primer] [SUBTITLE: Awww... cute, fuzzy URIs] RDF uses URIs to specify subjects and predicates. URI stands for Uniform Resource Identifier and it is how we identify things on the web. A URL, which you type into the location bar of your web browser, is a type of URI. URIs can be very long and annoying to type out, which is why we have a new concept in RDFa called the CURIE. CURIEs are a shorthand way of writing long URIs. CURIE is an abbreviation for Compact URI. ----- An example of a CURIE is foaf:name In this case, foaf expands to a much longer URL and name is appended to that URL. You don't need to know what that URL means right now, just that the thing on the left side of the colon expands to a long URL and the thing on the right of the colon is added to the end of the expanded URL. ------------------------------------------------------------------------ [TITLE: Triples and N3 Notation] [SUBTITLE: Trippin' with N3] RDF and CURIEs often come up when people talk about RDFa. They are used when discussing RDF statements. Now, RDF is a concept, not a syntax, so we must learn how to express RDF statements. This is where N3 notation comes in. Remember that in RDF, everything is a subject-predicate-object statement. This statement is called a triple. If we take our previous example, "Dave likes cookies", we can express it in N3 notation like so... --- The @prefix line lets us know what the shorthand is for all of the CURIEs in the document. In other words, it defines what the namespaces are... Moving to the next line, we find the actual triple. The first item is the subject, and is enclosed in angle brackets to specify that it is a URI. The second item is the predicate, which is also a URI. The third item is the object, also a URI. Finally, there is a period at end of the triple to end the statement. --- There can be many triples associated with a particular subject - the more triples there are, the more we know about the subject. If you look closely at this example, you will also notice that the predicate points to something called a vocabulary. ------------------------------------------------------------------------ [TITLE: The Friend-of-a-Friend Vocabulary] [SUBTITLE: Who knows who and what do they do] Just like N3 is a syntax used to describe RDF to humans, RDFa is a syntax used to describe RDF to computers. Neither N3 nor RDFa have any inherent meaning until you pair them up with a vocabulary. --- A vocabulary defines what the triples actually mean. A vocabulary allows a computer to understand when you are talking about a specific concept. One such vocabulary that is quite popular on the semantic web is the Friend-of-a-Friend vocabulary, also known as FOAF. FOAF contains several concepts that are useful for identifying people, and representing relationships between those people. FOAF will be the first vocabulary we use in this tutorial. ------------------------------------------------------------------------ [TITLE: Creating your first triple] [SUBTITLE: Getting to know your inner node] Using the FOAF vocabulary, it is easy to start describing someone on any web page. All you need is a URI that talks about a person, and the proper predicate to describe that person. Let's use Jane as the person and let the browser know what her full name is. First, we will need to specify that we are going to be using the 'foaf' vocabulary in our XHTML page. We do this by using the xmlns attribute. --- We will also need to use two RDFa attributes: about and property. The first one is the 'about' attribute and is used to set the subject. The second one is the 'property' attribute and is used to set the predicate. Finally, we set her name using the text that will appear on the web page. This is really helpful because when somebody changes her name on the page, perhaps to add a middle initial, they won't have to change anything else for the machine-readable part of the data to be updated. Both the human-readable and machine-readable text comes from the same exact location on the page, ensuring that both humans and machines have the most up-to-date data. --- Looking back over the example, we define the namespace at the top of the document. We then state the subject using the about attribute. This is followed by stating the predicate using a CURIE, which uses the namespace at the top of the document. And finally, we specify the object by wrapping it in the SPAN element. Any browser reading this page will now know Jane's full name, and that's how you create a simple RDF triple in XHTML using RDFa. ------------------------------------------------------------------------ [TITLE: Organizing the world and connecting people] [SUBTITLE: What's your type? Come here often? *creepy stare*] Now that the browser knows there is something with a name on the page, we need to let it know that Jane is also a person. To do this, we can use the @instanceof attribute. @instanceof is used to specify a type, which is a very special sort of attribute on a subject. A type specifies exactly what class of thing the subject falls into. In this case, Jane is a Person. --- FOAF has a class called Person, so we apply it using the @instanceof attribute. Now the browser knows that Jane is a person. Let's go one step further and create a relationship by stating that Jane knows someone else on the page named Mack. -- To do this, we setup another person on the page named Mack in the same way that we setup Jane. Now all that is left is to link them together. To do this, we use a combination of the @rel attribute and the @resource attribute. There is a vocabulary term that FOAF defines called 'knows'. To state that one resource knows another resource, we can use foaf:knows as the predicate and link the resources using @rel. --- In this case, we use @resource as the target object for the @rel. Mack could just as easily have been mentioned on another website and the remote website URL could have been used instead of the local URL. You now know the basics of RDFa. You don't need to know much more to start authoring complex RDFa documents. ------------------------------------------------------------------------ [TITLE: Learning more] [SUBTITLE: Now you know enough to do some damage!] This is how the semantic web is built, triple by triple. Triples link to other triples, which then link to more triples. These links go between between pages, between blogs, between sites and between countries. The more triples that there are on the web, the more computers will be able to understand our world. This means that they will get really good at help us find news, music, movies, people and many more things that we are interested in. -- If you would like to learn more, there is an advanced RDFa tutorial that is a continuitation of this talk. There is also quite a bit of information available on the main RDFa website. There is also an RDFa Primer document for those that want more reading material, as well as an RDFa Syntax document for developers that want to understand how RDFa works. ------------------------------------------------------------------------ [TITLE: License] This entire video and all of the source material used to make it is available under a Creative Commons Attribution-Share-alike license. It allows you to remix and distribute copies of this video to anybody that you want. If you found this introduction helpful, please send it along to your friends and teach them about RDFa and the semantic web.