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

Re: foaf:sha1 property with img src=

From: Dan Brickley <danbri@danbri.org>
Date: Mon, 31 Mar 2008 13:52:50 +0100
Message-ID: <47F0DEA2.4010201@danbri.org>
To: Mark Birbeck <mark.birbeck@x-port.net>
Cc: RDFa <public-rdf-in-xhtml-tf@w3.org>

Mark Birbeck wrote:
> Hi Dan,
>>  I want to express the foaf:sha1 property of an image in my homepage
>>  (which already uses RDFa):
>>   From http://danbri.org/
>>  <img rel="foaf:depiction" src="danbri-txt.jpg"
>>       alt="danbri" style="float: center"/>
>>  ...this was already there, saying the picture was a depiction of me.
> @src acts like @about, not @resource/@href. So you would need to do this:
>   <span rel="foaf:depiction">
>     <img src="danbri-txt.jpg" alt="danbri" />
>   </span>

Ah. Was my original markup wrong then? Or just not extensible to this 
new sha1 need
> This is the kind of use-case that made it better to have @src
> represent 'a subject' rather than an object. It means that you are now
> able to do this:
>   <span rel="foaf:depiction">
>     <img src="danbri-txt.jpg" alt="danbri"
>       property="foaf:sha1sum" content="58d174f20c039289544b2364c5c21295df2e4a2b"
>      />
>   </span>
Thanks. Homepage updated! I've also added jquery to my homepage, and the 
hash for that specific jquery into the <head> using meta as you mention 

BTW can I jump in here before an example spreads further: the property 
is foaf:sha1 not :sha1sum. We do have a mailbox identity property called 
foaf:mbox_sha1sum but feedback was that this was a bit wordy, so when 
foaf:sha1 was added we went the short route (yes, at the cost of 
internal consistency...).

Here is the RDFa N3 I get from my homepage now, using the development js 
parsing bookmarklet:

<http://danbri.org/jquery-1.2.3.min.js> <http://xmlns.com/foaf/0.1/sha1> 
"6463e558dd79d51a2e8464806824c7bbc18c77fd"@en .
<http://danbri.org/> <http://www.w3.org/1999/xhtml/vocab#stylesheet> 
<http://danbri.org/simple.css> .
<http://danbri.org/> <http://www.w3.org/1999/xhtml/vocab#meta> 
<http://danbri.org/foaf.rdf> .
<http://danbri.org/> <http://www.w3.org/1999/xhtml/vocab#alternate> < 
http://feeds.feedburner.com/danbri_blog?format=xml> .
_:n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://xmlns.com/foaf/0.1/Person> .
_:n0 <http://xmlns.com/foaf/0.1/weblog> <http://danbri.org/words/> .
_:n0 <http://xmlns.com/foaf/0.1/currentProject> 
<http://www.foaf-project.org/> .
_:n0 <http://xmlns.com/foaf/0.1/currentProject> <http://widgetarians.org/> .
_:n0 <http://xmlns.com/foaf/0.1/depiction> 
<http://danbri.org/danbri-txt.jpg> .

<http://danbri.org/danbri-txt.jpg> <http://xmlns.com/foaf/0.1/sha1> 
"58d174f20c039289544b2364c5c21295df2e4a2b"@en .

Seems right :)
>>  Douglas Crockford just posted a proposal for a hash= attribute in HTML,
>>  to allow user agents to cache common files like jquery.js
>>  http://blog.360.yahoo.com/blog-TBPekxc1dLNy5DOloPfzVvFIVOWMB0li?p=789
> First, as we saw above this could already be implemented without
> adding a new attribute, just by using RDFa.
Yes, that's rather nice huh? :)

RDF isn't always an agent of complication!
> Second, by using RDFa we also get more flexibility in how this is
> marked up. For example, we could just dump a whole load of hash values
> into the head of our document:
>   <html>
>     <head>
>       <title>Dan's page</title>
>       <meta about="danbri-txt.jpg" property="foaf:sha1sum"
>          content="58d174f20c039289544b2364c5c21295df2e4a2b" />
>     </head>
I've done just that for jquery.

 <script type="text/javascript" src="jquery-1.2.3.min.js"></script>
 <meta about="jquery-1.2.3.min.js" property="foaf:sha1"
       content="6463e558dd79d51a2e8464806824c7bbc18c77fd" />

Could I have done this instead?

 <script type="text/javascript" src="jquery-1.2.3.min.js"

> Or we could even load them from an external location. So the hash
> values for particular scripts could be maintained by the script
> publishers, for example. This means that the author need not even add
> them--they could be added by a post-RDFa-parse phase.
Maybe they could be loaded and remembered from site-wide metadata but 
that's a bit advanced (and not peculiar to RDFa; rdf/xml would work 
there). Or perhaps I don't follow you.
> Third--and this one is a bit more future-oriented--I explained in
> answer to someone's question the other day about @cite, that certain
> attributes nicely follow the @instanceof model, which is that an
> attribute with a value represents a predicate and object pair. It's
> pretty easy to see how this also works for @hash, which would be
> equivalent to @property="xhv:hash". (It's a small point, I know.)
It's the same conceptual model, yup. Are you suggesting that in the 
future, properties could be automatically generated for these?
>>  ps. does anyone fancy hacking about in eg. Firefox to see about actually
>>  implementing this? could be scary deep in the core code, but would be a
>>  cool hack...
> It's an interesting idea, but my feeling is that this step would
> happen after the RDFa has been parsed, independent of how the URI was
> marked with a hash value. So that would be the first step

We'd need to know more about when Firefox initiates requests for 
dependent resources (css, js, images); if this is incremental, we'd need 
RDFa parsing to be happening then too, otherwise waiting til page load 
is complete could slow things down. But there we get into issue of 
different behaviours between XHTML and HTML maybe, since XML needs a 
full document to work on, not a stream...



Received on Monday, 31 March 2008 12:53:29 UTC

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