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

NAME

RDF::Trine::Serializer::SparqlUpdate - SPARQL/U serialization of triples

SYNOPSIS

    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 $_;
    }

DESCRIPTION

TODO

METHODS

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.

If atomic is set, every statement is wrapped in it's own INSERT/DELETE clause.

serialize_to_string ( $data, %opts )

Coerces both $data and $opts{delete} to a model and calls serialize_model_to_string with those.

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

serialize_model_to_string ( $model )

Serializes the $model to SPARQL/Update, returning the result as a string.

serialize_model_to_file ( $fh, $model )

Serializes the $model to SPARQL/Update, printing the results to the supplied filehandle <$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>.

Alias for "serialize_to_file".

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.

Alias for "serialize_to_string".

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

    INSERT DATA { GRAPH <$graph> { ... } };

otherwise they act on the default graph, like so:

    INSERT DATA { ... };

SEE ALSO

http://www.w3.org/TR/rdf-testcases/#ntriples

http://www.w3.org/TR/sparql11-update/#deleteInsert

AUTHOR

Konstantin Baierer <kba@cpan.org>

COPYRIGHT

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.