| RDF-Trine documentation | Contained in the RDF-Trine distribution. |
RDF::Trine - An RDF Framework for Perl
This document describes RDF::Trine version 0.135
use RDF::Trine;
RDF::Trine provides an RDF framework with an emphasis on extensibility, API stability, and the presence of a test suite. The package consists of several components:
iri ( $iri )Returns a RDF::Trine::Node::Resource object with the given IRI value.
blank ( $id )Returns a RDF::Trine::Node::Blank object with the given identifier.
literal ( $value, $lang, $dt )Returns a RDF::Trine::Node::Literal object with the given value and optional language/datatype.
variable ( $name )Returns a RDF::Trine::Node::Variable object with the given variable name.
statement ( @nodes )Returns a RDF::Trine::Statement object with the supplied node objects.
store ( $config )Returns a RDF::Trine::Store object based on the supplied configuration string. See RDF::Trine::Store for more information on store configuration strings.
Please report any bugs or feature requests to
<gwilliams@cpan.org>.
Gregory Todd Williams <gwilliams@cpan.org>
Copyright (c) 2006-2010 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| RDF-Trine documentation | Contained in the RDF-Trine distribution. |
# RDF::Trine # -----------------------------------------------------------------------------
package RDF::Trine; use 5.008003; use strict; use warnings; no warnings 'redefine'; use Module::Load::Conditional qw[can_load]; our ($debug, @ISA, $VERSION, @EXPORT_OK); BEGIN { $debug = 0; $VERSION = '0.135'; require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw(iri blank literal variable statement store UNION_GRAPH NIL_GRAPH); can_load( modules => { 'RDF::Redland' => undef, 'RDF::Trine::Store::Redland' => undef, 'RDF::Trine::Parser::Redland' => undef, } ); } use constant UNION_GRAPH => 'tag:gwilliams@cpan.org,2010-01-01:RT:ALL'; use constant NIL_GRAPH => 'tag:gwilliams@cpan.org,2010-01-01:RT:NIL'; use Log::Log4perl qw(:easy); Log::Log4perl->easy_init($ERROR); use RDF::Trine::Graph; use RDF::Trine::Parser; use RDF::Trine::Serializer; use RDF::Trine::Node; use RDF::Trine::Statement; use RDF::Trine::Namespace; use RDF::Trine::NamespaceMap; use RDF::Trine::Iterator; use RDF::Trine::Store; use RDF::Trine::Store::DBI; use RDF::Trine::Error; use RDF::Trine::Model; sub _uniq { my %seen; my @data; foreach (@_) { push(@data, $_) unless ($seen{ $_ }++); } return @data; }
sub iri { my $iri = shift; return RDF::Trine::Node::Resource->new( $iri ); }
sub blank { my $id = shift; return RDF::Trine::Node::Blank->new( $id ); }
sub literal { return RDF::Trine::Node::Literal->new( @_ ); }
sub variable { my $name = shift; return RDF::Trine::Node::Variable->new( $name ); }
sub statement { my @nodes = @_; if (scalar(@nodes) == 4) { return RDF::Trine::Statement::Quad->new( @nodes ); } else { return RDF::Trine::Statement->new( @nodes ); } }
sub store { my $config = shift; return RDF::Trine::Store->new_with_string( $config ); } 1; # Magic true value required at end of module __END__