NAME
    Net::Flickr::RDF - a.k.a RDF::Describes::Flickr
SYNOPSIS
     use Net::Flickr::RDF;
     use Config::Simple;
     use IO::AtomicFile;
     my $cfg = Config::Simple->new("/path/to/my.cfg");
     my $rdf = Net::Flickr::RDF->new($cfg);
     my $fh  = IO::AtomicFile->open("/foo/bar.rdf","w");
     $rdf->describe_photo({photo_id => 123,
                           secret   => 567,
                           fh       => \*$fh});
     $fh->close();
DESCRIPTION
    Describe Flickr photos as RDF.
    This package inherits from *Net::Flickr::API*.
OPTIONS
    Options are passed to Net::Flickr::Backup using a Config::Simple object
    or a valid Config::Simple config file. Options are grouped by "block".
  flickr
    * api_key
        String. *required*
        A valid Flickr API key.
    * api_secret
        String. *required*
        A valid Flickr Auth API secret key.
    * auth_token
        String. *required*
        A valid Flickr Auth API token.
  rdf
    * query_geonames
        Boolean.
        If true and a photo has geodata (latitude, longitude) associated
        with it, then the geonames.org database will be queried for a
        corresponding match. Data will be added as properties of the photo's
        geo:Point description. For example :
         
            -122.025151
            16
            visbility
            37.417839
            public
            
         
         
            PPLX
            US
            CA
            California
            Santa Clara
            2
         
        Default is false.
    * 
        Boolean.
        If true, the trynt colour extraction web service will be queried
        with the URL for the "medium" sized photo. Each colour will be added
        as it's own description, referenced from the photo's principal
        description. For example :
         
           
         
         
            c0c0c0
            654
         
        Default is false.
PACKAGE METHODS
  __PACKAGE__->new($cfg)
    Where $cfg is either a valid *Config::Simple* object or the path to a
    file that can be parsed by *Config::Simple*.
    Returns a *Net::Flickr::RDF* object.
PACKAGE METHODS YOU MAY CARE ABOUT
  __PACKAGE__->build_photo_uri(\%data)
    Returns a URL as a string.
  __PACKAGE__->build_geo_uri(\%data)
  __PACKAGE__->build_user_tag_uri(\@data)
    Returns a URL as a string.
  __PACKAGE__->build_global_tag_uri(\@data)
    Returns a URL as a string.
  __PACKAGE__->build_machinetag_uri(\@data)
    Returns a URL as a string.
  __PACKAGE__->build_user_uri($user_id)
    Returns a URL as a string.
  __PACKAGE__->build_group_uri($group_id)
    Returns a URL as a string.
  __PACKAGE__->build_grouppool_uri($group_id)
    Returns a URL as a string.
  __PACKAGE__->build_photoset_uri(\%set_data)
    Returns a URL as a string.
  __PACKAGE__->prune_triples(\@triples)
    Removes duplicate triples from *@triples*. Returns an array reference.
OBJECT METHODS YOU SHOULD CARE ABOUT
  $obj->describe_photo(\%args)
    Valid arguments are :
    * photo_id
        Int. *required*
    * secret
        String.
    * fh
        File-handle.
        Default is STDOUT.
    Returns true or false.
OBJECT METHODS YOU MAY CARE ABOUT
  $obj->collect_photo_data($photo_id,$secret)
    Returns a hash ref of the meta data associated with a photo.
    If any errors are unencounter an error is recorded via the log method
    and the method returns undef.
  $obj->collect_group_data($group_id)
    Returns a hash ref of the meta data associated with a group.
    If any errors are unencounter an error is recorded via the log method
    and the method returns undef.
  $obj->collect_user_data($user_id)
    Returns a hash ref of the meta data associated with a user.
    If any errors are unencounter an error is recorded via the log method
    and the method returns undef.
  $obj->collect_photoset_data($photoset_id)
    Returns a hash ref of the meta data associated with a photoset.
    If any errors are unencounter an error is recorded via the log method
    and the method returns undef.
  $obj->collect_cc_data()
    Returns a hash ref of the Creative Commons licenses used by Flickr.
    If any errors are unencounter an error is recorded via the log method
    and the method returns undef.
  $obj->collect_comment_data()
    Returns a hash ref of comments made about a photo.
  $obj->make_photo_triples(\%data)
    Returns an array ref (or alist in a wantarray context) of array refs of
    the meta data associated with a photo (*%data*).
  $obj->make_user_triples(\%user_data)
    Returns an array ref (or list in a wantarray context) of array refs of
    the meta data associated with a user (*%user_data*).
  $obj->make_tag_triples(\@tag_data)
    Returns an array ref (or list in a wantarray context) of array refs of
    the meta data associated with a tag (*@tag_data*).
  $pkg->make_photoset_triples(\%set_data)
    Returns an array ref (or list in a wantarray context) of array refs of
    the meta data associated with a photoset (*%set_data*).
  $obj->make_geo_triples(\%geo_data)
  $obj->make_flickrplaces_triples(\%geo_data)
  $obj->make_geonames_triples(\%geo_data)
  $obj->make_group_triples(\%group_data)
    Returns an array ref (or list in a wantarray context) of array refs of
    the meta data associated with a group (*%group_data*).
  $obj->make_grouppool_triples(\%group_data)
    Returns an array ref (or list in a wantarray context) of array refs of
    the meta data associated with a group pool (*%group_data*).
  $obj->make_cc_triples($url)
    Returns an array ref (or list in a wantarray context) of array refs of
    the meta data associated with a Creative Commons license (*$url*).
  $obj->make_comment_triples(\%data)
    Returns an array ref (or alist in a wantarray context) of array refs of
    the meta data associated with a photo comment (*%data*).
  $obj->geodata_from_tags(\%data)
    Try to parse out geolocative data from a collection of tag data.
    Returns a hash ref (containing 'lat' and 'long' keys) on success or
    undef if there were no matches.
  $obj->namespaces()
    Returns a hash ref of the prefixes and namespaces used by
    *Net::Flickr::RDF*
    The default key/value pairs are :
    a   http://www.w3.org/2000/10/annotation-ns
    acl http://www.w3.org/2001/02/acls#
    atom
        http://www.w3.org/2005/Atom/
    cc  http://web.resource.org/cc/
    dc  http://purl.org/dc/elements/1.1/
    dcterms
        http://purl.org/dc/terms/
    exif
        http://nwalsh.com/rdf/exif#
    exifi
        http://nwalsh.com/rdf/exif-intrinsic#
    flickr
        x-urn:flickr:
    foaf
        http://xmlns.com/foaf/0.1/#
    geo http://www.w3.org/2003/01/geo/wgs84_pos#
    geoname
        http://www.geonames.org/onto#
    i   http://www.w3.org/2004/02/image-regions#
    rdf http://www.w3.org/1999/02/22-rdf-syntax-ns#
    rdfs
        http://www.w3.org/2000/01/rdf-schema#
    skos
        http://www.w3.org/2004/02/skos/core#
    trynt
        http://www.trynt.com#
    ymaps
        urn:yahoo:maps
  $obj->add_namespace($prefix, $namespace)
    Add a prefix and namespace URI to the list of known namespaces.
    This method returns a string containing the prefix you should use for
    the namespace URI passed. If the prefix passed to the method is already
    reserved for another namespace the method will return the following
    string:
     "nfr_" + I
  $obj->namespace_prefix($uri)
    Return the namespace prefix for *$uri*
  $obj->uri_shortform($prefix,$name)
    Returns a string in the form of *prefix*:*property*. The property is the
    value of $name. The prefix passed may or may be the same as the prefix
    returned depending on whether or not the user has defined or redefined
    their own list of namespaces.
    Unless this package is subclassed the prefix passed to the method is
    assumed to be one of prefixes in the default list of namespaces.
  $obj->api_call(\%args)
    Valid args are :
    * method
        A string containing the name of the Flickr API method you are
        calling.
    * args
        A hash ref containing the key value pairs you are passing to
        *method*
    If the method encounters any errors calling the API, receives an API
    error or can not parse the response it will log an error event, via the
    log method, and return undef.
    Otherwise it will return a *XML::LibXML::Document* object (if
    XML::LibXML is installed) or a *XML::XPath* object.
  $obj->log()
    Returns a *Log::Dispatch* object.
  $obj->serialise_triples(\@triples,\*$fh)
    Print *@triples* as RDF/XML to a filehandle (*$fh*). If no filehandle is
    defined, prints to STDOUT.
  $obj->serialize_triples(\@triples,\*$fh)
    An alias for *serialise_triples*
VERSION
    2.0
DATE
    $Date: 2007/06/02 22:36:45 $
AUTHOR
    Aaron Straup Cope 
EXAMPLES
  CONFIG FILES
    This is an example of a Config::Simple file used to collect RDF data
    from Flickr
     [flickr] 
     api_key=asd6234kjhdmbzcxi6e323
     api_secret=s00p3rs3k3t
     auth_token=123-omgwtf4u
  RDF
    This is an example of an RDF dump for a photograph backed up from Flickr
    :
         
     
      
        2fc2c76d7634d1a6446b1898bf5471205ed3d0cb
        
        thincvox
      
      
        filtr
        
        
        
      
      
        PPLX
        US
        CA
        58
        State of California
        San Francisco County
        
      
      
        feature
        geonames
        
      
      
        Original
        1944
        2592
        
        
      
      
        cameraphone
      
      
        filtr
        
        
      
      
        Flash did not fire, auto mode
        100/100
        100
        2592
        297/100
        1944
        5.6 mm
        2007-05-30T15:10:01PDT
        sRGB
        f/2.8
        2007-05-30T15:10:01PDT
        4351/1000
        0.049 sec (49/1000)
      
      
        604040
        472
      
      
        
      
      
        000000
        4841
      
      
        san francisco
        sanfrancisco
        
        
      
      
        sanfrancisco
      
      
        Medium
        375
        500
        
        
        
      
      
        5405296
        
        
      
      
        cameraphone
        
        
      
      
        
        LOG (2007)
        
      
      
        6065-522214395-72157600293655654
        2007-05-31T14:54:25
        Kittens!
        
        
      
      
        587a68f90c4030a9b0c7d8ca6ff8549a8b40e5cd
        Aaron Straup Cope
        straup
      
      
        n95
        
        
        
      
      
        
      
      
        6065-522214395-72157600295486776
        2007-06-01T00:19:05
        here kitty, kitty, <a href="http://thincvox.com/audio_recordings/meow.mp3">meow</a>
        
        
      
      
        5405296
        
        
        
      
      
        process
        filtr
        
      
      
        debug
        geo
        
      
      
        filtr
        namespace test
        visbility
        Untitled #1180563722
        n95
        All rights reserved.
        public
        
        2007-05-30T15:10:01-0700
        2007-05-30T15:18:39-0700
        5405296
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
      
      
        Thumbnail
        75
        100
        
        
        
      
      
        
      
      
        -122.401937
        visbility
        37.794694
        16
        public
        
        
      
      
        filtr
        
        
      
      
        808080
        726
      
      
        a08080
        575
      
      
        000020
        499
      
      
        402020
        749
      
      
        n95
        
        
      
      
        2.0:1180823550
        2007-06-02T15:32:30-0700
        
        
      
      
        filtr
      
      
        namespace test
        
        
        
        
      
      
        200000
        841
      
      
        Small
        180
        240
        
        
        
      
      
        
      
      
        806060
        464
      
      
        camera
        ph
        
      
      
        Square
        75
        75
        
        
        
      
      
        Large
        768
        1024
        
        
        
      
      
        c0a0a0
        488
      
      
        San Francisco
        United States
        California
        San Francisco
        
      
      
        c0c0c0
        1475
      
      
        namespace test
        
        
      
      
SEE ALSO
    Net::Flickr::API
    RDF::Simple
TO DO
    *   Methods for describing more than just a photo; groups, tags, etc.
    *   Update bounding boxes to be relative to individual images
    *   Proper tests
    Patches are welcome.
BUGS
    Please report all bugs via http://rt.cpan.org/
LICENSE
    Copyright (c) 2005-2007 Aaron Straup Cope. All Rights Reserved.
    This is free software. You may redistribute it and/or modify it under
    the same terms as Perl itself.