Re: microformat for turtle?

On Thu, 2010-11-25 at 16:51 +0000, Nathan wrote:
> You can pretty much already do this unambiguously in a nice way by 
> leveraging the <script> element:
> 
>   <body>
>    <p>some normal content</p>
>    <script type="text/turtle">
>      @prefix foaf: <http://xmlns.com/foaf/0.1/> .
> 
>      <http://example.com/bob#me> a foaf:Person;
>        foaf:name "Bob" .
> 
>      :a :b ( "apple" "banana" ) .
>    </script>
>    <p>more..</p>
> 
> Benefits are that it gets ignored by normal script processors, you can 
> specify the correct media type, and charset, you can include other 
> scripts or extensions which lift / work with / handle the data - and you 
>   don't need to do any special &lt; encoding or suchlike. Also allowing 
> anybody to copy and paste it directly and so on.

Very nice!    Have you seen that used in practice?

> The drawback is that it's not visible in the browser, however that isn't 
> always a drawback, and a simple script could easily be included to 
> present it to a user, if needed.

Yeah, that's one drawback.   Another is that many more systems allow
people to use div with class and id attributes than allow script tags.  

I'll have to think about that some more.

One modification I think I might make to my proposal is to make the
pointy brackets around URIs optional if the URI includes a slash
character.   It makes turtle a little harder to parse and a little
easier to write, in general, and for HTML embedding it makes it a lot
easier to write.

     -- Sandro



> 
> Best,
> 
> Nathan
> 
> Sandro Hawke wrote:
> > Just a random idea.
> > 
> > Can we make it legit for people to publish RDF triples just by putting
> > some turtle as plain text in an HTML page, with class="turtle" and an id
> > to give a URI to the graph?    Something like this:
> > 
> > At http://example.org/page1:
> > 
> >   <html>
> >     <head>
> >       ...
> >     </head>
> >     <body>
> >       ...
> >     <div class="turtle" id="g1">
> >    @prefix : &lt;http://example.org/stuff/1.0/&gt; .
> >    :a :b ( "apple" "banana" ) .
> >    </div>
> >    </body>
> >    </html>
> > 
> > So the URI for that graph would be http://example.org/page1#g1
> > 
> > I'd suggest the format be defined to allow markup, which is ignored.  I
> > imagine this being used for nicer styling of the turtle code, and to
> > allow the URLs to be clickable, if the author wants that.   (Some
> > systems like wikis try hard to do that automatically.)   None of the
> > markup should affect the graph -- if you print the page, or cut/paste
> > it, it's still real turtle, producing the same triples.
> > 
> > I don't know anything about the html5 or microformats process, but I
> > assume there needs to be some consensus developed and recorded around
> > class="turtle" for this to be fully legitimate.
> > 
> > What's compelling about this, to me, is it would allow even more people
> > to publish RDF even more easily, at very low implementation cost to
> > consumers.  (Perhaps consuming turtle embedded in HTML like this could
> > be part of the Turtle Recommendation, if/when that happens?  I don't
> > know.)   I think turtle is easier to learn than RDFa, and most
> > publication platforms (eg blogs and wikis) allow people to include divs
> > with a class and id.  Basically, this would be more viral than existing
> > techniques because it's easier to see (unless people style it to be
> > invisible), and requires less specialized knowledge to publish.
> > (Hopefully people would, near this kind of content, include a link to
> > some turtle tutorial they like, explaining this mysterious code.)
> > 
> >      -- Sandro
> > 
> > 
> > 
> > 
> > 
> 
> 

Received on Thursday, 25 November 2010 17:03:44 UTC