The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::FluidDB::Object - FluidDB objects

SYNOPSIS

 use Net::FluidDB::Object;

 # create, with optional about
 $object = Net::FluidDB::Object->new(
     fdb   => $fdb,
     about => $unique_about
 );
 $object->create;
 $object->id; # returns the object's ID in FluidDB 
 
 # get by ID, optionally fetching about
 $object = Net::FluidDB::Object->get($fdb, $object_id, about => 1);

 # search
 @ids = Net::FluidDB::Object->search($fdb, "has fxn/rating");
 

DESCRIPTION

Net::FluidDB::Object models FluidDB objects.

USAGE

Inheritance

Net::FluidDB::Object is a subclass of Net::FluidDB::Base.

Class methods

Net::FluidDB::Object->new(%attrs)

Constructs a new object. The constructor accepts these parameters:

fdb (required)

An instance of Net::FluidDB.

about (optional)

A string, if any.

This constructor is only useful for creating new objects in FluidDB. Already existing objects are fetched with get.

Net::FluidDB::Object->get($fdb, $id, %opts)

Retrieves the object with ID $id from FluidDB. Options are:

about (optional, default false)

Tells get whether you want to get the about attribute of the object.

If about is not fetched has_about will be false even if the object has an about attribute in FluidDB.

Net::FluidDB::Object->search($fdb, $query)

Performs the query $query and returns a (possibly empty) array of strings with the IDs of the macthing objects.

Instance Methods

$object->create

Creates the object in FluidDB.

$object->id

Returns the UUID of the object, or undef if it is new.

$object->has_id

Predicate to test whether the object has an ID.

$object->about
$object->about($about)

Gets/sets the about attribute. About can't be modified in existing objects, the setter is only useful for new objects.

Note that you need to set the about flag when you fetch an object for this attribute to be initialized.

$object->has_about

Says whether the object has an about attribute.

Note that you need to set the about flag when you fetch an object for this attribute to be initialized.

$object->tag_paths

Returns the paths of the existing tags on the object as a (possibly empty) arrayref of strings.

$object->tag($tag_or_tag_path, $value)

This interface is subject to revision.

Tags an object. You can pass either a Tag instance or a tag path in the first argument. By now $value must be any of the primitive FluidDB types integer, float, string, or set of strings (represented as arrayref of strings). But this could change.

Please ensure the type of the scalar matches the FluidDB type. Either numify

    $object->tag($tag_or_tag_path, $value + 0);

or stringify:

    $object->tag($tag_or_tag_path, "$value");

as needed.

$object->value($tag_or_tag_path)

This interface is subject to revision.

Gets the value of a tag on an object. You can refer to it either with a Tag object or a tag path. By now it returns a scalar of any of the primitive FluidDB types integer, float, string, or set of strings (represented as arrayref of strings). But this could change.

FLUIDDB DOCUMENTATION

FluidDB high-level description

http://doc.fluidinfo.com/fluidDB/objects.html

FluidDB API documentation

http://doc.fluidinfo.com/fluidDB/api/objects.html

FluidDB API specification

http://api.fluidinfo.com/fluidDB/api/*/objects/*

AUTHOR

Xavier Noria (FXN), <fxn@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009 Xavier Noria

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.