- From: Richard Light <richard@light.demon.co.uk>
- Date: Tue, 19 Jan 2010 09:09:27 +0000
- To: Peter Ansell <ansell.peter@gmail.com>
- Cc: semantic-web@w3c.org
In message <a1be7e0e1001181249t23397d9bh3259b3dbc66abfd2@mail.gmail.com>, Peter Ansell <ansell.peter@gmail.com> writes > >Why can't you make up a namespace prefix in the RDF/XML document that >hasn't been used in the turtle document or the RDF/XML document and >apply it to all of the null prefixed items that you get out of turtle? Neat. Thank you. >The fact that the prefix represents a namespace in Turtle has no >bearing on the RDF model in general, you are just lucky that the >RDF/XML document has support for namespaces. That bears on the whole issue of the degree of equivalence between Turtle/SPARQL prefixes and XML namespace prefixes. They look as though they do the same job, but I have been harbouring a suspicion that there might be differences that matter. The "null prefix" case seemed to me to be an example of this. You say I am "just lucky", but in fact RDF/XML itself could not work as currently defined without namespace support. Since predicates are expressed as element names in RDF/XML, and since they are URIs, the use of a namespace prefix is necessary for an absolute URI even to have a chance of being a valid XML element name. All the non-NAME characters can go into the namespace URI. (Personally I would prefer predicates to be expressed as attributes in a revised XML serialization of RDF, so as to remove this dependency/limitation.) >What is the advantage of doing a straight translation without >representing the triples in memory as abstract RDF by the way? Have >you tried translating the turtle document to NTriples first? This whole exercise started when a draft framework of interest to me (VMF [1]) was offered only in Turtle form. What started as a quick hack has become a reasonably serious attempt to deal with the full Turtle syntax. I didn't see any value in going via intermediate forms, since my aim was to get machine-processible XML to drop into a triple store. I could have done this job more easily with a custom XML target format, but I wanted to improve my understanding of RDF/XML, and also to produce something which might be of use to others. In fact I load the parsed data directly into an XML DOM, and just serialize it when parsing is completed. An extension which would be easy to add would be to apply a user-supplied XSLT transform to this document, allowing output in any required format. A couple of points about Turtle also dropped out of this exercise. First, a literal-minded reading of the EBNF spec would suggest that white space is only allowed where specified. There ought to be a statement somewhere that white space is allowed freely between tokens (or did I miss it?). Second, the Turtle VMF resource didn't use UTF-8 encoding (accented characters were in ISO-8859-1), and despite this it imported without problems into Protege 4. This in turn suggests that Protege's Turtle support doesn't deal correctly with encoding issues. >Would the following do what you want? > ><rdf:Description rdf:about="http://example.org/a1"><a2 >xmlns="http://example.org/" >rdf:resource="http://example.org/a3"/></rdf:Description> Only if the rdf:resource is an absolute URI, I think. Richard [1] http://cdlr.strath.ac.uk/VMF/ -- Richard Light
Received on Tuesday, 19 January 2010 09:10:03 UTC