Re: N3 in XHTML / META tag

On Thu, 2009-08-13 at 08:24 +0200, Martin Hepp (UniBW) wrote:
> Hi Toby, thanks - sounds like a plan. Ideally, we would find a way to 
> include N3/Turtle without the need to escape <,>, and quotation
> marks. 
> Any ideas that don't require modifications of existing specs?

In HTML, angled brackets don't need to be escaped in scripts (though
"</" does still need escaping which would make root-relative URLs
problematic).

In XHTML, the opening angled bracket does need escaping, though the
closing angled bracket does not need to me. That said, there's the funny
CDATA wrapper syntax that allows you to avoid escaping:

<script type="text/n3" id="my_data"><![CDATA[
   @prefix foo:  <http://www.example.com/xyz#> .
   @prefix gr:   <http://purl.org/goodrelations/v1#> .
   @prefix xsd:  <http://www.w3.org/2001/XMLSchema#> .
   @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
   foo:myCompany
     a gr:BusinessEntity ;
     rdfs:seeAlso <http://www.example.com/xyz> ;
     gr:hasLegalName "Hepp Industries Ltd."^^xsd:string.
]]></script>

Because this uses square brackets to terminate the CDATA area, I don't
know if this might cause problems if you use a lot of blank nodes. I've
not thought through all the possible ways a syntax clash could emerge.
For longer chunks of Turtle, it certainly seems neater than escaping
individual left angled brackets.

> Also, maybe change
> <link rel="meta" href="#my_data" />
> to
> <link rel="meta" content="text/n3" href="#my_data" />

I'm assuming you mean @type rather than @content here.

Yes, I originally had that, but given the fact that the <script> element
itself has a type attribute, it seemed to me that repeating the same
information on the <link> element would be unnecessary duplication.

-- 
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>

Received on Thursday, 13 August 2009 10:07:31 UTC