go to content or go to sidebar

RSS Feed

The Web, Naturally!

WebOrganics » » RDF

  1. RDF-3T - RDF in Machine Tags
    Posted by Martin, about 534 days ago.

    RDF-3T is a metaformat(a language used to describe another language) that uses machine tags to describe RDF triples in XHTML. A Machine Tag is a word first used by flicr as a technical term for a triple tag. Machine Tags are in the wild are just like normal tags but have a special syntax that allows the user to express further semantics(meaning) in a tag and is made up of a namespace, predicate and a value, for example you could tag an image on flicr...

    lastfm:event=887898

    The namespace is "lastfm" the predicate is an "event" and the value is "887898".

    The first things I thought when I first saw machine tags was hey that looks a lot like a RDF statement and I wonder if you could use the Machine Tag syntax to describe a RDF triple.

    The first problem was that to express all the information contained in a RDF Triple in a tag was just too much so I though to use the @class area instead. A html class can be used on almost any html element and a class accepts data values where as a tag is just text. RDF-3T does not use rel=tag at all so it wont conflict with any existing usage of machine tags.

    In RDF-3T namespaces are declared using meta tags in the head of a page, and then referenced in a class using any of the terms(predicates) declared in the namespace document itself. Values are slightly different as RDF-3T uses keywords or pointerers to tell the machine where the value is, values can also be a string such as an ISO8601 formatted date or a geo location.

    RDF-3T uses the @id attribute to declare what a thing is about, The id attribute can contain a plain text string, which is used as a relative uri reference, or the id can be a compact uri expression(curie) for example the curie expression ...

    id="home:weborganics"

    ... in RDF-3T would resolve to http://weborganics.co.uk/#weborganics.

    RDF-3T triples are typically extracted using a GRDDL profile available at http://weborganics.co.uk/Profiles/RDF-3T, you can view the output using the W3C GRDDL service, for example here: RDF-3T to RDF.

    A more in depth explanation of RDF-3T along with a few tests and example mark-up can be found at http://weborganics.co.uk/RDF-3T/. Any feedback on the RDF-3T syntax or anything you are not happy with is welcome by either email or simply by adding a comment to this page.

    Comments: 0

  2. Hypertext Friend of a Friend
    Posted by Martin, about 604 days ago.

    hFoaf (Hypertext Friend of a Friend) has recently been updated to version 0.3, this one has been an important update because basically the XSLT needed a lot of tidying, refining, which also gave me an opportunity to add a few more actions such as being able to extract things that a user has made or authored, and a more complete expansion of XFN rel="me".

    What may be a good idea now would be to give you some clues on how to build hFoaf in a quick and dirty howto, but first... hFoaf is not a microformat or a proposed one, although it does rely heavily on microformats to determine the output of a FOAF RDF document.

    The first step is to create a hcard, then add an id="" to the hcard and a class="url" with the XFN relationship rel="me"

    Example:

    1. <div class="vcard" id="weborganics">
    2. <p class="fn n">
    3. <span class="given-name">Martin</span>
    4. <span class="family-name">McEvoy</span>
    5. </p>
    6. <p><img alt="weborganics" src="http://weborganics.co.uk/images/me.jpg" class="photo"/></p>
    7. <p>Contact: <a class="email" href="mailto:weborganics@googlemail.com"
    8. id="sha1:3cc1a719a5023e9087ced9c74610b66cfbb58d54">weborganics@googlemail.com</a></p>
    9. <p>Web: <a rel="me" class="url" href="http://weborganics.co.uk/">WebOrganics</a></p>
    10. <div class="geo">
    11. <p>Location: <abbr title="53.7552" class="latitude">N 53.7552</abbr>,
    12. <abbr title="-2.3675" class="longitude">W -2.3675</abbr><p>
    13. </div>
    14. </div>

    hCard classes and how they map to FOAF are as follows...

    • "vcard" => foaf:Person
    • "fn" => foaf:name
    • "given-name" => foaf:givenname
    • "family-name" => foaf:family_name
    • "email" => foaf:email
    • "url" => foaf:homepage
    • "url org" => foaf:workplaceHomepage
    • "photo" => foaf:img

    The geo component of hcard maps to foaf:based_near and defined using the WGS84 Geo Positioning RDF vocabulary...

    • "geo" => geo:Point
    • "latitude" => geo:lat
    • "longitude" => geo:long

    Lastly The value of foaf:mbox_sha1sum uses the id="" of class email prefixed with "sha1:"

    XFN relationship values are also expanded and added to your FOAF output. rel="me" values that are links to popular social networking sites are mapped to foaf:holdsAccount, although not all rel me links are added to the output, a list of supported sites are as follows...

    • twitter
    • flickr
    • digg
    • ma.gnolia
    • last.fm
    • delicious
    • pownce
    • youtube

    Example:

    1. <a rel="me" href="http://delicious.com/weborganics">delicious</a>

    All XFN relationships are defined as foaf:knows, foaf:Person, foaf:name and foaf:weblog along with its XFN value eg: xfn:met.

    Example:

    1. <a rel="friend met" href="http://www.djkippax.com/" title="James Kippax">James Kippax</a>

    Interests and things that have been made or authored by a user are simply defined as foaf:interest maps to hAtom rel="bookmark".

    And thats it, easy eh? There is a Demo of how to use hFoaf With GRDDL along with some copy and paste code and some example output available at hFoaf Demo and also a webservice available at TransFormr that extracts a FOAF document

    Comments: 0

  3. Bootstrapping hAudio
    Posted by Martin, about 728 days ago.

    haudio

    The hAudio Microformat can now be transformed to four different flavours, RSS1, RSS2, XSPF, and RDF Music Ontology

    The Newest Format is Mo hAudio which is an attempt at extracting a basic Music Ontology. A demo is available at http://weborganics.co.uk/mo-haudio/ . One of the questions you may ask is why all the different formats , Well the first answerer is its cool isn't it? And the second would be, proof that the contributors of hAudio got the common basic semantics right. I would also say that if you are going to publish music on your website, why not publish it in hAudio because It's easy to do...

    <div class="haudio">
    <a rel="enclosure" class="fn" href="http://mywebsite.com/file/myfile.mp3" type="audio/mpeg">My Groovy Choon</a>
    </div>

    ... and you get the added benefits of all the other formats too. There Is just one more transformation (available end of august) hAudio to M3U which will pretty much make the job of bootstrapping hAudio to as many different formats as I can complete, If you think I left something out please let me know.

    Comments: 4

  4. Extending hCard using RDFa
    Posted by Martin, about 855 days ago.

    Mark Birbeck the Designer of RDFa has recently posted a couple of really good articles recently one about the first steps in adding Foaf to RDFa and a second one about using RDFa and Microformats. Both these articles has inspired me to write a little introduction about how to use the hcard microformat and extend it using RDFa.

    I am going to mark up this example of a hCard as RDFa:

    <div class="vcard" id="weborganics">
    <p><span class="fn">Martin McEvoy</span></p>
    <p><img alt="weborganics" src="http://weborganics.co.uk/images/me.jpg" class="photo"></p>
    <p>Contact: <a title="Email" class="email" href="mailto:info@weborganics.co.uk">Email</a>
    Web: <a rel="me" class="url" href="http://weborganics.co.uk/index.xhtml">WebOrganics</a></p>
    <div class="geo">
            <abbr title="53.7552" class="latitude">N 53.7552</abbr>,
            <abbr title="-2.3675" class="longitude">W -2.3675</abbr>
    </div>
    </div>

    I have included the geo part of hcard because its useful for people, clients, or customers to know where you are yes?

    First add the RDFa document type to your page:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">

    So far so good your page is now RDFa and you are ready to add some namespaces, a namespace is just a place where a set of names and definitions is stored.

    I am going to use two namespaces in this example:

    • 1. Foaf, xmlns:foaf="http://xmlns.com/foaf/0.1/"
      Foaf Is primaraly used to define People, FOAF documents are machine-readable home pages.

    • 2. Geo, xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
      Geo Is the RDF equivalent of the World Geodetic System or WGS84 and is used to represent Latitude/Longitude information about the location of things.

    There are two ways to add a namespace in RDFa one is In the <html> tag of your page or another way is in the page using say a <div> or a <span> I am going to add the namespace to the hcard markup itself:

    <div class="vcard" id="weborganics"
                    xmlns:foaf="http://xmlns.com/foaf/0.1/" 
                    typeof="foaf:Person" 
                    about="#weborganics">

    @typeof is similar to a html <div> it describes a block of some thing, in this case Its a block of foaf:Person. @about means exactly as it says what this thing is about in this case Its about the foaf:Person weborganics.

    Lets add a Name to this person:

    <p><span property="foaf:name" class="fn">Martin McEvoy</span></p>

    Easy eh?, Properties are use to add information about the subject, in this case a person, the contents are usually just text.

    Next you may want to add your picture:

    <p rel="foaf:img">
    <img alt="weborganics" src="http://weborganics.co.uk/images/me.jpg" class="photo"/>
    </p>

    @rel is used in the same way as a html rel to describe the relationships between things. The above example has a relationship of a foaf:img of the foaf:Person. In RDFa you can use @rel anywhere in your page not just in links, you may also want to add your email address and homepage url in the same way:

    <p>Contact: <a rel="foaf:mbox" title="Email" class="email" href="mailto:info@weborganics.co.uk">Email</a>
    Web: <a rel="foaf:weblog me" class="url" href="http://weborganics.co.uk/index.xhtml">WebOrganics</a></p>

    You can leave it there if you wanted which is great! but I am going to take this a little further and demonstrate how you can mark up the Geo bit of a hcard. All in one go this time using the same techniques as demonstrated above:

    <div class="geo" id="weblog" rel="foaf:based_near"
            xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
            <span typeof="geo:Point" about="#weblog">
                    <abbr property="geo:lat" content="53.7552" title="53.7552" class="latitude">N 53.7552</abbr>, 
                    <abbr property="geo:long" content="-2.3675" title="-2.3675" class="longitude">W -2.3675</abbr>
            </span>
    </div>

    There Is one thing extra I have added I have used @content this works in the same way as the @title attribute in the abbr design pattern, Its used to carry machine readable data without it interfering with the human content, If you think about that from an accessible point of view its actually better than the current abbr design pattern.

    So there you have it a hCard marked up as RDFa in a few easy steps. I have created two examples to accompany this mini how-to. which you can simply just copy and paste with your own details.

    Microformats and RDFa work pretty well together I think, It adds Scope when previously there wasn't any, Microformats also make excellent building blocks for RDFa they give you hints on where everything should go. Thanks.

    Comments: 0

  5. hAudio RDFa
    Posted by Martin, about 1,072 days ago.

    hAudio has been creating quite a bit of exitement around the semantic web recently in particular the hAudio RDFa maping performed by David Lehn and Manu Sporny of Digital Bazaar, Inc.

    The Creative Commons Tech Blog describes the proposal in its entry about Metadata work of interest as

    ...could turn out to be interesting for describing licensed content on the web, all rather interesting.

    The Proposed hAudio RDFa maping can be found on the Digital Bazaar Wiki http://wiki.digitalbazaar.com/en/HAudio_RDFa a special well done to Manu Sporny because thanks to his efforts in the Microformats community and the RDFa community has become an invited expert in the W3C RDFa task force exellent news for both hAudio and Manu.
    If you want to see a working example of hAudio RDFa as always WebOrganics has Produced an example with one or two tools to work with which can be found at http://weborganics.co.uk/files/hAudio-RDFa.xhtml The example also uses Valid XHTML-RDFa 1.0, something else to talk about at a later date?

    Tags:

    Comments: 0