RDF::Server::Role::Resource - expectations of a resource object
package My::Resource use Moose; with 'RDF::Server::Role::Resource'; sub update { ... } sub fetch { ... } sub purge { ... }
Given an RDF document, this should add to the triple store all statements that can be built from the document. Special care should be taken with RDF containers.
This should return an RDF document describing all of the triples associated with this resource. References to other resources should be referenced only and not followed.
Given an RDF document, this should remove from the triple store all statements that can be built from the document.
TODO: Security to make sure we don't stray into another resource.
The URI of a resource defaults to the namespace of the model concatenated with the id of the resource.
id
This will add the triple to the resource's model. If the subject is undefined, the resource's URI is substituted.
This will query the resource's model on the existance of the given triple. If the subject is undefined, the resource's URI is substituted.
Given the namespace and localname of a predicate, this returns the value associated with the predicate and the given resource.
The Perl data structure representing the content of the resource is based on the RDF returned by the fetch method with some optimizations for RDF containers. Namespaces are expanded.
fetch
For example, if the following is the RDF for the resource:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:x="http://www.example.com/ns/"> <rdf:Description> <x:foo>bar</x:foo> <x:stuff> <rdf:Description> <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag" /> <rdf:_1>Red</rdf:_1> <rdf:_3>Blue</rdf:_3> <rdf:_1>Green</rdf:_1> </rdf:Description> </x:stuff> </rdf:Description> </rdf:RDF>
then the Perl data structure would be:
{ '{http://www.example.com/ns/}foo' => 'bar', '{http://www.example.com/ns/}stuff' => { '{http://www.w3.org/1999/02/22-rdf-syntax-ns#}Bag' => [ 'Red', 'Green', 'Blue' ] } }
James Smith, <jsmith@cpan.org>
<jsmith@cpan.org>
Copyright (c) 2008 Texas A&M University.
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
To install RDF::Server, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RDF::Server
CPAN shell
perl -MCPAN -e shell install RDF::Server
For more information on module installation, please visit the detailed CPAN module installation guide.