RDF::Trine::Serializer::SparqlUpdate - SPARQL/U serialization of triples
my $sparqlu = RDF::Trine::Serializer::SparqlUpdate->new; $query = $sparqlu->serialize_to_string( $stmt, delete => $model ); $query = $sparqlu->serialize_to_string( undef, delete => $iter ); my $sparqlu_quad = RDF::Trine::Serializer->new('sparqlu', quad_semantics => 1 ); $fh = $sparqlu_quad->serialize_to_io( $model ); while (<$fh>) { print $_; }
TODO
Beyond the methods documented below, this class inherits methods from the RDF::Trine::Serializer class.
new( [quad_semantics => (0|1)], [atomic => (0|1)] )
Returns a new SPARQL/Update serializer object.
If quad_semantics is set, contexts/graphs will be considered for INSERT and DELETE clauses. Otherwise, the serializer works on the union graph of the model.
quad_semantics
If atomic is set, every statement is wrapped in it's own INSERT/DELETE clause.
atomic
serialize_to_string ( $data, %opts )
Coerces both $data and $opts{delete} to a model and calls serialize_model_to_string with those.
serialize_model_to_string
serialize_to_file ( $fh, $data, %opts )
Coerces both $data and $opts{delete} to a model and calls serialize_model_to_string with those and writes the resulting string to filehandle $fh.
serialize_to_io( $data, %opts )
Returns an IO::Handle with the $data and $opts{delete} serialized to atomic SPARQL/U clauses
$data
serialize_model_to_string ( $model )
Serializes the $model to SPARQL/Update, returning the result as a string.
$model
serialize_model_to_file ( $fh, $model )
Serializes the $model to SPARQL/Update, printing the results to the supplied filehandle <$fh>.
<$fh
Alias for "serialize_to_file".
serialize_iterator_to_file ( $file, $iter )
Serializes the iterator to SPARQL/Update, printing the results to the supplied filehandle <$fh>.
serialize_iterator_to_string ( $iter )
Serializes the iterator to SPARQL/Update, returning the result as a string.
Alias for "serialize_to_string".
statement_as_string ( $st )
Serializes a statement to a SPARQL/Update INSERT DATA clause.
serialize_model_to_io( $model )
TODO Returns an IO::Handle with the $model serialized to atomic SPARQL/U clauses
_serialize_data_to_ntriples( $data )
Turns $data into a string of N-Triples.
_to_model( $data )
Turns $data into a RDF::Trine::Model.
_create_clause( $type, $data, [$graph] )
Creates a SPARQL/U 'INSERT' or 'DELETE' clause, depending on $type.
$data can be anything that "_serialize_data_to_ntriples" can coerce to N-Triples.
If $graph is given, clauses take the form
$graph
INSERT DATA { GRAPH <$graph> { ... } };
otherwise they act on the default graph, like so:
INSERT DATA { ... };
http://www.w3.org/TR/rdf-testcases/#ntriples
http://www.w3.org/TR/sparql11-update/#deleteInsert
Konstantin Baierer <kba@cpan.org>
Copyright (c) 2011 Konstantin Baierer. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install RDF::Trine::Serializer::SparqlUpdate, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RDF::Trine::Serializer::SparqlUpdate
CPAN shell
perl -MCPAN -e shell install RDF::Trine::Serializer::SparqlUpdate
For more information on module installation, please visit the detailed CPAN module installation guide.