NAME

RDF::Trine::Store::File::Quad - Using a file with N-Quads as quadstore

SYNOPSIS

To be used as a normal quad store.

  my $store = RDF::Trine::Store::File->new($filename);
  $store->add_statement(RDF::Trine::Statement->new(
						   RDF::Trine::Node::Resource->new('http://example.org/a'),
						   RDF::Trine::Node::Resource->new('http://example.org/b'),
						   RDF::Trine::Node::Resource->new('http://example.org/c')
						   RDF::Trine::Node::Resource->new('http://example.org/d')
						  ));
  ...

METHODS

new($filename)

A constructor, takes a filename as parameter. If the file doesn't exist, it will be created.

new_with_string('File::Quad;'.$filename)

A constructor, takes a string config as parameter. If the file doesn't exist, it will be created. The string will typically begin with File::Quad;, e.g.

my $store = RDF::Trine::Store::File::Quad->new_with_string('File::Quad;/path/to/file.nt');

new_with_config({ storetype => 'File::Quad', file => $filename});

A constructor, takes a hashref config as parameter. If the file doesn't exist, it will be created. It needs to have a storetype key with File::Quad as the value, e.g.

my $store = RDF::Trine::Store::File::Quad->new_with_config({ storetype => 'File::Quad', file => $filename});

temporary_store

Constructor that creates a temporary file to work on.

add_statement($statement)

Adds the specified $statement to the underlying model.

get_statements($subject, $predicate, $object, $context)

Returns a iterator object of all statements matching the specified subject, predicate, object and graph. Any of the arguments may be undef to match any value.

count_statements($subject, $predicate, $object)

Returns a count of all the statements matching the specified subject, predicate and objects. Any of the arguments may be undef to match any value.

remove_statement($statement)

Removes the specified $statement from the underlying model.

remove_statements($subject, $predicate, $object, $context)

Removes all statement matching the specified subject, predicate, objects and graph. Any of the arguments may be undef to match any value.

get_contexts

Will return an iterator with contexts (aka graph names).

size

Returns the number of statements in the store. Breaks if there are comments or empty lines in the file.

etag

Returns an etag based on the last modification time of the file. Note: This has resolution of one second, so it cannot be relied on for data that changes fast.

nuke

Permanently removes the store file and its data.

AUTHOR

Kjetil Kjernsmo, <kjetilk at cpan.org>

LICENSE AND COPYRIGHT

Copyright 2011-2012,2014 Kjetil Kjernsmo.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.