[Kde-perl] RDF, laces, and other things
Ashley Winters
jahqueel at yahoo.com
Tue Aug 26 19:05:45 CEST 2003
--- jo walsh <jo at abduction.org> wrote:
>
> hi hi,
>
> noticing today, while uploading the first draft or 2 of my
> RDF::Simple
> package to CPAN, your RDF::Laces. it's interesting! it does weird
> things!
> i must admit, i myself as an rdf-head, find it counterintuitive - i
> have
> hardwired, perhaps nonperlish expectations of what to expect, i
> couldn't
> make it do what i meant, though not digging down to the source level
> - but
> then perhaps i shouldn't have to ;)
>
> the sort of thing i'd expect is this:
>
> my $doc = RDF::Laces->new('#foo');
>
> $doc->{foaf} = 'http://xmlns.com/foaf/0.1/';
>
> my $p = $doc->foaf->Person->foaf->name('Jo Walsh');
> $p->foaf->knows->()->foaf->name('Schuyler Erle');
Fun. That's an interesting assumption I need to tackle in the docs,
apparently. To put it simply:
$subject->predicate($object)
->predicate($object, $object)
->prefix->predicate($object);
is equivalent to:
:subject :predicate :object;
:predicate :object, :object;
prefix:predicate :object .
So, it's a way of serializing triples in Perl-syntax. It's meant to be
n3 in Perl, not an XML document constructor.
To take an example straight from the FOAF spec:
$doc->() # new person in this document
->rdf
->type($doc->foaf->{Person})
# ->a($doc->foaf->{Person}) # proposed shortcut for that
->foaf
->mbox_sha1sum('241021fb0e6289f92815fc210f9e9137262c252e')
->homepage($doc->('http://rdfweb.org/people/danbri/'))
->image($doc->('http://rdfweb.org/.../danbri-small.jpeg')))
;
I hang out on #perl and #kdebindings mostly as jql. I'll be on in a
couple hours. RDF::Laces is slightly off-topic for this mailing-list,
but this might as well be my announcement of it: I released a module to
CPAN. It's not PerlKDE, but yay anyways!
Ashley Winters
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
More information about the Kde-perl
mailing list