[foaf-protocols] turning cert:hex into a literal

Story Henry henry.story at bblfish.net
Mon Feb 22 00:04:18 CET 2010


Working on an rdfa enabling profile pages on a wiki, I noticed that it would be a lot nicer if the cert:hex were a literal type.

I found myself recently with the following page:

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<body>
  <ul xmlns:cert="http://www.w3.org/ns/auth/cert#"
      xmlns:rsa="http://www.w3.org/ns/auth/rsa#" >
      <li rel="rsa:modulus">
        <pre property="cert:hex">
9dcfd6a5394da9312c703e02a25dc3508262d9310be76d43ddf75d3025a9
739b989b2e50f2a80961fe41e6fb26fb7ceedae0fe0e0c7c1921f20a3a63
45fe74e9</pre>
      </li>
      <li rel="cert:identity" href="#me">My certificate</li>
  </ul>
</body>
</html>

This gives us something like

[] a rsa:RSAPublicKey;
   :identity <file:/Users/hjs/xwiki.bblfish.html#me>;
   rsa:modulus  [ :hex """9dcfd6a5394da9312c703e02a25dc3508262d9310be76d43ddf75d3025a9
739b989b2e50f2a80961fe41e6fb26fb7ceedae0fe0e0c7c1921f20a3a63
45fe74e9"""@en ] .

The problem as you will have noticed is that the hex has an @en on the hex representation, which comes from the xml:lang="en" in the <html> element. This is quite tricky to notice, and in my case to remove as that @en is placed in the html by some templating mechansim... 

The solution could be the following rdfa which is one element less deep, and also easier to read. 

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<body>
  <ul xmlns:cert="http://www.w3.org/ns/auth/cert#"
      xmlns:rsa="http://www.w3.org/ns/auth/rsa#"
      typeof="rsa:RSAPublicKey" >
     <li property="rsa:modulus" datatype="cert:hex">
9dcfd6a5394da9312c703e02a25dc3508262d9310be76d43ddf75d3025a9
739b989b2e50f2a80961fe41e6fb26fb7ceedae0fe0e0c7c1921f20a3a63
45fe74e9</li>
    <li rel="cert:identity" href="#me">My certificate</li>
  </ul>
</body>
</html>

It also has avoided the @en problem. The above in N3 is 

[] a rsa:RSAPublicKey;
   cert:identity <file:/Users/hjs/xwiki.bblfish.html#me>;
   rsa:modulus """9dcfd6a5394da9312c703e02a25dc3508262d9310be76d43ddf75d3025a9
739b989b2e50f2a80961fe41e6fb26fb7ceedae0fe0e0c7c1921f20a3a63
45fe74e9"""^^cert:hex .

I spoke to Dan Connolly on #swig irc today about this [1]. In the next email I will look at what we can do to show that the above is just the same way of writing what we have right now. Hopefully with just a small change to the ontology we can use the same cert:hex relation to write out graphs both ways. We may need to make our SPARQL queries a little more complex to start off with, until inferencing engines can do the job for us. So our SPARQL query would have to check for what we check now, and for 

SELECT ?mod ?exp
WHERE {
 [] cert:identity ?i;
    rsa:moduls ?mod ;
    rsa:public_exponent ?exp .
}

where ?mod and ?exp are literals now. 

Is this something people could cope with?

[ and in the next mail I'll look at what may need to be changed/added to the ontology ]

Henry

[1] http://chatlogs.planetrdf.com/swig/2010-02-21.html


Social Web Architect
http://bblfish.net/



More information about the foaf-protocols mailing list