W3C home > Mailing lists > Public > public-rdf-in-xhtml-tf@w3.org > May 2007

Re: comment on using RDFa

From: Mark Birbeck <mark.birbeck@x-port.net>
Date: Mon, 28 May 2007 21:25:18 +0100
Message-ID: <640dd5060705281325w2f63f24pc770355f453854ae@mail.gmail.com>
To: "Peter Mika" <pmika@yahoo-inc.com>
Cc: public-rdf-in-xhtml-tf@w3.org

Hi Peter,

> I have some comments on RDFa based on my experiences in trying to use it
> for the openacademia project. Basically, the idea is to use RDFa to mark
> up publication metadata in HTML publication lists generated by
> openacademia. These typically are embedded in personal homepages as in
> [2]. We are using the SWRC ontology for publication metadata and FOAF
> for personal metadata.

Great...a perfect use of RDFa. :)

> My knowledge of RDFa is based on the Primer and I havent' followed the
> mailing list so far, so please forgive me if I point out something
> obvious or something that is already noted.

Not at all--your comments are very welcome, and real-use experience is
very valuable.

> Comment #1
> -------------
> RDFa seems to interfere with existing markup. On the pages we generate
> we would like to have both our own markup, hCard as well as RDFa.
> My first attempt to mix hCard and RDFa would be:
> <span class="vcard">
>     <span class="fn foaf:Person" property="foaf:name"
> about="http://www.cs.vu.nl/~pmika/publications.bib#peter_mika">Peter
> Mika</span>
> </span>
> This doesn't work: when I unleash the RDFa bookmarklet on this I get the
> nonsensical triple which says that #peter_mika is both type foaf:Person
> and type fn.

RDFa is still going to change a little more before it is finalised, so
comments like this are especially useful. In this case though, the
problem could be with the bookmarklet, since as things stand
non-prefixed class names should be ignored. The motivation is to try
as much as possible to ensure that the author 'really, really'
intended to create these triples.

> [snipped example, but you are right that an author shouldn't have to jump through hoops]
> The fact that I cannot mix RDFa class names and other class names in a
> single span element makes things even more complex when I want to say
> that there is a publication and this person is the author of it. My
> current minimal solution requires six levels of nesting (!):

Agreed...but hopefully, once non-prefixed class names are ignored,
things should be ok.

> [snip]
> Since this seems to defeat the purpose of human-writable markup, I
> suggest minimally documenting this issue... Stronger, I would have
> expected this to work based on the experiences with microformats, which
> happily mix together in the same class attribute.

Unfortunately, with microformats you have to define the rules of
mixing for each additional vocabulary, so it quickly gets out of hand.

> Note that from this code the bookmarklet still produces a number of
> nonsensical triples involving the non-RDFa classnames.

As I say, I'm almost certain that behaviour is incorrect, but we'll check.

> Comment #2
> ~~~~~~~~~
> It seems unnatural to put the foaf:Person class attribute on the element
> that gives the name of the person.

That's an interesting comment. From an RDF point of view it's not
unnatural at all, since 'type' is one predicate, and the name is
another. But I do understand what you're saying; from a non-RDF
standpoint, you'd most likely read the mark-up like this:

  * 'here is a person object';

  * contained within this person object are person properties.

RDF is of course much looser; we would say:

  * 'here is _any_ old object';

  * it has two properties, one of which is a name...

  * ...the other is an indicator of one of the types of that object.

The difference is certainly worth thinking about, and we should try to
see if there is anything better that can be done. But I have to say
that I'm not sure if the 'here is the root of an object' approach (as
used in microformats) lends itself to an RDF-inspired approach like
RDFa. For example, the following is another way to mark-up the same
information that you are describing:

<html ...>
    <link about="#s" rel="rdf:type" href="foaf:Person" />
    <span about="#s">
      <span property="foaf:name">Peter Mika</span>

The triples for this should be (namespaces and datatypes omitted for brevity):

  <#s> rdf:type foaf:Person .
  <#s> foaf:name "Peter Mika" .

As you can see, it generates the same triples that you want, but at
the point of parsing foaf:name there is nothing to indicate 'we are
now in foaf:Person parsing mode' (and it's a key design goal of RDFa
that there doesn't need to be).

> However, when I try the seemingly
> logical solution:
> .....
>            <span class="foaf:Person" rel="swrc:author"
> href="http://www.cs.vu.nl/~pmika/publications.bib#peter_mika">
>                         <span  property="foaf:name">
>                             Peter Mika
>                         </span>
>             </span>
> ....
> What happens is that the publication becomes type foaf:Person, instead
> of #peter_mika. Again, this is unnatural to me, so I suggest to change
> it, or if this is the best possible compromise, then it would be helpful
> to document it to alert users.

This is because the @class, @rel and @property values will *all* apply
to whatever the most recent @about value is, or to the document as a
whole if there isn't one. My feeling is that you need to flip the
author and publication by using @rev, and then use the fact that the
author is now the *subject* to hang your foaf:name properties on, and
set the rdf:type:

        rev="swrc:author" href="...#mika06jws"
      >Peter Mika</span>

I'm not sure if this is what you are trying to achieve, but since I'd
like to try to show the whole mark-up--including the
microformats--I've made the following assumptions:

  * that you have a list of publications;

  * that each publication could have multiple authors;

  * that you want to indicate the rdf:type of both the publications and
    the authors;

  * that you want to include the microformats for both;

  * that non-prefixed class names should be ignored by RDFa parsers;

Assuming all of these to be true, then the following mark-up should
give everything, although it is very terse:


     class="swrc:Article hbib article"
    <span class="vcard">
        rev="swrc:author" href="#mika06jws"
        class="foaf:Person author fn"
      >Peter Mika</span>
    <!-- Next author would come here -->

Key things to point out are:

  * following a rough 'subject, predicate, object' approach makes it a little
    clearer what is going on with something like the @class value on the

  * @rev is used to flip the subject and object, so that we can say things
    about the author--in this case it allows us to give them a foaf:name, and
    an rdf:type of foaf:Person.

Obviously this is easily generated, but if you feel it's too terse
then an alternative would be to merely reference the authors at the
top of each publication, and then give more details later in the

  <!-- Publications first -->

       class="swrc:Article hbib article"
          <a rel="swrc:author" href="#peter_mika" class="author">
            Peter Mika
      </ul><!-- authors list -->

       class="swrc:Article hbib article"
          <a rel="swrc:author" href="#peter_mika" class="author">
            Peter Mika
          <a rel="swrc:author" href="#john_doe" class="author">
            John Doe
      </ul><!-- authors list -->
    <!-- Next publication would come here -->
  </ul><!-- publications list -->

  <!-- Authors next -->
  <span id="peter_mika" about="#peter_mika" class="foaf:Person vcard">
    <span property="foaf:name" class="fn">Peter Mika</span>
  <span id="john_doe" about="#john_doe" class="foaf:Person vcard">
    <span property="foaf:name" class="fn">John Doe</span>
  <!-- Next author would come here -->

Note that the @id is only needed on each person if you want to have a
clickable link from the publications. And the key difference to before
is that we have reused the author entries multiple times for multiple

> Hope these comments are helpful... please let me know if I'm doing
> something wrong or have been misinterpreting how things should work.

Looking at your original mark-up, I think that the only thing you were
missing was the use of @rev. And given that you were hampered by the
'non-prefixed class name' problem, that's pretty good going!

The comments were certainly useful, and thanks for that.



  Mark Birbeck, formsPlayer

  mark.birbeck@x-port.net | +44 (0) 20 7689 9232
  http://www.formsPlayer.com | http://internet-apps.blogspot.com

  standards. innovation.
Received on Monday, 28 May 2007 20:25:25 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:01:50 UTC