Re: APIdeas

> structure defined in http://n2.talis.com/wiki/RDF_JSON_Specification
>
> I know you weren't that keen on the proposal cdr

right. thanks for your awareness!

any stuff like 'type' and 'value' spelled out over and over in a serialization (and this necessitating the same thing in consuming/producing code) i know something's amok and refuse to go there

plus the whole 'lang' and 'datatype' are special attributes thing. these are properties of a literal resource/node, specialcasing them in your JSON schema and API ignores this fact. theres URIs for the datatype predicates in XSD. Redland uses them. i turn them into ruby native values as so:

class E
 W3='http://www.w3.org/'
 XSD =W3+'2001/XMLSchema#'
 XSDs = { XSD+'string'=>:to_s,
    XSD+'nonNegativeInteger'=>:to_i,
    XSD+'integer'=>:to_i,
    XSD+'float'=>:to_f
  }
end

class Redland::Literal
    def to_type
      dt=Redland.librdf_node_get_literal_value_datatype_uri(node); dt=dt && Redland.librdf_uri_to_string(dt)
      value.send(E::XSDs[dt]||:to_s)
    end
end

(submitted a patch to dajobe a couple months ago)

fwiw, this is how i typically throw a stream of triple into a hash:

    r={}
    produce do |s,p,o|
      r[s] ||= {uri: s}
      r[s][p] ||= []
      r[s][p].push o
    end


ditto on the pure parsers. although Redland compiles and works fine with ruby 1.9, and is testable/fast, im a fan..


also nice is the 'special sauce' it does to fish out triples, eg conneg, surfing doctypes, xml headers, mime content-types and what not, useful as a discrete lib. in pure ruby/python/php. perhaps even a working note should be written up..Virtuoso has its 'sponger' as well. i know Content-Type has some kind of weight value but theres more to it than just contenttypes, especially if the doc is some variant of HTML (link rel=alternate, etc). how to 'find' linked data? i know theres a how to publish doc floating about..

Received on Thursday, 21 February 2008 01:50:01 UTC