W3C home > Mailing lists > Public > public-rdf-ruby@w3.org > February 2008

Re: APIdeas

From: carmen rocco <_@whats-your.name>
Date: Wed, 20 Feb 2008 16:42:55 -0500
To: public-rdf-ruby@w3.org
Message-ID: <20080220214255.GA15428@m>

> 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
 XSD =W3+'2001/XMLSchema#'
 XSDs = { XSD+'string'=>:to_s,

class Redland::Literal
    def to_type
      dt=Redland.librdf_node_get_literal_value_datatype_uri(node); dt=dt && Redland.librdf_uri_to_string(dt)

(submitted a patch to dajobe a couple months ago)

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

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

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:02:13 UTC