Re: How to Stringify RDFTriple and BlankNode

Thank you Toby!

That helps a lot. If you don't mind, I would like to take some code 
examples
into the document.


My comments are inline.
> Something like:
>
>     _:fsdfsdgfdrg
>
> Where everything after "_:" is a string that cannot be relied upon to be
> stable.
>   

Why the "_:" prefix? Does it provide any functionality?
Couldn't we let developers decide how to serialize it?
>> 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;
>      }
>    }
>   
Yes, that's the way how URIs are stringified at the moment.
This is a good explanation for it.
> 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;
>   }
>   
That's a good reason. I take that.

Thank you Toby!

Benjamin

-- 
__________________________________________
Benjamin Adrian
Email : benjamin.adrian@dfki.de
WWW : http://www.dfki.uni-kl.de/~adrian/
Tel.: +49631 20575 145
__________________________________________
Deutsches Forschungszentrum für Künstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschäftsführung:
Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster (Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats:
Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
__________________________________________

Received on Friday, 23 April 2010 12:10:37 UTC