use strict;

require RDF::Core::Storage::Memory;
require RDF::Core::Model;
require RDF::Core::Statement;
require RDF::Core::Model::Serializer;
require RDF::Core::Literal;
require RDF::Core::NodeFactory;

# create storage object
my $storage = new RDF::Core::Storage::Memory;
my $model = new RDF::Core::Model (Storage => $storage);

# new subject and new resource factory
my $subject = new RDF::Core::Resource('http://burningbird.net/articles/monsters1.rdf');
my $factory = new RDF::Core::NodeFactory(BaseURI=>'http://burningbird.net/articles/');

# create bnode for presentation
my $bPresentation = $factory->newResource;

# create bnode for requires
my $bRequires = $factory->newResource;

# add presentation
my $predicate = $subject->new('http://burningbird.net/postcon/elements/1.0/presentation');
my $statement = new RDF::Core::Statement($subject, $predicate, $bPresentation);
$model->addStmt($statement);

# add requires
$model->addStmt(new RDF::Core::Statement($bPresentation,
                                         $bPresentation->new('http://burningbird.net/postcon/elements/1.0/requires'),
                                          $bRequires));

# add rdf:value
$model->addStmt(new RDF::Core::Statement($bRequires,
                                         $bRequires->new('http://www.w3.org/1999/02/22-rdf-syntax-ns#value'),
                                          new RDF::Core::Literal('http://burningbird.net/de.css')));

# add value type
$model->addStmt(new RDF::Core::Statement($bRequires,
                                         $bRequires->new('http://burningbird.net/postcon/elements/1.0/type'),
                                          new RDF::Core::Literal('stylesheet')));

my $xml = '';
my $serializer = new RDF::Core::Model::Serializer(Model=>$model,
                                                    Output=>\$xml
                                                   );
$serializer->serialize;
print "$xml\n";
