- From: Toby Inkster <tai@g5n.co.uk>
- Date: Fri, 23 Apr 2010 11:33:38 +0100
- To: benjamin.adrian@dfki.de
- Cc: "RDFa WG" <public-rdfa-wg@w3.org>
> What would you expect to be the result of the following print statements:
>
> 1. var bn = new BlankNode()
> print(bn.toString())
Something like:
_:fsdfsdgfdrg
Where everything after "_:" is a string that cannot be relied upon to be
stable.
> 2. subject = new URI("http://www.example.com#foo");
> var triple1 = new RDFTriple(subject, rdfa.rdfs.label, new
> PlainLiteral("a,b c; g"));
> print(triple1.toString());
Definately:
http://www.example.com#foo
And not:
<http://www.example.com#foo>
toString is called by the Javascript engine automatically when an object
is coerced into a string, so needs to return the most useful
representation of the object. Returning without the angled brackets allows
it to be used like this:
for (each triple blah blah)
{
if (triple.subject == document.location.href)
{
do something;
}
}
> 3. subject = new URI("http://www.example.com#foo");
> var triple1 = new RDFTriple(subject, rdfa.rdfs.label, new
> PlainLiteral("http://www.example.com#foo"));
> print(triple1.toString());
>
> In an early release of the JS Prototype of the RDFa DOM API, I used
> TURTLE syntax in general.
> This would solve the problem but seems to be too much RDF in this API.
I'd expect an N-Triples representation of the triple with some
canonicalised whitespace agreed on. Say, a single space character between
each of the subject, predicate, object and full stop; and no trailing
whitespace or new line characters.
That makes it possible to easily check a triple against a known value:
if (triple == '<http://example.com/joe#me>
<http://xmlns.com/foaf/0.1/name> "Joe" .')
{
do something;
}
-Toby
Received on Friday, 23 April 2010 10:34:14 UTC